Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
benjamintshi opened this issue Oct 17, 2024 · 0 comments
Open

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

benjamintshi opened this issue Oct 17, 2024 · 0 comments

Comments

@benjamintshi
Copy link

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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant