Inspect SDK

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

import { OneID } from './oneid';

const oneId = new OneID({
  provider: provider,
  rpcUrl: string,
})

Parameters:

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?: CHAIN_TYPE): Promise<LinkedWallet[]>

Parameters:

  • 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

  • Refer the Supported Chains in Linked Wallet to get mapping of chainID

Example:

const wallets = await oneid.getWalletsByID(“test.c98”, CHAIN_TYPE.BINANCE_SMART) // BSC

Returns:

[
  { 
    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>

Parameters

  • walletAddress

Example:

const id = await oneid.getPrimaryName('0x123...') 

Returns:

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[]>

Parameters

  • walletAddress

Example:

const ids = await oneid.getLinkedIDs('0x123...') 

Returns:

[
  {
    "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[]>>

Parameters

  • ids

Example:

const owners = await oneid.getPermission(['test.c98']) 

Returns:

owners: ['0x123...', ...]

Get Node

getNode() will validate and generate node of an ID Name, then this node shall be used to interact with contract.

Interface:

getNode(id: string): string

Parameters

  • id

Example:

const node = await oneid.getNode(['test.c98']) 

Returns:

node: '0xzxc...'

Supported Chains in Linked Wallet

ChainTypeChainIDChainKey

CHAIN_TYPE.PLATON

210425

platon

CHAIN_TYPE.MOONBEAM

1284

moonbeam

CHAIN_TYPE.APTOSLABS

aptoslabs

aptoslabs

CHAIN_TYPE.INJECTIVE

injective-1

injective

CHAIN_TYPE.OSMOSIS

osmosis-1

osmosis

CHAIN_TYPE.EVMOS

evmos_9001-2

evmos

CHAIN_TYPE.JUNO

juno-1

juno

CHAIN_TYPE.AGORIC

agoric-3

agoric

CHAIN_TYPE.OASIS

42262

oasis

CHAIN_TYPE.KUJIRA

kaiyo-1

kujira

CHAIN_TYPE.STARGAZE

stargaze-1

stargaze

CHAIN_TYPE.UMEE

umee-1

umee

CHAIN_TYPE.STRIDE

stride-1

stride

CHAIN_TYPE.APTOS

ait-3

aptos

CHAIN_TYPE.SUI_MAINNET

sui

suiMainnet

CHAIN_TYPE.SEI_MAINNET

pacific-1

seiMainnet

CHAIN_TYPE.ARCHWAY

constantine-1

archway

CHAIN_TYPE.TOMO

88

tomo

CHAIN_TYPE.ARCHWAY_MAINNET

archway-1

archwayMainnet

CHAIN_TYPE.CHILIZ

88880

chiliz

CHAIN_TYPE.NAUTILUS

22222

nautilus

CHAIN_TYPE.MANTLE

5000

mantle

CHAIN_TYPE.SCROLL

534352

scroll

CHAIN_TYPE.BITCOIN

bitcoin

bitcoin

CHAIN_TYPE.ETHER

1

ether

CHAIN_TYPE.ETHERPOW

10001

etherPow

CHAIN_TYPE.BINANCE_SMART

56

binanceSmart

CHAIN_TYPE.HECO

128

heco

CHAIN_TYPE.OKEX

66

okex

CHAIN_TYPE.TERRA_2

phoenix-1

terra2

CHAIN_TYPE.GATE

86

gate

CHAIN_TYPE.KUCOIN

321

kucoin

CHAIN_TYPE.SOLANA

solana

solana

CHAIN_TYPE.NEAR

near

near

CHAIN_TYPE.AVAX

43114

avax

CHAIN_TYPE.AVAX_X

avaxX

avaxX

CHAIN_TYPE.TRON

tron

tron

CHAIN_TYPE.POLYGON

137

matic

CHAIN_TYPE.FANTOM

250

fantom

CHAIN_TYPE.XDAI

100

xdai

CHAIN_TYPE.POLKADOT

polkadot

polkadot

CHAIN_TYPE.KUSAMA

kusama

kusama

CHAIN_TYPE.COSMOS

cosmoshub-4

cosmos

CHAIN_TYPE.THOR

thor

thor

CHAIN_TYPE.AURA

aura

aura

CHAIN_TYPE.BAND

columbus-5

terra

CHAIN_TYPE.BAND

band

band

CHAIN_TYPE.KAVA

kava

kava

CHAIN_TYPE.SECRET_NETWORK

secret-4

secretNetwork

CHAIN_TYPE.PERSISTENCE

core-1

persistence

CHAIN_TYPE.BINANCE

binance

binance

CHAIN_TYPE.FUNCTION_X

fxcore

functionX

CHAIN_TYPE.ELROND

elrond

elrond

CHAIN_TYPE.TEZOS

tezos

tezos

CHAIN_TYPE.CELO

42220

celo

CHAIN_TYPE.ALGORAND

algorand

algorand

CHAIN_TYPE.CASPER

casper

casper

CHAIN_TYPE.KARDIA

24

kardia

CHAIN_TYPE.RONIN

2020

ronin

CHAIN_TYPE.KLAYTN

8217

klaytn

CHAIN_TYPE.HARMONY

1666600000

harmony

CHAIN_TYPE.CONFLUX

conflux

conflux

CHAIN_TYPE.OPTIMISM

10

optimism

CHAIN_TYPE.BOBA

288

boba

CHAIN_TYPE.ZKSYNC_POLYGON

1101

zksyncPolygon

CHAIN_TYPE.ZKSYNC_ERA

324

zksyncEra

CHAIN_TYPE.ARBITRUM

42161

arbitrum

CHAIN_TYPE.ARBITRUM_XDAI

200

arbitrumXdai

CHAIN_TYPE.AURORA

1313161554

aurora

CHAIN_TYPE.TON

ton

ton

CHAIN_TYPE.CRONOS

25

cronos

CHAIN_TYPE.BITTORRENT

199

bittorrent

CHAIN_TYPE.THETA

theta

theta

CHAIN_TYPE.THETAFUEL

361

thetafuel

Last updated