Skip to content

BitPortal/bitportal-dapp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 

Repository files navigation

BitPortal Dapp Api

BitPortal provides user-friendly api to help developers build dapps for EOS.

(Deprecated due to the popularity of Scatter)

Setup

When your dapp opened in BitPortal Dapp Browser, you’ll have access to the api in window object.

Example implementation:

document.addEventListener('bitportalapi', () => {
  const bitportal = window.bitportal
  window.bitportal = null // Remember to remove the window reference for preventing other extensions using it.

  // Then you can use the bitportal api to do the blockchain actions.
  bitportal.transferEOSAsset({
    amount: '0.0001',
    symbol: 'EOS',
    contract: 'eosio.token',
    from: 'inita',
    to: 'initb',
    precision: 4
  }).then((data) => {
    // ...
  }).catch((error) => {
    // ...
  })
}

Api List

EOS related api

eosAuthSign

  • params
    • account: string
    • publicKey: string
    • signData: string
    • isHash?: boolean (default is false)
  • success return
    • data: string
  • error return
    • error: object
      • message: string

example:

bitportal.eosAuthSign({
  account: 'terencegehui',
  publicKey: 'EOS7HJqPYpjaiMvPo5b5cv8ZCvFGKDLdgjXUzL9tyFG3kgAjoLMfE',
  signData: 'hello, world'
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

pushEOSAction

  • params
    • actions: array (standard eos actions)
  • success return
    • data: object (standard eos transaction info from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.pushEOSAction({
  actions: [
    {
      account: 'eosio.token',
      name: 'transfer',
      authorization: [{
        actor: 'terencegehui',
        permission: 'active',
      }],
      data: {
        from: 'terencegehui',
        to: 'mythicalmind',
        quantity: '0.0001 EOS',
        memo: '',
      }
    }
  ]
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

transferEOSAsset

  • params
    • amount: string | number
    • precision: string | number
    • symbol: string
    • contract: string
    • from: string
    • to: string
  • success return
    • data: object (standard transaction data from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.transferEOSAsset({
  amount: '0.0001',
  symbol: 'EOS',
  contract: 'eosio.token',
  from: 'inita',
  to: 'initb',
  precision: 4
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

voteEOSProducers

  • params
    • voter: string
    • producers: string[]
  • success return
    • data: object (standard transaction data from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.voteEOSProducers({
  voter: 'init1',
  producers: ['producerA', 'producerB']
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

getEOSAccountInfo

  • params
    • account: string
  • success return
    • data: object (standard eos account info from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.getEOSAccountInfo({
  account: 'inita'
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

getEOSCurrencyBalance

  • params
    • account: string
    • contract: string
  • success return
    • data: string[]
  • error return
    • error: object
      • message: string

example:

bitportal.getEOSCurrencyBalance({
  account: 'inita',
  contract: 'eosio.token'
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

getEOSActions

  • params
    • account: string
    • position: string | number
    • offset: string | number
  • success return
    • data: object (standard eos action list from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.getEOSActions({
  account: 'inita',
  position: 0,
  offset: 20,
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

getEOSTransaction

  • params
    • id: string
  • success return
    • data: object (standard eos transaction info from eosjs)
  • error return
    • error: object
      • message: string

example:

bitportal.getEOSTransaction({
  id: '23905f75e15b710fbe2b42f404ffc5d5b9dd20878de63f8544b7d92a6632c23b',
}).then((data) => {
  // ...
}).catch((error) => {
  // ...
})

BitPortal related api

getCurrentWallet

  • no params
  • success return
    • data: object
      • account: string
      • publicKey: string
      • permisssion: string
  • error return
    • error: object
      • message: string

example:

bitportal.getCurrentWallet().then((data) => {
  // ...
}).catch((error) => {
  // ...
})

getAppInfo

  • no params
  • success return
    • data: object
      • name: string
      • platform: string
      • version: string
  • error return
    • error: object
      • message: string

example:

bitportal.getAppInfo().then((data) => {
  // ...
}).catch((error) => {
  // ...
})

About

BitPortal Wallet's EOS dApp Adaptor

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published