raydium-io/raydium-sdk

LAYOUT.encode / makeSwapFixedInInstruction fails for very large BNs

RyanWilkins opened this issue · 2 comments

To replicate:

call makeSwapFixedInInstruction with amtin = new BN(120154595939.92575).mul(new BN(1000000000))

encoding fails:

<BN: 6837ae06672b01e00>
        LAYOUT.encode({
            instruction: 9,
            amountIn: (0, entity_1.parseBigNumberish)(amountIn),
            minAmountOut: (0, entity_1.parseBigNumberish)(minAmountOut),
        }, data);
Uncaught Error Error: byte array longer than desired length

This is an issue for some tokens with v. large amounts

Same issue

because your input data has exceeded the maximum allowed mint amount.