Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix serialization of bigints in transacitons command #837

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/core/src/list-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ export async function listTransactions(
? exState.result.address
: undefined
: undefined,
params: exState.constructorArgs,
value: networkInteraction.value,
params: exState.constructorArgs.map((arg) =>
zoeyTM marked this conversation as resolved.
Show resolved Hide resolved
typeof arg === "bigint" ? arg.toString() : arg
),
value: networkInteraction.value.toString(),
});

break;
Expand All @@ -116,8 +118,10 @@ export async function listTransactions(
),
name: `${artifact.contractName}#${exState.functionName}`,
to: networkInteraction.to,
params: exState.args,
value: networkInteraction.value,
params: exState.args.map((arg) =>
typeof arg === "bigint" ? arg.toString() : arg
),
value: networkInteraction.value.toString(),
});

break;
Expand All @@ -132,7 +136,7 @@ export async function listTransactions(
lastTxIndex === networkInteraction.transactions.length - 1
),
to: networkInteraction.to,
value: networkInteraction.value,
value: networkInteraction.value.toString(),
zoeyTM marked this conversation as resolved.
Show resolved Hide resolved
});

break;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/list-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface TransactionInfo {
name?: string; // can be contract name, function name, or undefined, depending on the type
address?: string;
params?: SolidityParameterType[];
value?: bigint;
value?: string;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions packages/core/test/list-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("listTransactions", () => {
name: "BasicContract",
address: "0x74e720c9B362ae3A65fF356ad62866511486BBBc",
params: ["0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"],
value: 0n,
value: "0",
},
{
type: "DEPLOYMENT_EXECUTION_STATE",
Expand All @@ -32,7 +32,7 @@ describe("listTransactions", () => {
name: "BasicLibrary",
address: "0x1c947344BA932fC7f3D622600dA0199520A67EFd",
params: [],
value: 0n,
value: "0",
},
{
type: "DEPLOYMENT_EXECUTION_STATE",
Expand All @@ -43,7 +43,7 @@ describe("listTransactions", () => {
name: "BasicLibrary",
address: "0xBdAce15b3211019E272418B8014971c1cefbC8f0",
params: [],
value: 0n,
value: "0",
},
{
type: "CALL_EXECUTION_STATE",
Expand All @@ -54,7 +54,7 @@ describe("listTransactions", () => {
name: "BasicContract#basicFunction",
to: "0x74e720c9B362ae3A65fF356ad62866511486BBBc",
params: [40],
value: 0n,
value: "0",
},
{
type: "DEPLOYMENT_EXECUTION_STATE",
Expand All @@ -65,7 +65,7 @@ describe("listTransactions", () => {
name: "ContractWithLibrary",
address: "0xD369D9aB22D85C2A12bEabc0B581a419789E3755",
params: [],
value: 0n,
value: "0",
},
{
type: "SEND_DATA_EXECUTION_STATE",
Expand All @@ -74,7 +74,7 @@ describe("listTransactions", () => {
"0x2870c7d9f84122caba3739be0dc2246343a87d1b216b57002654b3bd413fe8e2",
status: TransactionStatus.SUCCESS,
to: "0x74e720c9B362ae3A65fF356ad62866511486BBBc",
value: 123n,
value: "123",
},
];

Expand Down
Loading