Skip to main content
Time to read: 1 min

Flyover SDK - Advanced Operations

Custom network setups​

To configure custom networks, see Configuration section.

Captcha token handling​

The tokenResolver asynchronously fetches a token from the state managed by a store.

const tokenResolver = function () {
return import('./store/store').then(
(mod) => mod.store.getState().flyover.captchaToken,
);
};
Info

A Liquidity Provider can choose to enable captcha in the service to ensure only human-generated quotes.

  • The function above uses the dynamic import statement to import the module located at ./store/store. Once the module is imported, it accesses the store object from it using mod.store. Then, it retrieves the flyover.captchaToken from the state using store.getState().flyover.captchaToken. The import statement returns a promise, and the .then block is used to specify what should happen after the import is successful. In this case, it returns the captchaToken.
  • The same principle applies to any approach taken by the developer to manage the state of its application. Flyover SDK only expects a string resulting from the promise, regardless of the origin. It’s important to mention that the type of captcha expected by the Flyover SDK is a Invisible reCAPTCHA v2. The site key to use the captcha is included in the LiquidityProvider object retrieved by getLiquidityProviders() function.

Assigning Resolver in the Flyover Instance​

Add the captchaTokenResolver: tokenResolver in the Flyover instance.

const flyover = new Flyover({
network: 'Mainnet',
captchaTokenResolver: tokenResolver,
allowInsecureConnections: true,
});

This will assign the tokenResolver function as the captcha token resolver for the Flyover instance. This means that when the Flyover instance needs a captcha token, it will use the logic defined in tokenResolver to obtain it asynchronously.

FlyoverUtils​

Flyover SDK exports an object with a collection of util functions that the client application might use during the integration with the SDK. You can see the list of the utility functions and also when importing the FlyoverUtils object from the SDK package every function has a JsDoc explaining its usage.

Troubleshooting

Encountering difficulties with the SDK setup, LPS configuration, or specific Flyover issues? Join the Rootstock Discord community for expert support and assistance. Our dedicated team is ready to help you resolve any problems you may encounter.

Last updated on by Owanate Amachree