Frontend Integration

das-sdk-jsopen in new window

das-sdk-jsopen in new window is a NPM package that encapsulates JSON-RPC calls to indexer.

The dapp only need to integrate this SDK and invoke corresponding API, whose data is provided by das-account-indexer, can get the needed data.

Note that after the application gets the value of the user-set data, it should always verify the validity of the value.

das-sdk-js Documentopen in new window

Prerequisites

This SDK relies on the JSON-RPC service provided by das-account-indexer.

We recommend that developers buidl their own .bit Indexer, but developers can use the official .bit Indexer service for development and testing. See:

Official Indexer Service

Usage Example

import Das from 'das-sdk'

const das = new Das({
  url: 'https://indexer-not-use-in-production-env.did.id', // Avoding using this indexer in production
})

das.records('dasloveckb.bit').then(console.log)

Output

[{
  key: 'address.eth',
  label: 'coinbase',
  value: '0x1234...4567',
  ttl: 300,
  avatar: 'https://identicons.da.systems/identicon/dasloveckb.bit'
}, {
  key: 'address.eth',
  label: 'onchain',
  value: '0x2345...6789',
  ttl: 300,
  avatar: 'https://identicons.da.systems/identicon/dasloveckb.bit'
}]

Next Step