polkamarkets-js 3.1.7 → 3.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkamarkets-js",
3
- "version": "3.1.7",
3
+ "version": "3.1.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -11,26 +11,18 @@ const ERC20Contract = require('./ERC20Contract');
11
11
 
12
12
  const realitioLib = require('@reality.eth/reality-eth-lib/formatters/question');
13
13
 
14
- const actions = {
15
- 0: 'Buy',
16
- 1: 'Sell',
17
- 2: 'Add Liquidity',
18
- 3: 'Remove Liquidity',
19
- 4: 'Claim Winnings',
20
- 5: 'Claim Liquidity',
21
- 6: 'Claim Fees',
22
- 7: 'Claim Voided',
23
- }
24
-
25
- /**
26
- * PredictionMarket Contract Object
27
- * @constructor PredictionMarketContract
28
- * @param {Web3} web3
29
- * @param {Integer} decimals
30
- * @param {Address} contractAddress
31
- */
32
-
33
14
  class PredictionMarketV2Contract extends IContract {
15
+ static ACTIONS = {
16
+ 0: 'Buy',
17
+ 1: 'Sell',
18
+ 2: 'Add Liquidity',
19
+ 3: 'Remove Liquidity',
20
+ 4: 'Claim Winnings',
21
+ 5: 'Claim Liquidity',
22
+ 6: 'Claim Fees',
23
+ 7: 'Claim Voided',
24
+ };
25
+
34
26
  constructor(params) {
35
27
  super({...params, abi: params.abi || prediction});
36
28
  this.contractName = 'predictionMarketV2';
@@ -411,7 +403,7 @@ class PredictionMarketV2Contract extends IContract {
411
403
  const decimals = marketDecimals[marketIds.indexOf(event.returnValues.marketId)];
412
404
 
413
405
  return {
414
- action: actions[Numbers.fromBigNumberToInteger(event.returnValues.action, 18)],
406
+ action: this.constructor.ACTIONS[Numbers.fromBigNumberToInteger(event.returnValues.action, 18)],
415
407
  marketId: Numbers.fromBigNumberToInteger(event.returnValues.marketId, 18),
416
408
  outcomeId: Numbers.fromBigNumberToInteger(event.returnValues.outcomeId, 18),
417
409
  shares: Numbers.fromDecimalsNumber(event.returnValues.shares, decimals),
@@ -350,7 +350,7 @@ class PredictionMarketV3Contract extends PredictionMarketV2Contract {
350
350
  const decimals = marketDecimals[event.returnValues.marketId];
351
351
 
352
352
  return {
353
- action: actions[Numbers.fromBigNumberToInteger(event.returnValues.action, 18)],
353
+ action: this.constructor.ACTIONS[Numbers.fromBigNumberToInteger(event.returnValues.action, 18)],
354
354
  marketId: Numbers.fromBigNumberToInteger(event.returnValues.marketId, 18),
355
355
  outcomeId: Numbers.fromBigNumberToInteger(event.returnValues.outcomeId, 18),
356
356
  shares: Numbers.fromDecimalsNumber(event.returnValues.shares, decimals),