Configure the SDK

Get started with the zksync-easy-onramp SDK

You need to create an initial configuration to start using the SDK in your app. This configuration defines the settings and data required for the SDK to function properly.

import { createOnRampConfig } from 'zksync-easy-onramp';

createOnRampConfig({
  integrator: "ZKsync Easy OnRamp Demo",
},);

Parameters

apiUrl (string, optional)

The base URL for the ZKsync Easy On-Ramp API. It is by default set to the production URL for the API. It can be changed, for example, to test with a staging URL.

integrator (string, required)

The SDK requires an integrator option as a means to identify and ensure that the config has been initialized. Currently it is not being used track anything and is not stored on the API server.

services (ServicesConfig, optional)

The list of services to use when requesting quotes for users. If no services are provided only the default services will be used which may be rate-limited. Define the service with a boolean or a string for the public API key to use.

provider (SDKProvider, required)

A provider configuration that allows the SDK to execute transactions and signing with a wallet client provided by the app. This is required to enable executing quotes that have transactions.

dev (boolean, optional)

A development flag to use sandbox testing environments when developing. This will use sandbox environments from fiat on-ramp services. LI.FI does not have a sandbox environment for swapping tokens, instead we create a cheap swap from USDT to the requested token.

Update SDK configuration

The SDK provides methods to get and update the configuration after you've initialized. Import the global config object and use the methods available.

import { config } from 'zksync-easy-onramp';

Configuration methods

get()

Returns the current SDK configuration.

set(configOptions: Partial<SDKConfig>)

Updates the SDK configuration with the provided config options.


Made with ❤️ by the ZKsync Community