Constructors

Properties

WGAS: string
gasCost: bigint = ...
params: RouteParams = ...
routerContains: {
    [key: string]: bigint;
} = {}

Type declaration

  • [key: string]: bigint
ADDRESS_THIS: string = '0x0000000000000000000000000000000000000002'
BALANCE_THIS: bigint = ...
MSG_SENDER: string = '0x0000000000000000000000000000000000000001'
ROUTER: string = EVM_ROUTER_ADDRESS

Methods

  • Parameters

    • options: {
          additionalMargin?: number;
          remote?: boolean;
      } = {}
      • Optional additionalMargin?: number
      • Optional remote?: boolean

    Returns bigint

  • Parameters

    • fromVault: string
    • toVault: string
    • channelId: string
    • minOuts: [bigint, bigint]
    • transferTo: string
    • gasTokensToSend: bigint
    • routingIncentive: RoutingIncentive
    • amount: bigint = RouterArguments.BALANCE_THIS
    • deadline: bigint = ...
    • target_data: string = ''
    • revert_to: string = RouterArguments.MSG_SENDER

    Returns void

  • Encodes a sendAsset into the routers calldata.

    Parameters

    • fromAsset: string
    • toAssetIndex: number
    • fromVault: string
    • toVault: string
    • channelId: string
    • minOut: bigint
    • transferTo: string
    • gasTokensToSend: bigint

      How many gas tokens are sent to the incentive contract? Should be getIncentiveCost(...) of the incentives

      • the estimated cost of verifying the message from the source chain.
    • routingIncentive: RoutingIncentive

      The routing incentives provided to the relayer routingIncentive.maxGasDelivery should be the estimated cost on the destination chain. routingIncentive.maxGasAck should be the estimated cost on the source chain. routingIncentive.refundGasTo Should be the sender of the transaction. Cannot be set to RouterArguments.MSG_SENDER. routingIncentive.priceOfDeliveryGas How much to pay for execution on the destination chain in native gas? routingIncentive.priceOfAckGas Should be greater than the base gas when the transaction is executed. routingIncentive.targetDelta Set it to more than the confirmation time for the bridge.

    • deadline: bigint = ...
    • underwritingIncentive: bigint = ...
    • target_data: string = ''
    • revert_to: string = RouterArguments.MSG_SENDER

    Returns void

  • Transfers single asset after enacting a permit if necessary. If a permit (single) and a signature are provided, it enacts the permit before transferring the asset. If no permit information is provided, it directly transfers the specified asset.

    Parameters

    • asset: {
          amount: bigint;
          token: string;
      }

      An object containing the token address and amount to be transferred.

      • amount: bigint
      • token: string
    • Optional permitData: PermitData

      Optional. An object containing the permit information for a single permit.

    • order: CombineRouteParamsOrder = CombineRouteParamsOrder.Last

    Returns void

  • Transfers multiple assets after enacting a permit if necessary. If a permit (batch) and a signature are provided, it enacts the permit before transferring the assets. If no permit information is provided, it directly transfers the specified assets.

    Parameters

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

      An array of objects containing the token address and amount to be transferred.

    • owner: string

      The address of the owner of the assets.

    • Optional permitBatchData: PermitBatchData

      Optional. An object containing the permit information for a batched permit.

    • order: CombineRouteParamsOrder = CombineRouteParamsOrder.Last

    Returns void

  • Parameters

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

      The assets to be transferred, with their token addresses and amounts.

    • owner: string

      The owner of the assets to be transferred.

    • gasUsage: {
          estimatedGasUsedOnLocalAck: bigint;
          estimatedGasUsedOnRemote: bigint;
          estimatedRoutingPayment: bigint;
      }

      The estimated gas usage for the remote and local operations.

      • estimatedGasUsedOnLocalAck: bigint
      • estimatedGasUsedOnRemote: bigint
      • estimatedRoutingPayment: bigint
    • Optional permitBatchData: PermitBatchData

      The data required for the permit batch, if using a permit.

    Returns {
        executionInstructions: {
            commands: string;
            gas: {
                estimatedGasUsedOnLocal: bigint;
                estimatedGasUsedOnLocalAck: bigint;
                estimatedGasUsedOnRemote: bigint;
                estimatedRefundOnAck: bigint;
                estimatedRoutingPayment: bigint;
            };
            inputs: string[];
        };
    }

    An object containing the execution instructions, including the commands, inputs, and estimated gas usage.

    • executionInstructions: {
          commands: string;
          gas: {
              estimatedGasUsedOnLocal: bigint;
              estimatedGasUsedOnLocalAck: bigint;
              estimatedGasUsedOnRemote: bigint;
              estimatedRefundOnAck: bigint;
              estimatedRoutingPayment: bigint;
          };
          inputs: string[];
      }
      • commands: string
      • gas: {
            estimatedGasUsedOnLocal: bigint;
            estimatedGasUsedOnLocalAck: bigint;
            estimatedGasUsedOnRemote: bigint;
            estimatedRefundOnAck: bigint;
            estimatedRoutingPayment: bigint;
        }
        • estimatedGasUsedOnLocal: bigint
        • estimatedGasUsedOnLocalAck: bigint
        • estimatedGasUsedOnRemote: bigint
        • estimatedRefundOnAck: bigint
        • estimatedRoutingPayment: bigint
      • inputs: string[]

    Notice

    Adds the transfer with optional permit instructions to the router for a deposit with liquidity swaps. This function should be called after prepareDepositWithLiquiditySwapsViaPermits to complete the deposit with liquidity swap flow. If gas is provided as an asset prepareDepositWithLiquiditySwaps, it is not needed to set the asset here. (Unless you want to combine both newly wrapped gas & pre-wrapped gas)

  • Parameters

    • asset: {
          amount: bigint;
          token: string;
      }

      The asset to be transferred, with its token address and amount.

      • amount: bigint
      • token: string
    • gasUsage: {
          estimatedGasUsedOnLocalAck: bigint;
          estimatedGasUsedOnRemote: bigint;
          estimatedRoutingPayment: bigint;
      }

      The estimated gas usage for the remote and local operations.

      • estimatedGasUsedOnLocalAck: bigint
      • estimatedGasUsedOnRemote: bigint
      • estimatedRoutingPayment: bigint
    • Optional permitData: PermitData

      The data required for the permit, if using a permit.

    Returns {
        executionInstructions: {
            commands: string;
            gas: {
                estimatedGasUsedOnLocal: bigint;
                estimatedGasUsedOnLocalAck: bigint;
                estimatedGasUsedOnRemote: bigint;
                estimatedRefundOnAck: bigint;
                estimatedRoutingPayment: bigint;
            };
            inputs: string[];
        };
    }

    An object containing the execution instructions, including the commands, inputs, and estimated gas usage.

    • executionInstructions: {
          commands: string;
          gas: {
              estimatedGasUsedOnLocal: bigint;
              estimatedGasUsedOnLocalAck: bigint;
              estimatedGasUsedOnRemote: bigint;
              estimatedRefundOnAck: bigint;
              estimatedRoutingPayment: bigint;
          };
          inputs: string[];
      }
      • commands: string
      • gas: {
            estimatedGasUsedOnLocal: bigint;
            estimatedGasUsedOnLocalAck: bigint;
            estimatedGasUsedOnRemote: bigint;
            estimatedRefundOnAck: bigint;
            estimatedRoutingPayment: bigint;
        }
        • estimatedGasUsedOnLocal: bigint
        • estimatedGasUsedOnLocalAck: bigint
        • estimatedGasUsedOnRemote: bigint
        • estimatedRefundOnAck: bigint
        • estimatedRoutingPayment: bigint
      • inputs: string[]

    Notice

    Adds the transfer with optional permit instructions to the router for a withdraw with liquidity swap. This function should be called after prepareWithdrawWithLiquiditySwapsViaPermits to complete the withdraw with liquidity swap flow.

  • Parameters

    • vault: string
    • amountVaultTokens: bigint
    • withdrawRatios: bigint[]
    • minOuts: bigint[]

    Returns void

  • Returns the base cost given exactly by the routing incentives. There may be additional costs associated with verification which has to be paid on the sending side. Call estimateAdditionalCost() on the CCI to find out.

    Parameters

    Returns bigint