ulysses-actions-sdk
Version:
An sdk for interacting with contracts using Ulysses Protocol
49 lines (48 loc) • 2.44 kB
TypeScript
import { BigintIsh } from 'maia-core-sdk';
import { GasParams, IMultipleDepositParams, ISingleDepositParams, ITokenOutputParams } from 'ulysses-sdk';
import { IActionResult, IContextParameters } from '../utils';
export declare type ITokenInputParams = ISingleDepositParams | IMultipleDepositParams;
/**
* Returns the action context
* @param chainId chain id
* @param useVirtualAccount flag to use virtual account
* @param userAccount user account
* @param value message value
* @param gasParams cross-chain gas parameters
* @returns the action context for use in transaction builder
*/
export declare function getActionContext(chainId: number, useVirtualAccount: boolean, userAccount?: string, value?: string, gasParams?: GasParams, inputTokens?: ITokenInputParams, outputTokens?: ITokenOutputParams): IContextParameters;
/**
* Creates the token input parameters
* @param hTokens the hTokens
* @param tokens the tokens
* @param amounts the amounts
* @param deposits the deposits
* @returns the token input parameters
*/
export declare function createTokenInputParams(hTokens: string[], tokens: string[], amounts: BigintIsh[], deposits: BigintIsh[]): ITokenInputParams;
/**
* Creates the token output parameters
* @param settlementOwner the settlement owner
* @param recipient the recipient in the destination chain
* @param dstChainId the destination chain id
* @param gasParams the gas parameters
* @param outputTokens the output tokens
* @param amountsOut the amounts out
* @param depositsOut the deposits out
* @returns
*/
export declare function createTokenOutputParams(settlementOwner: string, recipient: string, dstChainId: number, gasParams: GasParams, outputTokens: string[], amountsOut: BigintIsh[], depositsOut: BigintIsh[]): ITokenOutputParams;
export interface ITransferOrApproveParams {
approvalFlags: boolean[];
tokensToSpend: string[];
amountsToSpend: BigintIsh[];
spenders: string[];
}
/**
* Generates the approvals calldata - e.g. useful to get calldata to send for Virtual Account execution.
* @param params the approval parameters
* @returns the approvals calldata
*/
export declare function generateTransferOrApproveCalldata(params: ITransferOrApproveParams): IActionResult<unknown>[];
export declare function returnDefaultParams(targets: string[], calldatas: string[], values: string[] | undefined): IActionResult<unknown>[];