Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.39 KB

bitcoin.md

File metadata and controls

51 lines (40 loc) · 1.39 KB

Bitcoin

Instantiate Cryptum SDK first:

const sdk = new CryptumSdk({
  environment: 'testnet',
  apiKey: 'YOUR-API-KEY'
})

Transfer bitcoins.

sdk.token.transfer(opts)

  • opts.protocol (string)(required) - blockchain protocol must be BITCOIN.
  • opts.wallet (Wallet)(required) - wallet to sign the transaction with.
  • opts.destination (string) - destination address.
  • opts.amount (string) - amount to transfer.
  • opts.destinations (array of Outputs) - destination outputs.
    • opts.destinations[].address (string)(required) - recipient address.
    • opts.destinations[].amount (string)(required) - amount to receive.
  • opts.data (string)(optional) - OP_RETURN data. (The data must be at most 80 characters long)
  • opts.fee (string)(optional) - fee amount to pay for transaction in satoshis.

Use destination and amount if you want to transfer to one address.

Use destinations to transfer to many addresses at once.

This function returns the transaction hash.

Example:

const { hash } = await sdk.token.transfer({
  protocol: 'BITCOIN',
  wallet,
  destination: 'address-1',
  amount: '0.03744'
})

const { hash } = await sdk.token.transfer({
  protocol: 'BITCOIN',
  wallet,
  destinations: [
    { address: 'address-1', amount: '0.05' },
    { address: 'address-2', amount: '0.01' },
  ]
})