The redeem script you want to add.
The DApp ID. If no dAppId is set the default DApp ID will be set.
Create a signed transaction with specified outputs. The provider will not add any outputs.
const txid = await provider.advancedSend([
{
lockScript: "76a91467b2e55ada06c869547e93288a4cf7377211f1f088ac",
amount: 10000
}
])
console.log(txid)
> "9591fdf10b16d4de6f65bcc49aadadc21d7a3a9169a13815e59011b426fe494f"
The Array of TransactionOutput objects.
The DApp ID. If no dAppId is set the default DApp ID will be set.
The signed raw transaction in serialized transaction format encoded as hex. The provider should throw an error when the transaction is not generated.
Returns the current wallet address index.
const addrIdx = await provider.getAddressIndex(
1,
"53212266f7994100e442f6dff10fbdb50a93121d25c196ce0597517d35d42e68"
)
console.log(addrIdx)
> 3
The BIP44 change path.
The DApp ID. If no dAppId is set the default DApp ID will be set.
The current wallet address index.
Returns the wallet address list. Address format is CashAddr.
const addresses = await provider.getAddresses(
0,
2,
3,
"53212266f7994100e442f6dff10fbdb50a93121d25c196ce0597517d35d42e68"
)
console.log(addresses)
> ["bitcoincash:qrsy0xwugcajsqa...", "bitcoincash:qrsfpepw3egqq4k..."]
The number of addresses you want.
The BIP44 address_index path.
The DApp ID. If no dAppId is set the default DApp ID will be set.
The wallet address list.
Returns the transaction fee per byte.
const fee = await provider.getFeePerByte()
console.log(fee)
> 1
Transaction fee per byte in satoshi.
Returns the current network.
const network = await provider.getNetwork()
console.log(network)
> 3823236072
Network magic bytes
Returns the bitcoin protocol version.
const version = await provider.getProtocolVersion()
console.log(version)
> 70015
The protocol version.
Returns the stored redeem scripts related to the DApp ID.
const redeemScripts = await provider.getRedeemScripts(
"53212266f7994100e442f6dff10fbdb50a93121d25c196ce0597517d35d42e68"
)
console.log(redeemScripts)
> ["03424f587e06424954424f5887", "789787a72c21452a1c98ff"]
The DApp ID. If no dAppId is set the default DApp ID will be set.
The list of redeem scripts stored.
Returns the transaction outputs which addresses are spendable.
const utxos = await provider.getSpendableUtxos(
"53212266f7994100e442f6dff10fbdb50a93121d25c196ce0597517d35d42e68"
)
console.log(utxos)
> [
{
'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
'outputIndex' : 0,
'address' : 'bitcoincash:qrsy0xwugcajsqa99c9nf05pz7ndckj55ctlsztu2p',
'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
'satoshis' : 50000
}
]
The DApp ID.
The unspent transaction output object list.
Returns the unspent transaction outputs belonging to the DApp which addresses are unspendable.
const utxos = await provider.getUnspendableUtxos(
"53212266f7994100e442f6dff10fbdb50a93121d25c196ce0597517d35d42e68"
)
console.log(utxos)
> [
{
'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
'outputIndex' : 0,
'address' : 'bitcoincash:qrsy0xwugcajsqa99c9nf05pz7ndckj55ctlsztu2p',
'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
'satoshis' : 50000
}
]
The DApp ID.
The unspent transaction output object list. If the addresses of the DApp are spendable, returns an empty array.
Returns the current provider interface version.
const version = await provider.getVersion()
console.log(version)
> "0.0.1"
The current provider interface version
Signs a message with the private key of an address.
const result = await provider.sign(
"bchtest:qq28xgrzkdyeg5vf7tp2s3mvx8u95zes5cf7wpwgux",
"af4c61ddcc5e8a2d..." // second argument is SHA1("hello")
)
console.log(result)
> "30440220227e0973..."
A P2PKH address whose private key belongs to the provider.
Data to sign in hex format.
The signed data. Bitcoin signatures are serialized in the DER format over the wire. The provider should throw an error when
Generated using TypeDoc
Adds the redeem script into the wallet.
Example
await provider.addRedeemScript( "03424f587e064249..." )