@mento-protocol/mento-sdk 1.0.4 → 1.0.6

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.
@@ -6,4 +6,4 @@ var ChainId;
6
6
  ChainId[ChainId["CELO"] = 42220] = "CELO";
7
7
  ChainId[ChainId["ALFAJORES"] = 44787] = "ALFAJORES";
8
8
  ChainId[ChainId["BAKLAVA"] = 62320] = "BAKLAVA";
9
- })(ChainId = exports.ChainId || (exports.ChainId = {}));
9
+ })(ChainId || (exports.ChainId = ChainId = {}));
@@ -11,4 +11,4 @@ var ProposalState;
11
11
  ProposalState[ProposalState["QUEUED"] = 5] = "QUEUED";
12
12
  ProposalState[ProposalState["EXPIRED"] = 6] = "EXPIRED";
13
13
  ProposalState[ProposalState["EXECUTED"] = 7] = "EXECUTED";
14
- })(ProposalState = exports.ProposalState || (exports.ProposalState = {}));
14
+ })(ProposalState || (exports.ProposalState = ProposalState = {}));
@@ -9,7 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getLimitId = exports.getLimits = exports.getLimitsState = exports.getLimitsConfig = void 0;
12
+ exports.getLimitsConfig = getLimitsConfig;
13
+ exports.getLimitsState = getLimitsState;
14
+ exports.getLimits = getLimits;
15
+ exports.getLimitId = getLimitId;
13
16
  const assert_1 = require("assert");
14
17
  const ethers_1 = require("ethers");
15
18
  /**
@@ -34,7 +37,6 @@ function getLimitsConfig(broker, exchangeId, asset) {
34
37
  };
35
38
  });
36
39
  }
37
- exports.getLimitsConfig = getLimitsConfig;
38
40
  /**
39
41
  * Returns the limit state in the broker for the given exchange and asset
40
42
  * @param broker an instance of the broker
@@ -64,7 +66,6 @@ function getLimitsState(broker, exchangeId, asset) {
64
66
  };
65
67
  });
66
68
  }
67
- exports.getLimitsState = getLimitsState;
68
69
  /**
69
70
  * Returns a human-friendly representation of the limits for the given exchange and asset
70
71
  * @param broker an instance of the broker
@@ -113,7 +114,6 @@ function getLimits(broker, exchangeId, asset) {
113
114
  return limits;
114
115
  });
115
116
  }
116
- exports.getLimits = getLimits;
117
117
  /**
118
118
  * Returns the limit id for the given exchange and asset
119
119
  * @param exchangeId the id of the exchange
@@ -127,4 +127,3 @@ function getLimitId(exchangeId, asset) {
127
127
  (0, assert_1.strict)(exchangeIdBytes.length === assetBytes.length, 'exchangeId and asset0 must be the same length');
128
128
  return ethers_1.utils.hexlify(exchangeIdBytes.map((b, i) => b ^ assetBytes[i]));
129
129
  }
130
- exports.getLimitId = getLimitId;
package/dist/cjs/mento.js CHANGED
@@ -69,8 +69,8 @@ class Mento {
69
69
  * Get tradable pairs for backwards compatibility
70
70
  * @returns an array of Asset pairs
71
71
  */
