Set up the SDK

After you have installed the SDK, you first need to set it up.

To get started, you have to instantiate and configure the SDK.

import Chainge from '@chainge/sdk';
const chainge = new Chainge(ethereum, config); // ethereum. window.ethereum is described in EIP-1193

The optional config parameter can be used to pass custom configuration to the SDK:

const config = {
    signUrl: '', // required. 
    expireTime: 5000, // optional. The default value is 5000 ms, range 1000 ~ 20000
    appKey: '', // optional. 
}

The signUrl defines which backend should be called. The backend should provide a method for encryption so that the SDK can work properly.

This appKey is optional and required if you need to host the signature service for us to handle.

Next Steps

Check out how to set up the service.

Last updated