Skip to content

Commit

Permalink
Fix Nano Prefix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormtv committed May 4, 2019
1 parent 608650f commit 98e35eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,9 @@ module.exports = function (password) {
if (lastBlock) {
return api.getBlockFromHash(lastBlock).isState()
} else {
throw new Error('There is no previous block synced!')
return true
// new account
//throw new Error('There is no previous block synced!')
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/js/services/nanoService.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ angular.module('canoeApp.services')
var accountsAndHashes = rai.accounts_pending(accountIds)
$log.debug('Pending hashes: ' + JSON.stringify(accountsAndHashes))
lodash.each(accountsAndHashes, function (hashes, account) {
if (account.startsWith('xrb')) {
account = account.substring(3)
account = 'nano'.concat(account)
}
var blocks = rai.blocks_info(hashes)
lodash.each(blocks, function (blk, hash) {
root.handleIncomingSendBlock(hash, account, blk.block_account, blk.amount)
Expand Down
4 changes: 2 additions & 2 deletions www/rai.rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function Rai (url_base) {
return deterministic_key
}

this.frontiers = function (account = 'xrb_1111111111111111111111111111111111111111111111111117353trpda', count = '1048576') {
this.frontiers = function (account = 'nano_1111111111111111111111111111111111111111111111111117353trpda', count = '1048576') {
var rpc_frontiers = this.rpc(JSON.stringify({'action': 'frontiers', 'account': account, 'count': count}))
return rpc_frontiers.frontiers
}
Expand Down Expand Up @@ -380,7 +380,7 @@ function Rai (url_base) {
return key_expand
}

this.ledger = function (account = 'xrb_1111111111111111111111111111111111111111111111111117353trpda', count = '1048576', representative = false, weight = false, pending = false, sorting = false) {
this.ledger = function (account = 'nano_1111111111111111111111111111111111111111111111111117353trpda', count = '1048576', representative = false, weight = false, pending = false, sorting = false) {
var ledger = this.rpc(JSON.stringify({'action': 'ledger', 'account': account, 'count': count, 'representative': representative, 'weight': weight, 'pending': pending, 'sorting': sorting}))
return ledger.accounts
}
Expand Down

0 comments on commit 98e35eb

Please sign in to comment.