Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test("succeed", async () => {
const account = await getSynced();
expect(fromAccountRaw(toAccountRaw(account))).toBeDefined();
});
implementations.forEach(impl => {
const account = fromAccountRaw({
...accountData.raw,
id: encodeAccountId({
...decodeAccountId(accountData.raw.id),
type: impl
})
});
accountsRelated.push({
currencyData,
accountData,
account,
impl
});
})
);
> = createCommand('AccountPrepareTransaction', o => {
const account = fromAccountRaw(o.account)
const transaction = fromTransactionRaw(o.transaction)
const bridge = bridgeImpl.getAccountBridge(account, null)
return from(bridge.prepareTransaction(account, transaction).then(toTransactionRaw))
})
> = createCommand('AccountSignAndBroadcast', o => {
const account = fromAccountRaw(o.account)
const transaction = fromTransactionRaw(o.transaction)
const bridge = bridgeImpl.getAccountBridge(account, null)
return bridge
.signAndBroadcast(account, transaction, o.deviceId)
.pipe(map(toSignAndBroadcastEventRaw))
})
> = createCommand('AccountStartSync', o => {
const account = fromAccountRaw(o.account)
const bridge = bridgeImpl.getAccountBridge(account, null)
return bridge.startSync(account, o.observation).pipe(map(f => toAccountRaw(f(account))))
})
const cmd: Command = createCommand('libcoreSyncAccount', rawAccount => {
const account = fromAccountRaw(rawAccount)
return syncAccount(account)
.pipe(reduce((acc, updater: Account => Account) => updater(acc), account))
.pipe(map(account => toAccountRaw(account)))
})
const cmd: Command = createCommand('libcoreGetFees', ({ accountRaw, transaction }) =>
from(
getFeesForTransaction({
account: fromAccountRaw(accountRaw),
transaction,
}).then(fees => fees.toString()),
),
)
appjsondata.data.accounts.map(a => fromAccountRaw(a.data))
).pipe(
> = createCommand('AccountGetTransactionStatus', o => {
const account = fromAccountRaw(o.account)
const transaction = fromTransactionRaw(o.transaction)
const bridge = bridgeImpl.getAccountBridge(account, null)
return from(
bridge
.getTransactionStatus(account, transaction)
.then((raw: TransactionStatus) => toTransactionStatusRaw(raw)),
)
})
scan = async () => {
this.setState({ status: 'scanning' })
const { importableAccounts } = this.state
try {
for (let i = 0; i < importableAccounts.length; i++) {
const a = importableAccounts[i]
const scanPayload = {
seedIdentifier: `dev_${a.xpub}`,
currencyId: a.currency.id,
xpub: a.xpub,
derivationMode: a.derivationMode,
}
const rawAccount = await scanFromXPUB.send(scanPayload).toPromise()
const account = fromAccountRaw(rawAccount)
await this.import({
...account,
name: a.name,
})
this.removeImportableAccount(a)
}
this.reset()
} catch (error) {
this.setState({ status: 'error', error })
}
}