Skip to content

Commit c2d342e

Browse files
committed
fix: add getWallet method reference
1 parent b46c318 commit c2d342e

2 files changed

Lines changed: 7 additions & 33 deletions

File tree

src/Polymath.ts

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { union, compact } from 'lodash';
1111
import { Context } from './Context';
1212
import { getInjectedProvider } from './browserUtils';
1313
import { ErrorCode, TransactionSpeed } from './types';
14-
import { Erc20TokenBalance, SecurityToken } from './entities';
14+
import { Erc20TokenBalance, SecurityToken, Wallet } from './entities';
1515
import { ReserveSecurityToken } from './procedures';
1616
import { PolymathError } from './PolymathError';
1717
import { PolymathBase } from './PolymathBase';
@@ -280,40 +280,14 @@ export class Polymath {
280280
};
281281

282282
/**
283-
* Get the balance of ETH in a wallet
283+
* Retrieve a Wallet by address
284284
*
285-
* @param walletAddress wallet to check for balance
285+
* @param address wallet address
286286
*/
287-
public getEthBalance = async (args: { walletAddress: string }) => {
288-
const { walletAddress } = args;
289-
290-
return this.context.contractWrappers.getBalance({ address: walletAddress });
291-
};
292-
293-
/**
294-
* Get the balance of a specific ERC20 token in a wallet
295-
*
296-
* @param tokenAddress address of the ERC20 token
297-
* @param walletAddress wallet to check for balance
298-
*/
299-
public getErc20TokenBalance = async (
300-
args:
301-
| {
302-
tokenAddress: string;
303-
walletAddress: string;
304-
}
305-
| string
306-
) => {
307-
let uid: string;
308-
309-
// fetch by UUID
310-
if (typeof args === 'string') {
311-
uid = args;
312-
} else {
313-
uid = Erc20TokenBalance.generateId(args);
314-
}
287+
public getWallet = (args: { address: string }): Wallet => {
288+
const { address } = args;
315289

316-
return this.context.factories.erc20TokenBalanceFactory.fetch(uid);
290+
return new Wallet({ address }, this.context);
317291
};
318292

319293
/**

src/entities/Wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Wallet extends Entity<Params> {
4444

4545
private contractWrappers: PolymathBase;
4646

47-
constructor(params: Params & UniqueIdentifier, context: Context) {
47+
constructor(params: Params, context: Context) {
4848
super();
4949

5050
const { address } = params;

0 commit comments

Comments
 (0)