Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
core.coreAddress.toString(coreFreshAddress),
core.coreAddress.getDerivationPath(coreFreshAddress),
]);
const freshAddress = {
str: freshAddressStr,
path: `${accountPath}/${freshAddressPath}`,
};
const name =
coreOperations.length === 0
? getNewAccountPlaceholderName({
currency,
index: accountIndex,
derivationMode,
})
: getAccountPlaceholderName({
currency,
index: accountIndex,
derivationMode,
});
// retrieve xpub
const { value: xpub } = await core.coreAccount.getRestoreKey(coreAccount);
const id = encodeAccountId({
type: "libcore",
version: "1",
currencyId: currency.id,
xpubOrAddress: xpub,
derivationMode,
});
if (shouldSkipEmpty) {
return {}
}
// NB for legacy addresses maybe we will continue at least for the first 10 addresses
return { complete: true }
}
const account: $Exact = {
type: 'Account',
id: accountId,
seedIdentifier: freshAddress,
freshAddress,
freshAddressPath,
freshAddresses: [{ address: freshAddress, derivationPath: freshAddressPath }],
derivationMode,
name: getAccountPlaceholderName({ currency, index, derivationMode }),
balance,
blockHeight: currentBlock.height,
index,
currency,
operations: [],
pendingOperations: [],
unit: currency.units[0],
lastSyncDate: new Date(),
}
for (let i = 0; i < 50; i++) {
const last = txs[txs.length - 1]
if (!last) break
const { block } = last
if (!block) break
const next = await api.getTransactions(account.freshAddress, block.hash)
if (next.txs.length === 0) break
}
if (shouldSkipEmpty) {
return {};
}
// NB for legacy addresses maybe we will continue at least for the first 10 addresses
return { complete: true };
}
const account: $Exact = {
id: accountId,
seedIdentifier: freshAddress,
freshAddress,
freshAddressPath,
derivationMode,
name: getAccountPlaceholderName({ currency, index, derivationMode }),
balance,
blockHeight: currentBlock.height,
index,
currency,
operations: [],
pendingOperations: [],
unit: currency.units[0],
lastSyncDate: new Date(),
};
for (let i = 0; i < 50; i++) {
const api = apiForCurrency(account.currency);
const last = txs[txs.length - 1];
if (!last) break;
const { block } = last;
if (!block) break;
const next = await api.getTransactions(
}))
if (addresses.length === 0) {
throw new NoAddressesFound()
}
const { str: freshAddress, path: freshAddressPath } = addresses[0]
ops.sort((a, b) => b.getDate() - a.getDate())
const operations = ops.map(op => buildOperationRaw({ core, op, xpub }))
const name =
operations.length === 0
? getNewAccountPlaceholderName({ currency, index: accountIndex, derivationMode })
: getAccountPlaceholderName({
currency,
index: accountIndex,
derivationMode,
})
const rawAccount: AccountRaw = {
id: encodeAccountId({
type: 'libcore',
version: '1',
currencyId: currency.id,
xpubOrAddress: xpub,
derivationMode,
}),
seedIdentifier,
derivationMode,
xpub,
!balance.isNaN() && balance.isFinite(),
`Ripple: invalid balance=${balance.toString()} for address ${address}`,
);
const transactions = await api.getTransactions(address, {
minLedgerVersion,
maxLedgerVersion,
types: ["payment"],
});
if (finished) return;
const account: $Exact = {
id: accountId,
seedIdentifier: freshAddress,
derivationMode,
name: getAccountPlaceholderName({
currency,
index,
derivationMode,
}),
freshAddress,
freshAddressPath,
balance,
blockHeight: maxLedgerVersion,
index,
currency,
operations: [],
pendingOperations: [],
unit: currency.units[0],
lastSyncDate: new Date(),
};
account.operations = transactions
render() {
const { currency, derivationMode, index } = this.props;
const { address, path, error } = this.state;
return (
<div style="{{">
<strong style="{{">
{getAccountPlaceholderName({ currency, derivationMode, index })}
</strong>
{error ? (
<code style="{{">
{String(error.message || error)}
<button>verify</button>
</code>
) : path ? (
<span>
<code style="{{">
{`${path}: ${address}`}
</code>
<button>verify</button>
</span>
) : null}
</div>
);