Instantiate Cryptum SDK first:
const sdk = new CryptumSdk({
environment: 'testnet',
apiKey: 'YOUR-API-KEY'
})
opts.protocol
(string)(required) - blockchain protocol must beBITCOIN
.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' },
]
})