You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// receiver, sender: cash type address// mnemonic: 12 words mnemonic code// amount: (unit BCH)consttransferBch=async(receiver,amount,sender,mnemonic)=>{consttransactionBuilder=newbitbox.TransactionBuilder('mainnet');try{// Utxoconstutxo=awaitbitbox.Address.utxo(sender);letbalance=0;utxo.utxos.every((item,index)=>{balance+=item.satoshis;transactionBuilder.addInput(item.txid,item.vout);});constamountInSatoshi=bitbox.BitcoinCash.toSatoshi(amount);constbyteCount=bitbox.BitcoinCash.getByteCount({P2PKH: 1},{P2PKH: 2});constsendAmount=amountInSatoshi-byteCount;transactionBuilder.addOutput(receiver,sendAmount);// ChangetransactionBuilder.addOutput(sender,balance-sendAmount-byteCount);transactionBuilder.setLockTime(50000);// SignconstseedBuffer=bitbox.Mnemonic.toSeed(mnemonic);// create HDNode from seed bufferconsthdNode=bitbox.HDNode.fromSeed(seedBuffer);// keypairletkeyPair=bitbox.HDNode.toKeyPair(hdNode);// empty redeemScript variableletredeemScript;// sign w/ keyPairtransactionBuilder.sign(0,keyPair,redeemScript,transactionBuilder.hashTypes.SIGHASH_ALL,amountInSatoshi,// transactionBuilder.signatureAlgorithms.SCHNORR,);consttx=transactionBuilder.build();consthex=tx.toHex();// sendRawTransaction to running BCH nodetry{constsendRawTransaction=awaitbitbox.RawTransactions.sendRawTransaction(hex,);console.log(rawTransaction);}catch(error){thrownewError(error);}}catch(error){console.log(error,'errr');thrownewError(error);}};
But I still can't send my bch by following the developer guide and doc
The text was updated successfully, but these errors were encountered:
cshung1994
changed the title
Got [object Object] in my react native project
Got [object Object] in react native when sending BCH
Jun 2, 2020
cshung1994
changed the title
Got [object Object] in react native when sending BCH
Got [object Object] error in react native when sending BCH
Jun 2, 2020
Here is how I sign and brocast bch tx:
But I still can't send my bch by following the developer guide and doc
The text was updated successfully, but these errors were encountered: