Class CatalystSDKAbstract

Catalyst SDK class definition

Hierarchy (view full)

Implements

Constructors

Properties

address?: string
catalystNetwork: CatalystNetwork
CATALYST_VERSION: "v1" = 'v1'

Accessors

Methods

  • Determine the asset output from a given swap output

    Parameters

    • vault: string

      target catalyst vault address

    • to: string

      token received from the pool

    • units: bigint

      swap amount in liquidity units

    Returns Promise<bigint>

    output amount in tokens

  • Determine the liquidity output from a given swap input

    Parameters

    • vault: string

      target catalyst vault address

    • from: string

      token swapped into the pool

    • amount: bigint

      swap amount in tokens

    Returns Promise<bigint>

    output amount in liquidity units

  • Check the amount of tokens a given account has permitted another account to transfer.

    Parameters

    • token: string

      token address to check for allowance

    • owner: string

      holder of tokens

    • spender: string

      mover of tokens

    Returns Promise<bigint>

    the amount of tokens the spender may transfer

  • Retrieve token balances for an account

    Parameters

    • tokens: string[]

      list of addresses to check

    • owner: string

      account to check

    Returns Promise<Record<string, bigint>>

    account balances of requested tokens

  • Check the amount of tokens that a given account has permitted another account to spend using permit2.

    Parameters

    • token: string

      token address to check for allowance

    • owner: string

      holder of tokens

    • spender: string

      mover of tokens

    Returns Promise<bigint>

    the max amount of tokens the spender can transfer

  • Deposit mixed tokens into a given vault. Provided tokens amounts must match the input length and ordinal position of the desired deposit tokens.

    Parameters

    • vault: string

      target vault address

    • tokenAmounts: bigint[]

      array of index correlated deposit values

    • minOut: bigint

      minimum number of liquidity tokens received from deposit

    Returns Promise<SdkResponse>

    transaction hash of the initiated deposit

  • Check if an account has permission to spend a given amount of tokens, and if not, attempt to increase the allowance for the spender.

    Parameters

    • token: string

      The address of the token contract.

    • owner: string

      The address of the token owner (account that holds the tokens).

    • spender: string

      The address of the account that needs to be approved to spend the tokens.

    • amount: bigint

      The amount of tokens that the spender needs to be allowed to spend.

    • Optional options: TransactionOptions

      Optional. Transaction options for the allowance approval operation.

    Returns Promise<undefined | SdkResponse>

    A Promise that resolves to either: - An SdkResponse object representing the transaction for ensuring the allowance, or - undefined if the allowance was already sufficient or the operation failed.

  • Ensures that the Permit2 address has the required allowance for the given token.

    Parameters

    • token: string

      The address of the token for which the allowance should be checked.

    • Optional options: TransactionOptions

      Optional. Transaction options for the allowance approval operation.

    Returns Promise<undefined | SdkResponse>

    A Promise that resolves to either: - An SdkResponse object representing the transaction for ensuring the Permit2 allowance, or - undefined if the allowance was already sufficient or the operation failed.

  • Estimates the gas limit required to execute the given instructions on the Catalyst router.

    Parameters

    • instructions: ExecutionInstructions

      Execution instructions encoded for the router

    • Optional gasAmount: bigint

      Optional parameter, required to send native tokens with a transaction

    • Optional options: TransactionOptions

      Optional transaction options

    Returns Promise<bigint>

    Estimated gas limit (a bigint) required for executing the instructions

    Throws

    Error if the estimation fails, which can happen when the source chain is experiencing high traffic

  • Increase the amount of tokens a given account has permitted another account to spend using permit2 for multiple tokens.

    Parameters

    • assets: {
          amount?: bigint;
          token: string;
      }[]

      An array of objects containing the token address, the amount by which the permit should be increased. Amount is optional and defaults to uint160 max value.

    • spender: string

      The address of the account that is permitted to spend the tokens.

    Returns Promise<PermitBatchData>

    A Promise that resolves to the batch permit data for the increased permit amounts request.

  • Generate the Permit2 signature and permit data for increasing the token transfer amount for a given account for a single token.

    Parameters

    • token: string

      The address of the token for which the permit amount is to be increased.

    • spender: string

      The address of the account that is permitted to spend the tokens.

    • Optional amount: bigint

      Optional. The amount by which the permit should be increased. Defaults to uint160 max value.

    Returns Promise<PermitData>

    A Promise that resolves to the permit data for the increased permit amount request.

  • Get the connected accountus native token balance.

    Parameters

    • address: string

      Address to get balance

    Returns Promise<bigint>

    Native token balance

  • Initiate a cross chain swap

    Parameters

    • quote: PriceQuote
    • toAccount: string

      account to swap funds to

    • fallbackUser: string

      account to return funds to in case of swap failure

    • Optional callData: string

      optional call data for post swap integrations

    Returns Promise<SdkResponse>

    transaction hash of the initiated send

  • Set a connection to a given vault via a channel ID in the requested state.

    Parameters

    • vault: string

      target catalyst vault

    • toVault: string

      target destination vault

    • channelId: string

      requested channel id to establish connection

    • isActive: boolean

      parameter to activate or deactive the given channel

    Returns Promise<SdkResponse>

    transaction hash for the initiation set connection

  • Sign a given message.

    Parameters

    • message: string

      any message string signed using the sdk signing key

    Returns Promise<string>

    string representing a signed variant of the original message

  • Sign typed data according to the EIP-712 specification.

    Parameters

    • domain: TypedDataDomain | TypedDataDomain

      The domain separator data for the typed data.

    • types: Record<string, TypedDataField[] | TypedDataField[]>

      The type definitions for the typed data.

    • value: Record<string, any>

      The value of the typed data to be signed.

    Returns Promise<string>

    A promise that resolves to the signed typed value.

  • Withdraw mixed tokens in proportion from a given vault.

    Parameters

    • vault: string

      target vault address

    • poolTokens: bigint

      number of pool tokens to redeem for underlying assets

    • minOut: bigint[]

      array of index correlated withdraw values specifying minimum acceptable withdraw amounts

    Returns Promise<SdkResponse>

    transaction hash of the intiated mixed withdraw

  • Withdraw mixed tokens in specified ratios from a given vault.

    Parameters

    • vault: string

      target vault address

    • poolTokens: bigint

      number of pool tokens to redeem for underlying assets

    • withdrawRatio: bigint[]

      array of index correlated ratios specifying the weights for withdraw of the specific vault

    • minOut: bigint[]

      array of index correlated ratios specifying minimum acceptable withdraw amounts

    Returns Promise<SdkResponse>

    array of index correlated withdraw values