diff --git a/src/actions/public/L1/getLatestProposedL2BlockNumber.ts b/src/actions/public/L1/getLatestProposedL2BlockNumber.ts index 983eb08..c964f31 100644 --- a/src/actions/public/L1/getLatestProposedL2BlockNumber.ts +++ b/src/actions/public/L1/getLatestProposedL2BlockNumber.ts @@ -12,6 +12,12 @@ export type GetLatestProposedL2BlockNumberReturnType = { l2BlockNumber: bigint } +/** + * Gets the latest proposed L2 block number from the L2 Output Oracle. + * + * @param {RawOrContractAddress} l2OutputOracle the address of the L2 Output Oracle + * @returns {GetLatestProposedL2BlockNumberReturnType} the latest proposed L2 block number + */ export async function getLatestProposedL2BlockNumber( client: PublicClient, { diff --git a/src/actions/public/L1/getSecondsToFinalizable.ts b/src/actions/public/L1/getSecondsToFinalizable.ts index 005d64c..b6ded1a 100644 --- a/src/actions/public/L1/getSecondsToFinalizable.ts +++ b/src/actions/public/L1/getSecondsToFinalizable.ts @@ -16,6 +16,15 @@ export type GetSecondsToFinalizableParameters< l2OutputOracle: RawOrContractAddress<_chainId> } +/** + * Gets the number of seconds until a withdrawal is finalizable. + * + * @param {Hash} withdrawalHash the hash of the withdrawal + * @param {RawOrContractAddress} portal the address of the portal + * @param {RawOrContractAddress} l2OutputOracle the address of the L2 Output Oracle + * + * @returns {Promise} the number of seconds until the withdrawal is finalizable + */ export async function getSecondsToFinalizable( client: PublicClient, { diff --git a/src/actions/public/L1/getSecondsToNextL2Output.ts b/src/actions/public/L1/getSecondsToNextL2Output.ts index 3a34441..d2eb1a6 100644 --- a/src/actions/public/L1/getSecondsToNextL2Output.ts +++ b/src/actions/public/L1/getSecondsToNextL2Output.ts @@ -10,6 +10,14 @@ export type GetSecondsToNextL2OutputParameters< _chainId = TChain extends Chain ? TChain['id'] : number, > = { latestL2BlockNumber: bigint; l2OutputOracle: RawOrContractAddress<_chainId> } +/** + * Gets the number of seconds until the next L2 output is posted. + * + * @param {bigint} latestL2BlockNumber the latest L2 block number + * @param {RawOrContractAddress} l2OutputOracle the address of the L2 Output Oracle + * + * @returns {Promise} the number of seconds until the next L2 output is posted + */ export async function getSecondsToNextL2Output( client: PublicClient, { diff --git a/src/actions/public/L1/readFinalizedWithdrawals.ts b/src/actions/public/L1/readFinalizedWithdrawals.ts index 52ba2e2..db50ffc 100644 --- a/src/actions/public/L1/readFinalizedWithdrawals.ts +++ b/src/actions/public/L1/readFinalizedWithdrawals.ts @@ -12,6 +12,14 @@ export type ReadFinalizedWithdrawalsParameters< _chainId = TChain extends Chain ? TChain['id'] : number, > = { withdrawalHash: MessagePassedEvent['withdrawalHash']; portal: RawOrContractAddress<_chainId> } +/** + * Reads whether a withdrawal has been finalized from the Optimism Portal. + * + * @param {Hash} withdrawalHash the hash of the withdrawal + * @param {RawOrContractAddress} portal the address of the portal + * + * @returns {Promise} whether the withdrawal is finalized + */ export async function readFinalizedWithdrawals( client: PublicClient, { diff --git a/src/actions/public/L1/readProvenWithdrawals.ts b/src/actions/public/L1/readProvenWithdrawals.ts index 33110ea..898c6ec 100644 --- a/src/actions/public/L1/readProvenWithdrawals.ts +++ b/src/actions/public/L1/readProvenWithdrawals.ts @@ -21,6 +21,14 @@ export type ProvenWithdrawal = { export type ReadProvenWithdrawalsReturnType = ProvenWithdrawal // Convention: use `read` if this is just 1:1 with some contract function +/** + * Reads a proven withdrawal from the Optimism Portal. + * + * @param {Hash} withdrawalHash the hash of the withdrawal + * @param {RawOrContractAddress} portal the address of the portal + * + * @returns {Promise} the proven withdrawal + */ export async function readProvenWithdrawals( client: PublicClient, { diff --git a/src/actions/public/L2/simulateWithdrawERC20.ts b/src/actions/public/L2/simulateWithdrawERC20.ts index f69c68f..39b7698 100644 --- a/src/actions/public/L2/simulateWithdrawERC20.ts +++ b/src/actions/public/L2/simulateWithdrawERC20.ts @@ -16,6 +16,15 @@ export type SimulateWithdrawERC20ReturnType< TChainOverride extends Chain | undefined = undefined, > = SimulateContractReturnType +/** + * Simulates a withdrawal of ERC20 tokens to an L1 address. + * + * @param {Address} l2Token the address of the ERC20 token on L2 + * @param {Address} to the address to withdraw to on L1 + * @param {Bigint} amount the amount of tokens to withdraw + * @param {Bigint} minGasLimit the minimum gas limit for the withdrawal + * @param {Hex} [extraData] the extra data for the withdrawal + */ export async function simulateWithdrawERC20< TChain extends Chain | undefined = Chain, TChainOverride extends Chain | undefined = Chain | undefined, diff --git a/src/actions/public/L2/simulateWithdrawETH.ts b/src/actions/public/L2/simulateWithdrawETH.ts index f20a36d..fe444d4 100644 --- a/src/actions/public/L2/simulateWithdrawETH.ts +++ b/src/actions/public/L2/simulateWithdrawETH.ts @@ -19,6 +19,14 @@ export type SimulateWithdrawETHReturnType< TChainOverride extends Chain | undefined = undefined, > = SimulateWithdrawERC20ReturnType +/** + * Simulates a withdrawal of ETH to an L1 address. + * + * @param {Address} to the address to withdraw to on L1 + * @param {Bigint} amount the amount of ETH to withdraw + * @param {Bigint} minGasLimit the minimum gas limit for the withdrawal + * @param {Hex} [extraData] the extra data for the withdrawal + */ export async function simulateWithdrawETH< TChain extends Chain | undefined = Chain, TChainOverride extends Chain | undefined = Chain | undefined, diff --git a/src/actions/wallet/L2/writeWithdrawERC20.ts b/src/actions/wallet/L2/writeWithdrawERC20.ts index bf3b97f..05dd2ab 100644 --- a/src/actions/wallet/L2/writeWithdrawERC20.ts +++ b/src/actions/wallet/L2/writeWithdrawERC20.ts @@ -12,6 +12,17 @@ export type WriteWithdrawERC20Parameters< & { args: WithdrawToParameters } & L2WriteContractParameters +/** + * Withdraws ERC20 tokens to an L1 address. + * + * @param {Address} l2Token the address of the ERC20 token on L2 + * @param {Address} to the address to withdraw to on L1 + * @param {Bigint} amount the amount of tokens to withdraw + * @param {Bigint} minGasLimit the minimum gas limit for the withdrawal + * @param {Hex} [extraData] the extra data for the withdrawal + * + * @returns {Promise} the hash of the transaction + */ export async function writeWithdrawERC20< TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = Account | undefined, diff --git a/src/actions/wallet/L2/writeWithdrawETH.ts b/src/actions/wallet/L2/writeWithdrawETH.ts index 9308433..18cceeb 100644 --- a/src/actions/wallet/L2/writeWithdrawETH.ts +++ b/src/actions/wallet/L2/writeWithdrawETH.ts @@ -11,6 +11,16 @@ export type WriteWithdrawETHParameters< & { args: WithdrawETHParameters } & L2WriteContractParameters +/** + * Withdraws ETH to an L1 address. + * + * @param {Address} to the address to withdraw to on L1 + * @param {Bigint} amount the amount of ETH to withdraw + * @param {Bigint} minGasLimit the minimum gas limit for the withdrawal + * @param {Hex} [extraData] the extra data for the withdrawal + * + * @returns {Promise} the hash of the transaction + */ export async function writeWithdrawETH< TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = Account | undefined,