Skip to content

Latest commit

 

History

History
1197 lines (853 loc) · 42.9 KB

api-reference-btc.md

File metadata and controls

1197 lines (853 loc) · 42.9 KB

Classes

BTC_Base

Bitcoin Base

BTC_InboundBTC_Base

Bitcoin Inbound

BTC_OutboundBTC_Base

Bitcoin Outbound

BTC_Base

Bitcoin Base

Kind: global class


BTC_Base.storemanQuota(opts, skipValidation) ⇒ Promise

Make storeman quota call on Wanchain

Kind: instance method of BTC_Base Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Base.storemanInfo(opts, skipValidation) ⇒ Promise

Make storeman quota info on Wanchain

Kind: instance method of BTC_Base Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Base.buildStoremanQuotaTx(opts, skipValidation) ⇒ Object

Build storeman quota call

Kind: instance method of BTC_Base Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Base.buildStoremanInfoTx(opts, skipValidation) ⇒ Object

Build storeman info call

Kind: instance method of BTC_Base Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Base.buildStoremanQuotaData(opts, skipValidation) ⇒ string

Get data hex string for storeman quota call

Kind: instance method of BTC_Base Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Base.buildStoremanInfoData(opts, skipValidation) ⇒ string

Get data hex string for storeman info call

Kind: instance method of BTC_Base Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound ⇐ BTC_Base

Bitcoin Inbound

Kind: global class Extends: BTC_Base


BTC_Inbound.send(opts, skipValidation) ⇒ Promise

Complete crosschain transaction (lock + redeem); Assumes you have already generated a new HTLC lock address with buildHashTimeLockContract and have funded the address

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.to string Destination wan address
opts.value string Tx value
opts.txid string Id of funding btc tx
opts.lockTime string LockTime used to generate lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Inbound.lock(opts, skipValidation) ⇒ Promise

Lock transaction and confirmation; Assumes you have already generated a new HTLC lock address with buildHashTimeLockContract and have funded the address

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.to string Destination wan address
opts.value string Tx value
opts.txid string Id of funding btc tx
opts.lockTime string LockTime used to generate lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Inbound.redeem(opts, skipValidation) ⇒ Promise

Redeem transaction and confirmation

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.to string Destination wan address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
skipValidation boolean

BTC_Inbound.sendLock(opts, skipValidation) ⇒ Promise

Send lock tx on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.to string Destination wan address
opts.value string Tx value
opts.txid string Id of funding btc tx
opts.lockTime string LockTime used to generate lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Inbound.sendRedeem(opts, skipValidation) ⇒ Promise

Send redeem tx on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.to string Destination wan address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
skipValidation boolean

BTC_Inbound.listenLock(opts, skipValidation) ⇒ Promise

Listen for storeman lock confirmation on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Inbound.listenRedeem(opts, skipValidation) ⇒ Promise

Listen for storeman redeem confirmation on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Inbound.buildLockTx(opts, skipValidation) ⇒ Object

Build lock tx

Kind: instance method of BTC_Inbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.to string Destination wan address
opts.value string Tx value
opts.txid string Id of funding btc tx
opts.lockTime string LockTime used to generate lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Inbound.buildRedeemTx(opts, skipValidation) ⇒ Object

Build redeem tx

Kind: instance method of BTC_Inbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.to string Destination wan address
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
skipValidation boolean

BTC_Inbound.buildLockScanOpts(opts, skipValidation) ⇒ Object

Build lock scan opts

Kind: instance method of BTC_Inbound Returns: Object - Call opts object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Inbound.buildRedeemScanOpts(opts, skipValidation) ⇒ Object

Build redeem scan opts

Kind: instance method of BTC_Inbound Returns: Object - Call opts object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Inbound.buildLockData(opts, skipValidation) ⇒ string

Get data hex string for lock call

Kind: instance method of BTC_Inbound Returns: string - Data hex string

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman wan address
opts.from string Address that funded the P2SH address
opts.txid string ID of tx that funded the P2SH address
opts.lockTime number Locktime used to generate P2SH address
skipValidation boolean

BTC_Inbound.buildRedeemData(opts, skipValidation) ⇒ string

Get data hex string for redeem call

Kind: instance method of BTC_Inbound Returns: string - Data hex string

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
skipValidation boolean

