UNPKG

ulysses-sdk

Version:

An sdk for interacting with the Ulysses contracts

152 lines (151 loc) 11.7 kB
import { Interface } from '@ethersproject/abi'; import { IBranchRouterCallOutAndBridgeMultipleParams as IBranchCallOutAndBridgeMultipleParams, ICallOutAndBridgeParams as IBranchCallOutAndBridgeParams } from '../../types/baseBranchRouterTypes'; import { ICallOutSignedAndBridgeMultipleParams, ICallOutSignedAndBridgeParams, IRetrieveDepositParams, IRetrySettlementParams } from '../../types/branchBridgeAgentTypes'; import { IRetrieveSettlementParams, IRootBridgeCallOutAndBridgeMultipleParams as IRootCallOutAndBridgeMultipleParams, IRootBridgeCallOutAndBridgeParams as IRootCallOutAndBridgeParams } from '../../types/rootBridgeAgentTypes'; /** * Class to create the calldata to pass as argument for a given call to the branch router. */ export declare abstract class LzEndpoint { static readonly INTERFACE: Interface; /** * Cannot be constructed. */ private constructor(); /** * Produces the encoded bytes for version 2 adapter params. * @param gasLimit * @param nativeForDst * @param dstNativeAddress * @returns encoded adapter params. */ static encodeAdapterParamsV2(gasLimit: string, nativeForDst: string, dstNativeAddress: string): string; /** * Produces the calldata for an onchain call to the endpoint's `estimateFess` function. * @param dstChainId The id of the destination chain. * @param bridgeAgentAddress The address of the bridge agent on the source chain. * @param payload The payload to pass to the endpoint's `estimateFees` function and would be used in the `send` call. * @param gasLimit The gas limit to pass to the endpoint's `estimateFees` function and would be used in the `send` call. * @param nativeForDst The amount of native tokens to receive in destination chain. * @returns */ static createEstimateFeesCalldata(dstChainId: number, bridgeAgentAddress: string, payload: string, gasLimit: string, nativeForDst: string, dstNativeAddress: string): string; /** * Produces the endpoint calldata for a call that does not require a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param params The parameters to pass to the branch router function. * @returns encoded endpoint calldata for the callOut function. */ static createCallOutLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, params: string): string; /** * Produces the endpoint calldata for a call that requires a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param depositParams params that hold information about the deposit token and amount. * @returns endpoint calldata for the callOutAndBridge function */ static createCallOutAndBridgeLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, { params, depositParams }: IBranchCallOutAndBridgeParams): string; /** * Produces the endpoint calldata to pass as argument for a call that requires multiple token deposits. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param depositParams params that hold information about the deposit tokens and amounts. * @returns endpoint calldata for the callOutAndBridgeMultiple function */ static createBranchCallOutAndBridgeMultipleLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, { params, depositParams }: IBranchCallOutAndBridgeMultipleParams): string; /** * Produces the on-chain calldata to pass as argument for a signed call (using the user's Virtual Account) * that does not require a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param account The user's account as deposit owner and gas refundee. * @param params The parameters to pass to the branch router function. * @returns endpoint calldata for the callOutSigned function */ static createBranchCallOutSignedLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, account: string, params: string): string; /** * Produces the on-chain calldata to pass as argument for a signed call (using the user's Virtual Account) that requires a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param account user account that's used for the refund of gas if applicable * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param depositParams params that hold information about the deposit token and amount. * @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas * @param hasFallbackToggled true if the call should send a fallback message to clear assets in origin chain upon failure. * @returns */ static createBranchCallOutSignedAndBridgeLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, account: string, { params, depositParams, hasFallbackToggled }: ICallOutSignedAndBridgeParams): string; /** * Produces the on-chain calldata to pass as argument for a signed call (using the user's Virtual Account) * that requires multiple token deposits. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param depositParams params that hold information about the deposit tokens and amounts. * @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas * @param hasFallbackToggled true if the call should send a fallback message to clear assets in origin chain upon failure. * @returns */ static createBranchCallOutSignedAndBridgeMultipleLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, account: string, { params, depositParams, hasFallbackToggled }: ICallOutSignedAndBridgeMultipleParams): string; /** * Used to encode enpoint calldata for the retry of a failed settlement. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param account The user's account as deposit owner and gas refundee. * @param settlementNonce The nonce of the settlement to retry. * @param params The parameters to pass to the branch router function. * @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas * @param hasFallbackToggled true if the call should send a fallback message to clear assets in origin chain upon failure. * @returns encoded calldata for the retrySettlement function */ static createBranchRetrySettlementEndpointCalldata(srcChainId: number, srcAddress: string, account: string, { settlementNonce, params, gasParams, hasFallbackToggled }: IRetrySettlementParams): string; /** * Used encode enpoint calldata for deposit retrieval request. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param account The user's account as deposit owner and gas refundee. * @param depositNonce The nonce of the deposit to retrieve. * @returns encoded calldata for the retrieveDeposit function */ static createBranchRetrieveDepositEndpointCalldata(srcChainId: number, srcAddress: string, account: string, { depositNonce }: IRetrieveDepositParams): string; /** * Produces the endpoit calldata for a call that does not require a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param recipient The recipient account as deposit owner and gas refundee. * @param params The parameters to pass to the branch router function. */ static createRootCallOutLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, recipient: string, params: string): string; /** * Produces the endpoint calldata for a call that requires a token deposit. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param recipient The recipient account of the settlement tokens. * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param settlementParams params that hold information about the settlement token and amount. * @param hasFallbackToggled send fallback message to clear assets in origin chain upon failure. * @returns encoded endpoint calldata for the callOutAndBridge function */ static createRootCallOutAndBridgeLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, { recipient, params, settlementParams, hasFallbackToggled }: IRootCallOutAndBridgeParams): string; /** * Produces the endpoint calldata for a call that requires multiple token deposits. * @param srcChainId The id of the source branch chain. * @param srcAddress The address of the source branch chain encode packed with the destination address. * @param nonce The nonce of the deposit to encode. * @param recipient The recipient account of the settlement tokens. * @param params The encoded params to pass to the root router. (executeSignedDepositSingle function on the router) * @param settlementParams params that hold information about the settlement tokens and amounts. * @param hasFallbackToggled send fallback message to clear assets in origin chain upon failure. * @returns encoded endpoint calldata for the callOutAndBridgeMultiple function */ static createRootCallOutAndBridgeMultipleLzEndpointCalldata(srcChainId: number, srcAddress: string, nonce: number, { recipient, params, settlementParams, hasFallbackToggled }: IRootCallOutAndBridgeMultipleParams): string; static createRootRetrieveSettlementEndpointCalldata(srcChainId: number, srcAddress: string, { settlementNonce }: IRetrieveSettlementParams): string; }