Learn about the core concepts of the SDK.
BridgeConfig
type that is exported by the SDK.
Each key will be a chain while the value will represent the chain config (ChainConfig
type). Each value in the tokens
field of a chain config represents a TokenConfig
.
A lot of functions in the SDK will have the BridgeConfig
or a specific ChainConfig
/TokenConfig
as parameters. So for most advanced use cases you will most likely want to fetch the bridge config first.
string
parameters, the SDK provides a list of supported chains and tokens to avoid the usage of magic strings. You can use them like this:
SupportedTokens
does not include swap tokens as those are too dynamic to be included in a static list like this.data
and error
fields instead of throwing. Checking one for being defined will automatically narrow down the type of the other to non-nullable in the opposite code path. Errors are always a discriminated union type with a _tag
or type
field as discriminator. Some error types will also contain some additional fields with specific information about the error.