These packages aim to provide developers with a set of commonly used functions and features to interact with TokenE graph and core contracts.
yarn add @tokene/sdk
To let the SDK work properly, you need to initialize:
import {
initSdkConfig,
initGraphQlClients,
initCoreContracts,
extensionsManager
} from '@tokene/sdk'
const init = async () => {
/**
* initSdkConfig - should be done at the very beginning of the app
*/
initSdkConfig({
CORE_GRAPH_URL: config.CORE_GRAPH_URL,
MASTER_CONTRACTS_REGISTRY_CONTRACT_ADDRESS: config.MASTER_CONTRACTS_REGISTRY_CONTRACT_ADDRESS,
})
/**
* initGraphQlClients - should be done at the very beginning of the app, rigiht after initSdkConfig
*/
initGraphQlClients()
/**
* initCoreContracts - should be done after user connected to the wallet, or after Fallback provider initialized if you use so
*/
await initCoreContracts(
web3ProvidersStore.provider.getProvider()!,
web3ProvidersStore.provider.rawProvider!,
)
await extensionsManager.init()
}
To get access to core contracts as like as constants-registry or master access management, ...etc:
import { coreContracts } from '@tokene/sdk'
const masterContractsRegistryContract = coreContracts.getMasterContractsRegistryContract()
const masterAccessManagementContract = coreContracts.getMasterAccessManagementContract()
const constantsRegistryContract = coreContracts.getConstantsRegistryContract()
const reviewableRequestsContract = coreContracts.getReviewableRequestsContract()
some of composables, helpers and utils require to have access to the ExtensionsManager,
but if you ain't use them, you can skip extensionsManager.init()
but you will not able to use some of sdk features, for example:
Usage of this contracts you can check in composables
Furthermore, here's some prepared composables you can use in your app, if you haven't some specific needs:
yarn test
This project is licensed under the MIT License - see the LICENSE.md file for details
Generated using TypeDoc