carbon-js-sdk 0.4.3-dev.2 → 0.4.4

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.
@@ -12,17 +12,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const pagination_1 = require("../codec/cosmos/base/query/v1beta1/pagination");
16
- const tendermint_1 = require("../codec/ibc/lightclients/tendermint/v1/tendermint");
17
15
  const constant_1 = require("../constant");
18
16
  const ibc_1 = require("../constant/ibc");
19
17
  const network_1 = require("../constant/network");
18
+ const KeplrAccount_1 = __importDefault(require("../provider/keplr/KeplrAccount"));
20
19
  const util_1 = require("../util");
21
- const blockchain_1 = require("../util/blockchain");
22
20
  const number_1 = require("../util/number");
23
- const query_1 = require("../codec/ibc/applications/transfer/v1/query");
24
- const stargate_1 = require("@cosmjs/stargate");
25
- const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
26
21
  const long_1 = __importDefault(require("long"));
27
22
  const InsightsQueryClient_1 = __importDefault(require("./InsightsQueryClient"));
28
23
  const SYMBOL_OVERRIDE = {
@@ -48,18 +43,11 @@ class TokenClient {
48
43
  this.wrapperMap = {};
49
44
  this.poolTokens = {};
50
45
  this.cdpTokens = {};
51
- this.bridges = { polynetwork: [], ibc: [] };
52
46
  this.symbols = {};
53
47
  this.usdValues = {};
54
48
  this.commonAssetNames = constant_1.CommonAssetName;
55
49
  this.geckoTokenNames = constant_1.CoinGeckoTokenNames;
56
- // ibc apis
57
- this.denomTraces = {};
58
50
  this.additionalGeckoDenoms = {};
59
- this.getIbcChainFromBlockchainV2 = (blockchain) => {
60
- const ibcBridge = this.bridges.ibc.find(bridge => (bridge.chainName === blockchain || bridge.chainName.toLowerCase() === blockchain));
61
- return ibcBridge === null || ibcBridge === void 0 ? void 0 : ibcBridge.chain_id_name;
62
- };
63
51
  }
64
52
  static instance(query, configProvider) {
65
53
  return new TokenClient(query, configProvider);
@@ -70,8 +58,6 @@ class TokenClient {
70
58
  yield this.reloadWrapperMap();
71
59
  yield this.reloadTokens();
72
60
  yield this.reloadDenomGeckoMap();
73
- yield this.reloadDenomTraces();
74
- yield this.getBridges();
75
61
  // non-blocking reload
76
62
  try {
77
63
  this.reloadUSDValues();
@@ -94,11 +80,10 @@ class TokenClient {
94
80
  return (_c = ((_b = (_a = this.tokens[denom]) !== null && _a !== void 0 ? _a : this.poolTokens[denom]) !== null && _b !== void 0 ? _b : this.cdpTokens[denom])) === null || _c === void 0 ? void 0 : _c.decimals.toNumber();
95
81
  }
96
82
  getBlockchain(denom) {
97
- var _a, _b;
83
+ var _a, _b, _c;
98
84
  const networkConfig = this.configProvider.getConfig();
99
- const tokenData = this.tokens[denom];
100
85
  // chainId defaults to 3 so that blockchain will be undefined
101
- let chainId = (_b = (_a = tokenData === null || tokenData === void 0 ? void 0 : tokenData.chainId) === null || _a === void 0 ? void 0 : _a.toNumber()) !== null && _b !== void 0 ? _b : 3;
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;
102
87
  if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom)) {
103
88
  // native denoms "swth" and "usc" should be native.
104
89
  // pool and cdp tokens are on the Native blockchain, hence 0
@@ -110,18 +95,6 @@ class TokenClient {
110
95
  const blockchain = util_1.BlockchainUtils.blockchainForChainId(chainId, networkConfig.network);
111
96
  return blockchain;
112
97
  }
113
- getBlockchainV2(denom) {
114
- if (!denom)
115
- return undefined;
116
- let token = this.tokens[denom];
117
- if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom) || this.isGroupedToken(denom)) {
118
- // native denoms "swth" and "usc" should be native.
119
- // pool and cdp tokens are on the Native blockchain, hence 0
120
- return 'Native';
121
- }
122
- const bridge = this.getBridgeFromToken(token);
123
- return bridge === null || bridge === void 0 ? void 0 : bridge.chainName;
124
- }
125
98
  getSymbol(denom) {
126
99
  var _a, _b;
127
100
  if (TokenClient.isCdpToken(denom)) {
@@ -256,7 +229,7 @@ class TokenClient {
256
229
  }
257
230
  return result;
258
231
  }
259
- getWrappedToken(denom, blockchain, version = 'V1') {
232
+ getWrappedToken(denom, blockchain) {
260
233
  const networkConfig = this.configProvider.getConfig();
261
234
  // if denom is already a wrapped denom or no blockchain was specified,
262
235
  // just return the input denom.
@@ -272,15 +245,9 @@ class TokenClient {
272
245
  }
273
246
  // check if wrapped denom is of correct blockchain
274
247
  const token = this.tokens[wrappedDenom];
275
- let tokenChain = '';
276
- if (version === "V1") {
277
- tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber());
278
- if (TokenClient.isIBCDenom(token.denom)) {
279
- tokenChain = util_1.IBCUtils.BlockchainMap[wrappedDenom];
280
- }
281
- }
282
- else {
283
- tokenChain = this.getBlockchainV2(token.denom);
248
+ let tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber(), networkConfig.network);
249
+ if (TokenClient.isIBCDenom(wrappedDenom)) {
250
+ tokenChain = util_1.IBCUtils.BlockchainMap[wrappedDenom];
284
251
  }
285
252
  if (!tokenChain) {
286
253
  continue; // unknown chain! just ignore this source token
@@ -316,34 +283,21 @@ class TokenClient {
316
283
  isNativeStablecoin(denom) {
317
284
  return denom === "usc";
318
285
  }
319
- isGroupedToken(denom) {
320
- const groupedTokenRegex = new RegExp(/^cgt\/\d+$/);
321
- return groupedTokenRegex.test(denom);
322
- }
323
- isCarbonToken(token) {
324
- return Boolean(token && (this.isNativeToken(token.denom) || token.bridgeId.eq(0)));
325
- }
326
- getDepositTokenFor(tokenDenom, chain, version = "V1") {
286
+ getDepositTokenFor(tokenDenom, chain) {
327
287
  const networkConfig = this.configProvider.getConfig();
328
288
  const token = this.tokenForDenom(tokenDenom);
329
289
  if (!token) {
330
290
  console.error("getDepositTokenFor token not found for", tokenDenom);
331
291
  return;
332
292
  }
333
- let targetChain = "";
334
293
  // check if selected token is a source token
335
- if (version === "V1") {
336
- targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber(), networkConfig.network);
337
- if (TokenClient.isIBCDenom(token.denom)) {
338
- targetChain = util_1.IBCUtils.BlockchainMap[token.denom];
339
- }
340
- }
341
- else {
342
- targetChain = this.getBlockchainV2(token.denom);
294
+ let targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber(), networkConfig.network);
295
+ if (TokenClient.isIBCDenom(token.denom)) {
296
+ targetChain = util_1.IBCUtils.BlockchainMap[token.denom];
343
297
  }
344
298
  const isSourceToken = targetChain === chain && token.denom !== "swth";
345
299
  // if not source token find wrapped token for chain
346
- const depositToken = isSourceToken ? token : this.getWrappedToken(token.denom, chain, version);
300
+ const depositToken = isSourceToken ? token : this.getWrappedToken(token.denom, chain);
347
301
  if (!depositToken) {
348
302
  console.error(`getDepositTokenFor wrapped token not found for "${token.denom}"`);
349
303
  return;
@@ -387,211 +341,52 @@ class TokenClient {
387
341
  this.symbols[token.denom] = token.symbol;
388
342
  }
389
343
  }
390
- return this.tokens;
391
- });
392
- }
393
- reloadDenomTraces() {
394
- return __awaiter(this, void 0, void 0, function* () {
395
- const result = yield this.query.ibc.transfer.DenomTraces({
396
- pagination: {
397
- limit: new long_1.default(1000000),
398
- offset: long_1.default.UZERO,
399
- key: new Uint8Array(),
400
- countTotal: false,
401
- reverse: false,
402
- },
403
- });
404
- result.denomTraces.forEach((denomTrace) => {
405
- const ibcDenom = util_1.IBCUtils.makeIBCMinimalDenom(denomTrace.path, denomTrace.baseDenom);
406
- const token = this.tokenForDenom(ibcDenom);
407
- this.denomTraces[ibcDenom] = Object.assign(Object.assign({}, denomTrace), { token });
408
- });
409
- const swthTraces = yield this.getCarbonDenomTraces();
410
- return Object.assign(Object.assign({}, this.denomTraces), swthTraces);
411
- });
412
- }
413
- getDenomTraceData(denom) {
414
- return this.denomTraces[denom];
415
- }
416
- getBridges() {
417
- return __awaiter(this, void 0, void 0, function* () {
418
- const allBridges = yield this.query.coin.BridgeAll({
419
- pagination: {
420
- key: new Uint8Array(),
421
- limit: new long_1.default(10000),
422
- offset: long_1.default.UZERO,
423
- countTotal: true,
424
- reverse: false,
425
- },
426
- });
427
- const unmatchedIbcBridgeList = allBridges.bridges.filter(bridge => {
428
- if (!bridge.enabled)
429
- return;
430
- return bridge.bridgeId.toNumber() === blockchain_1.BRIDGE_IDS.ibc;
431
- });
432
- const ibcBridges = yield this.matchChainsWithDifferentChainIds(unmatchedIbcBridgeList);
433
- const polynetworkBridges = allBridges.bridges.reduce((prev, bridge) => {
434
- if (!bridge.enabled || bridge.bridgeId.toNumber() !== blockchain_1.BRIDGE_IDS.polynetwork)
435
- return prev;
436
- prev.push(Object.assign(Object.assign({}, bridge), { isEvmChain: util_1.BlockchainUtils.isEvmChain(bridge.chainName) }));
437
- return prev;
438
- }, []);
439
- Object.assign(this.bridges, {
440
- polynetwork: polynetworkBridges,
441
- ibc: ibcBridges
442
- });
443
- return this.bridges;
444
- });
445
- }
446
- matchChainsWithDifferentChainIds(bridges) {
447
- return __awaiter(this, void 0, void 0, function* () {
448
- let newBridges = [];
449
- try {
450
- const channels_to_connection = yield this.query.ibc.channel.Channels({
451
- pagination: pagination_1.PageRequest.fromPartial({
452
- limit: new long_1.default(1000000)
453
- })
454
- });
455
- const connection_to_clientId = yield this.query.ibc.connection.Connections({
456
- pagination: pagination_1.PageRequest.fromPartial({
457
- limit: new long_1.default(1000000)
458
- })
459
- });
460
- const clientId_to_chainIdName = yield this.query.ibc.client.ClientStates({
461
- pagination: pagination_1.PageRequest.fromPartial({
462
- limit: new long_1.default(1000000)
463
- })
464
- });
465
- const clientStates = clientId_to_chainIdName.clientStates.map(s => ({
466
- clientState: Object.assign({}, tendermint_1.ClientState.decode(s.clientState.value)),
467
- clientId: s.clientId,
468
- }));
469
- newBridges = bridges.map(bridge => {
470
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
471
- const connection = channels_to_connection.channels.find(channel => channel.channelId === ("channel-" + (bridge.chainId.toNumber() - 1)));
472
- const connectionId = connection === null || connection === void 0 ? void 0 : connection.connectionHops[0];
473
- const src_channel = (_a = connection === null || connection === void 0 ? void 0 : connection.channelId) !== null && _a !== void 0 ? _a : "";
474
- const dst_channel = (_c = (_b = connection === null || connection === void 0 ? void 0 : connection.counterparty) === null || _b === void 0 ? void 0 : _b.channelId) !== null && _c !== void 0 ? _c : "";
475
- const cosmRegexArr = (_e = (_d = connection === null || connection === void 0 ? void 0 : connection.counterparty) === null || _d === void 0 ? void 0 : _d.portId) === null || _e === void 0 ? void 0 : _e.match(ibc_1.cosmBridgeRegex);
476
- const portId = (_f = cosmRegexArr === null || cosmRegexArr === void 0 ? void 0 : cosmRegexArr[1]) !== null && _f !== void 0 ? _f : "transfer";
477
- const clientId = (_g = connection_to_clientId.connections.find(connection => connection.id === connectionId)) === null || _g === void 0 ? void 0 : _g.clientId;
478
- const chainIdName = (_j = ((_h = clientStates.find(client => client.clientId === clientId)) === null || _h === void 0 ? void 0 : _h.clientState)) === null || _j === void 0 ? void 0 : _j.chainId;
479
- return Object.assign(Object.assign({}, bridge), { chain_id_name: chainIdName !== null && chainIdName !== void 0 ? chainIdName : "", channels: { src_channel, dst_channel, port_id: portId } });
480
- });
481
- }
482
- finally {
483
- const checkedBefore = new Array(newBridges.length).fill(false);
484
- const chainMap = {};
485
- for (let i = 0; i < newBridges.length; i++) {
486
- if (checkedBefore[i])
487
- continue;
488
- const bridge = newBridges[i];
489
- const chainId = bridge.chain_id_name;
490
- if (chainMap[chainId]) {
491
- const chainName = chainMap[chainId];
492
- for (let j = i; j < newBridges.length; j++) {
493
- const subBridge = newBridges[j];
494
- if (subBridge.chain_id_name === chainId) {
495
- subBridge.chainName = chainName;
496
- checkedBefore[j] = true;
497
- }
344
+ const networkConfig = this.configProvider.getConfig();
345
+ if (networkConfig.network === network_1.Network.MainNet) {
346
+ const symbolDenoms = Object.keys(this.symbols);
347
+ const symbolMap = Object.values(this.symbols);
348
+ const carbonIbc = this.getCarbonIbcTokens();
349
+ carbonIbc.forEach((token) => {
350
+ const index = symbolMap.indexOf("swth");
351
+ if (!this.tokens[token.denom])
352
+ this.tokens[token.denom] = token;
353
+ if (!this.symbols[token.denom])
354
+ this.symbols[token.denom] = token.symbol;
355
+ if (index > -1) {
356
+ const similarDenom = symbolDenoms[index];
357
+ if (similarDenom && !this.wrapperMap[token.denom] && similarDenom !== token.denom) {
358
+ this.wrapperMap[token.denom] = similarDenom;
498
359
  }
499
360
  }
500
- else {
501
- chainMap[chainId] = bridge.chainName;
502
- }
503
- }
504
- return newBridges;
361
+ });
505
362
  }
363
+ return this.tokens;
506
364
  });
507
365
  }
508
- getIbcBlockchainNames() {
509
- return this.bridges.ibc.map(bridge => bridge.chainName);
510
- }
511
- getPolynetworkBlockchainNames() {
512
- return this.bridges.polynetwork.map(bridge => bridge.chainName);
513
- }
514
- getAllBlockchainNames() {
515
- return this.getIbcBlockchainNames().concat(this.getPolynetworkBlockchainNames());
516
- }
517
- getBridgesFromBridgeId(bridgeId) {
518
- switch (bridgeId) {
519
- case blockchain_1.BRIDGE_IDS.polynetwork:
520
- return this.bridges.polynetwork;
521
- case blockchain_1.BRIDGE_IDS.ibc:
522
- return this.bridges.ibc;
523
- default:
524
- return this.bridges.polynetwork;
525
- }
526
- }
527
- getIbcTokens() {
528
- const ibcTokens = Object.values(this.tokens).reduce((prev, token) => {
529
- const newPrev = prev;
530
- if (token.bridgeId.toNumber() === blockchain_1.BRIDGE_IDS.ibc) {
531
- newPrev[token.denom] = token;
532
- }
533
- return newPrev;
534
- }, {});
535
- return ibcTokens;
536
- }
537
- getPolyNetworkTokens() {
538
- const polynetworkTokens = Object.values(this.tokens).reduce((prev, token) => {
539
- const newPrev = prev;
540
- if (token.bridgeId.toNumber() === blockchain_1.BRIDGE_IDS.polynetwork) {
541
- newPrev[token.denom] = token;
542
- }
543
- return newPrev;
544
- }, {});
545
- return polynetworkTokens;
546
- }
547
- getBlockchainV2FromIDs(chainId, bridgeId) {
548
- var _a, _b;
549
- const chainIdNum = Number(chainId);
550
- const bridgeIdNum = Number(bridgeId);
551
- if ((chainIdNum === 5 && bridgeIdNum === 1) || (chainIdNum === 0 && bridgeIdNum === 2))
552
- return "Carbon";
553
- const bridgeList = this.getBridgesFromBridgeId(bridgeIdNum);
554
- return (_b = (_a = bridgeList.find(bridge => bridge.chainId.toNumber() === chainIdNum)) === null || _a === void 0 ? void 0 : _a.chainName) !== null && _b !== void 0 ? _b : undefined;
555
- }
556
- getBridgeFromToken(token) {
557
- if (!token || !token.bridgeId)
558
- return undefined;
559
- const bridgeList = this.getBridgesFromBridgeId(token.bridgeId.toNumber());
560
- return bridgeList.find(bridge => token.chainId.equals(bridge.chainId));
561
- }
562
- getIbcChainIdFromToken(token) {
563
- if (!token)
564
- return undefined;
565
- const bridge = this.getBridgeFromToken(token);
566
- if (!bridge || !(0, blockchain_1.isIbcBridge)(bridge))
567
- return undefined;
568
- return bridge.chain_id_name;
569
- }
570
- getCarbonDenomTraces() {
571
- return __awaiter(this, void 0, void 0, function* () {
572
- // get swth on osmosis
573
- const osmoTmClient = yield tendermint_rpc_1.Tendermint34Client.connect(network_1.publicRpcNodes.Osmosis);
574
- const osmoClient = new stargate_1.QueryClient(osmoTmClient);
575
- const osmosRpcClient = (0, stargate_1.createProtobufRpcClient)(osmoClient);
576
- const osmoIbcClient = new query_1.QueryClientImpl(osmosRpcClient);
577
- const osmoDenomTraces = yield osmoIbcClient.DenomTraces({
578
- pagination: pagination_1.PageRequest.fromPartial({
579
- limit: new long_1.default(1000000),
580
- }),
581
- });
582
- const osmoSwthDenomTrace = osmoDenomTraces.denomTraces.filter((trace) => {
583
- return trace.baseDenom === "swth";
584
- });
585
- return osmoSwthDenomTrace.reduce((prev, trace) => {
586
- var _a;
587
- const coinMinimalDenom = util_1.IBCUtils.makeIBCMinimalDenom(trace.path, trace.baseDenom);
588
- const token = (_a = this.tokenForDenom(coinMinimalDenom)) !== null && _a !== void 0 ? _a : this.tokenForDenom(trace.baseDenom);
589
- const traceExtended = Object.assign(Object.assign({}, trace), { token });
590
- this.denomTraces[coinMinimalDenom] = traceExtended;
591
- prev[coinMinimalDenom] = traceExtended;
592
- return prev;
593
- }, {});
366
+ getCarbonIbcTokens() {
367
+ const swthTokens = ibc_1.swthIbcWhitelist.map((chainId) => {
368
+ var _a, _b, _c;
369
+ const blockchain = util_1.IBCUtils.BlockchainMap[chainId];
370
+ const carbonBlockchain = util_1.IBCUtils.ChainIdBlockchainMap[blockchain !== null && blockchain !== void 0 ? blockchain : ""];
371
+ const blockchainNum = (_a = util_1.BlockchainUtils.CHAIN_IDS[carbonBlockchain !== null && carbonBlockchain !== void 0 ? carbonBlockchain : ""]) !== null && _a !== void 0 ? _a : 0;
372
+ const swthChannel = (_b = ibc_1.swthChannels[chainId]) === null || _b === void 0 ? void 0 : _b.ibc;
373
+ const assetDenom = util_1.IBCUtils.makeIBCMinimalDenom((_c = swthChannel === null || swthChannel === void 0 ? void 0 : swthChannel.dstChannel) !== null && _c !== void 0 ? _c : "channel-0", KeplrAccount_1.default.SWTH_CURRENCY.coinMinimalDenom);
374
+ return {
375
+ id: assetDenom,
376
+ creator: "",
377
+ denom: assetDenom,
378
+ name: "Carbon",
379
+ symbol: KeplrAccount_1.default.SWTH_CURRENCY.coinDenom,
380
+ decimals: new long_1.default(KeplrAccount_1.default.SWTH_CURRENCY.coinDecimals),
381
+ bridgeId: new long_1.default(util_1.BlockchainUtils.BRIDGE_IDS.ibc),
382
+ chainId: new long_1.default(blockchainNum),
383
+ tokenAddress: "",
384
+ bridgeAddress: "",
385
+ isActive: true,
386
+ isCollateral: false,
387
+ };
594
388
  });
389
+ return swthTokens;
595
390
  }
596
391
  getCdpUnderlyingToken(cdpDenom) {
597
392
  if (!this.cdpTokens[cdpDenom]) {
@@ -77,7 +77,7 @@ export declare class ZILClient {
77
77
  private walletProvider?;
78
78
  private constructor();
79
79
  static instance(opts: ZILClientOpts): CarbonSDK.ZILClient;
80
- getExternalBalances(sdk: CarbonSDK, address: string, whitelistDenoms?: string[], version?: string): Promise<TokensWithExternalBalance[]>;
80
+ getExternalBalances(sdk: CarbonSDK, address: string, whitelistDenoms?: string[]): Promise<TokensWithExternalBalance[]>;
81
81
  formatWithdrawalAddress(bech32Address: string): Promise<string>;
82
82
  private callContract;
83
83
  approveZRC2(params: ApproveZRC2Params): Promise<Transaction>;
@@ -69,17 +69,12 @@ class ZILClient {
69
69
  }
70
70
  return new ZILClient(configProvider, blockchain);
71
71
  }
72
- getExternalBalances(sdk, address, whitelistDenoms, version = "V1") {
72
+ getExternalBalances(sdk, address, whitelistDenoms) {
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  const tokenQueryResults = yield sdk.token.getAllTokens();
75
- const tokens = tokenQueryResults.filter((token) => {
76
- const isCorrectBlockchain = version === "V2"
77
- ?
78
- !!sdk.token.getBlockchainV2(token.denom) && (blockchain_1.BLOCKCHAIN_V2_TO_V1_MAPPING[sdk.token.getBlockchainV2(token.denom)] == this.blockchain)
79
- :
80
- (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain;
81
- return isCorrectBlockchain && token.tokenAddress.length == 40 && (!whitelistDenoms || whitelistDenoms.includes(token.denom));
82
- });
75
+ const tokens = tokenQueryResults.filter((token) => (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain &&
76
+ token.tokenAddress.length == 40 &&
77
+ (!whitelistDenoms || whitelistDenoms.includes(token.denom)));
83
78
  const requests = tokens.map((token) => token.tokenAddress === zeroAddress
84
79
  ? (0, exports.balanceBatchRequest)(address.replace(/^0x/i, ""))
85
80
  : (0, exports.tokenBalanceBatchRequest)(token.tokenAddress, address));
@@ -78,13 +78,6 @@ export interface CosmWasmChannelSet extends ChannelSet {
78
78
  export declare const swthChannels: SimpleMap<ChannelConfig>;
79
79
  export declare const cibtIbcTokenRegex: RegExp;
80
80
  export declare const ibcTokenRegex: RegExp;
81
- export declare const cw20TokenRegex: RegExp;
82
- export declare const cosmBridgeRegex: RegExp;
83
81
  export declare const ibcNetworkRegex: RegExp;
84
- export declare const ibcTransferChannelRegex: RegExp;
85
82
  export declare const ibcDefaultGas: number;
86
83
  export declare const DefaultGasPriceStep: GasPriceStep;
87
- export declare type MinimalDenomMap = SimpleMap<string>;
88
- export interface ExtendedChainInfo extends ChainInfo {
89
- minimalDenomMap: MinimalDenomMap;
90
- }
@@ -19,7 +19,7 @@ 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.ibcTransferChannelRegex = exports.ibcNetworkRegex = exports.cosmBridgeRegex = exports.cw20TokenRegex = exports.ibcTokenRegex = exports.cibtIbcTokenRegex = 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
25
  const token_1 = require("./token");
@@ -2116,10 +2116,7 @@ exports.swthChannels = {
2116
2116
  };
2117
2117
  exports.cibtIbcTokenRegex = RegExp(`^${token_1.DenomPrefix.CDPToken}/ibc/([a-f\\d]+)$`, "i");
2118
2118
  exports.ibcTokenRegex = /^ibc\/([a-f\d]+)$/i;
2119
- exports.cw20TokenRegex = /^cw20:([a-z\d]+)$/i;
2120
- exports.cosmBridgeRegex = /^wasm\.([a-z\d]+)$/i;
2121
2119
  exports.ibcNetworkRegex = /^([a-z\d_-]+)-([\d]+)$/i;
2122
- exports.ibcTransferChannelRegex = /^transfer\/channel-(\d+)/i;
2123
2120
  exports.ibcDefaultGas = 300000;
2124
2121
  exports.DefaultGasPriceStep = {
2125
2122
  low: 0.01,
@@ -1,4 +1,3 @@
1
- import { SimpleMap } from "../util/type";
2
1
  export declare enum Network {
3
2
  MainNet = "mainnet",
4
3
  TestNet = "testnet",
@@ -65,4 +64,3 @@ export interface NetworkConfigProvider {
65
64
  export declare const NetworkConfigs: {
66
65
  [key in Network]: NetworkConfig;
67
66
  };
68
- export declare const publicRpcNodes: SimpleMap<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.publicRpcNodes = exports.NetworkConfigs = exports.DEFAULT_NETWORK = exports.CarbonChainIDs = exports.Network = void 0;
3
+ exports.NetworkConfigs = exports.DEFAULT_NETWORK = exports.CarbonChainIDs = exports.Network = void 0;
4
4
  const neon_core_next_1 = require("@cityofzion/neon-core-next");
5
5
  var Network;
6
6
  (function (Network) {
@@ -318,7 +318,3 @@ exports.NetworkConfigs = {
318
318
  },
319
319
  },
320
320
  };
321
- exports.publicRpcNodes = {
322
- Osmosis: "https://rpc.osmosis.zone/",
323
- Terra: "https://terra-rpc.lavenderfive.com:443/",
324
- };
@@ -1,4 +1,4 @@
1
- import { Blockchain, BlockchainV2 } from "../util/blockchain";
1
+ import { Blockchain } from "../util/blockchain";
2
2
  export interface GetTransfersRequest {
3
3
  bridging_blockchain?: string;
4
4
  source_blockchain?: string;
@@ -53,9 +53,9 @@ export interface CrossChainTransfer {
53
53
  nonce: string;
54
54
  created_at: Date;
55
55
  updated_at: Date;
56
- source_blockchain: Blockchain | BlockchainV2 | null;
57
- bridging_blockchain: Blockchain | BlockchainV2 | null;
58
- destination_blockchain: Blockchain | BlockchainV2 | null;
56
+ source_blockchain: Blockchain | null;
57
+ bridging_blockchain: Blockchain | null;
58
+ destination_blockchain: Blockchain | null;
59
59
  status: CrossChainFlowStatus;
60
60
  carbon_token_id: string;
61
61
  recovery_address_hash: string;
@@ -68,7 +68,7 @@ export interface CrossChainTransferDetailed extends CrossChainTransfer {
68
68
  }
69
69
  export interface ChainTransaction {
70
70
  id: string;
71
- blockchain: Blockchain | BlockchainV2;
71
+ blockchain: Blockchain;
72
72
  contract: string;
73
73
  block_height: number;
74
74
  tx_hash: string;
@@ -1,14 +1,13 @@
1
- import { ExtendedChainInfo } from "../constant";
2
- import { ChainInfo } from "../provider";
3
- import { CarbonTx, TypeUtils } from "../util";
1
+ import { CarbonTx } from "../util";
4
2
  import BigNumber from "bignumber.js";
5
3
  import BaseModule from "./base";
6
4
  export declare class IBCModule extends BaseModule {
5
+ /** @deprecated please use sendIbcTransferUpdated instead */
7
6
  sendIBCTransfer(params: IBCModule.SendIBCTransferParams, msgOpts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
8
- getChainInfoMap(): Promise<TypeUtils.SimpleMap<ExtendedChainInfo>>;
9
- getChainInfo(chainName: string, chainId: string): Promise<ChainInfo | undefined>;
7
+ sendIbcTransferV2(params: IBCModule.SendIBCTransferV2Params, msgOpts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
10
8
  }
11
9
  export declare namespace IBCModule {
10
+ /** @deprecated sendIBCTransfer function is deprecated, please use sendIbcTransferUpdated instead */
12
11
  interface SendIBCTransferParams {
13
12
  sender?: string;
14
13
  receiver: string;
@@ -20,4 +19,17 @@ export declare namespace IBCModule {
20
19
  revisionNumber?: number;
21
20
  timeoutTimestamp?: number;
22
21
  }
22
+ interface SendIBCTransferV2Params {
23
+ sender?: string;
24
+ receiver: string;
25
+ amount: BigNumber;
26
+ denom: string;
27
+ sourceChannel: string;
28
+ sourcePort: string;
29
+ timeoutHeight?: {
30
+ revisionNumber: BigNumber;
31
+ revisionHeight: BigNumber;
32
+ };
33
+ timeoutTimestamp?: BigNumber;
34
+ }
23
35
  }