@oneid-xyz/inspect
v1.1.1
Published
OneID SDK supports our partners to integrate OneID Service easily, which will solve all the complicated cross-chain issues, and help the blockchain products easier to use. Currently, OneID Service supports 70+ chains with only 1 step setup and the OneID N
Downloads
2,935
Readme
Inspect SDK
OneID SDK supports our partners to integrate OneID Service easily, which will solve all the complicated cross-chain issues, and help the blockchain products easier to use. Currently, OneID Service supports 70+ chains with only 1 step setup and the OneID NFT is using TRC-721 (TomoChain)
Published on npm
Installation
We recommend switching to Node.js Version 16 to make sure common crypto dependencies works.
Then run:
npm install @oneid-xyz/inspect
yarn add @oneid-xyz/inspect
Getting Started
To get started, your must accept with the terms of use for using @oneid-xyz/inspect.
import { OneID } from '@oneid-xyz/inspect';
const oneId = new OneID({
provider: provider,
rpcUrl: string,
})
Parameter
provider (optional)
rpcUrl (optional)
- HTTP Web3 Provider.
Functions
Init Configuration
initConfig()
allows to init base configuration from OneID SDK
Interface
await oneid.systemConfig.initConfig()
Note: Inspect & Core SDK are using same system config, developer shall only need to init once.
Get Wallet by ID Name
getWalletsByID
will return the Linked Wallet of an ID Name.
Linked Wallet is the wallet address that user actually interacts with when Dapps/Wallets integrated our ONEID SDK
For example, when you transfer assets to ID Name test.c98 on C98 Wallet, the assets are transferred to the Linked Wallet address.
Interface
getWalletsByID(id: string, chainId?: ChainId): Promise<LinkedWallet[]>
Params
chainId
is optional- If null, OneID will return 70+ chains & its address.
- If developers have included chainId, then OneID will return address of that chain.
- chainId has been defined in SDK to be managed easier. In case, the chain does not have public chainID,
CHAIN_TYPE
will support to get the chain’s address. we recommend usingCHAIN_TYPE
in second params.
const wallets = await oneid.getWalletsByID(“test.c98”, CHAIN_TYPE.BINANCE_SMART) // BSC
Result
LinkedWallet [ { chain: "binanceSmart", address: '0x123...' } ]
Get Primary Name
getPrimaryName
will return the Primary Name of the wallet address.
Primary Name is using as main interacting with DAPPs when the wallet address has multiple ID names. For example, in the OneID website, user shall be able to see their Primary Name on the top right corner.
Note: OneID Primary Name offers multi-chains, hence Developer can use
address
of any chain to get Primary Name even if it's Solana, Cosmos or EVM
Interface
getPrimaryName(walletAddress: string): Promise<string>
- For example
const id = await oneid.getPrimaryName('0x123...')
Result
id: 'test.c98'
Get Linked ID Names
getLinkedIDs
will return all the ID Names that linked to the wallets.
Note: this function support EVM address only
Interface
getLinkedIDs(walletAddress: string): Promise<LinkedID[]>
- For example
const ids = await oneid.getLinkedIDs('0x123...')
Result
IDs [ { "walletName": "", "isPrimary": false, "node": "0xzxc...", "code": "123...", "linked": [ { "chain": "bitcoin", "address": "bc...", }, ... ], "registar": "0xzxc...", "expires": 1725437071, "id": "123...", "name": "test.c98" }, ... ]
Get Controller Permission
getPermission
will return the address that has permission to edit Records of ID Name.
Interface
getPermission(ids: string[]): Promise<ResponseExecuteTransaction<string[]>>
- For example
const owners = await oneid.getPermission(['test.c98'])
Result
owners: ['0x123...', ...]
Get Node
getNode
will return node of ID Name which has been stored in contract
Interface
getNode(id: string): string
- For example
const node = await oneid.getNode(['test.c98'])
Result
node: '0xzxc...'