tokenpay-wallet-js
A pure JavaScript TokenPay library.
Usage
Fields specifications:
amount
must be in TokenPay amount not in satoshis nor bitcoins e.g. 1
, 5.5
, 10
.
fee
the minimum value allowed is 0.0001 (10,000).
Note: Values are multiplied by 100,000,000
Private keys
Private keys must be in hex (64 characters).
Spend from a 2-of-3 multisig P2SH address
const Transaction = ; const publicKeys = '<public-key-1>' '<public-key-1>' '<public-key-1>'; const inputs = txid: '<transaction-id>' vout: <vout> amount: 55 address: '<multisig-address>' ; try const tx = ; const raw = tx; // returns an object {hex: "<hex>", complete: true|false} catch e console;
Get transaction object representation
const Transaction = ; const publicKeys = '<public-key-1>' '<public-key-1>' '<public-key-1>'; const inputs = txid: '<transaction-id>' vout: <vout> amount: 55 address: '<multisig-address>' ; try const tx = ; const obj = tx; catch e console;
Spend from transaction object representation
const Transaction = ; const publicKeys = '<public-key-1>' '<public-key-1>' '<public-key-1>'; const inputs = txid: '<transaction-id>' vout: <vout> amount: 55 address: '<multisig-address>' ; try const tx = ; catch e console; const obj = tx;const tx2 = Transaction;const raw = tx2;