Skip to main content

Install and Initialize

Before integrating Portkey SDK, you need to install and initialize.

Core SDK

Core SDK serves as a wrapper for our API, encompassing most of Portkey's functionalities. Before you start using the Core SDK, it's essential to configure the API service.

Initialize the Core SDK client with the network on which you want your application to run:

NetworkDescription
Testnetaelf test
Mainnetaelf mainnet

Installation

npm install @portkey/did

Initialize

New a did object globally and configure it, use our function with did Please refer to Environmental configuration

import { DID } from '@portkey/did';

export const did = new DID();

did.setConfig({
// Modify the value corresponding to the following fields
requestDefaults: {
baseURL: 'your did server node',
timeout: 30000, // optional default 8000ms
},
graphQLUrl: 'your graphQL node',
storageMethod: 'your store',
network: {
defaultNetwork: 'TESTNET',
},
});

UI SDK

UI SDK enables swift integration for projects, eliminating the need for an in-depth understanding of Portkey's underlying mechanisms. This facilitates the seamless incorporation of core functionalities without delving into Portkey's tech details.

Installation

npm install @portkey/did-ui-react@latest

Configuration

import { ConfigProvider } from '@portkey/did-ui-react';

ConfigProvider.setGlobalConfig({
requestDefaults: {
baseUrl: 'https://aa-portkey-test.portkey.finance'
},
graphQLUrl:
"https://dapp-aa-portkey-test.portkey.finance/Portkey_V2_DID/PortKeyIndexerCASchema/graphql",
});