carbon-js-sdk 0.3.38-beta.1 → 0.3.38-beta.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.
@@ -81,6 +81,7 @@ class TokenClient {
81
81
  }
82
82
  getBlockchain(denom) {
83
83
  var _a, _b, _c;
84
+ const networkConfig = this.configProvider.getConfig();
84
85
  // chainId defaults to 3 so that blockchain will be undefined
85
86
  let chainId = (_c = (_b = (_a = this.tokens[denom]) === null || _a === void 0 ? void 0 : _a.chainId) === null || _b === void 0 ? void 0 : _b.toNumber()) !== null && _c !== void 0 ? _c : 3;
86
87
  if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom)) {
@@ -91,7 +92,7 @@ class TokenClient {
91
92
  if (TokenClient.isIBCDenom(denom)) {
92
93
  return util_1.IBCUtils.BlockchainMap[denom];
93
94
  }
94
- const blockchain = util_1.BlockchainUtils.blockchainForChainId(chainId);
95
+ const blockchain = util_1.BlockchainUtils.blockchainForChainId(chainId, networkConfig.network);
95
96
  return blockchain;
96
97
  }
97
98
  getSymbol(denom) {
@@ -229,6 +230,7 @@ class TokenClient {
229
230
  return result;
230
231
  }
231
232
  getWrappedToken(denom, blockchain) {
233
+ const networkConfig = this.configProvider.getConfig();
232
234
  // if denom is already a wrapped denom or no blockchain was specified,
233
235
  // just return the input denom.
234
236
  if (this.wrapperMap[denom] || !blockchain) {
@@ -243,7 +245,7 @@ class TokenClient {
243
245
  }
244
246
  // check if wrapped denom is of correct blockchain
245
247
  const token = this.tokens[wrappedDenom];
246
- let tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber());
248
+ let tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber(), networkConfig.network);
247
249
  if (TokenClient.isIBCDenom(wrappedDenom)) {
248
250
  tokenChain = util_1.IBCUtils.BlockchainMap[wrappedDenom];
249
251
  }
@@ -282,13 +284,14 @@ class TokenClient {
282
284
  return denom === "usc";
283
285
  }
284
286
  getDepositTokenFor(tokenDenom, chain) {
287
+ const networkConfig = this.configProvider.getConfig();
285
288
  const token = this.tokenForDenom(tokenDenom);
286
289
  if (!token) {
287
290
  console.error("getDepositTokenFor token not found for", tokenDenom);
288
291
  return;
289
292
  }
290
293
  // check if selected token is a source token
291
- let targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber());
294
+ let targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber(), networkConfig.network);
292
295
  if (TokenClient.isIBCDenom(token.denom)) {
293
296
  targetChain = util_1.IBCUtils.BlockchainMap[token.denom];
294
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.3.38-beta.1",
3
+ "version": "0.3.38-beta.2",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",