Skip to content

Commit

Permalink
serialize bigints to strings (wormhole-foundation#2237)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek authored Jul 10, 2024
1 parent 1fe5b35 commit f659edc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions wormhole-connect/src/utils/wallet/aptos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ export async function signAndSendTransaction(
// The wallets do not handle Uint8Array serialization
const payload = request.transaction as Types.EntryFunctionPayload;
if (payload.arguments) {
payload.arguments = payload.arguments.map((a: any) =>
a instanceof Uint8Array ? Array.from(a) : a,
);
payload.arguments = payload.arguments.map((a: any) => {
if (a instanceof Uint8Array) {
return Array.from(a);
} else if (typeof a === 'bigint') {
return a.toString();
} else {
return a;
}
});
}

const tx = await (wallet as AptosWallet).signAndSendTransaction(
Expand Down

0 comments on commit f659edc

Please sign in to comment.