Skip to content

Commit

Permalink
fix: check, don't assume, functionParams' presence
Browse files Browse the repository at this point in the history
The `increment` test doesn't pass `functionParams`
  • Loading branch information
chadoh committed Aug 1, 2024
1 parent e509f0f commit a8bff11
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ async function main() {
...contract.basicNodeSigner(keypair, networkPassphrase),
});
const args: Record<string, any> = {};
functionParams.split(",").forEach((p) => {
const [name, value] = p.split(":");
args[name] = value;
});
if (functionParams) {
functionParams.split(",").forEach((p) => {
const [name, value] = p.split(":");
args[name] = value;
});
}
// @ts-ignore client[functionName] is defined dynamically
const { result } = await client[functionName](args);
console.log(JSON.stringify(result));
Expand Down

0 comments on commit a8bff11

Please sign in to comment.