polkamarkets-js 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,7 +75,7 @@ await polkamarkets.buy(marketId, outcomeId, ethAmount, minOutcomeSharesToBuy);
75
75
 
76
76
  // Selling Outcome Shares
77
77
  const maxOutcomeSharesToSell = await polkamarkets.calcSellAmount(marketId, outcomeId, ethAmount)
78
- await polkamarkets.buy(marketId, outcomeId, ethAmount, maxOutcomeSharesToSell);
78
+ await polkamarkets.sell(marketId, outcomeId, ethAmount, maxOutcomeSharesToSell);
79
79
 
80
80
  // Claiming Winnings
81
81
  await polkamarkets.claimWinnings(marketId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkamarkets-js",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Polkamarkets Javascript SDK",
5
5
  "engines": {
6
6
  "node": "^14.15.0"
package/polkamarkets.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as realitioLib from '@reality.eth/reality-eth-lib/formatters/question';
2
2
  import * as beprojs from 'bepro-js';
3
+
3
4
  export default class Polkamarkets {
4
5
  constructor(web3Provider, web3EventsProvider = null) {
5
6
  // bepro app
@@ -28,6 +29,19 @@ export default class Polkamarkets {
28
29
  this.contracts.realitio = this.bepro.getRealitioERC20Contract({ contractAddress });
29
30
  }
30
31
 
32
+ getContracts() {
33
+ // re-fetching contracts
34
+ if (this.contracts.pm && this.contracts.pm.params.contractAddress) {
35
+ this.getPredictionMarketContract(this.contracts.pm.params.contractAddress);
36
+ }
37
+ if (this.contracts.realitio && this.contracts.realitio.params.contractAddress) {
38
+ this.getRealitioERC20Contract(this.contracts.realitio.params.contractAddress);
39
+ }
40
+ if (this.contracts.erc20 && this.contracts.erc20.params.contractAddress) {
41
+ this.getERC20Contract(this.contracts.erc20.params.contractAddress);
42
+ }
43
+ }
44
+
31
45
  // returns wether wallet is connected to service or not
32
46
  async isLoggedIn() {
33
47
  return this.bepro.isLoggedIn();