Skip to content

Commit b503f20

Browse files
authored
Merge pull request #5497 from BitGo/coin-3052-fix-apt-withdrawal-bugs
fix(sdk-coin-apt): read 64 bit little endian amount
2 parents d8e083f + 977310b commit b503f20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/sdk-coin-apt/src/lib/transaction/transferTransaction.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export class TransferTransaction extends Transaction {
3535
this._assetId = entryFunction.type_args[0].toString();
3636
this._recipient.address = entryFunction.args[0].toString();
3737
const amountBuffer = Buffer.from(entryFunction.args[1].bcsToBytes());
38-
this._recipient.amount = amountBuffer.readBigUint64LE().toString();
38+
39+
const low = BigInt(amountBuffer.readUint32LE());
40+
const high = BigInt(amountBuffer.readUint32LE(4));
41+
const amount = (high << BigInt(32)) + low;
42+
this._recipient.amount = amount.toString();
3943
}
4044

4145
protected async buildRawTransaction(): Promise<void> {

0 commit comments

Comments
 (0)