SDK for creating native peg-in and peg-out transactions following the PowPeg protocol.
pnpm add @rsksmart/powpeg-sdkimport { PowPegSDK, LedgerSigner } from '@rsksmart/powpeg-sdk'
const sdk = new PowPegSDK(null, null, 'TEST')
// Peg-in: BTC -> RBTC
const signer = await LedgerSigner.init('TEST')
const unsignedPegin = await sdk.createAndFundPegin(500_000n, '0xRecipientRskAddress', signer)
const txId = await sdk.signAndBroadcastPegin(unsignedPegin.psbt, unsignedPegin.inputs, unsignedPegin.transactions)
// Peg-out: RBTC -> BTC
const { tx, bitcoinFee, rootstockFee } = await sdk.createPegout('0.01', '0xSenderRskAddress')
await sdk.signAndBroadcastPegout(tx, someEthersSigner)See docs/bitcoin-signers.md for other ways to supply a BitcoinSigner (e.g. TrezorSigner, or your own implementation).
See docs/api.md for the full table of public exports (PowPegSDK, the bundled signers, and every exported type/error).
pnpm test # run once
pnpm coverage # with coverage reportSee docs/ for setup details, the full API reference, and the BitcoinSigner extension point (docs/setup.md, docs/api.md, docs/bitcoin-signers.md).
- Update
package.jsonversionfield to the format<version>-beta.<i++>(eg: 1.0.1-beta.0). - Create tag matching the
versionfield. - Push pre-release for the github package.
- Update
package.jsonversionfield to the format<version>(eg: 1.0.1). - Create tag matching the
versionfield. - Publish the github package.