carbon-js-sdk 0.3.11 → 0.3.12
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.
|
@@ -38,6 +38,7 @@ declare class TokenClient {
|
|
|
38
38
|
static isCdpToken(denom: string): boolean;
|
|
39
39
|
static isPoolToken(denom: string): boolean;
|
|
40
40
|
static isIBCDenom(denom: string): boolean;
|
|
41
|
+
static isCdpIbcDenom(denom: string): boolean;
|
|
41
42
|
isWrappedToken(denom?: string): boolean;
|
|
42
43
|
hasWrappedToken(denom?: string): boolean;
|
|
43
44
|
getWrappedTokens(denom: string): Token[];
|
|
@@ -132,7 +132,7 @@ class TokenClient {
|
|
|
132
132
|
var _a;
|
|
133
133
|
if (typeof denom !== 'string')
|
|
134
134
|
return '';
|
|
135
|
-
if (!TokenClient.isIBCDenom(denom)) {
|
|
135
|
+
if (!TokenClient.isIBCDenom(denom) && !TokenClient.isCdpIbcDenom(denom)) {
|
|
136
136
|
denom = denom.toLowerCase();
|
|
137
137
|
}
|
|
138
138
|
const symbol = this.getSymbol(denom);
|
|
@@ -198,6 +198,9 @@ class TokenClient {
|
|
|
198
198
|
static isIBCDenom(denom) {
|
|
199
199
|
return denom.match(ibc_1.ibcTokenRegex) !== null;
|
|
200
200
|
}
|
|
201
|
+
static isCdpIbcDenom(denom) {
|
|
202
|
+
return ibc_1.cibtIbcTokenRegex.test(denom);
|
|
203
|
+
}
|
|
201
204
|
isWrappedToken(denom) {
|
|
202
205
|
return !!this.wrapperMap[denom !== null && denom !== void 0 ? denom : ""];
|
|
203
206
|
}
|
package/lib/constant/ibc.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export interface ChannelConfig {
|
|
|
62
62
|
dstChannel: string;
|
|
63
63
|
}
|
|
64
64
|
export declare const swthChannels: SimpleMap<ChannelConfig>;
|
|
65
|
+
export declare const cibtIbcTokenRegex: RegExp;
|
|
65
66
|
export declare const ibcTokenRegex: RegExp;
|
|
66
67
|
export declare const ibcNetworkRegex: RegExp;
|
|
67
68
|
export declare const ibcDefaultGas: number;
|
package/lib/constant/ibc.js
CHANGED
|
@@ -19,9 +19,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.DefaultGasPriceStep = exports.ibcDefaultGas = exports.ibcNetworkRegex = exports.ibcTokenRegex = exports.swthChannels = exports.EmbedChainInfosInit = exports.ibcWhitelist = exports.swthIbcWhitelist = exports.ChainIds = exports.IBCAddress = void 0;
|
|
22
|
+
exports.DefaultGasPriceStep = exports.ibcDefaultGas = exports.ibcNetworkRegex = exports.ibcTokenRegex = exports.cibtIbcTokenRegex = exports.swthChannels = exports.EmbedChainInfosInit = exports.ibcWhitelist = exports.swthIbcWhitelist = exports.ChainIds = exports.IBCAddress = void 0;
|
|
23
23
|
const bech32 = __importStar(require("bech32"));
|
|
24
24
|
const generic_1 = require("./generic");
|
|
25
|
+
const token_1 = require("./token");
|
|
25
26
|
exports.IBCAddress = {
|
|
26
27
|
getAddressBytes(bech32Address, prefix) {
|
|
27
28
|
const decoded = bech32.decode(bech32Address);
|
|
@@ -1727,6 +1728,7 @@ exports.swthChannels = {
|
|
|
1727
1728
|
dstChannel: "channel-46",
|
|
1728
1729
|
},
|
|
1729
1730
|
};
|
|
1731
|
+
exports.cibtIbcTokenRegex = RegExp(`^${token_1.DenomPrefix.CDPToken}/ibc/([a-f\\d]+)$`, "i");
|
|
1730
1732
|
exports.ibcTokenRegex = /^ibc\/([a-f\d]+)$/i;
|
|
1731
1733
|
exports.ibcNetworkRegex = /^([a-z\d_-]+)-([\d]+)$/i;
|
|
1732
1734
|
exports.ibcDefaultGas = 200000;
|