@tokel/bitgo-komodo-cc-lib
Advanced tools
Comparing version 0.1.15 to 0.1.16
@@ -10,2 +10,3 @@ /** borrowed from https://github.com/pbca26/bitgo-utxo-lib/blob/57f1a95694bbc825d3b055bfec8e0311181b7d2e/samples/cctokenspoc.js#L479 */ | ||
const Transaction = require('../src/transaction'); | ||
const ccutils = require('./ccutils') | ||
let ccimp; | ||
@@ -44,7 +45,9 @@ if (process.browser) | ||
async function create_normaltx(_wif, _destaddress, _satoshi) { | ||
async function create_normaltx(_wif, _destaddress, _satoshi, _network, _peers) { | ||
let wif = _wif; | ||
let destaddress = _destaddress; | ||
let satoshi = _satoshi; | ||
let tx = await makeNormalTx(wif, destaddress, satoshi); | ||
let network = _network; | ||
let peers = _peers | ||
let tx = await makeNormalTx(wif, destaddress, satoshi, network, peers); | ||
@@ -54,10 +57,10 @@ return tx.toHex(); | ||
async function makeNormalTx(wif, destaddress, amount) { | ||
async function makeNormalTx(wif, destaddress, amount, network, peers) { | ||
// init lib cryptoconditions | ||
p2cryptoconditions.cryptoconditions = await ccimp; // note we need cryptoconditions here bcz it is used in FinalizCCtx o check if a vin is normal or cc | ||
const txbuilder = new TransactionBuilder(mynetwork); | ||
const txbuilder = new TransactionBuilder(network); | ||
const txfee = 10000; | ||
let mypair = ecpair.fromWIF(wif, mynetwork); | ||
let mypair = ecpair.fromWIF(wif, network); | ||
let txwutxos = await ccutils.createTxAndAddNormalInputs( | ||
@@ -71,3 +74,3 @@ peers, | ||
Buffer.from(txwutxos.txhex, 'hex'), | ||
mynetwork | ||
network | ||
); | ||
@@ -84,3 +87,3 @@ | ||
txwutxos.previousTxns, | ||
mynetwork | ||
network | ||
); | ||
@@ -87,0 +90,0 @@ if (added < amount + txfee) |
{ | ||
"name": "@tokel/bitgo-komodo-cc-lib", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "Client-side Bitcoin JavaScript library with Komodo cryptocondions support", | ||
@@ -65,2 +65,3 @@ "main": "./src/index.js", | ||
"safe-buffer": "^5.2.1", | ||
"secp256k1": "^3.5.2", | ||
"setimmediate": "^1.0.4", | ||
@@ -67,0 +68,0 @@ "sha.js": "2.4.11", |
264843
60
7215
37
+ Addedsecp256k1@^3.5.2