Skip to content

Commit 76d5464

Browse files
committed
coderabbit fix
1 parent da82426 commit 76d5464

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

apps/dashboard/src/@/components/contracts/code-overview.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ var transactionReceipt = await contract.Write(wallet, contract, "{{function}}",
258258
"calls": [
259259
{
260260
"contractAddress": "{{contract_address}}",
261-
"method": "{{function}}"
261+
"method": "{{function}}",
262+
"params": [{{args}}]
262263
}
263264
],
264265
"chainId": {{chainId}}

apps/dashboard/src/@/components/contracts/functions/contract-function.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ function ContractFunctionInner(props: ContractFunctionProps) {
120120
fn,
121121
});
122122

123-
const apiSnippet = formatSnippet(
124-
{ api: COMMANDS.api[commandsKey] },
125-
{
126-
args: fn.inputs?.map((i) => i.name || ""),
127-
chainId: contract.chain.id,
128-
contractAddress: contract.address,
129-
extensionNamespace,
130-
fn,
131-
},
132-
);
123+
// Safety check: Only include API snippet if the command exists in COMMANDS.api
124+
const apiSnippet = COMMANDS.api[commandsKey]
125+
? formatSnippet(
126+
{ api: COMMANDS.api[commandsKey] },
127+
{
128+
args: fn.inputs?.map((i) => i.name || ""),
129+
chainId: contract.chain.id,
130+
contractAddress: contract.address,
131+
extensionNamespace,
132+
fn,
133+
},
134+
)
135+
: {};
133136

134137
const codeSnippet = {
135138
...baseSnippet,

0 commit comments

Comments
 (0)