Skip to content

Commit 57cd6c9

Browse files
authored
chore: updates to reflect quote changes (#15)
* chore: update docs to reflect quote changes * chore: update docs to reflect quote changes
1 parent bba8584 commit 57cd6c9

File tree

4 files changed

+172
-38
lines changed

4 files changed

+172
-38
lines changed

docs/src/sdk-reference/ethers/deposits.md

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,28 @@ const q = await sdk.deposits.quote({
8585
/*
8686
{
8787
route: "eth-base" | "eth-nonbase" | "erc20-base" | "erc20-nonbase",
88-
approvalsNeeded: [{ token, spender, amount }],
89-
baseCost?: bigint,
90-
mintValue?: bigint,
91-
suggestedL2GasLimit?: bigint,
92-
gasPerPubdata?: bigint
88+
summary: {
89+
route,
90+
approvalsNeeded: [{ token, spender, amount }],
91+
amounts: {
92+
transfer: { token, amount }
93+
},
94+
fees: {
95+
token,
96+
maxTotal,
97+
mintValue,
98+
l1: { gasLimit, maxFeePerGas, maxPriorityFeePerGas, maxTotal },
99+
l2: { total, baseCost, operatorTip, gasLimit, maxFeePerGas, maxPriorityFeePerGas, gasPerPubdata }
100+
},
101+
baseCost,
102+
mintValue
103+
}
93104
}
94105
*/
95106
```
96107

97108
> [!TIP]
98-
> If `approvalsNeeded` is non-empty (ERC-20), `create()` will include those approval steps automatically.
109+
> If `summary.approvalsNeeded` is non-empty (ERC-20), `create()` will include those approval steps automatically.
99110
100111
### `tryQuote(p) → Promise<{ ok: true; value: DepositQuote } | { ok: false; error }>`
101112

@@ -239,11 +250,38 @@ type Eip1559GasOverrides = {
239250

240251
type DepositQuote = {
241252
route: 'eth-base' | 'eth-nonbase' | 'erc20-base' | 'erc20-nonbase';
242-
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
243-
baseCost?: bigint;
244-
mintValue?: bigint;
245-
suggestedL2GasLimit?: bigint;
246-
gasPerPubdata?: bigint;
253+
summary: {
254+
route: 'eth-base' | 'eth-nonbase' | 'erc20-base' | 'erc20-nonbase';
255+
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
256+
amounts: {
257+
transfer: {
258+
token: Address;
259+
amount: bigint;
260+
};
261+
};
262+
fees: {
263+
token: Address;
264+
maxTotal: bigint;
265+
mintValue: bigint;
266+
l1: {
267+
gasLimit: bigint;
268+
maxFeePerGas: bigint;
269+
maxPriorityFeePerGas: bigint;
270+
maxTotal: bigint;
271+
};
272+
l2: {
273+
total: bigint;
274+
baseCost: bigint;
275+
operatorTip: bigint;
276+
gasLimit: bigint;
277+
maxFeePerGas: bigint;
278+
maxPriorityFeePerGas: bigint;
279+
gasPerPubdata: bigint;
280+
};
281+
};
282+
baseCost: bigint;
283+
mintValue: bigint;
284+
};
247285
};
248286

249287
type DepositPlan<TTx = TransactionRequest> = {

docs/src/sdk-reference/ethers/withdrawals.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ const { status, receipt: l1Receipt } = await sdk.withdrawals.finalize(handle.l2T
5656

5757
| Route | Meaning |
5858
| --------------- | ---------------------------------------------------- |
59-
| `eth-base` | Base token is **ETH** on L2 |
60-
| `eth-nonbase` | Base token is **not ETH** on L2 |
59+
| `base` | Withdrawing the **base token** (ETH or otherwise) |
6160
| `erc20-nonbase` | Withdrawing an ERC-20 that is **not** the base token |
6261

6362
You **don’t** pass a route manually; it’s derived from network metadata and the token.
@@ -84,9 +83,20 @@ Estimate the operation (route, approvals, gas hints). Does **not** send transact
8483
const q = await sdk.withdrawals.quote({ token, amount, to });
8584
/*
8685
{
87-
route: "eth-base" | "eth-nonbase" | "erc20-nonbase",
88-
approvalsNeeded: [{ token, spender, amount }],
89-
suggestedL2GasLimit?: bigint
86+
route: "base" | "erc20-nonbase",
87+
summary: {
88+
route,
89+
approvalsNeeded: [{ token, spender, amount }],
90+
amounts: {
91+
transfer: { token, amount }
92+
},
93+
fees: {
94+
token,
95+
maxTotal,
96+
mintValue,
97+
l2: { gasLimit, maxFeePerGas, maxPriorityFeePerGas, total }
98+
}
99+
}
90100
}
91101
*/
92102
```
@@ -246,9 +256,28 @@ export interface Eip1559GasOverrides {
246256
}
247257

248258
export interface WithdrawQuote {
249-
route: 'eth-base' | 'eth-nonbase' | 'erc20-nonbase';
250-
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
251-
suggestedL2GasLimit?: bigint;
259+
route: 'base' | 'erc20-nonbase';
260+
summary: {
261+
route: 'base' | 'erc20-nonbase';
262+
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
263+
amounts: {
264+
transfer: {
265+
token: Address;
266+
amount: bigint;
267+
};
268+
};
269+
fees: {
270+
token: Address;
271+
maxTotal: bigint;
272+
mintValue?: bigint;
273+
l2?: {
274+
gasLimit: bigint;
275+
maxFeePerGas: bigint;
276+
maxPriorityFeePerGas?: bigint;
277+
total: bigint;
278+
};
279+
};
280+
};
252281
}
253282

254283
export interface WithdrawPlan<TTx = TransactionRequest> {

docs/src/sdk-reference/viem/deposits.md

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,28 @@ const q = await sdk.deposits.quote({
103103
/*
104104
{
105105
route: "eth-base" | "eth-nonbase" | "erc20-base" | "erc20-nonbase",
106-
approvalsNeeded: [{ token, spender, amount }],
107-
baseCost?: bigint,
108-
mintValue?: bigint,
109-
suggestedL2GasLimit?: bigint,
110-
gasPerPubdata?: bigint
106+
summary: {
107+
route,
108+
approvalsNeeded: [{ token, spender, amount }],
109+
amounts: {
110+
transfer: { token, amount }
111+
},
112+
fees: {
113+
token,
114+
maxTotal,
115+
mintValue,
116+
l1: { gasLimit, maxFeePerGas, maxPriorityFeePerGas, maxTotal },
117+
l2: { total, baseCost, operatorTip, gasLimit, maxFeePerGas, maxPriorityFeePerGas, gasPerPubdata }
118+
},
119+
baseCost,
120+
mintValue
121+
}
111122
}
112123
*/
113124
```
114125

115126
> [!TIP]
116-
> If `approvalsNeeded` is non-empty (ERC-20), `create()` will automatically include those steps.
127+
> If `summary.approvalsNeeded` is non-empty (ERC-20), `create()` will automatically include those steps.
117128
118129
### `tryQuote(p) → Promise<{ ok: true; value: DepositQuote } | { ok: false; error }>`
119130

@@ -254,11 +265,38 @@ export interface Eip1559GasOverrides {
254265

255266
export interface DepositQuote {
256267
route: 'eth-base' | 'eth-nonbase' | 'erc20-base' | 'erc20-nonbase';
257-
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
258-
baseCost?: bigint;
259-
mintValue?: bigint;
260-
suggestedL2GasLimit?: bigint;
261-
gasPerPubdata?: bigint;
268+
summary: {
269+
route: 'eth-base' | 'eth-nonbase' | 'erc20-base' | 'erc20-nonbase';
270+
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
271+
amounts: {
272+
transfer: {
273+
token: Address;
274+
amount: bigint;
275+
};
276+
};
277+
fees: {
278+
token: Address;
279+
maxTotal: bigint;
280+
mintValue: bigint;
281+
l1: {
282+
gasLimit: bigint;
283+
maxFeePerGas: bigint;
284+
maxPriorityFeePerGas: bigint;
285+
maxTotal: bigint;
286+
};
287+
l2: {
288+
total: bigint;
289+
baseCost: bigint;
290+
operatorTip: bigint;
291+
gasLimit: bigint;
292+
maxFeePerGas: bigint;
293+
maxPriorityFeePerGas: bigint;
294+
gasPerPubdata: bigint;
295+
};
296+
};
297+
baseCost: bigint;
298+
mintValue: bigint;
299+
};
262300
}
263301

264302
export interface DepositPlan<TTx = TransactionRequest> {

docs/src/sdk-reference/viem/withdrawals.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ const { status, receipt: l1Receipt } = await sdk.withdrawals.finalize(handle.l2T
7171

7272
| Route | Meaning |
7373
| --------------- | ---------------------------------------------------- |
74-
| `eth-base` | Base token is **ETH** on L2 |
75-
| `eth-nonbase` | Base token is **not ETH** on L2 |
74+
| `base` | Withdrawing the **base token** (ETH or otherwise) |
7675
| `erc20-nonbase` | Withdrawing an ERC-20 that is **not** the base token |
7776

7877
Routes are derived automatically from network metadata and the supplied `token`.
@@ -99,9 +98,20 @@ Estimate the operation (route, approvals, gas hints). Does **not** send transact
9998
const q = await sdk.withdrawals.quote({ token, amount, to });
10099
/*
101100
{
102-
route: "eth-base" | "eth-nonbase" | "erc20-nonbase",
103-
approvalsNeeded: [{ token, spender, amount }],
104-
suggestedL2GasLimit?: bigint
101+
route: "base" | "erc20-nonbase",
102+
summary: {
103+
route,
104+
approvalsNeeded: [{ token, spender, amount }],
105+
amounts: {
106+
transfer: { token, amount }
107+
},
108+
fees: {
109+
token,
110+
maxTotal,
111+
mintValue,
112+
l2: { gasLimit, maxFeePerGas, maxPriorityFeePerGas, total }
113+
}
114+
}
105115
}
106116
*/
107117
```
@@ -255,9 +265,28 @@ export interface Eip1559GasOverrides {
255265
}
256266

257267
export interface WithdrawQuote {
258-
route: 'eth-base' | 'eth-nonbase' | 'erc20-nonbase';
259-
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
260-
suggestedL2GasLimit?: bigint;
268+
route: 'base' | 'erc20-nonbase';
269+
summary: {
270+
route: 'base' | 'erc20-nonbase';
271+
approvalsNeeded: Array<{ token: Address; spender: Address; amount: bigint }>;
272+
amounts: {
273+
transfer: {
274+
token: Address;
275+
amount: bigint;
276+
};
277+
};
278+
fees: {
279+
token: Address;
280+
maxTotal: bigint;
281+
mintValue?: bigint;
282+
l2?: {
283+
gasLimit: bigint;
284+
maxFeePerGas: bigint;
285+
maxPriorityFeePerGas?: bigint;
286+
total: bigint;
287+
};
288+
};
289+
};
261290
}
262291

263292
export interface WithdrawPlan<TTx = TransactionRequest> {

0 commit comments

Comments
 (0)