Recent Artilces

BLOG

OnBlock

← All Topics

ToDo

  • What is OnBlock integration? Who is the audience?
  • Provide fully working example of an OnBlock integration.

What is the OnBlock Integration?

OnBlock provides features and functions for two distinct groups of users:

  • One is for the end user. OnBlock allows for easy account creation on the IOST blockchain and
  • Two is for developers. The OnBlock SDK gives developers all the tools required to create accounts, allocate resources such as iGAS and iRAM, and on board new users to their dapp.

Benefits for the end user to easily create an account on IOST which allows the user to access dapps. For instance, Joe wants to play the Herorats game but finds that creating the IOST account requires knowledge of iRAM, iGAS, and he needs to visit multiple websites to set this up. Only then can Joe play Herorats. OnBlock allows Joe a single location to create the account and immediately play the game.

The second function is for developers. As an example, the developer of Herorats used the OnBlock SDK to integrate the IOST currency into their game. No need to create user accounts, deal with password resets, or cryptocurrency wallets.

(link to http://developers1.onblock.me/docs/en/introduce/ and remove text)

OnBlock JavaScript SDK

OnBlock.js

OnBlock.js

OnBlock.js provided the basic API with OnBlock

isInOnBlock

Determine whether it is on OnBlock or not.

Parameters

NameTypeDescription
urlStringonblock url,Default https://onblock.me

Return

Booleam true/false true means it is on OnBlock, false means it is not on OnBlock

For example

const isOnBlock = OnBlock.isInOnBlock()
// const isOnBlock = OnBlock.isInOnBlock('http://testnet.onblock.me')

enable

obtain username method

Return

Promise returns username (OID)

For example

OnBlock.enable().then(name => {
  console.log(name) 
})

getOnBlockAccountInfo

Get OnBlock Account Information

Return

Promise returns Account Balance List

NameTypeDescription
idNumberID
chainStringChain
symbolStringToken
availableStringAvailable Asset
freezeStringFrozen Asset

For example

OnBlock.getOnBlockAccountInfo().then(data => {
  //  data sample:
  //  [
  //    {id: 1, chain: 'iost', symbol: 'iost', available: '0', freeze: '0'},
  //    {id: 2, chain: 'iost', symbol: 'iet', available: '0', freeze: '0'},
  //    {id: 2, chain: 'iost', symbol: 'your token', available: '0', freeze: '0'}
  //  ]
})

account

Obtain account information

Return

Object account information

NameTypedescription
nameStringOID
OAAStringIOSTOAA
EosOAAStringEosOAA
networkStringchain information
typeStringplatform information

For example

const user = OnBlock.account
{name: 'xxx', OAA: 'xxx',  EosOAA: 'xxx', network: 'MAINNET', type: 'onblock'}

newIOST

Create an iost instance, please refer IOST frontend for more.

Find IOST user guide in IOST document.

Last Updated On August 01, 2019
Tags:
Vote For Us
Vote for IOST Watch and receive Daily IOST reward