carbon-js-sdk 0.11.18-beta.2 → 0.11.20

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.
Files changed (55) hide show
  1. package/lib/CarbonSDK.d.ts +4 -2
  2. package/lib/CarbonSDK.js +4 -0
  3. package/lib/clients/CarbonQueryClient.d.ts +2 -0
  4. package/lib/clients/CarbonQueryClient.js +85 -83
  5. package/lib/clients/HydrogenClient.d.ts +1 -0
  6. package/lib/clients/HydrogenClient.js +12 -3
  7. package/lib/clients/TokenClient.d.ts +5 -2
  8. package/lib/clients/TokenClient.js +64 -2
  9. package/lib/clients/index.d.ts +1 -0
  10. package/lib/clients/index.js +3 -1
  11. package/lib/codec/Switcheo/carbon/cdp/asset_params.d.ts +0 -2
  12. package/lib/codec/Switcheo/carbon/cdp/asset_params.js +8 -21
  13. package/lib/codec/Switcheo/carbon/coin/export.d.ts +2 -2
  14. package/lib/codec/Switcheo/carbon/coin/export.js +6 -2
  15. package/lib/codec/Switcheo/carbon/coin/query.d.ts +21 -0
  16. package/lib/codec/Switcheo/carbon/coin/query.js +88 -1
  17. package/lib/codec/Switcheo/carbon/coin/tx.d.ts +24 -0
  18. package/lib/codec/Switcheo/carbon/coin/tx.js +125 -1
  19. package/lib/codec/Switcheo/carbon/oracle/export.d.ts +2 -2
  20. package/lib/codec/Switcheo/carbon/oracle/export.js +2 -6
  21. package/lib/codec/Switcheo/carbon/oracle/genesis.d.ts +1 -2
  22. package/lib/codec/Switcheo/carbon/oracle/genesis.js +11 -26
  23. package/lib/codec/Switcheo/carbon/oracle/oracle.d.ts +0 -24
  24. package/lib/codec/Switcheo/carbon/oracle/oracle.js +1 -152
  25. package/lib/codec/Switcheo/carbon/oracle/query.d.ts +1 -28
  26. package/lib/codec/Switcheo/carbon/oracle/query.js +1 -169
  27. package/lib/codec/Switcheo/carbon/pricing/params.d.ts +2 -0
  28. package/lib/codec/Switcheo/carbon/pricing/params.js +40 -0
  29. package/lib/codec/carbon-models.d.ts +1 -0
  30. package/lib/codec/carbon-models.js +2 -1
  31. package/lib/codec/cosmos/ics23/v1/proofs.d.ts +4 -1
  32. package/lib/codec/index.d.ts +64 -0
  33. package/lib/codec/index.js +1623 -192
  34. package/lib/constant/generic.js +1 -2
  35. package/lib/constant/network.d.ts +4 -0
  36. package/lib/constant/network.js +23 -0
  37. package/lib/constant/web3Config.d.ts +2 -0
  38. package/lib/constant/web3Config.js +30 -9
  39. package/lib/eth/abis/index.d.ts +2 -1
  40. package/lib/eth/abis/index.js +3 -1
  41. package/lib/hydrogen/transfer.d.ts +1 -0
  42. package/lib/modules/admin.js +0 -1
  43. package/lib/modules/index.d.ts +1 -0
  44. package/lib/modules/index.js +1 -0
  45. package/lib/provider/amino/AminoTypesMap.js +1 -1
  46. package/lib/provider/amino/types/index.d.ts +1 -0
  47. package/lib/provider/amino/types/index.js +3 -1
  48. package/lib/provider/amino/utils.d.ts +2 -0
  49. package/lib/provider/amino/utils.js +17 -8
  50. package/lib/provider/metamask/MetaMask.js +15 -0
  51. package/lib/util/blockchain.d.ts +15 -6
  52. package/lib/util/blockchain.js +46 -4
  53. package/lib/util/tx.d.ts +64 -0
  54. package/lib/wallet/CarbonWallet.js +2 -5
  55. package/package.json +1 -1
@@ -2,11 +2,11 @@
2
2
  import { Network, NetworkConfig, Network as _Network } from "./constant";
3
3
  import { Tendermint37Client } from "@cosmjs/tendermint-rpc";
4
4
  import * as clients from "./clients";
5
- import { CarbonQueryClient, ETHClient, HydrogenClient, InsightsQueryClient, NEOClient, TokenClient, ZILClient } from "./clients";
5
+ import { CarbonQueryClient, AxelarBridgeClient, ETHClient, HydrogenClient, InsightsQueryClient, NEOClient, TokenClient, ZILClient } from "./clients";
6
6
  import GasFee from "./clients/GasFee";
7
7
  import GrpcQueryClient from "./clients/GrpcQueryClient";
8
8
  import N3Client from "./clients/N3Client";