72
- getTradablePairs({ cached = true, } = {}) {
73
- return __awaiter(this, void 0, void 0, function* () {
72
+ getTradablePairs() {
73
+ return __awaiter(this, arguments, void 0, function* ({ cached = true, } = {}) {
74
74
  return (yield this.getTradablePairsWithPath({ cached })).map((pair) => pair.assets);
75
75
  });
76
76
  }
@@ -131,8 +131,8 @@ class Mento {
131
131
  * the two Asset objects, and an array of exchange details for each hop.
132
132
  * @returns An array of TradablePair objects representing available trade routes.
133
133
  */
134
- getTradablePairsWithPath({ cached = true, } = {}) {
135
- return __awaiter(this, void 0, void 0, function* () {
134
+ getTradablePairsWithPath() {
135
+ return __awaiter(this, arguments, void 0, function* ({ cached = true, } = {}) {
136
136
  // Get tradable pairs from cache if available.
137
137
  if (cached) {
138
138
  const value = (0, tradablePairs_1.getCachedTradablePairs)(yield (0, utils_1.getChainId)(this.signerOrProvider));
package/dist/cjs/utils.js CHANGED
@@ -9,7 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.increaseAllowance = exports.getSymbolFromTokenAddress = exports.getBrokerAddressFromRegistry = exports.validateSignerOrProvider = exports.validateSigner = exports.getChainId = void 0;
12
+ exports.getChainId = getChainId;
13
+ exports.validateSigner = validateSigner;
14
+ exports.validateSignerOrProvider = validateSignerOrProvider;
15
+ exports.getBrokerAddressFromRegistry = getBrokerAddressFromRegistry;
16
+ exports.getSymbolFromTokenAddress = getSymbolFromTokenAddress;
17
+ exports.increaseAllowance = increaseAllowance;
13
18
  const ethers_1 = require("ethers");
14
19
  /**
15
20
  * Gets the chain ID from a signer or provider
@@ -24,7 +29,6 @@ function getChainId(signerOrProvider) {
24
29
  return (yield provider.getNetwork()).chainId;
25
30
  });
26
31
  }
27
- exports.getChainId = getChainId;
28
32
  /**
29
33
  * Ensures that given signer is truly a a connected signer
30
34
  * @param signer an ethers signer
@@ -38,7 +42,6 @@ function validateSigner(signer) {
38
42
  throw new Error('Signer must be connected to a provider');
39
43
  }
40
44
  }
41
- exports.validateSigner = validateSigner;
42
45
  /**
43
46
  * Ensures that given signerOrProvider is truly a provider or a connected signer
44
47
  * @param signerOrProvider an ethers provider or signer
@@ -54,7 +57,6 @@ function validateSignerOrProvider(signerOrProvider) {
54
57
  throw new Error('Signer must be connected to a provider');
55
58
  }
56
59
  }
57
- exports.validateSignerOrProvider = validateSignerOrProvider;
58
60
  /**
59
61
  * Returns the broker address from the Celo registry
60
62
  * @param signerOrProvider an ethers provider or signer
@@ -75,7 +77,6 @@ function getBrokerAddressFromRegistry(signerOrProvider) {
75
77
  return brokerAddress;
76
78
  });
77
79
  }
78
- exports.getBrokerAddressFromRegistry = getBrokerAddressFromRegistry;
79
80
  /**
80
81
  * Returns the symbol of an erc20 token
81
82
  * @param tokenAddr the address of the erc20 token
@@ -89,7 +90,6 @@ function getSymbolFromTokenAddress(tokenAddr, signerOrProvider) {
89
90
  return contract.symbol();
90
91
  });
91
92
  }
92
- exports.getSymbolFromTokenAddress = getSymbolFromTokenAddress;
93
93
  /**
94
94
  * Returns a populated tx obj for increasing the allowance of a spender for a given erc20 token by a given amount
95
95
  * @param tokenAddr the address of the erc20 token
@@ -109,4 +109,3 @@ function increaseAllowance(tokenAddr, spender, amount, signerOrProvider) {
109
109
  return yield contract.populateTransaction.increaseAllowance(spender, amount);
110
110
  });
111
111
  }
112
- exports.increaseAllowance = increaseAllowance;
@@ -20,8 +20,8 @@ export class ChainClient {
20
20
  });
21
21
  }
22
22
  getChainId() {
23
- var _a;
24
23
  return __awaiter(this, void 0, void 0, function* () {
24
+ var _a;
25
25
  let chainId = 0;
26
26
  if (Signer.isSigner(this.signerOrProvider)) {
27
27
  const network = yield ((_a = this.signerOrProvider.provider) === null || _a === void 0 ? void 0 : _a.getNetwork());