Skip to content

Commit

Permalink
Merge branch 'main' of github.com:pimlicolabs/docs into permisssionle…
Browse files Browse the repository at this point in the history
…ss/wagmi
  • Loading branch information
plusminushalf committed Oct 9, 2024
2 parents 49e2e72 + 04034cd commit 557bb29
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sponsoring without approving max
# How to use the ERC-20 Paymaster without unlimited token approvals

This guide will show you how to use the `prepareUserOperationForErc20Paymaster` function in permissionless.

Expand All @@ -10,15 +10,15 @@ This function lets you approve only the required amount of tokens for your userO
### Define imports and create the clients

```ts
// [!include ~/snippets/erc20-paymaster/prepare-for-erc20-paymasters.ts:clients]
// [!include ~/snippets/erc20-paymaster/use-paymaster-without-unlimited-approval.ts:clients]
```

### Add the `prepareUserOperationForErc20Paymaster` override to `createSmartAccountClient`

This override will replace viem's `prepareUserOperation` action.

```ts
// [!include ~/snippets/erc20-paymaster/prepare-for-erc20-paymasters.ts:prepareUserOperation]
// [!include ~/snippets/erc20-paymaster/use-paymaster-without-unlimited-approval.ts:prepareUserOperation]
```

### Call `sendTransaction`
Expand All @@ -28,7 +28,7 @@ Calling sendTransaction will now automatically approve the required amount of to
If the sender has a sufficient existing approval, then the additional approval call will not be added to the calldata.

```ts
// [!include ~/snippets/erc20-paymaster/prepare-for-erc20-paymasters.ts:sendOp]
// [!include ~/snippets/erc20-paymaster/use-paymaster-without-unlimited-approval.ts:sendOp]
```

::::
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ Chain ID: 137
| WOO | 0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603 |
| WBTC | 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6 |
| USDC | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
| SUKU | 0x60Ea918FC64360269Da4efBDA11d8fC6514617C6 |
| USDT | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F |
| BNB | 0xeCDCB5B88F8e3C15f95c720C51c71c9E2080525d |
| USDT | 0x07365017e2436b5C3553028DB2a98d7672fb75Eb |
Expand Down Expand Up @@ -722,3 +723,4 @@ Chain ID: 11155420
| Symbol | Address |
|--------|--------|
| USDC | 0x5fd84259d66Cd46123540766Be93DFE6D43130D7 |

8 changes: 4 additions & 4 deletions vocs.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ export const paymasterSidebar = [
link: "/infra/paymaster/erc20-paymaster/how-to/use-paymaster",
},
{
text: "Estimating costs",
link: "/infra/paymaster/erc20-paymaster/how-to/calculate-costs",
text: "How to use the ERC-20 Paymaster without unlimited token approvals",
link: "/infra/paymaster/erc20-paymaster/how-to/use-paymaster-without-unlimited-approval",
},
{
text: "Sponsoring without approving max",
link: "/infra/paymaster/erc20-paymaster/how-to/prepare-for-erc20paymaster",
text: "How to estimate token cost and cost in USD",
link: "/infra/paymaster/erc20-paymaster/how-to/calculate-costs",
},
],
},
Expand Down

0 comments on commit 557bb29

Please sign in to comment.