9
- import { AdminModule, AllianceModule, BankModule, BrokerModule, CDPModule, CoinModule, ERC20Module, EvmMergeModule, EvmModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PerpspoolModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
9
+ import { AdminModule, AllianceModule, BankModule, BridgeModule, BrokerModule, CDPModule, CoinModule, ERC20Module, EvmMergeModule, EvmModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PerpspoolModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
10
10
  import { GrantModule } from "./modules/grant";
11
11
  import { StakingModule } from "./modules/staking";
12
12
  import { CosmosLedger, Keplr, LeapExtended } from "./provider";
@@ -95,12 +95,14 @@ declare class CarbonSDK {
95
95
  xchain: XChainModule;
96
96
  evm: EvmModule;
97
97
  evmmerge: EvmMergeModule;
98
+ bridge: BridgeModule;
98
99
  neo: NEOClient;
99
100
  eth: ETHClient;
100
101
  bsc: ETHClient;
101
102
  arbitrum: ETHClient;
102
103
  polygon: ETHClient;
103
104
  okc: ETHClient;
105
+ axelarBridgeClient: AxelarBridgeClient;
104
106
  zil: ZILClient;
105
107
  n3: N3Client;
106
108
  chainId: string;
package/lib/CarbonSDK.js CHANGED
@@ -120,6 +120,7 @@ class CarbonSDK {
120
120
  this.xchain = new modules_1.XChainModule(this);
121
121
  this.evm = new modules_1.EvmModule(this);
122
122
  this.evmmerge = new modules_1.EvmMergeModule(this);
123
+ this.bridge = new modules_1.BridgeModule(this);
123
124
  this.neo = clients_1.NEOClient.instance({
124
125
  configProvider: this,
125
126
  blockchain: blockchain_1.Blockchain.Neo,
@@ -157,6 +158,9 @@ class CarbonSDK {
157
158
  blockchain: blockchain_1.Blockchain.Okc,
158
159
  tokenClient: this.token,
159
160
  });
161
+ this.axelarBridgeClient = clients_1.AxelarBridgeClient.instance({
162
+ configProvider: this,
163
+ });
160
164
  }
161
165
  static instance(opts = DEFAULT_SDK_INIT_OPTS) {
162
166
  var _a, _b, _c, _d;
@@ -6,6 +6,7 @@ import { QueryClientImpl as CoinQueryClient } from "../codec/Switcheo/carbon/coi
6
6
  import { QueryClientImpl as AuthQueryClient } from "../codec/cosmos/auth/v1beta1/query";
7
7
  import { QueryClientImpl as BankQueryClient } from "../codec/cosmos/bank/v1beta1/query";
8
8
  import { QueryClientImpl as NativeBankQueryClient } from "../codec/Switcheo/carbon/bank/query";
9
+ import { QueryClientImpl as BridgeQueryClient } from "../codec/Switcheo/carbon/bridge/query";
9
10
  import { ServiceClientImpl as CosmosTmClient } from "../codec/cosmos/base/tendermint/v1beta1/query";
10
11
  import { QueryClientImpl as DistributionQueryClient } from "../codec/cosmos/distribution/v1beta1/query";
11
12
  import { QueryClientImpl as EvidenceQueryClient } from "../codec/cosmos/evidence/v1beta1/query";
@@ -69,6 +70,7 @@ export interface CarbonQueryClientOpts {
69
70
  declare class CarbonQueryClient {
70
71
  adl: ADLQueryClient;
71
72
  book: BookQueryClient;
73
+ bridge: BridgeQueryClient;
72
74
  broker: BrokerQueryClient;
73
75
  coin: CoinQueryClient;
74
76
  cdp: CDPQueryClient;
@@ -11,47 +11,48 @@ const query_5 = require("../codec/Switcheo/carbon/coin/query");
11
11
  const query_6 = require("../codec/cosmos/auth/v1beta1/query");
12
12
  const query_7 = require("../codec/cosmos/bank/v1beta1/query");
13
13
  const query_8 = require("../codec/Switcheo/carbon/bank/query");
14
- const query_9 = require("../codec/cosmos/base/tendermint/v1beta1/query");
15
- const query_10 = require("../codec/cosmos/distribution/v1beta1/query");
16
- const query_11 = require("../codec/cosmos/evidence/v1beta1/query");
17
- const query_12 = require("../codec/cosmos/gov/v1/query");
18
- const query_13 = require("../codec/cosmos/group/v1/query");
19
- const query_14 = require("../codec/cosmos/mint/v1beta1/query");
20
- const query_15 = require("../codec/cosmos/params/v1beta1/query");
21
- const query_16 = require("../codec/cosmos/slashing/v1beta1/query");
22
- const query_17 = require("../codec/cosmos/staking/v1beta1/query");
23
- const query_18 = require("../codec/cosmos/upgrade/v1beta1/query");
24
- const query_19 = require("../codec/ethermint/evm/v1/query");
25
- const query_20 = require("../codec/cosmos/authz/v1beta1/query");
26
- const query_21 = require("../codec/cosmos/feegrant/v1beta1/query");
27
- const query_22 = require("../codec/Switcheo/carbon/evmmerge/query");
28
- const query_23 = require("../codec/Switcheo/carbon/evmbank/query");
29
- const query_24 = require("../codec/ethermint/feemarket/v1/query");
30
- const query_25 = require("../codec/Switcheo/carbon/fee/query");
31
- const query_26 = require("../codec/Switcheo/carbon/headersync/query");
32
- const query_27 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
33
- const query_28 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
34
- const query_29 = require("../codec/ibc/applications/transfer/v1/query");
35
- const query_30 = require("../codec/ibc/core/client/v1/query");
36
- const query_31 = require("../codec/ibc/core/connection/v1/query");
37
- const query_32 = require("../codec/ibc/core/channel/v1/query");
38
- const query_33 = require("../codec/Switcheo/carbon/inflation/query");
39
- const query_34 = require("../codec/Switcheo/carbon/insurance/query");
40
- const query_35 = require("../codec/Switcheo/carbon/leverage/query");
41
- const query_36 = require("../codec/Switcheo/carbon/liquidation/query");
42
- const query_37 = require("../codec/Switcheo/carbon/liquiditypool/query");
43
- const query_38 = require("../codec/Switcheo/carbon/market/query");
44
- const query_39 = require("../codec/Switcheo/carbon/marketstats/query");
45
- const query_40 = require("../codec/Switcheo/carbon/misc/query");
46
- const query_41 = require("../codec/Switcheo/carbon/oracle/query");
47
- const query_42 = require("../codec/Switcheo/carbon/order/query");
48
- const query_43 = require("../codec/Switcheo/carbon/position/query");
49
- const query_44 = require("../codec/Switcheo/carbon/pricing/query");
50
- const query_45 = require("../codec/Switcheo/carbon/profile/query");
51
- const query_46 = require("../codec/Switcheo/carbon/subaccount/query");
52
- const query_47 = require("../codec/alliance/alliance/query");
53
- const query_48 = require("../codec/Switcheo/carbon/perpspool/query");
54
- const query_49 = require("../codec/Switcheo/carbon/erc20/query");
14
+ const query_9 = require("../codec/Switcheo/carbon/bridge/query");
15
+ const query_10 = require("../codec/cosmos/base/tendermint/v1beta1/query");
16
+ const query_11 = require("../codec/cosmos/distribution/v1beta1/query");
17
+ const query_12 = require("../codec/cosmos/evidence/v1beta1/query");
18
+ const query_13 = require("../codec/cosmos/gov/v1/query");
19
+ const query_14 = require("../codec/cosmos/group/v1/query");
20
+ const query_15 = require("../codec/cosmos/mint/v1beta1/query");
21
+ const query_16 = require("../codec/cosmos/params/v1beta1/query");
22
+ const query_17 = require("../codec/cosmos/slashing/v1beta1/query");
23
+ const query_18 = require("../codec/cosmos/staking/v1beta1/query");
24
+ const query_19 = require("../codec/cosmos/upgrade/v1beta1/query");
25
+ const query_20 = require("../codec/ethermint/evm/v1/query");
26
+ const query_21 = require("../codec/cosmos/authz/v1beta1/query");
27
+ const query_22 = require("../codec/cosmos/feegrant/v1beta1/query");
28
+ const query_23 = require("../codec/Switcheo/carbon/evmmerge/query");
29
+ const query_24 = require("../codec/Switcheo/carbon/evmbank/query");
30
+ const query_25 = require("../codec/ethermint/feemarket/v1/query");
31
+ const query_26 = require("../codec/Switcheo/carbon/fee/query");
32
+ const query_27 = require("../codec/Switcheo/carbon/headersync/query");
33
+ const query_28 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
34
+ const query_29 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
35
+ const query_30 = require("../codec/ibc/applications/transfer/v1/query");
36
+ const query_31 = require("../codec/ibc/core/client/v1/query");
37
+ const query_32 = require("../codec/ibc/core/connection/v1/query");
38
+ const query_33 = require("../codec/ibc/core/channel/v1/query");
39
+ const query_34 = require("../codec/Switcheo/carbon/inflation/query");
40
+ const query_35 = require("../codec/Switcheo/carbon/insurance/query");
41
+ const query_36 = require("../codec/Switcheo/carbon/leverage/query");
42
+ const query_37 = require("../codec/Switcheo/carbon/liquidation/query");
43
+ const query_38 = require("../codec/Switcheo/carbon/liquiditypool/query");
44
+ const query_39 = require("../codec/Switcheo/carbon/market/query");
45
+ const query_40 = require("../codec/Switcheo/carbon/marketstats/query");
46
+ const query_41 = require("../codec/Switcheo/carbon/misc/query");
47
+ const query_42 = require("../codec/Switcheo/carbon/oracle/query");
48
+ const query_43 = require("../codec/Switcheo/carbon/order/query");
49
+ const query_44 = require("../codec/Switcheo/carbon/position/query");
50
+ const query_45 = require("../codec/Switcheo/carbon/pricing/query");
51
+ const query_46 = require("../codec/Switcheo/carbon/profile/query");
52
+ const query_47 = require("../codec/Switcheo/carbon/subaccount/query");
53
+ const query_48 = require("../codec/alliance/alliance/query");
54
+ const query_49 = require("../codec/Switcheo/carbon/perpspool/query");
55
+ const query_50 = require("../codec/Switcheo/carbon/erc20/query");
55
56
  const stargate_1 = require("@cosmjs/stargate");
56
57
  const BlockchainClient_1 = __importDefault(require("./BlockchainClient"));
57
58
  class CarbonQueryClient {
@@ -60,58 +61,59 @@ class CarbonQueryClient {
60
61
  const rpcClient = (_a = opts.grpcClient) !== null && _a !== void 0 ? _a : (0, stargate_1.createProtobufRpcClient)(new stargate_1.QueryClient(opts.tmClient));
61
62
  this.chain = BlockchainClient_1.default.connectWithTm(opts.tmClient);
62
63
  this.adl = new query_1.QueryClientImpl(rpcClient);
63
- this.alliance = new query_47.QueryClientImpl(rpcClient);
64
+ this.alliance = new query_48.QueryClientImpl(rpcClient);
64
65
  this.book = new query_2.QueryClientImpl(rpcClient);
66
+ this.bridge = new query_9.QueryClientImpl(rpcClient);
65
67
  this.broker = new query_3.QueryClientImpl(rpcClient);
66
68
  this.coin = new query_5.QueryClientImpl(rpcClient);
67
69
  this.cdp = new query_4.QueryClientImpl(rpcClient);
68
- this.fee = new query_25.QueryClientImpl(rpcClient);
69
- this.inflation = new query_33.QueryClientImpl(rpcClient);
70
- this.insurance = new query_34.QueryClientImpl(rpcClient);
71
- this.leverage = new query_35.QueryClientImpl(rpcClient);
72
- this.liquidation = new query_36.QueryClientImpl(rpcClient);
73
- this.liquiditypool = new query_37.QueryClientImpl(rpcClient);
74
- this.market = new query_38.QueryClientImpl(rpcClient);
75
- this.marketstats = new query_39.QueryClientImpl(rpcClient);
76
- this.misc = new query_40.QueryClientImpl(rpcClient);
77
- this.oracle = new query_41.QueryClientImpl(rpcClient);
78
- this.order = new query_42.QueryClientImpl(rpcClient);
79
- this.position = new query_43.QueryClientImpl(rpcClient);
80
- this.pricing = new query_44.QueryClientImpl(rpcClient);
81
- this.profile = new query_45.QueryClientImpl(rpcClient);
82
- this.subaccount = new query_46.QueryClientImpl(rpcClient);
83
- this.headersync = new query_26.QueryClientImpl(rpcClient);
84
- this.evmmerge = new query_22.QueryClientImpl(rpcClient);
85
- this.evmbank = new query_23.QueryClientImpl(rpcClient);
86
- this.perpspool = new query_48.QueryClientImpl(rpcClient);
70
+ this.fee = new query_26.QueryClientImpl(rpcClient);
71
+ this.inflation = new query_34.QueryClientImpl(rpcClient);
72
+ this.insurance = new query_35.QueryClientImpl(rpcClient);
73
+ this.leverage = new query_36.QueryClientImpl(rpcClient);
74
+ this.liquidation = new query_37.QueryClientImpl(rpcClient);
75
+ this.liquiditypool = new query_38.QueryClientImpl(rpcClient);
76
+ this.market = new query_39.QueryClientImpl(rpcClient);
77
+ this.marketstats = new query_40.QueryClientImpl(rpcClient);
78
+ this.misc = new query_41.QueryClientImpl(rpcClient);
79
+ this.oracle = new query_42.QueryClientImpl(rpcClient);
80
+ this.order = new query_43.QueryClientImpl(rpcClient);
81
+ this.position = new query_44.QueryClientImpl(rpcClient);
82
+ this.pricing = new query_45.QueryClientImpl(rpcClient);
83
+ this.profile = new query_46.QueryClientImpl(rpcClient);
84
+ this.subaccount = new query_47.QueryClientImpl(rpcClient);
85
+ this.headersync = new query_27.QueryClientImpl(rpcClient);
86
+ this.evmmerge = new query_23.QueryClientImpl(rpcClient);
87
+ this.evmbank = new query_24.QueryClientImpl(rpcClient);
88
+ this.perpspool = new query_49.QueryClientImpl(rpcClient);
87
89
  this.auth = new query_6.QueryClientImpl(rpcClient);
88
90
  this.bank = new query_7.QueryClientImpl(rpcClient);
89
91
  this.nativeBank = new query_8.QueryClientImpl(rpcClient);
90
- this.distribution = new query_10.QueryClientImpl(rpcClient);
91
- this.evidence = new query_11.QueryClientImpl(rpcClient);
92
- this.grant = new query_20.QueryClientImpl(rpcClient);
93
- this.feegrant = new query_21.QueryClientImpl(rpcClient);
94
- this.group = new query_13.QueryClientImpl(rpcClient);
95
- this.gov = new query_12.QueryClientImpl(rpcClient);
96
- this.mint = new query_14.QueryClientImpl(rpcClient);
97
- this.params = new query_15.QueryClientImpl(rpcClient);
98
- this.slashing = new query_16.QueryClientImpl(rpcClient);
99
- this.staking = new query_17.QueryClientImpl(rpcClient);
100
- this.upgrade = new query_18.QueryClientImpl(rpcClient);
101
- this.cosmosTm = new query_9.ServiceClientImpl(rpcClient);
102
- this.alliance = new query_47.QueryClientImpl(rpcClient);
103
- this.erc20 = new query_49.QueryClientImpl(rpcClient);
92
+ this.distribution = new query_11.QueryClientImpl(rpcClient);
93
+ this.evidence = new query_12.QueryClientImpl(rpcClient);
94
+ this.grant = new query_21.QueryClientImpl(rpcClient);
95
+ this.feegrant = new query_22.QueryClientImpl(rpcClient);
96
+ this.group = new query_14.QueryClientImpl(rpcClient);
97
+ this.gov = new query_13.QueryClientImpl(rpcClient);
98
+ this.mint = new query_15.QueryClientImpl(rpcClient);
99
+ this.params = new query_16.QueryClientImpl(rpcClient);
100
+ this.slashing = new query_17.QueryClientImpl(rpcClient);
101
+ this.staking = new query_18.QueryClientImpl(rpcClient);
102
+ this.upgrade = new query_19.QueryClientImpl(rpcClient);
103
+ this.cosmosTm = new query_10.ServiceClientImpl(rpcClient);
104
+ this.alliance = new query_48.QueryClientImpl(rpcClient);
105
+ this.erc20 = new query_50.QueryClientImpl(rpcClient);
104
106
  this.ibc = {
105
- controller: new query_27.QueryClientImpl(rpcClient),
106
- host: new query_28.QueryClientImpl(rpcClient),
107
- transfer: new query_29.QueryClientImpl(rpcClient),
108
- client: new query_30.QueryClientImpl(rpcClient),
109
- connection: new query_31.QueryClientImpl(rpcClient),
110
- channel: new query_32.QueryClientImpl(rpcClient),
107
+ controller: new query_28.QueryClientImpl(rpcClient),
108
+ host: new query_29.QueryClientImpl(rpcClient),
109
+ transfer: new query_30.QueryClientImpl(rpcClient),
110
+ client: new query_31.QueryClientImpl(rpcClient),
111
+ connection: new query_32.QueryClientImpl(rpcClient),
112
+ channel: new query_33.QueryClientImpl(rpcClient),
111
113
  };
112
114
  this.ethermint = {
113
- evm: new query_19.QueryClientImpl(rpcClient),
114
- feeMarket: new query_24.QueryClientImpl(rpcClient),
115
+ evm: new query_20.QueryClientImpl(rpcClient),
116
+ feeMarket: new query_25.QueryClientImpl(rpcClient),
115
117
  };
116
118
  }
117
119
  }
@@ -8,6 +8,7 @@ export declare const HydrogenEndpoints: {
8
8
  transfer_payloads: string;
9
9
  relays: string;
10
10
  fee_quote: string;
11
+ bridge_fee: string;
11
12
  };
12
13
  declare class HydrogenClient {
13
14
  private config;
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.HydrogenEndpoints = void 0;
16
16
  const constant_1 = require("../constant");
17
17
  const util_1 = require("../util");
18
+ const blockchain_1 = require("../util/blockchain");
18
19
  const dayjs_1 = __importDefault(require("dayjs"));
19
20
  exports.HydrogenEndpoints = {
20
21
  // Status api
@@ -25,6 +26,8 @@ exports.HydrogenEndpoints = {
25
26
  relays: "/relays",
26
27
  // Fee service api
27
28
  fee_quote: "/fee_quote",
29
+ // Bridge fees
30
+ bridge_fee: "/bridge_fee",
28
31
  };
29
32
  const formatDateField = (value) => {
30
33
  if (typeof value !== "string")
@@ -73,6 +76,8 @@ const getBridgeBlockchainFromId = (bridgeId) => {
73
76
  return 'Polynetwork';
74
77
  case 2:
75
78
  return 'Ibc';
79
+ case 3:
80
+ return 'Axelar';
76
81
  default:
77
82
  return 'Polynetwork';
78
83
  }
@@ -84,13 +89,17 @@ class HydrogenClient {
84
89
  var _a, _b, _c, _d;
85
90
  if (typeof value !== "object")
86
91
  return value;
87
- return Object.assign(Object.assign({}, value), { created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), updated_at: formatDateField((_b = value.updated_at) === null || _b === void 0 ? void 0 : _b.toString()), source_blockchain: this.tokenClient.getBlockchainV2FromIDs(Number(value.from_chain_id), value.bridge_id), bridging_blockchain: getBridgeBlockchainFromId(value.bridge_id), destination_blockchain: this.tokenClient.getBlockchainV2FromIDs(Number(value.to_chain_id), value.bridge_id), source_event: this.formatChainEventV2(value.source_event, (_c = value.source_blockchain) !== null && _c !== void 0 ? _c : ''), bridging_event: this.formatChainEventV2(value.bridging_event, getBridgeBlockchainFromId(value.bridge_id)), destination_event: this.formatChainEventV2(value.destination_event, (_d = value.destination_blockchain) !== null && _d !== void 0 ? _d : ''), relay: this.formatRelaysTransfersV2(value.relay) });
92
+ // brdg tokens will all be chain_id 0 which will also be deprecated in future
93
+ // hence for brdg tokens cannot use chain_id to differentiate between blockchains
94
+ const isBridgeToken = this.tokenClient.isBridgedToken(value.carbon_token_id);
95
+ return Object.assign(Object.assign({}, value), { created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), updated_at: formatDateField((_b = value.updated_at) === null || _b === void 0 ? void 0 : _b.toString()), source_blockchain: isBridgeToken ? (0, blockchain_1.getFormattedBlockchainName)(value.source_blockchain) : this.tokenClient.getBlockchainV2FromIDs(Number(value.from_chain_id), value.bridge_id), bridging_blockchain: getBridgeBlockchainFromId(value.bridge_id), destination_blockchain: isBridgeToken ? (0, blockchain_1.getFormattedBlockchainName)(value.destination_blockchain) : this.tokenClient.getBlockchainV2FromIDs(Number(value.to_chain_id), value.bridge_id), source_event: this.formatChainEventV2(value.source_event, (_c = value.source_blockchain) !== null && _c !== void 0 ? _c : ''), bridging_event: this.formatChainEventV2(value.bridging_event, getBridgeBlockchainFromId(value.bridge_id)), destination_event: this.formatChainEventV2(value.destination_event, (_d = value.destination_blockchain) !== null && _d !== void 0 ? _d : ''), relay: this.formatRelaysTransfersV2(value.relay) });
88
96
  };
89
97
  this.formatCrossChainTransferDetailedV2 = (value) => {
90
98
  if (!value || typeof value !== "object")
91
99
  return value;
92
- const source_blockchain = this.tokenClient.getBlockchainV2FromIDs(Number(value.from_chain_id), value.bridge_id);
93
- const destination_blockchain = this.tokenClient.getBlockchainV2FromIDs(Number(value.to_chain_id), value.bridge_id);
100
+ const isBridgeToken = this.tokenClient.isBridgedToken(value.carbon_token_id);
101
+ const source_blockchain = isBridgeToken ? (0, blockchain_1.getFormattedBlockchainName)(value.source_blockchain) : this.tokenClient.getBlockchainV2FromIDs(Number(value.from_chain_id), value.bridge_id);
102
+ const destination_blockchain = isBridgeToken ? (0, blockchain_1.getFormattedBlockchainName)(value.destination_blockchain) : this.tokenClient.getBlockchainV2FromIDs(Number(value.to_chain_id), value.bridge_id);
94
103
  const bridging_blockchain = getBridgeBlockchainFromId(value.bridge_id);
95
104
  return Object.assign(Object.assign({}, this.formatCrossChainTransferV2(value)), { source_event: this.formatChainEventV2(value.source_event, source_blockchain !== null && source_blockchain !== void 0 ? source_blockchain : ''), bridging_event: this.formatChainEventV2(value.bridging_event, bridging_blockchain), destination_event: this.formatChainEventV2(value.destination_event, destination_blockchain !== null && destination_blockchain !== void 0 ? destination_blockchain : '') });
96
105
  };
@@ -2,7 +2,7 @@ import { Carbon } from "../CarbonSDK";
2
2
  import { NetworkConfigProvider } from "../constant";
3
3
  import { GetFeeQuoteResponse } from "../hydrogen/feeQuote";
4
4
  import { BlockchainUtils, TypeUtils } from "../util";
5
- import { BlockchainV2, BridgeMap, IbcBridge } from '../util/blockchain';
5
+ import { AxelarBridge, BlockchainV2, BridgeMap, IbcBridge } from '../util/blockchain';
6
6
  import BigNumber from "bignumber.js";
7
7
  import CarbonQueryClient from "./CarbonQueryClient";
8
8
  declare class TokenClient {
@@ -57,18 +57,21 @@ declare class TokenClient {
57
57
  isNativeToken(denom: string): boolean;
58
58
  isNativeStablecoin(denom: string): boolean;
59
59
  isGroupedToken(denom: string): boolean;
60
+ isBridgedToken(denom: string): boolean;
60
61
  isCarbonToken(token?: Carbon.Coin.Token | null): boolean;
61
62
  getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain | BlockchainUtils.BlockchainV2, version?: string): Carbon.Coin.Token | undefined;
62
63
  getAllTokens(): Promise<Carbon.Coin.Token[]>;
63
64
  reloadTokens(): Promise<TypeUtils.SimpleMap<Carbon.Coin.Token>>;
64
65
  getBridges(): Promise<BridgeMap>;
65
66
  matchChainsWithDifferentChainIds(bridges: Carbon.Coin.Bridge[]): Promise<IbcBridge[]>;
67
+ mapBridgesFromConnections(): Promise<AxelarBridge[]>;
66
68
  getIbcBlockchainNames(): string[];
69
+ getAxelarBlockchainNames(): string[];
67
70
  getIbcBridgeFromBlockchainV2: (blockchain: BlockchainV2 | undefined) => IbcBridge | undefined;
68
71
  getIbcChainFromBlockchainV2: (blockchain: BlockchainV2 | undefined) => string | undefined;
69
72
  getPolynetworkBlockchainNames(): string[];
70
73
  getAllBlockchainNames(): string[];
71
- getBridgesFromBridgeId(bridgeId: number): Carbon.Coin.Bridge[] | IbcBridge[];
74
+ getBridgesFromBridgeId(bridgeId: number): Carbon.Coin.Bridge[] | IbcBridge[] | AxelarBridge[];
72
75
  getIbcTokens(): TypeUtils.SimpleMap<Carbon.Coin.Token>;
73
76
  getPolyNetworkTokens(): TypeUtils.SimpleMap<Carbon.Coin.Token>;
74
77
  getBlockchainV2FromIDs(chainId: number, bridgeId: number): BlockchainV2 | undefined;
@@ -48,7 +48,7 @@ class TokenClient {
48
48
  this.wrapperMap = {};
49
49
  this.poolTokens = {};
50
50
  this.cdpTokens = {};
51
- this.bridges = { polynetwork: [], ibc: [] };
51
+ this.bridges = { polynetwork: [], ibc: [], axelar: [] };
52
52
  this.symbols = {};
53
53
  this.usdValues = {};
54
54
  this.commonAssetNames = constant_1.CommonAssetName;
@@ -113,6 +113,7 @@ class TokenClient {
113
113
  return blockchain;
114
114
  }
115
115
  getBlockchainV2(denom) {
116
+ var _a;
116
117
  if (!denom)
117
118
  return undefined;
118
119
  const token = this.tokens[denom];
@@ -121,6 +122,13 @@ class TokenClient {
121
122
  // pool and cdp tokens are on the Native blockchain, hence 0
122
123
  return 'Native';
123
124
  }
125
+ if (this.isBridgedToken(denom)) {
126
+ // brdg tokens will all be chain_id 0 which will also be deprecated in future
127
+ // hence for brdg tokens cannot use chain_id to differentiate between blockchains
128
+ const bridgeList = this.bridges.axelar;
129
+ const chainName = (_a = bridgeList.find((bridge) => bridge.bridgeAddress === token.bridgeAddress)) === null || _a === void 0 ? void 0 : _a.chainName;
130
+ return chainName;
131
+ }
124
132
  const bridge = this.getBridgeFromToken(token);
125
133
  return bridge === null || bridge === void 0 ? void 0 : bridge.chainName;
126
134
  }
@@ -340,6 +348,10 @@ class TokenClient {
340
348
  const groupedTokenRegex = new RegExp(/^cgt\/\d+$/);
341
349
  return groupedTokenRegex.test(denom);
342
350
  }
351
+ isBridgedToken(denom) {
352
+ const bridgedTokenRegex = new RegExp(/^brdg\//);
353
+ return bridgedTokenRegex.test(denom);
354
+ }
343
355
  isCarbonToken(token) {
344
356
  return Boolean(token && (this.isNativeToken(token.denom) || token.bridgeId.eq(0)));
345
357
  }
@@ -427,6 +439,7 @@ class TokenClient {
427
439
  return bridge.bridgeId.toNumber() === blockchain_1.BRIDGE_IDS.ibc;
428
440
  });
429
441
  const ibcBridges = yield this.matchChainsWithDifferentChainIds(unmatchedIbcBridgeList);
442
+ const axelarBridges = yield this.mapBridgesFromConnections();
430
443
  const polynetworkBridges = allBridges.bridges.reduce((prev, bridge) => {
431
444
  if (bridge.bridgeId.toNumber() !== blockchain_1.BRIDGE_IDS.polynetwork)
432
445
  return prev;
@@ -436,6 +449,7 @@ class TokenClient {
436
449
  Object.assign(this.bridges, {
437
450
  polynetwork: polynetworkBridges,
438
451
  ibc: ibcBridges,
452
+ axelar: axelarBridges,
439
453
  });
440
454
  return this.bridges;
441
455
  });
@@ -494,14 +508,60 @@ class TokenClient {
494
508
  return newBridges;
495
509
  });
496
510
  }
511
+ mapBridgesFromConnections() {
512
+ return __awaiter(this, void 0, void 0, function* () {
513
+ const newBridges = [];
514
+ try {
515
+ const results = yield this.query.bridge.ConnectionAll({
516
+ bridgeId: new long_1.default(0),
517
+ pagination: pagination_1.PageRequest.fromPartial({
518
+ limit: new long_1.default(10000),
519
+ }),
520
+ });
521
+ const connections = results.connections;
522
+ connections.forEach(connection => {
523
+ newBridges.push({
524
+ name: `${connection.chainDisplayName} via Axelar`,
525
+ bridgeId: new long_1.default(blockchain_1.BRIDGE_IDS.axelar),
526
+ chainId: new long_1.default(blockchain_1.BRIDGE_IDS.axelar),
527
+ bridgeAddress: connection.connectionId,
528
+ chain_id_name: connection.chainId,
529
+ chainName: connection.chainDisplayName,
530
+ bridgeName: 'Axelar',
531
+ bridgeAddresses: [],
532
+ enabled: connection.isEnabled,
533
+ });
534
+ });
535
+ }
536
+ catch (err) {
537
+ console.error(err);
538
+ }
539
+ finally {
540
+ const chainMap = {};
541
+ newBridges.forEach((bridge) => {
542
+ const chainId = bridge.chain_id_name;
543
+ if (chainMap[chainId]) {
544
+ bridge.chainName = chainMap[chainId];
545
+ }
546
+ else {
547
+ chainMap[chainId] = bridge.chainName;
548
+ }
549
+ });
550
+ }
551
+ return newBridges;
552
+ });
553
+ }
497
554
  getIbcBlockchainNames() {
498
555
  return this.bridges.ibc.map(bridge => bridge.chainName);
499
556
  }
557
+ getAxelarBlockchainNames() {
558
+ return this.bridges.axelar.map(bridge => bridge.chainName);
559
+ }
500
560
  getPolynetworkBlockchainNames() {
501
561
  return this.bridges.polynetwork.map(bridge => bridge.chainName);
502
562
  }
503
563
  getAllBlockchainNames() {
504
- return this.getIbcBlockchainNames().concat(this.getPolynetworkBlockchainNames());
564
+ return this.getIbcBlockchainNames().concat(this.getPolynetworkBlockchainNames()).concat(this.getAxelarBlockchainNames());
505
565
  }
506
566
  getBridgesFromBridgeId(bridgeId) {
507
567
  switch (bridgeId) {
@@ -509,6 +569,8 @@ class TokenClient {
509
569
  return this.bridges.polynetwork;
510
570
  case blockchain_1.BRIDGE_IDS.ibc:
511
571
  return this.bridges.ibc;
572
+ case blockchain_1.BRIDGE_IDS.axelar:
573
+ return this.bridges.axelar;
512
574
  default:
513
575
  return this.bridges.polynetwork;
514
576
  }
@@ -1,3 +1,4 @@
1
+ export { default as AxelarBridgeClient } from "./AxelarBridgeClient";
1
2
  export { default as BatchQueryClient } from "./BatchQueryClient";
2
3
  export { default as BlockchainClient } from "./BlockchainClient";
3
4
  export { default as CarbonQueryClient } from "./CarbonQueryClient";
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ZILClient = exports.TokenClient = exports.NEOClient = exports.InsightsQueryClient = exports.HydrogenClient = exports.ETHClient = exports.CarbonQueryClient = exports.BlockchainClient = exports.BatchQueryClient = void 0;
6
+ exports.ZILClient = exports.TokenClient = exports.NEOClient = exports.InsightsQueryClient = exports.HydrogenClient = exports.ETHClient = exports.CarbonQueryClient = exports.BlockchainClient = exports.BatchQueryClient = exports.AxelarBridgeClient = void 0;
7
+ var AxelarBridgeClient_1 = require("./AxelarBridgeClient");
8
+ Object.defineProperty(exports, "AxelarBridgeClient", { enumerable: true, get: function () { return __importDefault(AxelarBridgeClient_1).default; } });
7
9
  var BatchQueryClient_1 = require("./BatchQueryClient");
8
10
  Object.defineProperty(exports, "BatchQueryClient", { enumerable: true, get: function () { return __importDefault(BatchQueryClient_1).default; } });
9
11
  var BlockchainClient_1 = require("./BlockchainClient");
@@ -3,8 +3,6 @@ import _m0 from "protobufjs/minimal";
3
3
  export declare const protobufPackage = "Switcheo.carbon.cdp";
4
4
  export interface AssetParams {
5
5
  denom: string;
6
- /** deprecated: oracle_id is now on pricing */
7
- oracleId: string;
8
6
  rateStrategyName: string;
9
7
  allowRepayStablecoinInterest: boolean;
10
8
  loanToValue: string;
@@ -11,7 +11,6 @@ const wrappers_1 = require("../../../google/protobuf/wrappers");
11
11
  exports.protobufPackage = "Switcheo.carbon.cdp";
12
12
  const baseAssetParams = {
13
13
  denom: "",
14
- oracleId: "",
15
14
  rateStrategyName: "",
16
15
  allowRepayStablecoinInterest: false,
17
16
  loanToValue: "",
@@ -25,9 +24,6 @@ exports.AssetParams = {
25
24
  if (message.denom !== "") {
26
25
  writer.uint32(10).string(message.denom);
27
26
  }
28
- if (message.oracleId !== "") {
29
- writer.uint32(18).string(message.oracleId);
30
- }
31
27
  if (message.rateStrategyName !== "") {
32
28
  writer.uint32(26).string(message.rateStrategyName);
33
29
  }
@@ -61,9 +57,6 @@ exports.AssetParams = {
61
57
  case 1:
62
58
  message.denom = reader.string();
63
59
  break;
64
- case 2:
65
- message.oracleId = reader.string();
66
- break;
67
60
  case 3:
68
61
  message.rateStrategyName = reader.string();
69
62
  break;
@@ -98,10 +91,6 @@ exports.AssetParams = {
98
91
  object.denom !== undefined && object.denom !== null
99
92
  ? String(object.denom)
100
93
  : "";
101
- message.oracleId =
102
- object.oracleId !== undefined && object.oracleId !== null
103
- ? String(object.oracleId)
104
- : "";
105
94
  message.rateStrategyName =
106
95
  object.rateStrategyName !== undefined && object.rateStrategyName !== null
107
96
  ? String(object.rateStrategyName)
@@ -138,7 +127,6 @@ exports.AssetParams = {
138
127
  toJSON(message) {
139
128
  const obj = {};
140
129
  message.denom !== undefined && (obj.denom = message.denom);
141
- message.oracleId !== undefined && (obj.oracleId = message.oracleId);
142
130
  message.rateStrategyName !== undefined &&
143
131
  (obj.rateStrategyName = message.rateStrategyName);
144
132
  message.allowRepayStablecoinInterest !== undefined &&
@@ -154,18 +142,17 @@ exports.AssetParams = {
154
142
  return obj;
155
143
  },
156
144
  fromPartial(object) {
157
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
145
+ var _a, _b, _c, _d, _e, _f, _g, _h;
158
146
  const message = Object.assign({}, baseAssetParams);
159
147
  message.denom = (_a = object.denom) !== null && _a !== void 0 ? _a : "";
160
- message.oracleId = (_b = object.oracleId) !== null && _b !== void 0 ? _b : "";
161
- message.rateStrategyName = (_c = object.rateStrategyName) !== null && _c !== void 0 ? _c : "";
148
+ message.rateStrategyName = (_b = object.rateStrategyName) !== null && _b !== void 0 ? _b : "";
162
149
  message.allowRepayStablecoinInterest =
163
- (_d = object.allowRepayStablecoinInterest) !== null && _d !== void 0 ? _d : false;
164
- message.loanToValue = (_e = object.loanToValue) !== null && _e !== void 0 ? _e : "";
165
- message.liquidationThreshold = (_f = object.liquidationThreshold) !== null && _f !== void 0 ? _f : "";
166
- message.liquidationDiscount = (_g = object.liquidationDiscount) !== null && _g !== void 0 ? _g : "";
167
- message.supplyCap = (_h = object.supplyCap) !== null && _h !== void 0 ? _h : "";
168
- message.borrowCap = (_j = object.borrowCap) !== null && _j !== void 0 ? _j : "";
150
+ (_c = object.allowRepayStablecoinInterest) !== null && _c !== void 0 ? _c : false;
151
+ message.loanToValue = (_d = object.loanToValue) !== null && _d !== void 0 ? _d : "";
152
+ message.liquidationThreshold = (_e = object.liquidationThreshold) !== null && _e !== void 0 ? _e : "";
153
+ message.liquidationDiscount = (_f = object.liquidationDiscount) !== null && _f !== void 0 ? _f : "";
154
+ message.supplyCap = (_g = object.supplyCap) !== null && _g !== void 0 ? _g : "";
155
+ message.borrowCap = (_h = object.borrowCap) !== null && _h !== void 0 ? _h : "";
169
156
  return message;
170
157
  },
171
158
  };
@@ -3,6 +3,6 @@ export { NewTokenEvent, SyncTokenEvent, BindTokenEvent, UnbindTokenEvent, LinkTo
3
3
  export { GenesisState_WrapperMappingsEntry } from "./genesis";
4
4
  export { TokenGroup, TokenGroupDetails, GroupedTokenConfig } from "./group";
5
5
  export { CreateTokenProposal } from "./proposal";
6
- export { QueryGetTokenRequest, QueryGetTokenResponse, QueryAllTokenRequest, QueryAllTokenResponse, QueryGetLockedCoinsRequest, QueryGetLockedCoinsResponse, QueryAllWrapperMappingsRequest, QueryAllWrapperMappingsResponse, QueryAllWrapperMappingsResponse_WrapperMappingsEntry, QueryGetBalancesRequest, QueryGetBalancesResponse, QueryTotalBalancesRequest, QueryTotalBalancesResponse, QueryGetBridgeRequest, QueryGetBridgeResponse, QueryAllBridgeRequest, QueryAllBridgeResponse, QueryGetTokenGroupRequest, QueryGetTokenGroupResponse, QueryAllTokenGroupsRequest, QueryAllTokenGroupsResponse, QueryTokenGroupMappingsRequest, QueryTokenGroupMappingsResponse, QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry } from "./query";
6
+ export { QueryGetTokenRequest, QueryGetTokenResponse, QueryAllTokenRequest, QueryAllTokenResponse, QueryGetLockedCoinsRequest, QueryGetLockedCoinsResponse, QueryAllWrapperMappingsRequest, QueryAllWrapperMappingsResponse, QueryAllWrapperMappingsResponse_WrapperMappingsEntry, QueryGetBalancesRequest, QueryGetBalancesResponse, QueryTotalBalancesRequest, QueryTotalBalancesResponse, QueryGetBridgeRequest, QueryGetBridgeResponse, QueryAllBridgeRequest, QueryAllBridgeResponse, QueryGetTokenGroupRequest, QueryGetTokenGroupResponse, QueryAllTokenGroupsRequest, QueryAllTokenGroupsResponse, QueryTokenGroupMappingsRequest, QueryTokenGroupMappingsResponse, QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry, QueryPolyBlacklistRequest, QueryPolyBlacklistResponse } from "./query";
7
7
  export { Token, BalanceChange, Metadata, LockedCoins, LockedCoinsRecord, PositionPool, TokenBalance } from "./token";
8
- export { MsgCreateToken, CreateTokenParams, MsgCreateTokenResponse, MsgSyncToken, MsgSyncTokenResponse, MsgMintToken, MsgMintTokenResponse, MsgBindToken, MsgBindTokenResponse, MsgUnbindToken, MsgUnbindTokenResponse, MsgLinkToken, MsgLinkTokenResponse, MsgWithdraw, MsgWithdrawResponse, MsgAuthorizeBridge, MsgAuthorizeBridgeResponse, MsgDeauthorizeBridge, MsgDeauthorizeBridgeResponse, MsgEditBridgeName, MsgEditBridgeNameResponse, MsgRemoveBridge, MsgRemoveBridgeResponse, MsgUpdateToken, UpdateTokenParams, MsgUpdateTokenResponse, MsgAddBridgeAddress, MsgAddBridgeAddressResponse, MsgRemoveBridgeAddress, MsgRemoveBridgeAddressResponse, MsgCreateGroup, MsgCreateGroupResponse, MsgUpdateGroup, UpdateGroupParams, MsgUpdateGroupResponse, MsgRegisterToGroup, MsgRegisterToGroupResponse, MsgDeregisterFromGroup, MsgDeregisterFromGroupResponse, MsgDepositToGroup, MsgDepositToGroupResponse, MsgWithdrawFromGroup, MsgWithdrawFromGroupResponse, MsgUpdateGroupedTokenConfig, UpdateGroupedTokenConfigParams, MsgUpdateGroupedTokenConfigResponse } from "./tx";
8
+ export { MsgCreateToken, CreateTokenParams, MsgCreateTokenResponse, MsgSyncToken, MsgSyncTokenResponse, MsgMintToken, MsgMintTokenResponse, MsgBindToken, MsgBindTokenResponse, MsgUnbindToken, MsgUnbindTokenResponse, MsgLinkToken, MsgLinkTokenResponse, MsgWithdraw, MsgWithdrawResponse, MsgAdminWithdraw, MsgAdminWithdrawResponse, MsgAuthorizeBridge, MsgAuthorizeBridgeResponse, MsgDeauthorizeBridge, MsgDeauthorizeBridgeResponse, MsgEditBridgeName, MsgEditBridgeNameResponse, MsgRemoveBridge, MsgRemoveBridgeResponse, MsgUpdateToken, UpdateTokenParams, MsgUpdateTokenResponse, MsgAddBridgeAddress, MsgAddBridgeAddressResponse, MsgRemoveBridgeAddress, MsgRemoveBridgeAddressResponse, MsgCreateGroup, MsgCreateGroupResponse, MsgUpdateGroup, UpdateGroupParams, MsgUpdateGroupResponse, MsgRegisterToGroup, MsgRegisterToGroupResponse, MsgDeregisterFromGroup, MsgDeregisterFromGroupResponse, MsgDepositToGroup, MsgDepositToGroupResponse, MsgWithdrawFromGroup, MsgWithdrawFromGroupResponse, MsgUpdateGroupedTokenConfig, UpdateGroupedTokenConfigParams, MsgUpdateGroupedTokenConfigResponse } from "./tx";