1 import bytom from './bytom'
4 setupNet: bytom.setupNet
7 account.create = function(accountAlias, keyAlias, passwd, success, error) {
8 let retPromise = new Promise((resolve, reject) => {
10 .create(keyAlias, passwd)
13 .createAccountUseServer(res.xpub, accountAlias)
29 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
31 account.balance = function(guid, dstAsset) {
32 if (dstAsset == undefined) {
36 let retPromise = new Promise((resolve, reject) => {
38 .listAddressUseServer(guid)
41 addresses.forEach(item => {
42 if (item.balances != null) {
43 item.balances.forEach(asset => {
44 if (asset.asset == dstAsset) {
45 balance += Number(asset.balance)
50 balance = dstAsset === ASSET_BTM? (balance / 100000000): balance
60 account.list = function() {
61 let retPromise = new Promise((resolve, reject) => {
63 .listAccountUseServer()
65 Promise.all(accounts.map(async (account) => {
66 const balance = await this.balance(account.guid)
67 account.balance = balance
80 account.backup = function() {
81 return bytom.wallet.backup()
84 account.restore = function(walletImage) {
85 return bytom.wallet.restore(walletImage)
88 export default account