Skip to content

Commit

Permalink
docs: fix inputs for BatchCallInvoker (wevm#2684)
Browse files Browse the repository at this point in the history
fix execute args
  • Loading branch information
AyushBherwani1998 authored Sep 3, 2024
1 parent 68be3ba commit e857d95
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 41 deletions.
16 changes: 8 additions & 8 deletions site/pages/experimental/eip7702/contract-writes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const authorization = await walletClient.signAuthorization({
})

// 3. Invoke the Contract's `execute` function to perform batch calls.
const hash = await batchCallInvoker.write.execute([{
const hash = await batchCallInvoker.write.execute([[{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
}, {
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
}], {
}]], {
authorizationList: [authorization],
// ↑ 4. Pass the Authorization as an option.
})
Expand Down Expand Up @@ -335,15 +335,15 @@ const authorization = await walletClient.signAuthorization({
contractAddress,
})

const hash = await batchCallInvoker.write.execute([{ // [!code focus]
const hash = await batchCallInvoker.write.execute([[{ // [!code focus]
data: '0x', // [!code focus]
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D', // [!code focus]
value: parseEther('0.001'), // [!code focus]
}, { // [!code focus]
data: '0x', // [!code focus]
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
value: parseEther('0.002'), // [!code focus]
}], { // [!code focus]
}]], { // [!code focus]
authorizationList: [authorization], // [!code focus]
}) // [!code focus]
```
Expand Down Expand Up @@ -416,11 +416,11 @@ const hash = await walletClient.writeContract({
address: walletClient.account.address,
authorizationList: [authorization],
functionName: 'execute',
args: [{
args: [[{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
}],
}]],
})
```
:::
Expand Down Expand Up @@ -448,15 +448,15 @@ const authorization = await walletClient.signAuthorization({

const invoker = privateKeyToAccount('0x...') // [!code ++]

const hash = await batchCallInvoker.write.execute([{
const hash = await batchCallInvoker.write.execute([[{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
}, {
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
}], {
}]], {
account: invoker, // [!code ++]
authorizationList: [authorization],
})
Expand Down
72 changes: 39 additions & 33 deletions site/pages/experimental/eip7702/sending-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ const hash = await walletClient.sendTransaction({
abi,
functionName: 'execute',
args: [
{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
},
{
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
},
],
[
{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
},
{
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
},
],
]
}),
to: walletClient.account.address,
})
Expand Down Expand Up @@ -261,17 +263,19 @@ const hash = await walletClient.sendTransaction({ // [!code focus]
abi, // [!code focus]
functionName: 'execute', // [!code focus]
args: [ // [!code focus]
{ // [!code focus]
data: '0x', // [!code focus]
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D', // [!code focus]
value: parseEther('0.001'), // [!code focus]
}, // [!code focus]
{ // [!code focus]
data: '0x', // [!code focus]
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
value: parseEther('0.002'), // [!code focus]
}, // [!code focus]
], // [!code focus]
[ // [!code focus]
{ // [!code focus]
data: '0x', // [!code focus]
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D', // [!code focus]
value: parseEther('0.001'), // [!code focus]
}, // [!code focus]
{ // [!code focus]
data: '0x', // [!code focus]
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
value: parseEther('0.002'), // [!code focus]
}, // [!code focus]
], // [!code focus]
] // [!code focus]
}), // [!code focus]
to: walletClient.account.address, // [!code focus]
}) // [!code focus]
Expand Down Expand Up @@ -351,17 +355,19 @@ const hash = await walletClient.sendTransaction({
abi,
functionName: 'execute',
args: [
{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
},
{
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
},
],
[
{
data: '0x',
to: '0xcb98643b8786950F0461f3B0edf99D88F274574D',
value: parseEther('0.001'),
},
{
data: '0x',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.002'),
},
],
]
}),
to: walletClient.account.address,
})
Expand Down

0 comments on commit e857d95

Please sign in to comment.