ulysses-sdk
Version:
An sdk for interacting with the Ulysses contracts
114 lines (113 loc) • 7.4 kB
TypeScript
import { Interface } from '@ethersproject/abi';
import { MethodReturnParams } from 'maia-core-sdk';
import { ICallOutSignedAndBridgeMultipleParams, ICallOutSignedAndBridgeParams, IRedeemDepositParams, IRedeemDepositSingleParams, IRetrieveDepositParams, IRetryDepositSignedParams, IRetrySettlementParams } from '../../types/branchBridgeAgentTypes';
import { GasParams, IMultipleDepositParams, ISingleDepositParams } from '../../types/encodingTypes';
/**
* Class to create the calldata to pass as argument for a given call to the branch router.
*/
export declare abstract class BranchBridgeAgent {
static readonly INTERFACE: Interface;
/**
* Cannot be constructed.
*/
private constructor();
/**
* 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.
* Eg: Claiming rewards,withdraw, etc.
* @param params The parameters to pass to the branch router function.
*/
static encodeCallOutSignedCalldata(params: string, gasParams: GasParams): 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 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 defaults to true.
* @returns
*/
static encodeCallOutSignedAndBridgeCalldata({ params, depositParams, gasParams, 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 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 defaults to true
* @returns
*/
static encodeCallOutSignedAndBridgeMultipleCalldata({ params, depositParams, gasParams, hasFallbackToggled, }: ICallOutSignedAndBridgeMultipleParams): string;
/**
* Used to retry a failed signed deposit on the branch chain.
* @param depositNonce The nonce of the deposit to retry.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas
* @returns encoded calldata for the retryDeposit function
*/
static encodeRetryDepositSigned({ depositNonce, params, gasParams, hasFallbackToggled, }: IRetryDepositSignedParams): string;
/**
* Used to retry a failed settlement.
* @param settlementNonce The nonce of the settlement to retry.
* @param params The encoded params to pass to the destination branch router.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas
* @param hasFallbackToggled defaults to true
* @returns encoded calldata for the retrySettlement function
*/
static encodeRetrySettlement({ settlementNonce, params, gasParams, hasFallbackToggled, }: IRetrySettlementParams): string;
/**
* Used to request tokens back to the branch chain after an call fails.
* @param depositNonce The nonce of the deposit to retrieve.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas
* @returns encoded calldata for the retrieveDeposit function
*/
static encodeRetrieveDeposit({ depositNonce, gasParams }: IRetrieveDepositParams): string;
/**
* Used to transfer tokens from the branch port to the owner of the deposit after an call fails.
* @param depositNonce The nonce of the deposit to retrieve.
* @param account user account that's used for receive the redeemed tokens.
* @returns encoded calldata for the redeemDeposit function
*/
static encodeRedeemDeposit({ depositNonce, account }: IRedeemDepositParams): string;
/**
* Used to transfer one of the deposited tokens from the branch port to the owner of the deposit after an call fails.
* @param depositNonce The nonce of the deposit to retrieve.
* @param account user account that's used for receive the redeemed tokens.
* @param localToken local token address to redeem
* @returns encoded calldata for the redeemDeposit function
*/
static encodeRedeemDepositSingle({ depositNonce, account, localToken }: IRedeemDepositSingleParams): string;
/**
* Creates the calldata to pass as argument to a BranchBridgeAgent during a signed call (using the user's Virtual Account) to a MulticallRootRouterLibZip.
* Produces the on-chain calldata to pass as argument for a call that does not require a token deposit.
* Eg: Claiming rewards,withdraw liq, etc.
*
* @param params The parameters to pass to the branch router function.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas.
* @returns the encoded calldata and message value for the call
*
*/
static encodeCallOutSignedLibZipCalldata(params: string, gasParams: GasParams): MethodReturnParams;
/**
* Creates the calldata to pass as argument to a BranchBridgeAgent during a signed call (using the user's Virtual Account) to a MulticallRootRouterLibZip.
* Produces the on chain parameters to pass as arguments for a given call that requires a single token deposit.
* Eg: ERC4626 Deposit, swap, etc.
*
* @param params parameters to pass to the branch router function.
* @param dParams deposit params to pass to the branch router function.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas.
* @returns the encoded calldata and message value for the call
*/
static encodeCallOutSignedAndBridgeLibZipCalldata(params: string, dParams: ISingleDepositParams, gasParams: GasParams, hasFallbackToggled?: boolean): MethodReturnParams;
/**
* Creates the calldata to pass as argument to a BranchBridgeAgent during a signed call (using the user's Virtual Account) to a MulticallRootRouterLibZip.
* Produces the on chain parameters to pass as arguments for a given call that requires multiple token deposit.
* Eg: Adding Liquidity, etc.
*
* @param params parameters to pass to the branch router function.
* @param mdParams multiple deposit params to pass to the branch router function.
* @param gasParams params that hold information about the gasLimit and remoteBranchExecutionGas.
* @returns the encoded calldata and message value for the call
*/
static encodeCallOutSignedAndBridgeMultipleLibZipCalldata(params: string, mdParams: IMultipleDepositParams, gasParams: GasParams, hasFallbackToggled?: boolean): MethodReturnParams;
}