Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 759631e

Browse files
committed
fix: 🐛 Unnecessary logic removed
1 parent 1d65417 commit 759631e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/checkAndAskPolyToken.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RedundantSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
2-
import { ApiConstructorParams, PolymathAPI } from '../src/PolymathAPI';
32
import { BigNumber } from '@polymathnetwork/abi-wrappers';
3+
import { ApiConstructorParams, PolymathAPI } from '../src/PolymathAPI';
44

55
// This file acts as a valid sandbox.ts file in root directory for request POLY tokens on an unlocked node (like ganache)
66

@@ -17,12 +17,14 @@ window.addEventListener('load', async () => {
1717
// Instantiate the API
1818
const polymathAPI = new PolymathAPI(params);
1919

20+
// Get some poly tokens in your account and the security token
21+
const myAddress = await polymathAPI.getAccount();
22+
2023
let polyBalance = await polymathAPI.polyToken.balanceOf();
2124
console.log('Poly Balance:', polyBalance.toNumber());
22-
if (!polyBalance.toNumber()) {
23-
// getPolyTokens only works on a testnet environment
24-
await polymathAPI.getPolyTokens({ amount: new BigNumber(500000) });
25-
}
25+
26+
// getPolyTokens only works on a testnet environment
27+
await polymathAPI.getPolyTokens({ amount: new BigNumber(1000000), address: myAddress });
2628
polyBalance = await polymathAPI.polyToken.balanceOf();
2729
console.log('Poly Balance:', polyBalance.toNumber());
2830
});

0 commit comments

Comments
 (0)