Skip to content

bitcore-lib-doge Unhandled Rejection (Error): Assertion failed #3810

@benjamintshi

Description

@benjamintshi
const core = require("bitcore-lib-doge");
const net = core.Networks["mainnet"];
const inputs = [
  {
    address: "DHDfGwckknYiPTyrV33bErSe85wtbx5XoL",
    txId: "a5c7246e07bca9c19458a7f5f6e3a443388568ead490b3c15ddcd8996dc1f258",
    outputIndex: 0,
    script: core.Script.fromAddress(
      "DHDfGwckknYiPTyrV33bErSe85wtbx5XoL"
    ).toHex(),
    satoshis: 13541014139440400,
  },
];
const outputs = [
  {
    address: "DHDfGwckknYiPTyrV33bErSe85wtbx5XoL",
    satoshis: 13541014129440400,
  },
];
const transaction = new core.Transaction(net).from(inputs).to(outputs);
transaction.version = 2;
transaction.sign([""]);
console.log(transaction.toString());

// error info --> 

// node_modules/bn.js/lib/bn.js:6
// if (!val) throw new Error(msg || 'Assertion failed');

// error from --> node_modules/bitcore-lib-doge/lib/transaction/output.js:72
this._satoshisBN = BN.fromNumber(num));
// should be change to --> this._satoshisBN = BN.fromString(num.toString());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions