Optimism 백서

Optimism

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 8쪽

src/actions/shared/BaseNamespace.ts#L29)</sub> *** #### `getMarkets()` Get all markets across all configured providers | Parameter | Type | Description | | - | - | - | | `params` | `GetLendMarketsParams` | Optional filtering parameters | **Returns:** Promise resolving to array of markets from all providers <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/BaseLendNamespace.ts#L43)</sub> *** #### `getMarket()` Get a specific market by routing to the correct provider | Parameter | Type | Description | | - | - | - | | `params` | `GetLendMarketParams` | Market identifier | **Returns:** Promise resolving to market information <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/BaseLendNamespace.ts#L55)</sub> *** #### `getPositions()` | Parameter | Type | Description | | - | - | - | | `params` | `GetPositionsParams` | Wallet address and optional position filters | **Returns:** Promise resolving to the wallet's positions across providers <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/BaseLendNamespace.ts#L68)</sub> *** #### `openPosition()` Open a lending position | Parameter | Type | Description | | - | - | - | | `params` | `LendOpenPositionParams` | Lending position parameters | **Returns:** Promise resolving to transaction receipt <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/WalletLendNamespace.ts#L35)</sub> *** #### `getPosition()` Get position information for this wallet | Parameter | Type | Description | | - | - | - | | `params` | `GetPositionParams` | Position query parameters | **Returns:** Promise resolving to position information <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/WalletLendNamespace.ts#L53)</sub> *** #### `closePosition()` Close a lending position (withdraw from market) | Parameter | Type | Description | | - | - | - | | `params` | `ClosePositionParams` | Position closing parameters | **Returns:** Promise resolving to transaction receipt <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/lend/namespaces/WalletLendNamespace.ts#L72)</sub> *** # Swap Documentation Source: https://docs.optimism.io/app-developers/reference/actions/swap-documentation API reference for Actions SDK swap operations, functions, and parameters. ## WalletSwapNamespace Wallet swap namespace with full operations including signing. Provides getQuote() for pricing and execute() for swapping tokens. ### Methods | Function | Description | | - | - | | **[supportedChainIds()](#supportedchainids)** | Union of chain IDs supported by any configured provider. | | **[getQuote()](#getquote)** | Get a swap quote bound to the wallet as executor. Defaults the output recipient to the wallet address when omitted. | | **[getQuotes()](#getquotes)** | Get quotes from all providers bound to the wallet as executor. | | **[getMarket()](#getmarket)** | Get a specific swap market by ID. | | **[getMarkets()](#getmarkets)** | Get available swap markets across all providers | | **[execute()](#execute)** | Execute a token swap. Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting). When a pre-built quote is passed, its wallet address must equal this wallet's address so approvals are checked against the account that will execute the swap. Re-quote via `wallet.swap.getQuote(...)` to bind the quote to this wallet. | #### `supportedChainIds()` Union of chain IDs supported by any configured provider. <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/shared/BaseNamespace.ts#L29)</sub> *** #### `getQuote()` Get a swap quote bound to the wallet as executor. Defaults the output recipient to the wallet address when omitted. | Parameter | Type | Description | | - | - | - | | `params` | `SwapQuoteParams` | | <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L44)</sub> *** #### `getQuotes()` Get quotes from all providers bound to the wallet as executor. | Parameter | Type | Description | | - | - | - | | `params` | `SwapQuoteParams` | | <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L59)</sub> *** #### `getMarket()` Get a specific swap market by ID. | Parameter | Type | Description | | - | - | - | | `params` | `GetSwapMarketParams` | Market identifier (poolId + chainId) | | `provider` | `SwapProviderName` | Optional provider name to query directly instead of searching all | **Returns:** Market information <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/BaseSwapNamespace.ts#L119)</sub> *** #### `getMarkets()` Get available swap markets across all providers | Parameter | Type | Description | | - | - | - | | `params` | `GetSwapMarketsParams` | Optional filtering by chainId or asset | **Returns:** Promise resolving to array of markets from all providers <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/BaseSwapNamespace.ts#L149)</sub> *** #### `execute()` Execute a token swap. Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting). When a pre-built quote is passed, its wallet address must equal this wallet's address so approvals are checked against the account that will execute the swap. Re-quote via `wallet.swap.getQuote(...)` to bind the quote to this wallet. | Parameter | Type | Description | | | - | - | - | - | | `params` | \`WalletSwapParams | SwapQuote\` | Swap parameters or a pre-built SwapQuote from getQuote() | **Returns:** Swap receipt with transaction details <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L85)</sub> *** # Wallet Documentation Source: https://docs.optimism.io/app-developers/reference/actions/wallet-definitions API reference for Actions SDK wallet classes, functions, and parameters. ## WalletNamespace Wallet namespace that provides unified wallet operations ### Methods | Function | Description | | - | - | | **[hostedWalletProvider()](#hostedwalletprovider)** | Get direct access to the hosted wallet provider | | **[smartWalletProvider()](#smartwalletprovider)** | Get direct access to the smart wallet provider | | **[createSmartWallet()](#createsmartwallet)** | Create a new smart wallet | | **[createSigner()](#createsigner)** | Create a viem LocalAccount signer from the hosted wallet | | **[toActionsWallet()](#toactionswallet)** | Convert a hosted wallet or local account to an Actions wallet | | **[getSmartWallet()](#getsmartwallet)** | Get an existing smart wallet with a provided signer | #### `hostedWalletProvider()` Get direct access to the hosted wallet provider **Returns:** Promise resolving to the configured hosted wallet provider instance <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L119)</sub> *** #### `smartWalletProvider()` Get direct access to the smart wallet provider **Returns:** Promise resolving to the configured smart wallet provider instance <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L136)</sub> *** #### `createSmartWallet()` Create a new smart wallet | Parameter | Type | Description | | - | - | - | | `params` | `CreateSmartWalletOptions` | Smart wallet creation parameters | | `params.signer` | `LocalAccount` | Primary local account used for signing transactions | | `params.signers` | `Signer[]` | Optional array of additional signers for the smart wallet | | `params.nonce` | `bigint` | Optional nonce for smart wallet address generation (defaults to 0) | | `params.deploymentChainIds` | `SupportedChainId[]` | Optional chain IDs to deploy the wallet to. | | If not provided, the wallet will be deployed to all supported chains. | | | **Returns:** Promise resolving to deployment result containing: * `wallet`: The created SmartWallet instance * `deployments`: Array of deployment results with chainId, receipt, success flag, and error <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L158)</sub> *** #### `createSigner()` Create a viem LocalAccount signer from the hosted wallet | Parameter | Type | Description | | - | - | - | | `params` | `TToActionsMap[THostedProviderType]` | Configuration for the signer | **Returns:** Promise resolving to a viem `LocalAccount` with the hosted wallet as the signer backend <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L174)</sub> *** #### `toActionsWallet()` Convert a hosted wallet or local account to an Actions wallet | Parameter | Type | Description | | - | - | - | | `params` | `ToActionsWalletParam<THostedProviderType, TToActionsMap>` | Provider params or a viem LocalAccount | **Returns:** Promise resolving to the Actions wallet instance <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L190)</sub> *** #### `getSmartWallet()` Get an existing smart wallet with a provided signer | Parameter | Type | Description | | - | - | - | | `params` | `GetSmartWalletOptions` | Wallet retrieval parameters | | `params.signer` | `LocalAccount` | Local account to use for signing transactions on the smart wallet | | `params.signers` | `Signer[]` | Optional array of additional signers for the smart wallet | | `params.deploymentSigners` | `Signer[]` | Optional array of signers used during wallet deployment | | `params.walletAddress` | `Address` | Optional explicit smart wallet address (skips address calculation) | | `params.nonce` | `bigint` | Optional nonce used during smart wallet creation | **Returns:** Promise resolving to the smart wallet instance with the provided signer <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/namespace/WalletNamespace.ts#L223)</sub> *** ## Wallet Base actions wallet class ### Namespaces | Namespace | Type | Description | | - | - | - | | `lend` | `WalletLendNamespace` | Lend namespace with all lending operations | | `borrow` | `WalletBorrowNamespace` | Borrow namespace with all borrow operations | | `swap` | `WalletSwapNamespace` | Swap namespace with all swap operations | ### Properties | Property | Type | Description | | - | - | - | | `address` | `Address` | Get the address of this actions wallet | | `signer` | `LocalAccount` | Get a signer for this actions wallet | ### Methods | Function | Description | | - | - | | **[has()](#has)** | Check whether a wallet namespace (`lend`, `swap`, `borrow`) is configured on this wallet. Useful for callers that branch on capability instead of catching a `TypeError` later. | | **[getBalance()](#getbalance)** | Get asset balances across the requested chains (or all supported chains). | | **[send()](#send)** | Send a transaction using this actions wallet | | **[sendBatch()](#sendbatch)** | Send a batch of transactions using this actions wallet | #### `has()` Check whether a wallet namespace (`lend`, `swap`, `borrow`) is configured on this wallet. Useful for callers that branch on capability instead of catching a `TypeError` later. | Parameter | Type | Description | | - | - | - | | `namespace` | `ActionName` | Wallet namespace name to probe. | **Returns:** `true` when the namespace is configured. <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/wallets/abstract/Wallet.ts#L111)</sub> *** #### `getBalance()` Get asset balances across the requested chains (or all supported chains). | Parameter | Type | Description | | - | - | - | | `options` | `BalanceFetchOptions` | Optional `chainIds` filter | **Returns:** Promise resolving to array of token balances with chain breakdown <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/wallets/abstract/Wallet.ts#L121)</sub> *** #### `send()` Send a transaction using this actions wallet | Parameter | Type | Description | | - | - | - | | `transactionData` | `TransactionData` | The transaction data to execute | | `chainId` | `SupportedChainId` | Target blockchain chain ID | **Returns:** Promise resolving to the transaction hash <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/wallets/abstract/Wallet.ts#L183)</sub> *** #### `sendBatch()` Send a batch of transactions using this actions wallet | Parameter | Type | Description | | - | - | - | | `transactionData` | `readonly TransactionData[]` | The transaction data to execute | | `chainId` | `SupportedChainId` | Target blockchain chain ID | **Returns:** Promise resolving to the transaction hash <sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/wallet/core/wallets/abstract/Wallet.ts#L195)</sub> *** # Interoperability predeploys Source: https://docs.optimism.io/app-developers/reference/contracts/interop/predeploy Learn how interoperability predeploys work. <Info>OP Stack interop is in active development. Some features may be experimental.</Info> The following predeploys have been added to enable interoperability. *Predeployed smart contracts* exist at predetermined addresses, coming from the genesis state. They're similar to [precompiles](https://www.evm.codes/precompiled) but run directly in the EVM instead of running as native code. ## CrossL2Inbox The `CrossL2Inbox` is the system predeploy for cross chain messaging. Anyone can trigger the execution or validation of cross chain messages, on behalf of any user. * **Address:** `0x4200000000000000000000000000000000000022` * **Specs:** [`CrossL2Inbox`](https://specs.optimism.io/interop/predeploys.html?utm_source=op-docs\&utm_medium=docs#crossl2inbox) * **Source code:** [`CrossL2Inbox`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol) ## L2ToL2CrossDomainMessenger The `L2ToL2CrossDomainMessenger` is a higher level abstraction on top of the `CrossL2Inbox` that provides general message passing. It's utilized for secure ERC20 token transfers between L2 chains. Messages sent through the `L2ToL2CrossDomainMessenger` on the source chain receive both replay protection and domain binding (the executing transaction can only be valid on a single chain). * **Address:** `0x4200000000000000000000000000000000000023` * **Specs:** [`L2ToL2CrossDomainMessenger`](https://specs.optimism.io/interop/predeploys.html?utm_source=op-docs\&utm_medium=docs#l2tol2crossdomainmessenger) * **Source code:** [`L2ToL2CrossDomainMessenger`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol) ## SuperchainETHBridge The `SuperchainETHBridge` is a predeploy contract that facilitates cross-chain ETH bridging within the OP Stack interop cluster. It serves as an abstraction layer on top of the `L2ToL2CrossDomainMessenger` specifically designed for native ETH transfers between chains. The contract integrates with the `ETHLiquidity` contract to manage native ETH liquidity across chains, ensuring seamless cross-chain transfers of native ETH. * **Address:** `0x4200000000000000000000000000000000000024` * **Specs:** [`SuperchainETHBridge`](https://specs.optimism.io/interop/superchain-eth-bridge.html) * **Source code:** [`SuperchainETHBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainETHBridge.sol) ## ETHLiquidity The `ETHLiquidity` contract is a predeploy that manages native ETH liquidity for cross-chain transfers within the OP Stack interop set. It works in conjunction with the `SuperchainETHBridge` to facilitate the movement of ETH between chains without requiring modifications to the EVM to generate new ETH. The contract is initialized with a very large balance (type(uint248).max wei) to ensure it can handle all legitimate minting operations. This design allows the `SuperchainETHBridge` to have a guaranteed source of ETH liquidity on each chain, which is essential for the cross-chain ETH transfer mechanism. * **Address:** `0x4200000000000000000000000000000000000025` * **Specs:** [`ETHLiquidity`](https://specs.optimism.io/interop/eth-liquidity.html) * **Source code:** [`ETHLiquidity`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/ETHLiquidity.sol) ## SuperchainTokenBridge The `SuperchainTokenBridge` is an abstraction on top of the `L2ToL2CrossDomainMessenger` that facilitates token bridging using interop, as described in the [token bridging spec](https://specs.optimism.io/interop/token-bridging.html). * **Address:** `0x4200000000000000000000000000000000000028` * **Specs:** [`SuperchainTokenBridge`](https://specs.optimism.io/interop/predeploys.html?utm_source=op-docs\&utm_medium=docs#superchaintokenbridge) * **Source code:** [`SuperchainTokenBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol) ## Next steps * Learn [how messages get from one chain to another chain](/app-developers/guides/interoperability/message-passing) # OP Stack RPC directory Source: https://docs.optimism.io/app-developers/reference/rpc-providers Find public RPC endpoints and production RPC providers across all OP Stack networks. <Warning> Items on this page refer to third-party projects or products that are not maintained by Optimism. They are provided for convenience; refer to each project's own documentation as the source of truth. </Warning> This directory provides developers with a comprehensive collection of RPC endpoints across all OP Stack networks, making it easier to build, deploy, and scale applications on the OP Stack ecosystem. ## Public RPC endpoints The following table lists public RPC endpoints for all OP Stack networks. These endpoints are **rate-limited and not suitable for production use**, but are perfect for development, testing, and proof-of-concept work. For production use, please see the [Production RPC Providers](#production-rpc-providers) section below. <Tabs> <Tab title="Mainnet"> | Chain | Public RPC URL | Documentation | |
프로젝트로 돌아가기