Skip to content

Commit 3d524bb

Browse files
grypezclaude
andcommitted
fix(evm-wallet): coerce amount to bigint at JSON boundary in away-coordinator
CLI callers (Docker e2e, kernel-cli) serialize bigints as numeric strings in JSON. The away coordinator is the external boundary — coerce amount to BigInt() in transferNative/transferFungible before forwarding to delegation twins whose M.bigint() / M.lte(bigint) guards now strictly require bigints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d4eff4a commit 3d524bb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

packages/evm-wallet-experiment/src/vats/away-coordinator.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,8 +1788,12 @@ export function buildRootObject(
17881788
* @param amount - Amount in wei.
17891789
* @returns The transaction hash.
17901790
*/
1791-
async transferNative(to: Address, amount: bigint): Promise<Hex> {
1792-
const amt = amount;
1791+
async transferNative(
1792+
to: Address,
1793+
amount: string | number | bigint,
1794+
): Promise<Hex> {
1795+
// Coerce at the JSON boundary — CLI callers pass numeric strings.
1796+
const amt = BigInt(amount);
17931797
const matching = delegationSections.filter(
17941798
(sec) => sec.method === 'transferNative',
17951799
);
@@ -1826,9 +1830,10 @@ export function buildRootObject(
18261830
async transferFungible(
18271831
token: Address,
18281832
to: Address,
1829-
amount: bigint,
1833+
amount: string | number | bigint,
18301834
): Promise<Hex> {
1831-
const amt = amount;
1835+
// Coerce at the JSON boundary — CLI callers pass numeric strings.
1836+
const amt = BigInt(amount);
18321837
const tokenLower = token.toLowerCase() as Address;
18331838
const matching = delegationSections.filter(
18341839
(sec) => sec.method === 'transferFungible' && sec.token === tokenLower,

0 commit comments

Comments
 (0)