You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/bridge-provider-detailed.md
+113-2Lines changed: 113 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,17 +62,27 @@ This implementation mirrors the established provider pattern:
62
62
63
63
Following the wallet provider pattern, bridge clients are **instantiated by developers** and passed to Actions SDK. This keeps API keys out of Actions SDK.
64
64
65
-
### Example: Native Bridge (No Client Needed)
65
+
The native bridge is the **default** and requires no configuration. For L2 ↔ L2 transfers or advanced routing, developers can configure custom bridge providers.
66
+
67
+
### Example: Native Bridge (Default - No Client Needed)
68
+
69
+
The native bridge handles L1 ↔ L2 transfers using Optimism's StandardBridge contracts. It is the default and requires no configuration.
66
70
67
71
```typescript
68
72
const actions =createActions({
69
73
wallet: { /* ... */ },
70
-
// No bridge config = native bridge (default)
74
+
chains: [
75
+
{ chainId: 1, rpcUrl: '...' }, // Ethereum L1
76
+
{ chainId: 10, rpcUrl: '...' }, // OP Mainnet
77
+
],
78
+
// bridge defaults to native - no config needed
71
79
})
72
80
```
73
81
74
82
### Example: Custom Bridge Provider
75
83
84
+
Custom bridges support L2 ↔ L2 transfers and advanced routing through third-party aggregators.
@@ -84,6 +94,10 @@ const bridgeClient = new CustomBridgeClient({
84
94
// Pass client to Actions
85
95
const actions =createActions({
86
96
wallet: { /* ... */ },
97
+
chains: [
98
+
{ chainId: 10, rpcUrl: '...' }, // OP Mainnet
99
+
{ chainId: 8453, rpcUrl: '...' }, // Base
100
+
],
87
101
bridge: {
88
102
type: 'custom',
89
103
client: bridgeClient, // ← Actions never sees API key
@@ -850,6 +864,103 @@ const ERC20_ABI = [
850
864
] asconst
851
865
```
852
866
867
+
---
868
+
869
+
### Superchain Bridge Addresses
870
+
871
+
The SDK includes StandardBridge contract addresses for all Superchain networks, sourced from the [Superchain Registry](https://github.com/ethereum-optimism/superchain-registry).
872
+
873
+
#### L2StandardBridge (Predeploy)
874
+
875
+
All OP Stack chains use a standardized predeploy address for the L2StandardBridge:
// Note: For L2 ↔ L2 (e.g., Base → OP Mainnet), use a custom bridge provider
957
+
]
958
+
```
959
+
960
+
**Important:** To bridge from Base to OP Mainnet (or any L2 ↔ L2), developers must use a custom bridge provider that supports direct L2-to-L2 routing (e.g., Socket, Across, etc.).
// Or configure a third-party provider for L2 ↔ L2
213
+
// bridge: {
214
+
// type: 'custom',
215
+
// client: customBridgeClient,
216
+
// },
208
217
})
209
218
```
210
219
211
220
### BridgeConfig Type
212
221
213
-
Developers can use the native bridge (default) or provide a custom bridge client following the provider pattern.
214
-
215
222
```typescript
216
223
interfaceBridgeConfig {
217
-
/** Bridge provider type ('native' or 'custom') */
224
+
/** Bridge provider type (defaults to 'native') */
218
225
type?:'native'|'custom'
219
226
220
227
/** Custom bridge client instance (required if type === 'custom') */
@@ -255,45 +262,67 @@ interface BridgeClient {
255
262
## Design Decisions
256
263
257
264
-**Provider pattern** - Developers instantiate bridge clients and pass to Actions SDK (Actions never handles API keys)
258
-
-**Adapter pattern** - `BridgeProvider` base class with `NativeBridgeProvider` default and extensible custom implementations
265
+
-**Adapter pattern** - `BridgeProvider` base class with `NativeBridgeProvider` (default) and extensible custom implementations
266
+
-**Default to native** - Native bridge is the default for L1 ↔ L2 transfers, custom providers available for L2 ↔ L2
259
267
-**Transparent integration** - Bridge triggered automatically when `fromChainId !== toChainId` in `send()`
260
268
-**Smart chain detection** - Auto-detect source chain from wallet balances when not specified
269
+
-**Superchain registry** - Built-in bridge addresses for all Superchain networks, extensible for custom chains
261
270
-**Fee protection** - Optional max fee percentage to prevent expensive bridges
262
271
-**Route restrictions** - Optional allowlist/blocklist by asset and chain pairs
263
272
264
273
---
265
274
266
275
## Bridge Providers
267
276
268
-
### Native Bridge (Built-in Default)
277
+
### Native Bridge (Optimism Standard Bridge)
269
278
270
-
The Actions SDK includes a built-in implementation of the Optimism Native Bridge:
279
+
The Actions SDK includes a built-in implementation of the Optimism Native Bridge for L1 ↔ L2 transfers.
271
280
272
-
-**Routes:** OP Mainnet ↔ Base, OP Sepolia ↔ Base Sepolia, Ethereum ↔ OP/Base
273
-
-**Fee:** 0% (gas only)
281
+
**Important:** The native bridge only supports transfers between Ethereum L1 and individual L2 chains. It does NOT support direct L2 ↔ L2 transfers (e.g., Base → OP Mainnet). For L2 ↔ L2 bridging, use a custom bridge provider.
282
+
283
+
-**Routes:** Ethereum L1 ↔ Each L2 (OP Mainnet, Base, OP Sepolia, Base Sepolia, Mode, Fraxtal, etc.)
284
+
-**Fee:** 0% bridge fee (gas only)
274
285
-**Time:**~10 minutes (L1 → L2), ~7 days (L2 → L1 with fault proofs)
275
286
-**Assets:** ETH, USDC, USDT, and all Superchain-native tokens
276
-
-**Configuration:** Zero config required - works out of the box
287
+
-**L2 Contract:**`0x4200000000000000000000000000000000000010` (standard predeploy across all OP Stack chains)
288
+
-**L1 Contracts:** Chain-specific StandardBridge addresses (sourced from [Superchain Registry](https://github.com/ethereum-optimism/superchain-registry))
289
+
290
+
#### Superchain Bridge Addresses
291
+
292
+
The SDK includes L1StandardBridge addresses for all Superchain networks:
293
+
294
+
| Network | Chain ID | L1StandardBridge |
295
+
|---------|----------|------------------|
296
+
| OP Mainnet | 10 |`0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1`|
297
+
| Base | 8453 |`0x3154Cf16ccdb4C6d922629664174b904d80F2C35`|
298
+
| OP Sepolia | 11155420 |`0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1`|
299
+
| Base Sepolia | 84532 |`0xfd0Bf71F60660E2f608ed56e1659C450eB113120`|
For additional Superchain networks, the SDK will fetch addresses from the [Superchain Registry](https://github.com/ethereum-optimism/superchain-registry).
277
304
278
305
### Custom Bridge Providers
279
306
280
-
Third-party bridge providers can be integrated by implementing the `BridgeClient` interface and passing the client instance to Actions configuration. See the provider pattern documentation for implementation details.
307
+
For L2 ↔ L2 transfers and advanced routing, developers can integrate third-party bridge aggregators by implementing the `BridgeClient` interface and passing the client instance to Actions configuration.
0 commit comments