javascript-sdk
javascript-sdk copied to clipboard
chainId bad documented on Transaction
Hello,
I started having this error after updating the library:
Error: chain id should not be null\n at new Transaction (/var/app/current/programs/server/npm/node_modules/@binance-chain/javascript-sdk/lib/tx/index.js:62:13)
Then found out that the parameter in the Transaction object is documented as chain_id everywhere: https://github.com/binance-chain/javascript-sdk/blob/ts/docs/classes/transaction.md https://github.com/binance-chain/javascript-sdk/blob/52268fa46c7294e46c417d972725b355c15bc4b7/src/tx/index.ts#L24
Even in some tests is set as chain_id and I don't see how they are passing: https://github.com/binance-chain/javascript-sdk/blob/7e3b906f92ca12d354da6e600385516b0da57ea5/tests/fixtures/transfer.json
And the actual validation of the class is with chainId: https://github.com/binance-chain/javascript-sdk/blob/52268fa46c7294e46c417d972725b355c15bc4b7/src/types/tx/stdTx.ts#L4 https://github.com/binance-chain/javascript-sdk/blob/52268fa46c7294e46c417d972725b355c15bc4b7/src/tx/index.ts#L56
Suggest either changing all to chainId or chain_id. Actually suggest using a standard, javascript standard is camelcase, so it should be chainId