If you need more control over the bridge flow, you can use the prepareBridge
function instead of the previously discussed bridge
function.
prepareBridge
function is particularly useful if you want to make bridges based on user input in a UI. The standard bridge function will execute the entire bridge flow in one go, meaning only one user input to start the entire process is possible. The prepareBridge
function however will allow you to first present the user with the generated quote and then only start the token approval (if needed) and actual bridge when the user explicitly initiates them.
bridge
function, prepareBridge
will not make any transactions immediately. The initial call will only
no-approval-needed
bridge
function that will initiate the actual bridge transaction when called. It will return the same result as the standard bridge function.
approval-needed
approve
function that can be called to initiate the token approvalapproval
function will return on object containing a function to make the actual bridge or an error if the token approval failed. This bridge function will behave the same as in the previous case.
error