Table of Contents

Class ThirdwebBridge

Namespace
Thirdweb.Bridge
Assembly
Thirdweb.dll
public class ThirdwebBridge
Inheritance
ThirdwebBridge
Inherited Members
Extension Methods

Methods

Buy_Prepare(BigInteger, string, BigInteger, string, BigInteger, string, string, int, object)

Get the transactions required to buy a specific amount of tokens on any chain, alongside the quote.

public Task<BuyPrepareData> Buy_Prepare(BigInteger originChainId, string originTokenAddress, BigInteger destinationChainId, string destinationTokenAddress, BigInteger buyAmountWei, string sender, string receiver, int maxSteps = 3, object purchaseData = null)

Parameters

originChainId BigInteger

The chain ID of the origin chain.

originTokenAddress string

The address of the token on the origin chain.

destinationChainId BigInteger

The chain ID of the destination chain.

destinationTokenAddress string

The address of the token on the destination chain.

buyAmountWei BigInteger

The amount of tokens to buy in wei.

sender string

The address of the sender.

receiver string

The address of the receiver.

maxSteps int

The maximum number of steps in the returned route.

purchaseData object

Arbitrary purchase data to be included with the payment and returned with all webhooks and status checks.

Returns

Task<BuyPrepareData>

A BuyPrepareData object representing the prepare data.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.

Buy_Quote(BigInteger, string, BigInteger, string, BigInteger, int)

Get a quote for buying a specific amount of tokens on any chain.

public Task<BuyQuoteData> Buy_Quote(BigInteger originChainId, string originTokenAddress, BigInteger destinationChainId, string destinationTokenAddress, BigInteger buyAmountWei, int maxSteps = 3)

Parameters

originChainId BigInteger

The chain ID of the origin chain.

originTokenAddress string

The address of the token on the origin chain.

destinationChainId BigInteger

The chain ID of the destination chain.

destinationTokenAddress string

The address of the token on the destination chain.

buyAmountWei BigInteger

The amount of tokens to buy in wei.

maxSteps int

The maximum number of steps in the returned route.

Returns

Task<BuyQuoteData>

A BuyQuoteData object representing the quote.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.

Create(ThirdwebClient)

Create a new instance of the ThirdwebBridge class.

public static Task<ThirdwebBridge> Create(ThirdwebClient client)

Parameters

client ThirdwebClient

The ThirdwebClient instance.

Returns

Task<ThirdwebBridge>

A new instance of ThirdwebBridge.

Onramp_Prepare(OnrampProvider, BigInteger, string, string, string, string, BigInteger?, string, int?, List<BigInteger>, object)

public Task<OnrampPrepareData> Onramp_Prepare(OnrampProvider onramp, BigInteger chainId, string tokenAddress, string amount, string receiver, string onrampTokenAddress = null, BigInteger? onrampChainId = null, string currency = "USD", int? maxSteps = 3, List<BigInteger> excludeChainIds = null, object purchaseData = null)

Parameters

onramp OnrampProvider
chainId BigInteger
tokenAddress string
amount string
receiver string
onrampTokenAddress string
onrampChainId BigInteger?
currency string
maxSteps int?
excludeChainIds List<BigInteger>
purchaseData object

Returns

Task<OnrampPrepareData>

Onramp_Status(string)

public Task<OnrampStatusData> Onramp_Status(string id)

Parameters

id string

Returns

Task<OnrampStatusData>

Sell_Prepare(BigInteger, string, BigInteger, string, BigInteger, string, string, int, object)

Get the transactions required to sell a specific amount of tokens on any chain, alongside the quote.

public Task<SellPrepareData> Sell_Prepare(BigInteger originChainId, string originTokenAddress, BigInteger destinationChainId, string destinationTokenAddress, BigInteger sellAmountWei, string sender, string receiver, int maxSteps = 3, object purchaseData = null)

Parameters

originChainId BigInteger

The chain ID of the origin chain.

originTokenAddress string

The address of the token on the origin chain.

destinationChainId BigInteger

The chain ID of the destination chain.

destinationTokenAddress string

The address of the token on the destination chain.

sellAmountWei BigInteger

The amount of tokens to sell in wei.

sender string

The address of the sender.

receiver string

The address of the receiver.

maxSteps int

The maximum number of steps in the returned route.

purchaseData object

Arbitrary purchase data to be included with the payment and returned with all webhooks and status checks.

Returns

Task<SellPrepareData>

A SellPrepareData object representing the prepare data.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.

Sell_Quote(BigInteger, string, BigInteger, string, BigInteger, int)

Get a quote for selling a specific amount of tokens on any chain.

public Task<SellQuoteData> Sell_Quote(BigInteger originChainId, string originTokenAddress, BigInteger destinationChainId, string destinationTokenAddress, BigInteger sellAmountWei, int maxSteps = 3)

Parameters

originChainId BigInteger

The chain ID of the origin chain.

originTokenAddress string

The address of the token on the origin chain.

destinationChainId BigInteger

The chain ID of the destination chain.

destinationTokenAddress string

The address of the token on the destination chain.

sellAmountWei BigInteger

The amount of tokens to sell in wei.

maxSteps int

The maximum number of steps in the returned route.

Returns

Task<SellQuoteData>

A SellQuoteData object representing the quote.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.

Status(string, BigInteger)

Get the status of any bridge-initiated transaction.

public Task<StatusData> Status(string transactionHash, BigInteger chainId)

Parameters

transactionHash string

The hash of the transaction.

chainId BigInteger

The chain ID of the transaction.

Returns

Task<StatusData>

A StatusData object representing the status.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.

Transfer_Prepare(BigInteger, string, BigInteger, string, string, string, object)

Get the transactions required to transfer a specific amount of tokens on any chain.

public Task<TransferPrepareData> Transfer_Prepare(BigInteger chainId, string tokenAddress, BigInteger transferAmountWei, string sender, string receiver, string feePayer = "sender", object purchaseData = null)

Parameters

chainId BigInteger

The chain ID of the token.

tokenAddress string

The address of the token.

transferAmountWei BigInteger

The amount of tokens to transfer in wei.

sender string

The address of the sender.

receiver string

The address of the receiver.

feePayer string

The fee payer (default is "sender").

purchaseData object

Arbitrary purchase data to be included with the payment and returned with all webhooks and status checks.

Returns

Task<TransferPrepareData>

A TransferPrepareData object representing the prepare data.

Exceptions

ArgumentException

Thrown when one of the parameters is invalid.