Skip to content

Commit

Permalink
Init account
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBenc committed Jan 14, 2021
1 parent 0c78d08 commit a6456af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/frontend/wallet/account-manager.ts
Expand Up @@ -19,7 +19,7 @@ const AccountManager = ({config, cryptoProvider, blockchainExplorer}) => {
}

async function addNewAccount(account) {
await account.isAccountUsed() // To ensure user exported pubkey
await account.init() // To ensure user exported pubkey
const isLastAccountUsed =
accounts.length > 0 ? await accounts[accounts.length - 1].isAccountUsed() : true
if (
Expand Down
8 changes: 8 additions & 0 deletions app/frontend/wallet/account.ts
Expand Up @@ -36,6 +36,7 @@ const DummyAddressManager = () => {
discoverAddresses: () => [],
discoverAddressesWithMeta: () => [],
getAddressToAbsPathMapping: () => ({}),
_deriveAddress: () => ({}),
}
}

Expand Down Expand Up @@ -172,6 +173,12 @@ const Account = ({
blockchainExplorer,
})

async function init() {
// get first address to ensure that public keys were exported
await myAddresses.legacyExtManager._deriveAddress(0)
await myAddresses.baseExtAddrManager._deriveAddress(0)
}

async function calculateTtl() {
try {
const bestSlot = await blockchainExplorer.getBestSlot().then((res) => res.Right.bestSlot)
Expand Down Expand Up @@ -463,6 +470,7 @@ const Account = ({
accountIndex,
getPoolRecommendation,
isAccountUsed,
init,
}
}

Expand Down

0 comments on commit a6456af

Please sign in to comment.