BTC_Inbound.buildHashTimeLockContract(opts) ⇒ Object

Build new P2SH lock contract address

Kind: instance method of BTC_Inbound Returns: Object - Contract object

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.lockTime number LockTime for lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.btc string Storeman Bitcoin address

BTC_Inbound.hashForRevokeSig(opts) ⇒ string

Build the hash for signature for revoke tx

Kind: instance method of BTC_Inbound Returns: string - Hash string

Param Type Description
opts Object Tx options
opts.from string Revoker btc address
opts.payTo string Address to revoke funds to (optional, defaults to revoker)
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.lockTime number LockTime for lock address
opts.redeemScript string Lock address redeemScript

BTC_Inbound.buildRevokeTx(opts) ⇒ string

Build revoke tx from sigHash

Kind: instance method of BTC_Inbound Returns: string - Signed tx as hex string

Param Type Description
opts Object Tx options
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.lockTime number LockTime for lock address
opts.redeemScript string Lock address redeemScript
opts.publicKey string Public key of the revoker
opts.sigHash string Signed hash for signature
opts.payTo string Address to revoke funds to (optional, defaults to revoker)

BTC_Inbound.buildRevokeTxFromWif(opts) ⇒ string

Build revoke tx from WIF

Kind: instance method of BTC_Inbound Returns: string - Signed tx as hex string

Param Type Description
opts Object Tx options
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.lockTime number LockTime for lock address
opts.redeemScript string Lock address redeemScript
opts.wif string Private key of the revoker
opts.payTo string Address to revoke funds to (optional, defaults to revoker)

BTC_Inbound.storemanQuota(opts, skipValidation) ⇒ Promise

Make storeman quota call on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound.storemanInfo(opts, skipValidation) ⇒ Promise

Make storeman quota info on Wanchain

Kind: instance method of BTC_Inbound Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound.buildStoremanQuotaTx(opts, skipValidation) ⇒ Object

Build storeman quota call

Kind: instance method of BTC_Inbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound.buildStoremanInfoTx(opts, skipValidation) ⇒ Object

Build storeman info call

Kind: instance method of BTC_Inbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound.buildStoremanQuotaData(opts, skipValidation) ⇒ string

Get data hex string for storeman quota call

Kind: instance method of BTC_Inbound Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Inbound.buildStoremanInfoData(opts, skipValidation) ⇒ string

Get data hex string for storeman info call

Kind: instance method of BTC_Inbound Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound ⇐ BTC_Base

Bitcoin Outbound

Kind: global class Extends: BTC_Base


BTC_Outbound.send(opts, skipValidation) ⇒ Promise

Complete crosschain transaction (lock + redeem)

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.to string Redeemer btc address
opts.value string Tx value
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Outbound.lock(opts, skipValidation) ⇒ Promise

Lock transaction and confirmation

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.to string Redeemer btc address
opts.value string Tx value
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Outbound.getOutboundFee(opts, skipValidation) ⇒ Promise

Get outbound fee amount

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.value string Tx value
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.sendLock(opts, skipValidation) ⇒ Promise

Send lock tx

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.to string Redeemer btc address
opts.value string Tx value
opts.outboundFee string Tx outbound fee
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Outbound.sendRevoke(opts, skipValidation) ⇒ Promise

Send revoke tx

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.listenLock(opts, skipValidation) ⇒ Promise

Listen for storeman lock confirmation on Wanchain

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.listenRedeem(opts, skipValidation) ⇒ Promise

Listen for storeman redeem confirmation on Wanchain

Kind: instance method of BTC_Outbound Returns: Promise - Promise object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.buildOutboundFeeTx(opts, skipValidation) ⇒ Object

Build outboundFee tx

Kind: instance method of BTC_Outbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.value string Tx value
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.buildLockTx(opts, skipValidation) ⇒ Object

Build lock tx

Kind: instance method of BTC_Outbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.to string Redeemer btc address
opts.value string Tx value
opts.outboundFee string Tx outbound fee
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
opts.storeman.btc string Storeman Bitcoin address
skipValidation boolean

BTC_Outbound.buildRevokeTx(opts, skipValidation) ⇒ Object

Build revoke tx

Kind: instance method of BTC_Outbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.from string Sender wan address
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.buildLockScanOpts(opts, skipValidation) ⇒ Object

