carbon-js-sdk 0.11.5 → 0.11.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.
- package/lib/modules/ibc.d.ts +1 -1
- package/lib/modules/ibc.js +8 -4
- package/package.json +1 -1
package/lib/modules/ibc.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class IBCModule extends BaseModule {
|
|
|
11
11
|
sendIBCTransfer(params: IBCModule.SendIBCTransferParams, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
12
12
|
sendIbcTransferV2(params: IBCModule.SendIBCTransferV2Params, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
13
13
|
getChainInfoMap(denomTraces?: TypeUtils.SimpleMap<DenomTrace>): Promise<TypeUtils.SimpleMap<ExtendedChainInfo>>;
|
|
14
|
-
getAppCurrency(coinMinimalDenom: string, coinGeckoId
|
|
14
|
+
getAppCurrency(coinMinimalDenom: string, coinGeckoId?: string, tokenInfo?: Token, cw20RegexArr?: RegExpMatchArray | null): AppCurrency;
|
|
15
15
|
getChainInfo(chainName: string): Promise<ChainInfo | undefined>;
|
|
16
16
|
getAssembledChainInfo(chainId: string, chainData?: ChainRegistryItem): Promise<ChainInfo | undefined>;
|
|
17
17
|
}
|
package/lib/modules/ibc.js
CHANGED
|
@@ -67,7 +67,7 @@ class IBCModule extends base_1.default {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
getChainInfoMap(denomTraces = {}) {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
71
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
72
|
const tokenClient = this.sdkProvider.getTokenClient();
|
|
73
73
|
const ibcBridges = tokenClient.bridges.ibc;
|
|
@@ -102,12 +102,16 @@ class IBCModule extends base_1.default {
|
|
|
102
102
|
const chainId = tokenClient.getIbcChainIdFromToken(token);
|
|
103
103
|
if (chainId && chainInfoMap[chainId]) {
|
|
104
104
|
const cw20RegexArr = denomTrace.baseDenom.match(constant_1.cw20TokenRegex);
|
|
105
|
-
const coinGeckoId = (
|
|
105
|
+
const coinGeckoId = (_e = (_d = tokenClient.geckoTokenNames) === null || _d === void 0 ? void 0 : _d[denom]) !== null && _e !== void 0 ? _e : (_f = tokenClient.geckoTokenNames) === null || _f === void 0 ? void 0 : _f[denomTrace.baseDenom];
|
|
106
106
|
const dstDenom = isChainNativeToken ? denomTrace.baseDenom.replace(/:/g, '/') : util_1.IBCUtils.makeIBCMinimalDenom(denomTrace.path.replace(constant_1.ibcTransferChannelRegex, "").replace(/^\//, ''), denomTrace.baseDenom);
|
|
107
|
-
const currency = this.getAppCurrency(dstDenom, coinGeckoId, token, cw20RegexArr);
|
|
108
107
|
const chainInfo = chainInfoMap[chainId];
|
|
109
|
-
chainInfo.currencies.push(currency);
|
|
110
108
|
chainInfo.minimalDenomMap[token.denom] = dstDenom;
|
|
109
|
+
const existingCurrencyIndex = chainInfo.currencies.findIndex(c => c.coinMinimalDenom === dstDenom);
|
|
110
|
+
if (existingCurrencyIndex !== -1) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const currency = this.getAppCurrency(dstDenom, coinGeckoId, token, cw20RegexArr);
|
|
114
|
+
chainInfo.currencies.push(currency);
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
return chainInfoMap;
|