@radar/htlc
A library used to construct and interact with HTLCs across multiple networks & network models
Installation
npm
npm install @radar/htlcyarn
yarn add @radar/htlcUsage - Bitcoin
Construct a Bitcoin HTLC
Construct a new Bitcoin HTLC with an absolute timelock:
import { HTLC, UTXO } from '@radar/htlc';
const htlc = HTLC.construct(Network.BITCOIN, BitcoinSubnet.SIMNET, {
paymentHash: 'fba6da3ff596b9c6fabe67d4f728474697640ef6edd9e361c2a46be345112839',
claimerPublicKey: '0286ab3b59ce3862515b01c8a282edb6011b4eb50c608ab298bfd70f6033f7bc65',
refundAddress: 'sb1qxnqqm56ta40p3uhtsmtdxglhwuxjk3tul94mq0',
timelock: {
type: UTXO.LockType.ABSOLUTE,
blockHeight: 597732,
},
});Construct a new Bitcoin HTLC with a relative timelock:
Construct a Bitcoin HTLC from an existing redeem script:
Construct a Bitcoin HTLC with a refund public key instead of address:
Interact with the Bitcoin HTLC
Usage - Ethereum
Construct an Ethereum HTLC
Interact with the Ethereum HTLC
Usage - Stellar
Construct a Stellar HTLC
Interact with the Stellar HTLC
Testing
Build container services for tests
Run tests:
Additional Information
Subnet Naming
Last updated
Was this helpful?