Gaëtan Renaudeau
7 years ago
No known key found for this signature in database
GPG Key ID: 7B66B85F042E5451
4 changed files with
14 additions and
12 deletions
-
.prettierignore
-
src/bridge/RippleJSBridge.js
-
test-e2e/sync/sync-accounts.spec.js
-
test-e2e/sync/wait-sync.js
|
|
@ -1 +1,2 @@ |
|
|
|
package.json |
|
|
|
test-e2e/**/*.json |
|
|
|
|
|
@ -261,12 +261,11 @@ const recipientIsNew = async (endpointConfig, recipient) => { |
|
|
|
} |
|
|
|
|
|
|
|
const cacheRecipientsNew = {} |
|
|
|
const cachedRecipientIsNew= (endpointConfig, recipient) => { |
|
|
|
const cachedRecipientIsNew = (endpointConfig, recipient) => { |
|
|
|
if (recipient in cacheRecipientsNew) return cacheRecipientsNew[recipient] |
|
|
|
return (cacheRecipientsNew[recipient] = recipientIsNew(endpointConfig, recipient)) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
scanAccountsOnDevice: (currency, deviceId) => |
|
|
|
Observable.create(o => { |
|
|
|
|
|
@ -46,15 +46,13 @@ function getSanitized(filePath) { |
|
|
|
const data = require(`${filePath}`) // eslint-disable-line import/no-dynamic-require
|
|
|
|
const accounts = data.data.accounts.map(a => a.data) |
|
|
|
accounts.sort(ACCOUNT_SORT) |
|
|
|
return accounts |
|
|
|
.map(a => pick(a, ACCOUNTS_FIELDS)) |
|
|
|
.map(a => { |
|
|
|
a.operations.sort(OP_SORT) |
|
|
|
return { |
|
|
|
...a, |
|
|
|
operations: a.operations.map(o => pick(o, OPS_FIELDS)), |
|
|
|
} |
|
|
|
}) |
|
|
|
return accounts.map(a => pick(a, ACCOUNTS_FIELDS)).map(a => { |
|
|
|
a.operations.sort(OP_SORT) |
|
|
|
return { |
|
|
|
...a, |
|
|
|
operations: a.operations.map(o => pick(o, OPS_FIELDS)), |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function getOpHash(op) { |
|
|
|
|
|
@ -27,7 +27,11 @@ async function waitForSync() { |
|
|
|
const areAllSync = mapped.every(account => { |
|
|
|
const diff = now - new Date(account.lastSyncDate).getTime() |
|
|
|
if (diff <= MIN_TIME_DIFF) return true |
|
|
|
console.log(`[${account.name}] synced ${moment(account.lastSyncDate).fromNow()} (${moment(account.lastSyncDate).format('YYYY-MM-DD HH:mm:ss')})`) |
|
|
|
console.log( |
|
|
|
`[${account.name}] synced ${moment(account.lastSyncDate).fromNow()} (${moment( |
|
|
|
account.lastSyncDate, |
|
|
|
).format('YYYY-MM-DD HH:mm:ss')})`,
|
|
|
|
) |
|
|
|
return false |
|
|
|
}) |
|
|
|
return areAllSync |
|
|
|