π¬Events
Events are available as callback functions in the PoodlApp config object. Each event will provide you with a set of outputs that can then be used in custom functions.
onAccountChange
This event is triggered every time users connect or disconnect their wallet as well as switching between accounts.
/*
* available args
* newAccount: string
* oldAccount: string
*/
onAccountChange: newAccount => {
console.log(newAccount)
}onChainChange
This event is triggered every time users change newtork (chain).
/*
* available args
* newChainId: chainId
* oldChainId: chainId
*/
onChainChange: newChainId => {
console.log(newChainId)
}onTokenSelect
This event is triggered every time users change either the input or the output token.
It gives back 2 json objects - inputToken and outputToken
Usage example:
onSuccessSwap
This event is triggered every time users succesfully swap a token through the widget
It gives back a json object - quote
The quote object represent the aggregator quote used to submit the transaction and therefore it includes all the information related to that transaction.
This is particularly useful for tracking or analytics purposes:
Last updated