Module @tokene/sdk

@tokene/sdk

These packages aim to provide developers with a set of commonly used functions and features to interact with TokenE graph and core contracts.

version (scoped package) types tree-shaking checks

Getting Started

Installing

yarn add @tokene/sdk

Setup

To let the SDK work properly, you need to initialize:

  • sdkConfig - to initialize the SDK graphQlClients and coreContracts
  • graphQlClients - to provide the SDK utils and helpers know what graphQL clients it should work with
  • coreContracts - to provide the SDK utils and helpers know what contracts it should work with
  • ExtensionsManager - some of the SDK utils and helpers require to have access to the ExtensionsManager, so you need to provide it as well
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:

Running the tests

yarn test

License

This project is licensed under the MIT License - see the LICENSE.md file for details

References

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

BlockChangedFilter Block_Height Constant ConstantFragment Constant_Filter Contract Contract_Filter ERC20TokenMetadata ERC721TokenMetadata Exact Extension FlattenRole GetConstantsByIdPaginatedQuery GetConstantsByIdPaginatedQueryVariables GetConstantsPaginatedQuery GetConstantsPaginatedQueryVariables GetCoreContractsQuery GetCoreContractsQueryVariables GetGlobalQuery GetGlobalQueryVariables GetKycRequestByIdQuery GetKycRequestByIdQueryVariables GetKycRequestsByAddressAndStatusQuery GetKycRequestsByAddressAndStatusQueryVariables GetKycRequestsByAddressQuery GetKycRequestsByAddressQueryVariables GetKycRequestsQuery GetKycRequestsQueryVariables GetMasterContractRegistryAddressQuery GetMasterContractRegistryAddressQueryVariables GetRolesWithResourcesQuery GetRolesWithResourcesQueryVariables GetTerc20SByNamePaginatedQuery GetTerc20SByNamePaginatedQueryVariables GetTerc20SByNameQuery GetTerc20SByNameQueryVariables GetTerc721SByNamePaginatedQuery GetTerc721SByNamePaginatedQueryVariables GetTerc721SByNameQuery GetTerc721SByNameQueryVariables GetUserByIdQuery GetUserByIdQueryVariables GetUserKycRequestsByStatusQuery GetUserKycRequestsByStatusQueryVariables GetUsersByIdPaginatedQuery GetUsersByIdPaginatedQueryVariables GetUsersByRoleIdsPaginatedQuery GetUsersByRoleIdsPaginatedQueryVariables Global Global_Filter Incremental InputMaybe Kyc MakeEmpty MakeMaybe MakeOptional Maybe Permission PermissionType Query QueryConstantArgs QueryConstantsArgs QueryContractArgs QueryContractsArgs QueryGlobalArgs QueryGlobalsArgs QueryRequestArgs QueryRequestsArgs QueryRequestsThreadArgs QueryRequestsThreadsArgs QueryResourceArgs QueryResourcesArgs QueryRoleArgs QueryRolesArgs QueryTerc20Args QueryTerc20SArgs QueryTerc721Args QueryTerc721SArgs QueryUserArgs QueryUsersArgs QueryWalletArgs QueryWalletTerc20Args QueryWalletTerc20SArgs QueryWalletTerc721Args QueryWalletTerc721SArgs QueryWalletsArgs Query_MetaArgs Request RequestCommonFieldsFragment RequestDescriptionKyc Request_Filter RequestsThread RequestsThreadRequestsArgs RequestsThread_Filter Resource Resource_Filter Role RoleResourcesArgs RoleUsersArgs RoleWithResourcesFragment Role_Filter Scalars Subscription SubscriptionConstantArgs SubscriptionConstantsArgs SubscriptionContractArgs SubscriptionContractsArgs SubscriptionGlobalArgs SubscriptionGlobalsArgs SubscriptionRequestArgs SubscriptionRequestsArgs SubscriptionRequestsThreadArgs SubscriptionRequestsThreadsArgs SubscriptionResourceArgs SubscriptionResourcesArgs SubscriptionRoleArgs SubscriptionRolesArgs SubscriptionTerc20Args SubscriptionTerc20SArgs SubscriptionTerc721Args SubscriptionTerc721SArgs SubscriptionUserArgs SubscriptionUsersArgs SubscriptionWalletArgs SubscriptionWalletTerc20Args SubscriptionWalletTerc20SArgs SubscriptionWalletTerc721Args SubscriptionWalletTerc721SArgs SubscriptionWalletsArgs Subscription_MetaArgs SupportedTokenTypes Terc20 Terc20BalancesArgs Terc20CommonFragment Terc20_Filter Terc721 Terc721BalancesArgs Terc721CommonFragment Terc721_Filter Token User UserCommonFieldsFragment UserRolesArgs User_Filter Wallet WalletErc20Args WalletErc721Args WalletTerc20 WalletTerc20_Filter WalletTerc721 WalletTerc721_Filter Wallet_Filter _Block_ _Meta_

Variables

Functions

References

Re-exports ConstantsRegistry__factory
Re-exports KYCRequests__factory
Re-exports MasterAccessManagement__factory
Re-exports MasterContractsRegistry__factory
Re-exports ReviewableRequests__factory
Re-exports TERC20__factory
Re-exports TERC721__factory
Re-exports TokenFactory__factory
Re-exports TokenRegistry__factory

Generated using TypeDoc