This package is for HTLC transactions between the any blockchains. HTLC allows direct transactions between different chains. Usage and examples are shown below.
- Endpoint: https://sepolia.etherscan.io/address/0x9b2e421e5F516bcC991A355E8712af72621C54dF
- Contract address: 0x9b2e421e5F516bcC991A355E8712af72621C54dF
- Endpoint: https://sepolia.etherscan.io/address/0x2F16E9D5bd67F30AB355369413cA94d858FbDd91
- Contract address: 0x2F16E9D5bd67F30AB355369413cA94d858FbDd91
- Endpoint: https://sepolia.etherscan.io/address/0xe2E65a43dC5616B1e28472DfD72F40D3a4f81c6E
- Contract address: 0xe2E65a43dC5616B1e28472DfD72F40D3a4f81c6E
Install the necessary libraries
npm
npm install --save web3 @layerswap/evm
yarn
yarn add web3 @layerswap/evm
HTLC issues a secret and key in advance and uses this to issue a secret lock.
When both parties agree to the transaction, the secret and key are exchanged separately, and the key is used to receive a token. This is how the cross-chain swap is performed.
You can publish using this package with the following operations.
The output hashPair contains a secret and a proof. The secret is shared in advance, and the proof is issued at a mutually agreed timing.
With a secret lock, locked assets are withdrawn through a secret proof transaction.
To withdraw multiple HTLCs in a batch.
For more detailed examples, please check the sample collection below