Skip to content

Commit

Permalink
fix: fix how we get owned security tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVicente committed Feb 20, 2020
1 parent 454d285 commit d5dcb48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Polymath.ts
Expand Up @@ -295,19 +295,21 @@ export class Polymath {
walletAddress = await currentWallet.address();
}

const [ownedTickers, delegatedAddresses] = await Promise.all([
contractWrappers.securityTokenRegistry.getTickersByOwner({ owner: walletAddress }),
const [ownedTokens, delegatedTokens] = await Promise.all([
contractWrappers.securityTokenRegistry.getTokensByOwner({ owner: walletAddress }),
contractWrappers.securityTokenRegistry.getTokensByDelegate(walletAddress),
]);

const delegateTickers = await P.map(delegatedAddresses, async address => {
const allTokens = union(ownedTokens, delegatedTokens);

const allTickers = await P.map(allTokens, async address => {
const details = await contractWrappers.securityTokenRegistry.getSecurityTokenData({
securityTokenAddress: address,
});
return details.ticker;
});

return union(ownedTickers, delegateTickers);
return allTickers;
};

/**
Expand Down

0 comments on commit d5dcb48

Please sign in to comment.