Build lock scan opts

Kind: instance method of BTC_Outbound Returns: Object - Call opts object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.buildRedeemScanOpts(opts, skipValidation) ⇒ Object

Build redeem scan opts

Kind: instance method of BTC_Outbound Returns: Object - Call opts object

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.buildLockData(opts, skipValidation) ⇒ string

Get data hex string for lock call

Kind: instance method of BTC_Outbound Returns: string - Data hex string

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman addr pair
opts.storeman.wan string Storeman wan addr
opts.to string Redeemer btc addr
opts.value string Tx value
skipValidation boolean

BTC_Outbound.buildRevokeData(opts, skipValidation) ⇒ string

Get data hex string for revoke call

Kind: instance method of BTC_Outbound Returns: string - Data hex string

Param Type Description
opts Object Tx options
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
skipValidation boolean

BTC_Outbound.buildOutboundFeeData(opts, skipValidation) ⇒ string

Get data hex string for outboundFee call

Kind: instance method of BTC_Outbound Returns: string - Data hex string

Param Type Description
opts Object Tx options
opts.storeman Object Storeman addr pair
opts.storeman.wan string Storeman wan addr
opts.value string Tx value
skipValidation boolean

BTC_Outbound.buildHashTimeLockContract(opts) ⇒ Object

Build P2SH lock contract address

Kind: instance method of BTC_Outbound Returns: Object - Contract object

Param Type Description
opts Object Tx options
opts.to string Redeemer btc address
opts.lockTime number LockTime for lock address
opts.redeemKey Object Redeem key pair
opts.redeemKey.xHash string Redeem key xHash
opts.storeman Object Storeman address pair
opts.storeman.btc string Storeman Bitcoin address

BTC_Outbound.hashForRedeemSig(opts) ⇒ string

Build the hash for signature for redeem tx

Kind: instance method of BTC_Outbound Returns: string - Hash string

Param Type Description
opts Object Tx options
opts.to string Redeemer btc address
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.redeemScript string Lock address redeemScript

BTC_Outbound.buildRedeemTx(opts) ⇒ string

Build redeem tx from sigHash

Kind: instance method of BTC_Outbound Returns: string - Signed tx as hex string

Param Type Description
opts Object Tx options
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemScript string Lock address redeemScript
opts.publicKey string Public key of the redeemer
opts.sigHash string Signed hash for signature
opts.payTo string Address to redeem funds to (optional, defaults to redeemer)

BTC_Outbound.buildRedeemTxFromWif(opts) ⇒ string

Build redeem tx from WIF

Kind: instance method of BTC_Outbound Returns: string - Signed tx as hex string

Param Type Description
opts Object Tx options
opts.value string Tx value (minus miner fee)
opts.txid string Id of funding btc tx
opts.redeemKey Object Redeem key pair
opts.redeemKey.x string Redeem key x
opts.redeemScript string Lock address redeemScript
opts.wif string Private key of the redeemer
opts.payTo string Address to redeem funds to (optional, defaults to redeemer)

BTC_Outbound.storemanQuota(opts, skipValidation) ⇒ Promise

Make storeman quota call on Wanchain

Kind: instance method of BTC_Outbound Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.storemanInfo(opts, skipValidation) ⇒ Promise

Make storeman quota info on Wanchain

Kind: instance method of BTC_Outbound Returns: Promise - Promise returning object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.buildStoremanQuotaTx(opts, skipValidation) ⇒ Object

Build storeman quota call

Kind: instance method of BTC_Outbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.buildStoremanInfoTx(opts, skipValidation) ⇒ Object

Build storeman info call

Kind: instance method of BTC_Outbound Returns: Object - Tx object

Param Type Description
opts Object Tx options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.buildStoremanQuotaData(opts, skipValidation) ⇒ string

Get data hex string for storeman quota call

Kind: instance method of BTC_Outbound Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean

BTC_Outbound.buildStoremanInfoData(opts, skipValidation) ⇒ string

Get data hex string for storeman info call

Kind: instance method of BTC_Outbound Returns: string - Data hex string

Param Type Description
opts Object Data options
opts.storeman Object Storeman address pair
opts.storeman.wan string Storeman Wanchain address
skipValidation boolean