Error: decToBn: Input is not a base-10 integer
[1] at decToBn (C:\...\node_modules\@dydxprotocol\starkex-lib\build\src\lib\util.js:74:15)
[1] at SignableOrder.calculateHash (C:\...\node_modules\@dydxprotocol\starkex-lib\build\src\signable\order.js:64:49)
[1] at SignableOrder.getHashBN (C:\...\node_modules\@dydxprotocol\starkex-lib\build\src\signable\stark-signable.js:30:39)
[1] at SignableOrder.sign (C:\...\node_modules\@dydxprotocol\starkex-lib\build\src\signable\stark-signable.js:41:35)
[1] at Private.createOrder (C:\...\node_modules\@dydxprotocol\v3-client\build\src\modules\private.js:270:42)
[1] at C:\work\bitoro-perp-v2\dist\index.js:70:47
[1] at Generator.next (<anonymous>)
[1] at fulfilled (C:\...\dist\index.js:5:58)
[1] at processTicksAndRejections (node:internal/process/task_queues:96:5)
it appears in stark-signable.js, the function getHashBN() returns the undefined hashBN.
async getHashBN() {
if (this._hashBN === null) {
console.log('null')
this._hashBN = await this.calculateHash()
}
return this._hashBN;
}
/**
* Sign the message with the given private key, represented as a hex string or hex string pair.
*/
async sign(privateKey) {
const hashBN = await this.getHashBN();
console.log('hashBN------', hashBN)
const ecSignature = await (0, crypto_1.sign)((0, helpers_1.asEcKeyPair)(privateKey), hashBN);
return (0, helpers_1.serializeSignature)((0, helpers_1.asSimpleSignature)(ecSignature));
}
What's the this.calculateHash() function? How it does work?
While creating a new order, It showed me up.
the error;
it appears in
stark-signable.js
, the functiongetHashBN()
returns the undefinedhashBN
.What's the
this.calculateHash()
function? How it does work?