Summary
Version 1 of the SDK introduces bridge and swap and marks the first major stable release. It also introduces a shortcut to fetch bridge and token swap configs.Breaking changes
This release contains some minor breaking changes. Migration is very straightforward.Bridge functions change
The first argument of thebridge and prepareBridge functions now require an additional type field with the possible values of bridge and bridgeSwap. This is required as a swap requires slighly different arguments.
To adjust your existing code, you only need to add the highlighted field to your existing bridge or prepareBridge calls:
Chain adapter interface changes
ThegetApprovalAmount function on chain adapters previously only returned the required approval amount (or undefined if no approval needed). Now this function returns an object with requiredAllowance and availableAllowance fields.This change was neccessary to include those two fields into the
approval-needed variant of the prepareBridge function. It allows integrations to display the available and required allowance before users initiate the approval transaction.
There is no action needed regarding this change unless you have implemented your own chain adapter.
Config shortcuts
Previously you might have fetched the bridge config like this:The
getBridgeConfig in the bridge API wrapper is still available and will keep working. However, we recommend to use the new function for more idiomatic code.