0.2.0 ⢠Published 5 months ago
@odysseygpt/bitcoin-address-verifier v0.2.0
Bitcoin Address Verifier
A modular system for validating and generating Bitcoin contract addresses with plugin support.
Features
- š§© Plugin-based architecture for contract types
- š Automatic address generation from contract parameters
- š¦ Self-contained plugin system
Installation
npm install @unisat/bitcoin-address-verifier
# or
yarn add @unisat/bitcoin-address-verifierUsage
Basic Usage
import { verifyContract } from "./index";
const result = verifyContract("babylon:staking", {
stakerPk: "5092...",
covenantPks: ["5092...",],
finalityProviders: ["5092...",],
covenantThreshold: 1,
minUnbondingTime: 101,
stakingDuration: 144,
},{
address: "",
publicKey: ""
});
console.log(result);Wallet Integration
// Use in PSBT signing
wallet.signPsbt(psbt, {
contracts: [{
id: 'babylon:staking',
params: { /* ... */ }
}]
});Plugin Development
Creating a New Plugin
- Run the generator:
yarn new:plugin- Follow the interactive prompts
Plugin Structure
plugins/
āāā your-project/
āāā contract-name/
āāā index.ts # Main implementation
āāā plugin.test.ts # Test casesExample Plugin
// plugins/example/timelock/index.ts
export default {
id: 'example:timelock',
version: '1.0.0',
verify(params, account) {
// Implementation here
},
};Contributing
Fork the repository
Create a new branch (git checkout -b feature/your-plugin)
Commit your changes (git commit -am 'Add new plugin')
Push to the branch (git push origin feature/your-plugin)
Open a Pull Request
Build Setup
# Install dependencies
yarn
# Build project
yarn build
# Run tests
yarn testProject Structure
bitcoin-contract-validator/
āāā src/
ā āāā core-sdk/ # Core validation logic
ā āāā plugins/ # Plugin implementations
ā āāā generated/ # Auto-generated registry
āāā scripts/ # Generation scripts
āāā test/ # Test cases0.2.0
5 months ago