BitPortal provides user-friendly api to help developers build dapps for EOS.
(Deprecated due to the popularity of Scatter)
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) => {
// ...
})
}
- params
- account: string
- publicKey: string
- signData: string
- isHash?: boolean (default is false)
- success return
- data: string
- error return
- error: object
- message: string
- error: object
example:
bitportal.eosAuthSign({
account: 'terencegehui',
publicKey: 'EOS7HJqPYpjaiMvPo5b5cv8ZCvFGKDLdgjXUzL9tyFG3kgAjoLMfE',
signData: 'hello, world'
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- params
- actions: array (standard eos actions)
- success return
- data: object (standard eos transaction info from eosjs)
- error return
- error: object
- message: string
- error: object
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) => {
// ...
})
- 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
- error: object
example:
bitportal.transferEOSAsset({
amount: '0.0001',
symbol: 'EOS',
contract: 'eosio.token',
from: 'inita',
to: 'initb',
precision: 4
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- params
- voter: string
- producers: string[]
- success return
- data: object (standard transaction data from eosjs)
- error return
- error: object
- message: string
- error: object
example:
bitportal.voteEOSProducers({
voter: 'init1',
producers: ['producerA', 'producerB']
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- params
- account: string
- success return
- data: object (standard eos account info from eosjs)
- error return
- error: object
- message: string
- error: object
example:
bitportal.getEOSAccountInfo({
account: 'inita'
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- params
- account: string
- contract: string
- success return
- data: string[]
- error return
- error: object
- message: string
- error: object
example:
bitportal.getEOSCurrencyBalance({
account: 'inita',
contract: 'eosio.token'
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- 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
- error: object
example:
bitportal.getEOSActions({
account: 'inita',
position: 0,
offset: 20,
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- params
- id: string
- success return
- data: object (standard eos transaction info from eosjs)
- error return
- error: object
- message: string
- error: object
example:
bitportal.getEOSTransaction({
id: '23905f75e15b710fbe2b42f404ffc5d5b9dd20878de63f8544b7d92a6632c23b',
}).then((data) => {
// ...
}).catch((error) => {
// ...
})
- no params
- success return
- data: object
- account: string
- publicKey: string
- permisssion: string
- data: object
- error return
- error: object
- message: string
- error: object
example:
bitportal.getCurrentWallet().then((data) => {
// ...
}).catch((error) => {
// ...
})
- no params
- success return
- data: object
- name: string
- platform: string
- version: string
- data: object
- error return
- error: object
- message: string
- error: object
example:
bitportal.getAppInfo().then((data) => {
// ...
}).catch((error) => {
// ...
})