Issues when using eCash (XEC) with big values
Closed this issue · 2 comments
Environment Details
- OS: Linux
- Node Version: v20.10.0
- BitGoJS Version: 9.3.0
- BitGo Environment: XEC mainnet
Description
eCash (XEC) price is extremely low (currently quoted at $0.00005459), and therefore, we need to work with many high values to mount a simple transaction.
When trying to mount a transaction sending the value of 2682085286000000
XEC satoshis (~$1460), the library throws an error because this value is too high, but this value is not an unrealistic number for XEC.
@bitgo/utxo-lib
uses bitcoinjs-lib
under the hook, and it seems the library has a hard limit of 21 * 1e14
for satoshi values (https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/types.js#L97-L101).
Steps to Reproduce
import { UtxoTransactionBuilder } from '@bitgo/utxo-lib/dist/src/bitgo'
import { networks, addressFormat } from '@bitgo/utxo-lib'
const builder = new UtxoTransactionBuilder(networks.ecash)
builder.addOutput(
addressFormat.toOutputScriptTryFormats('qpxk69p8rehy80k9x6dz9msr8kaugda50q69tp5n4n', networks.ecash),
2682085286000000
)
UtxoTransactionBuilder
is deprecated and you should use UtxoPsbt
instead.
If this problem still occurs with the UtxoPsbt
class then please make another issue
@davidkaplanbitgo UtxoPsbt forces the use of BigInt
, making everything works as expected. Thanks for the hint!