SdkBase
SDK class encapsulating bridge functions.
Hierarchy
SdkShared
↳
SdkBase
Methods
bumpTransfer
▸ bumpTransfer(params
): Promise
<TransactionRequest
>
Increases the relayer fee for a specific transfer on origin; anyone is allowed to bump for any transfer.
Example
Parameters
Name | Type | Description |
---|---|---|
|
| SdkBumpTransferParams object. |
|
| The asset address you want to pay in (use "0x0000000000000000000000000000000000000000" for native). |
|
| The origin domain ID of the transfer. |
|
| The additional relayer fee to increase the transfer by, in the specified asset. |
|
| The transfer ID. |
Returns
Promise
<TransactionRequest
>
providers.TransactionRequest object.
calculateAmountReceived
▸ calculateAmountReceived(originDomain
, destinationDomain
, originTokenAddress
, amount
, receiveLocal?
, checkFastLiquidity?
): Promise
<{ amountReceived
: BigNumberish
; destinationSlippage
: BigNumberish
; originSlippage
: BigNumberish
; routerFee
: BigNumberish
; isFastPath
: boolean
}>
Calculates the estimated amount received on the destination domain for a bridge transaction.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
|
|
| The domain ID of the origin chain. |
|
|
| The domain ID of the destination chain. |
|
|
| The address of the token to be bridged from origin. |
|
|
| The amount of the origin token to bridge, in the origin token's native decimal precision. |
|
|
| (optional) Whether the desired destination token is the local asset ("nextAsset"). |
|
|
| (optional) Whether to check current router liquidity for fast path availability. |
Returns
Promise
<{ amountReceived
: BigNumberish
; destinationSlippage
: BigNumberish
; originSlippage
: BigNumberish
; routerFee
: BigNumberish
; isFastPath
: boolean
}>
Estimated amount received for local/adopted assets, if applicable, in their native decimal precisions.
estimateRelayerFee
▸ estimateRelayerFee(params
): Promise
<BigNumber
>
Calculates an estimated relayer fee in the native asset of the origin domain to be used in xcall.
Example
Parameters
Name | Type | Default value | Description |
---|---|---|---|
|
| undefined | SdkEstimateRelayerFeeParams object. |
|
| undefined | The origin domain ID of the transfer. |
|
| undefined | The destination domain ID of the transfer. |
|
| undefined | The gas amount needed for calldata. |
|
| "0x0000000000000000000000000000000000000000" | (optional) The native token of the origin domain. |
|
| "native" | (optional) "native" for native asset denomination or "usd" to get the estimate in USD value. |
|
| "0x0000000000000000000000000000000000000000" | (optional) The native token of the destination domain. |
|
| (uses external estimate - increases response time) | (optional) The USD price of the origin native token. |
|
| (uses external estimate - increases response time) | (optional) The USD price of the destination native token. |
|
| (uses external estimate - increases response time) | (optional) The gas price of the destination chain, in gwei units. |
Returns
Promise
<BigNumber
>
The relayer fee in native asset of the origin domain or USD equivalent.
xcall
▸ xcall(params
): Promise
<TransactionRequest
>
Prepares xcall inputs and encodes the calldata. Returns an ethers TransactionRequest object, ready to be sent to an RPC provider.
Example
Parameters
Name | Type | Description |
---|---|---|
|
| SdkXCallParams object. |
|
| (optional) The amount of tokens (in specified asset) to send with the xcall. If |
|
| (optional) The target asset to send with the xcall. Can be set to |
|
| (optional) Calldata to execute (can be empty: "0x"). |
|
| (optional) Address allowed to cancel an xcall on destination. |
|
| The destination domain ID. |
|
| The origin domain ID. |
|
| (optional) Whether to receive the local asset ("nextAsset"). |
|
| (optional) Fee paid to relayers, in native asset on origin. Use |
|
| (optional) Fee paid to relayers, in transacting asset on origin. Use |
|
| (optional) Maximum acceptable slippage in BPS. For example, a value of 30 means 0.3% slippage. |
|
| Address receiving funds or the target contract. |
|
| (optional) Whether we should wrap the native token before sending the xcall. This will use the Multisend utility contract to deposit ETH, approve Connext as a spender, and call xcall. If set true, |
|
| (optional) Whether we should unwrap the wrapped native token when the transfer reaches its destination. By default, if sending a wrapped native token, the wrapped token is what gets delivered at the destination. Setting this to |
Returns
Promise
<TransactionRequest
>
providers.TransactionRequest object.
create
▸ Static
create(_config
): Promise
<SdkBase
>
Create a singleton instance of the SdkBase class.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
|
| undefined | SdkConfig object. |
|
| undefined | Chain config, at minimum with providers for each chain. |
|
| undefined | Signer address for transactions. |
|
| "info" | (optional) Logging severity level. |
|
| "mainnet" | (optional) Blockchain environment to interact with. |
Returns
Promise
<SdkBase
>
providers.TransactionRequest object.
Example
See the Deployments page for all domain IDs and asset addresses.
updateSlippage
▸ updateSlippage(params
): Promise
<TransactionRequest
>
Updates the slippage tolerance for a specific transfer on origin; only the origin sender is allowed to do so.
Example
Parameters
Name | Type | Description |
---|---|---|
|
| SdkUpdateSlippageParams object. |
|
| The origin domain ID of the transfer. |
|
| The new relayer fee to use for this transfer, in BPS. |
|
| The transfer ID. |
Returns
Promise
<TransactionRequest
>
providers.TransactionRequest object.
Last updated