carbon-js-sdk 0.3.53-dev.1 → 0.3.53-dev.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.
Files changed (125) hide show
  1. package/lib/clients/CarbonQueryClient.d.ts +6 -0
  2. package/lib/clients/CarbonQueryClient.js +36 -30
  3. package/lib/clients/ETHClient.js +15 -15
  4. package/lib/clients/HydrogenClient.js +1 -1
  5. package/lib/clients/NEOClient.js +7 -7
  6. package/lib/clients/TokenClient.d.ts +4 -2
  7. package/lib/clients/TokenClient.js +68 -4
  8. package/lib/clients/ZILClient.js +17 -17
  9. package/lib/codec/broker/amm.d.ts +1 -0
  10. package/lib/codec/broker/amm.js +15 -1
  11. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  12. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  13. package/lib/codec/cosmos/tx/v1beta1/tx.js +2 -2
  14. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.d.ts +39 -0
  15. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.js +138 -0
  16. package/lib/codec/ethermint/evm/v1/events.d.ts +72 -0
  17. package/lib/codec/ethermint/evm/v1/events.js +303 -0
  18. package/lib/codec/ethermint/evm/v1/evm.d.ts +239 -0
  19. package/lib/codec/ethermint/evm/v1/evm.js +1140 -0
  20. package/lib/codec/ethermint/evm/v1/genesis.d.ts +43 -0
  21. package/lib/codec/ethermint/evm/v1/genesis.js +153 -0
  22. package/lib/codec/ethermint/evm/v1/query.d.ts +424 -0
  23. package/lib/codec/ethermint/evm/v1/query.js +1637 -0
  24. package/lib/codec/ethermint/evm/v1/tx.d.ts +219 -0
  25. package/lib/codec/ethermint/evm/v1/tx.js +935 -0
  26. package/lib/codec/ethermint/feemarket/v1/events.d.ts +34 -0
  27. package/lib/codec/ethermint/feemarket/v1/events.js +116 -0
  28. package/lib/codec/ethermint/feemarket/v1/feemarket.d.ts +51 -0
  29. package/lib/codec/ethermint/feemarket/v1/feemarket.js +176 -0
  30. package/lib/codec/ethermint/feemarket/v1/genesis.d.ts +26 -0
  31. package/lib/codec/ethermint/feemarket/v1/genesis.js +79 -0
  32. package/lib/codec/ethermint/feemarket/v1/query.d.ts +100 -0
  33. package/lib/codec/ethermint/feemarket/v1/query.js +276 -0
  34. package/lib/codec/ethermint/feemarket/v1/tx.d.ts +55 -0
  35. package/lib/codec/ethermint/feemarket/v1/tx.js +120 -0
  36. package/lib/codec/ethermint/types/v1/account.d.ts +26 -0
  37. package/lib/codec/ethermint/types/v1/account.js +78 -0
  38. package/lib/codec/ethermint/types/v1/dynamic_fee.d.ts +20 -0
  39. package/lib/codec/ethermint/types/v1/dynamic_fee.js +60 -0
  40. package/lib/codec/ethermint/types/v1/indexer.d.ts +41 -0
  41. package/lib/codec/ethermint/types/v1/indexer.js +153 -0
  42. package/lib/codec/ethermint/types/v1/web3.d.ts +36 -0
  43. package/lib/codec/ethermint/types/v1/web3.js +124 -0
  44. package/lib/codec/evmbank/genesis.d.ts +32 -0
  45. package/lib/codec/evmbank/genesis.js +152 -0
  46. package/lib/codec/evmbank/query.d.ts +40 -0
  47. package/lib/codec/evmbank/query.js +116 -0
  48. package/lib/codec/evmmerge/event.d.ts +20 -0
  49. package/lib/codec/evmmerge/event.js +90 -0
  50. package/lib/codec/evmmerge/genesis.d.ts +48 -0
  51. package/lib/codec/evmmerge/genesis.js +216 -0
  52. package/lib/codec/evmmerge/offchain.d.ts +22 -0
  53. package/lib/codec/evmmerge/offchain.js +105 -0
  54. package/lib/codec/evmmerge/query.d.ts +43 -0
  55. package/lib/codec/evmmerge/query.js +117 -0
  56. package/lib/codec/evmmerge/tx.d.ts +45 -0
  57. package/lib/codec/evmmerge/tx.js +128 -0
  58. package/lib/codec/index.d.ts +14 -10
  59. package/lib/codec/index.js +52 -27
  60. package/lib/codec/liquiditypool/event.d.ts +12 -0
  61. package/lib/codec/liquiditypool/event.js +74 -1
  62. package/lib/codec/liquiditypool/genesis.d.ts +2 -1
  63. package/lib/codec/liquiditypool/genesis.js +17 -2
  64. package/lib/codec/liquiditypool/liquiditypool.d.ts +40 -0
  65. package/lib/codec/liquiditypool/liquiditypool.js +320 -2
  66. package/lib/codec/liquiditypool/proposal.d.ts +37 -1
  67. package/lib/codec/liquiditypool/proposal.js +229 -1
  68. package/lib/codec/liquiditypool/query.d.ts +85 -24
  69. package/lib/codec/liquiditypool/query.js +338 -23
  70. package/lib/codec/liquiditypool/tx.d.ts +101 -46
  71. package/lib/codec/liquiditypool/tx.js +638 -309
  72. package/lib/codec/order/order.d.ts +1 -0
  73. package/lib/codec/order/order.js +45 -1
  74. package/lib/constant/generic.js +1 -1
  75. package/lib/modules/admin.d.ts +0 -2
  76. package/lib/modules/admin.js +0 -26
  77. package/lib/modules/cdp.js +43 -43
  78. package/lib/modules/coin.d.ts +19 -0
  79. package/lib/modules/coin.js +39 -0
  80. package/lib/modules/cosmwasm.js +1 -1
  81. package/lib/modules/gov.js +12 -26
  82. package/lib/modules/liquiditypool.d.ts +11 -2
  83. package/lib/modules/liquiditypool.js +34 -3
  84. package/lib/modules/market.d.ts +11 -0
  85. package/lib/modules/market.js +19 -0
  86. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  87. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  88. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  89. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  90. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  91. package/lib/provider/amino/types/admin.js +28 -32
  92. package/lib/provider/amino/types/bank.js +1 -1
  93. package/lib/provider/amino/types/broker.js +1 -1
  94. package/lib/provider/amino/types/cdp.js +22 -22
  95. package/lib/provider/amino/types/coin.js +4 -4
  96. package/lib/provider/amino/types/gov.js +4 -40
  97. package/lib/provider/amino/types/ibc.js +1 -1
  98. package/lib/provider/amino/types/leverage.js +1 -1
  99. package/lib/provider/amino/types/liquidityPool.js +7 -9
  100. package/lib/provider/amino/types/market.js +1 -1
  101. package/lib/provider/amino/types/oracle.js +1 -1
  102. package/lib/provider/amino/types/order.js +4 -4
  103. package/lib/provider/amino/types/position.js +1 -1
  104. package/lib/provider/amino/types/profile.js +1 -1
  105. package/lib/provider/amino/types/staking.js +4 -4
  106. package/lib/provider/amino/types/subaccount.js +3 -3
  107. package/lib/provider/amino/utils.js +11 -11
  108. package/lib/provider/ledger/ledger.js +2 -2
  109. package/lib/provider/metamask/MetaMask.js +1 -1
  110. package/lib/provider/o3/O3Wallet.js +2 -2
  111. package/lib/util/address.js +13 -13
  112. package/lib/util/api.js +4 -4
  113. package/lib/util/blockchain.d.ts +4 -1
  114. package/lib/util/fetch.js +1 -1
  115. package/lib/util/generic.js +3 -3
  116. package/lib/util/gov.d.ts +0 -2
  117. package/lib/util/gov.js +0 -6
  118. package/lib/util/number.js +5 -5
  119. package/lib/util/tx.d.ts +9 -4
  120. package/lib/wallet/CarbonSigner.js +2 -2
  121. package/lib/wallet/CarbonSigningClient.js +8 -8
  122. package/lib/wallet/CarbonWallet.js +6 -6
  123. package/lib/websocket/connector.js +3 -3
  124. package/lib/websocket/models.d.ts +7 -2
  125. package/package.json +1 -1
@@ -19,6 +19,9 @@ import { QueryClientImpl as HeadersyncQueryClient } from "../codec/headersync/qu
19
19
  import { QueryClientImpl as IBCInterchainControlQueryClient } from "../codec/ibc/applications/interchain_accounts/controller/v1/query";
20
20
  import { QueryClientImpl as IBCInterchainHostQueryClient } from "../codec/ibc/applications/interchain_accounts/host/v1/query";
21
21
  import { QueryClientImpl as IBCTransferQueryClient } from "../codec/ibc/applications/transfer/v1/query";
22
+ import { QueryClientImpl as IBCClientQueryClient } from "../codec/ibc/core/client/v1/query";
23
+ import { QueryClientImpl as IBCConnectionQueryClient } from "../codec/ibc/core/connection/v1/query";
24
+ import { QueryClientImpl as IBCChannelQueryClient } from "../codec/ibc/core/channel/v1/query";
22
25
  import { QueryClientImpl as InflationQueryClient } from "../codec/inflation/query";
23
26
  import { QueryClientImpl as InsuranceQueryClient } from "../codec/insurance/query";
24
27
  import { QueryClientImpl as LeverageQueryClient } from "../codec/leverage/query";
@@ -39,6 +42,9 @@ export interface IBCClientGroup {
39
42
  controller: IBCInterchainControlQueryClient;
40
43
  host: IBCInterchainHostQueryClient;
41
44
  transfer: IBCTransferQueryClient;
45
+ client: IBCClientQueryClient;
46
+ connection: IBCConnectionQueryClient;
47
+ channel: IBCChannelQueryClient;
42
48
  }
43
49
  declare class CarbonQueryClient {
44
50
  private readonly tmClient;
@@ -24,27 +24,30 @@ const query_18 = require("../codec/headersync/query");
24
24
  const query_19 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
25
25
  const query_20 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
26
26
  const query_21 = require("../codec/ibc/applications/transfer/v1/query");
27
- const query_22 = require("../codec/inflation/query");
28
- const query_23 = require("../codec/insurance/query");
29
- const query_24 = require("../codec/leverage/query");
30
- const query_25 = require("../codec/liquidation/query");
31
- const query_26 = require("../codec/liquiditypool/query");
32
- const query_27 = require("../codec/market/query");
33
- const query_28 = require("../codec/marketstats/query");
34
- const query_29 = require("../codec/misc/query");
35
- const query_30 = require("../codec/oracle/query");
36
- const query_31 = require("../codec/order/query");
37
- const query_32 = require("../codec/position/query");
38
- const query_33 = require("../codec/pricing/query");
39
- const query_34 = require("../codec/profile/query");
40
- const query_35 = require("../codec/subaccount/query");
27
+ const query_22 = require("../codec/ibc/core/client/v1/query");
28
+ const query_23 = require("../codec/ibc/core/connection/v1/query");
29
+ const query_24 = require("../codec/ibc/core/channel/v1/query");
30
+ const query_25 = require("../codec/inflation/query");
31
+ const query_26 = require("../codec/insurance/query");
32
+ const query_27 = require("../codec/leverage/query");
33
+ const query_28 = require("../codec/liquidation/query");
34
+ const query_29 = require("../codec/liquiditypool/query");
35
+ const query_30 = require("../codec/market/query");
36
+ const query_31 = require("../codec/marketstats/query");
37
+ const query_32 = require("../codec/misc/query");
38
+ const query_33 = require("../codec/oracle/query");
39
+ const query_34 = require("../codec/order/query");
40
+ const query_35 = require("../codec/position/query");
41
+ const query_36 = require("../codec/pricing/query");
42
+ const query_37 = require("../codec/profile/query");
43
+ const query_38 = require("../codec/subaccount/query");
41
44
  const stargate_1 = require("@cosmjs/stargate");
42
45
  const BlockchainClient_1 = __importDefault(require("./BlockchainClient"));
43
46
  class CarbonQueryClient {
44
47
  constructor(tmClient) {
45
48
  this.tmClient = tmClient;
46
49
  this.baseClient = new stargate_1.QueryClient(this.tmClient);
47
- const rpcClient = stargate_1.createProtobufRpcClient(this.baseClient);
50
+ const rpcClient = (0, stargate_1.createProtobufRpcClient)(this.baseClient);
48
51
  this.chain = BlockchainClient_1.default.connectWithTm(this.tmClient);
49
52
  this.adl = new query_1.QueryClientImpl(rpcClient);
50
53
  this.book = new query_2.QueryClientImpl(rpcClient);
@@ -52,20 +55,20 @@ class CarbonQueryClient {
52
55
  this.coin = new query_5.QueryClientImpl(rpcClient);
53
56
  this.cdp = new query_4.QueryClientImpl(rpcClient);
54
57
  this.fee = new query_17.QueryClientImpl(rpcClient);
55
- this.inflation = new query_22.QueryClientImpl(rpcClient);
56
- this.insurance = new query_23.QueryClientImpl(rpcClient);
57
- this.leverage = new query_24.QueryClientImpl(rpcClient);
58
- this.liquidation = new query_25.QueryClientImpl(rpcClient);
59
- this.liquiditypool = new query_26.QueryClientImpl(rpcClient);
60
- this.market = new query_27.QueryClientImpl(rpcClient);
61
- this.marketstats = new query_28.QueryClientImpl(rpcClient);
62
- this.misc = new query_29.QueryClientImpl(rpcClient);
63
- this.oracle = new query_30.QueryClientImpl(rpcClient);
64
- this.order = new query_31.QueryClientImpl(rpcClient);
65
- this.position = new query_32.QueryClientImpl(rpcClient);
66
- this.pricing = new query_33.QueryClientImpl(rpcClient);
67
- this.profile = new query_34.QueryClientImpl(rpcClient);
68
- this.subaccount = new query_35.QueryClientImpl(rpcClient);
58
+ this.inflation = new query_25.QueryClientImpl(rpcClient);
59
+ this.insurance = new query_26.QueryClientImpl(rpcClient);
60
+ this.leverage = new query_27.QueryClientImpl(rpcClient);
61
+ this.liquidation = new query_28.QueryClientImpl(rpcClient);
62
+ this.liquiditypool = new query_29.QueryClientImpl(rpcClient);
63
+ this.market = new query_30.QueryClientImpl(rpcClient);
64
+ this.marketstats = new query_31.QueryClientImpl(rpcClient);
65
+ this.misc = new query_32.QueryClientImpl(rpcClient);
66
+ this.oracle = new query_33.QueryClientImpl(rpcClient);
67
+ this.order = new query_34.QueryClientImpl(rpcClient);
68
+ this.position = new query_35.QueryClientImpl(rpcClient);
69
+ this.pricing = new query_36.QueryClientImpl(rpcClient);
70
+ this.profile = new query_37.QueryClientImpl(rpcClient);
71
+ this.subaccount = new query_38.QueryClientImpl(rpcClient);
69
72
  this.headersync = new query_18.QueryClientImpl(rpcClient);
70
73
  this.auth = new query_6.QueryClientImpl(rpcClient);
71
74
  this.bank = new query_7.QueryClientImpl(rpcClient);
@@ -82,10 +85,13 @@ class CarbonQueryClient {
82
85
  controller: new query_19.QueryClientImpl(rpcClient),
83
86
  host: new query_20.QueryClientImpl(rpcClient),
84
87
  transfer: new query_21.QueryClientImpl(rpcClient),
88
+ client: new query_22.QueryClientImpl(rpcClient),
89
+ connection: new query_23.QueryClientImpl(rpcClient),
90
+ channel: new query_24.QueryClientImpl(rpcClient),
85
91
  };
86
92
  }
87
93
  getProtobufRpcClient() {
88
- return stargate_1.createProtobufRpcClient(this.baseClient);
94
+ return (0, stargate_1.createProtobufRpcClient)(this.baseClient);
89
95
  }
90
96
  }
91
97
  exports.default = CarbonQueryClient;
@@ -44,15 +44,15 @@ class ETHClient {
44
44
  ?
45
45
  this.tokenClient.getBlockchainV2(token.denom) == ETHClient.BLOCKCHAINV2_MAPPING[this.blockchain]
46
46
  :
47
- blockchain_1.blockchainForChainId(token.chainId.toNumber(), api.network) == this.blockchain;
47
+ (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), api.network) == this.blockchain;
48
48
  return isCorrectBlockchain &&
49
49
  token.tokenAddress.length == 40 &&
50
- token.bridgeAddress.toLowerCase() == generic_1.stripHexPrefix(lockProxyAddress) &&
50
+ token.bridgeAddress.toLowerCase() == (0, generic_1.stripHexPrefix)(lockProxyAddress) &&
51
51
  (!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
52
- this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress));
52
+ this.verifyChecksum((0, generic_1.appendHexPrefix)(token.tokenAddress));
53
53
  });
54
54
  const assetIds = tokens.map((token) => {
55
- return this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress));
55
+ return this.verifyChecksum((0, generic_1.appendHexPrefix)(token.tokenAddress));
56
56
  });
57
57
  const provider = this.getProvider();
58
58
  const contractAddress = this.getBalanceReaderAddress();
@@ -103,14 +103,14 @@ class ETHClient {
103
103
  }
104
104
  const carbonNetwork = networkConfig.network;
105
105
  const fromTokenId = fromToken.id;
106
- const fromTokenAddress = generic_1.appendHexPrefix(fromToken.tokenAddress);
106
+ const fromTokenAddress = (0, generic_1.appendHexPrefix)(fromToken.tokenAddress);
107
107
  const toTokenDenom = toToken.denom;
108
108
  const recoveryAddressHex = ethers_1.ethers.utils.hexlify(util_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, carbonNetwork));
109
109
  const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
110
110
  const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
111
111
  const nonce = yield rpcProvider.getTransactionCount(fromAddress);
112
112
  const contract = new ethers_1.ethers.Contract(this.getBridgeEntranceAddr(), eth_1.ABIs.bridgeEntrance, rpcProvider);
113
- const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
113
+ const feeAddress = (0, generic_1.appendHexPrefix)(networkConfig.feeAddress);
114
114
  const tokenCreator = fromToken.creator;
115
115
  const targetAddressBytes = util_1.AddressUtils.SWTHAddress.getAddressBytes(tokenCreator, carbonNetwork);
116
116
  const targetProxyHash = ethers_1.ethers.utils.hexlify(targetAddressBytes);
@@ -145,9 +145,9 @@ class ETHClient {
145
145
  throw new Error("Minimum gas required: 150,000");
146
146
  }
147
147
  const networkConfig = this.getNetworkConfig();
148
- const assetId = generic_1.appendHexPrefix(token.tokenAddress);
149
- const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
150
- const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
148
+ const assetId = (0, generic_1.appendHexPrefix)(token.tokenAddress);
149
+ const targetProxyHash = (0, generic_1.appendHexPrefix)(this.getTargetProxyHash(token));
150
+ const feeAddress = (0, generic_1.appendHexPrefix)(networkConfig.feeAddress);
151
151
  const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
152
152
  const swthAddress = ethers_1.ethers.utils.hexlify(address);
153
153
  const contractAddress = this.getLockProxyAddress();
@@ -198,16 +198,16 @@ class ETHClient {
198
198
  return "insufficient balance";
199
199
  }
200
200
  const networkConfig = this.getNetworkConfig();
201
- const assetId = generic_1.appendHexPrefix(tokenWithExternalBalances.tokenAddress);
202
- const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(tokenWithExternalBalances));
203
- const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
201
+ const assetId = (0, generic_1.appendHexPrefix)(tokenWithExternalBalances.tokenAddress);
202
+ const targetProxyHash = (0, generic_1.appendHexPrefix)(this.getTargetProxyHash(tokenWithExternalBalances));
203
+ const feeAddress = (0, generic_1.appendHexPrefix)(networkConfig.feeAddress);
204
204
  const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(tokenWithExternalBalances.id));
205
205
  const nonce = Math.floor(Math.random() * 1000000000); // random nonce to prevent replay attacks
206
206
  const message = ethers_1.ethers.utils.solidityKeccak256(["string", "address", "bytes", "bytes", "bytes", "uint256", "uint256", "uint256"], ["sendTokens", assetId, targetProxyHash, toAssetHash, feeAddress, amount, feeAmount, nonce]);
207
207
  // logger("sendDeposit message", message)
208
208
  let signatureResult;
209
209
  const { address, signature } = yield getSignatureCallback(message);
210
- const signatureBytes = ethers_1.ethers.utils.arrayify(generic_1.appendHexPrefix(signature));
210
+ const signatureBytes = ethers_1.ethers.utils.arrayify((0, generic_1.appendHexPrefix)(signature));
211
211
  const rsv = ethers_1.ethers.utils.splitSignature(signatureBytes);
212
212
  // logger("sign result", address, signature)
213
213
  signatureResult = {
@@ -246,7 +246,7 @@ class ETHClient {
246
246
  if (!feeInfo.deposit_fee) {
247
247
  throw new Error("unsupported token");
248
248
  }
249
- if (blockchain_1.blockchainForChainId(token.chainId.toNumber(), this.configProvider.getConfig().network) !== this.blockchain) {
249
+ if ((0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), this.configProvider.getConfig().network) !== this.blockchain) {
250
250
  throw new Error("unsupported token");
251
251
  }
252
252
  let feeAmount = ethers_1.ethers.BigNumber.from(feeInfo.deposit_fee);
@@ -312,7 +312,7 @@ class ETHClient {
312
312
  getTargetProxyHash(token) {
313
313
  const networkConfig = this.getNetworkConfig();
314
314
  const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
315
- const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
315
+ const addressHex = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(addressBytes));
316
316
  return addressHex;
317
317
  }
318
318
  getProvider() {
@@ -29,7 +29,7 @@ exports.HydrogenEndpoints = {
29
29
  const formatDateField = (value) => {
30
30
  if (typeof value !== "string")
31
31
  return null;
32
- return dayjs_1.default(value);
32
+ return (0, dayjs_1.default)(value);
33
33
  };
34
34
  const formatCrossChainTransfer = (value) => {
35
35
  var _a, _b;
@@ -69,13 +69,13 @@ class NEOClient {
69
69
  ?
70
70
  sdk.token.getBlockchainV2(token.denom) == this.blockchain
71
71
  :
72
- blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain;
72
+ (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain;
73
73
  return isCorrectBlockchain && token.tokenAddress.length == 40 && token.bridgeAddress.length == 40;
74
74
  });
75
75
  const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
76
76
  // NOTE: fetching of tokens is chunked in sets of 15 as we may hit
77
77
  // the gas limit on the RPC node and error out otherwise
78
- const promises = lodash_1.chunk(tokens, 75).map((partition) => __awaiter(this, void 0, void 0, function* () {
78
+ const promises = (0, lodash_1.chunk)(tokens, 75).map((partition) => __awaiter(this, void 0, void 0, function* () {
79
79
  var _a, _b, _c;
80
80
  let acc = {};
81
81
  for (const token of partition) {
@@ -117,8 +117,8 @@ class NEOClient {
117
117
  const targetProxyHash = this.getTargetProxyHash(token);
118
118
  const toAssetHash = Neon.u.str2hexstring(token.id);
119
119
  const addressBytes = address_1.SWTHAddress.getAddressBytes(swthAddress, networkConfig.network);
120
- const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
121
- const zeroAddressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(constant_1.ZeroAddress));
120
+ const toAddress = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(addressBytes));
121
+ const zeroAddressHex = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(constant_1.ZeroAddress));
122
122
  const amount = ethers_1.ethers.BigNumber.from(token.externalBalance);
123
123
  const feeAmount = ethers_1.ethers.BigNumber.from(feeAmountInput !== null && feeAmountInput !== void 0 ? feeAmountInput : "100000000");
124
124
  const feeAddress = feeAmount.isZero() ? zeroAddressHex : networkConfig.feeAddress;
@@ -165,7 +165,7 @@ class NEOClient {
165
165
  const fromAddress = util_1.AddressUtils.NEOAddress.publicKeyToAddress(publicKeyOutput.publicKey);
166
166
  const targetProxyHash = this.getTargetProxyHash(token);
167
167
  const toAssetHash = Neon.u.str2hexstring(token.id);
168
- const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
168
+ const toAddress = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(address));
169
169
  const nonce = Math.floor(Math.random() * 1000000);
170
170
  if (amount.lt(feeAmount)) {
171
171
  throw new Error("Invalid amount");
@@ -201,7 +201,7 @@ class NEOClient {
201
201
  const fromAddress = ledger.scriptHash;
202
202
  const targetProxyHash = this.getTargetProxyHash(token);
203
203
  const toAssetHash = Neon.u.str2hexstring(token.id);
204
- const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
204
+ const toAddress = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(address));
205
205
  const feeAddress = networkConfig.feeAddress;
206
206
  const nonce = Math.floor(Math.random() * 1000000);
207
207
  if (amount.lt(feeAmount)) {
@@ -321,7 +321,7 @@ class NEOClient {
321
321
  getTargetProxyHash(token) {
322
322
  const networkConfig = this.getNetworkConfig();
323
323
  const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
324
- const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
324
+ const addressHex = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(addressBytes));
325
325
  return addressHex;
326
326
  }
327
327
  getNetworkConfig() {
@@ -4,7 +4,7 @@ import { FeeQuote } from "../hydrogen/feeQuote";
4
4
  import { BlockchainUtils, TypeUtils } from "../util";
5
5
  import BigNumber from "bignumber.js";
6
6
  import CarbonQueryClient from "./CarbonQueryClient";
7
- import { BlockchainV2, BridgeMap } from '../util/blockchain';
7
+ import { BlockchainV2, BridgeMap, ChainIdName } from '../util/blockchain';
8
8
  declare class TokenClient {
9
9
  readonly query: CarbonQueryClient;
10
10
  readonly configProvider: NetworkConfigProvider;
@@ -56,14 +56,16 @@ declare class TokenClient {
56
56
  getAllTokens(): Promise<Token[]>;
57
57
  reloadTokens(): Promise<TypeUtils.SimpleMap<Token>>;
58
58
  getBridges(): Promise<BridgeMap>;
59
+ matchChainsWithDifferentChainIds(bridges: Bridge[]): Promise<(Bridge & ChainIdName)[]>;
59
60
  getIbcBlockchainNames(): string[];
61
+ getIbcChainFromBlockchainV2: (blockchain: BlockchainV2 | undefined) => string | undefined;
60
62
  getPolynetworkBlockchainNames(): string[];
61
63
  getAllBlockchainNames(): string[];
62
64
  getBridgesFromBridgeId(bridgeId: number): Bridge[];
63
65
  getIbcTokens(): TypeUtils.SimpleMap<Token>;
64
66
  getPolyNetworkTokens(): TypeUtils.SimpleMap<Token>;
65
67
  getBlockchainV2FromIDs(chainId: string, bridgeId: string): BlockchainV2 | undefined;
66
- getBridgeFromToken(token: Token): Bridge | undefined;
68
+ getBridgeFromToken(token: Token | undefined): Bridge | undefined;
67
69
  getCarbonIbcTokens(): Token[];
68
70
  getCdpUnderlyingToken(cdpDenom: string): Token | undefined;
69
71
  reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
@@ -21,6 +21,8 @@ const number_1 = require("../util/number");
21
21
  const long_1 = __importDefault(require("long"));
22
22
  const InsightsQueryClient_1 = __importDefault(require("./InsightsQueryClient"));
23
23
  const blockchain_1 = require("../util/blockchain");
24
+ const pagination_1 = require("../codec/cosmos/base/query/v1beta1/pagination");
25
+ const tendermint_1 = require("../codec/ibc/lightclients/tendermint/v1/tendermint");
24
26
  const SYMBOL_OVERRIDE = {
25
27
  swth: "SWTH",
26
28
  NNEO: "nNEO",
@@ -50,6 +52,10 @@ class TokenClient {
50
52
  this.commonAssetNames = constant_1.CommonAssetName;
51
53
  this.geckoTokenNames = constant_1.CoinGeckoTokenNames;
52
54
  this.additionalGeckoDenoms = {};
55
+ this.getIbcChainFromBlockchainV2 = (blockchain) => {
56
+ const ibcBridge = this.bridges.ibc.find(bridge => (bridge.chainName === blockchain || bridge.chainName.toLowerCase() === blockchain));
57
+ return ibcBridge === null || ibcBridge === void 0 ? void 0 : ibcBridge.chain_id_name;
58
+ };
53
59
  }
54
60
  static instance(query, configProvider) {
55
61
  return new TokenClient(query, configProvider);
@@ -328,7 +334,7 @@ class TokenClient {
328
334
  }
329
335
  const isSourceToken = targetChain === chain && token.denom !== "swth";
330
336
  // if not source token find wrapped token for chain
331
- const depositToken = isSourceToken ? token : this.getWrappedToken(token.denom, chain);
337
+ const depositToken = isSourceToken ? token : this.getWrappedToken(token.denom, chain, version);
332
338
  if (!depositToken) {
333
339
  console.error(`getDepositTokenFor wrapped token not found for "${token.denom}"`);
334
340
  return;
@@ -405,11 +411,12 @@ class TokenClient {
405
411
  reverse: false,
406
412
  },
407
413
  });
408
- const ibcBridges = allBridges.bridges.filter(bridge => {
414
+ const unmatchedIbcBridgeList = allBridges.bridges.filter(bridge => {
409
415
  if (!bridge.enabled)
410
416
  return;
411
417
  return bridge.bridgeId.toNumber() === blockchain_1.BRIDGE_IDS.ibc;
412
418
  });
419
+ const ibcBridges = yield this.matchChainsWithDifferentChainIds(unmatchedIbcBridgeList);
413
420
  const polynetworkBridges = allBridges.bridges.filter(bridge => {
414
421
  if (!bridge.enabled)
415
422
  return;
@@ -422,6 +429,63 @@ class TokenClient {
422
429
  return this.bridges;
423
430
  });
424
431
  }
432
+ matchChainsWithDifferentChainIds(bridges) {
433
+ return __awaiter(this, void 0, void 0, function* () {
434
+ let newBridges = [];
435
+ try {
436
+ const channels_to_connection = yield this.query.ibc.channel.Channels({
437
+ pagination: pagination_1.PageRequest.fromPartial({
438
+ limit: new long_1.default(1000000)
439
+ })
440
+ });
441
+ const connection_to_clientId = yield this.query.ibc.connection.Connections({
442
+ pagination: pagination_1.PageRequest.fromPartial({
443
+ limit: new long_1.default(1000000)
444
+ })
445
+ });
446
+ const clientId_to_chainIdName = yield this.query.ibc.client.ClientStates({
447
+ pagination: pagination_1.PageRequest.fromPartial({
448
+ limit: new long_1.default(1000000)
449
+ })
450
+ });
451
+ const clientStates = clientId_to_chainIdName.clientStates.map(s => ({
452
+ clientState: Object.assign({}, tendermint_1.ClientState.decode(s.clientState.value)),
453
+ clientId: s.clientId,
454
+ }));
455
+ newBridges = bridges.map(bridge => {
456
+ var _a, _b, _c, _d;
457
+ const connectionId = (_a = channels_to_connection.channels.find(channel => channel.channelId === ("channel-" + (bridge.chainId.toNumber() - 1)))) === null || _a === void 0 ? void 0 : _a.connectionHops[0];
458
+ const clientId = (_b = connection_to_clientId.connections.find(connection => connection.id === connectionId)) === null || _b === void 0 ? void 0 : _b.clientId;
459
+ const chainIdName = (_d = ((_c = clientStates.find(client => client.clientId === clientId)) === null || _c === void 0 ? void 0 : _c.clientState)) === null || _d === void 0 ? void 0 : _d.chainId;
460
+ return Object.assign(Object.assign({}, bridge), { chain_id_name: chainIdName !== null && chainIdName !== void 0 ? chainIdName : "" });
461
+ });
462
+ }
463
+ finally {
464
+ const checkedBefore = new Array(newBridges.length).fill(false);
465
+ const chainMap = {};
466
+ for (let i = 0; i < newBridges.length; i++) {
467
+ if (checkedBefore[i])
468
+ continue;
469
+ const bridge = newBridges[i];
470
+ const chainId = bridge.chain_id_name;
471
+ if (chainMap[chainId]) {
472
+ const chainName = chainMap[chainId];
473
+ for (let j = i; j < newBridges.length; j++) {
474
+ const subBridge = newBridges[j];
475
+ if (subBridge.chain_id_name === chainId) {
476
+ subBridge.chainName = chainName;
477
+ checkedBefore[j] = true;
478
+ }
479
+ }
480
+ }
481
+ else {
482
+ chainMap[chainId] = bridge.chainName;
483
+ }
484
+ }
485
+ return newBridges;
486
+ }
487
+ });
488
+ }
425
489
  getIbcBlockchainNames() {
426
490
  return this.bridges.ibc.map(bridge => bridge.chainName);
427
491
  }
@@ -471,7 +535,7 @@ class TokenClient {
471
535
  return (_b = (_a = bridgeList.find(bridge => bridge.chainId.toNumber() === chainIdNum)) === null || _a === void 0 ? void 0 : _a.chainName) !== null && _b !== void 0 ? _b : undefined;
472
536
  }
473
537
  getBridgeFromToken(token) {
474
- if (!token.bridgeId)
538
+ if (!token || !token.bridgeId)
475
539
  return undefined;
476
540
  const bridgeList = this.getBridgesFromBridgeId(token.bridgeId.toNumber());
477
541
  return bridgeList.find(bridge => token.chainId.equals(bridge.chainId));
@@ -569,7 +633,7 @@ class TokenClient {
569
633
  processTokenPrices(tokenPrices) {
570
634
  return tokenPrices.reduce((prevPrices, price) => {
571
635
  const newPrev = prevPrices;
572
- newPrev[price.denom] = number_1.bnOrZero(price.twap).shiftedBy(-constant_1.decTypeDecimals);
636
+ newPrev[price.denom] = (0, number_1.bnOrZero)(price.twap).shiftedBy(-constant_1.decTypeDecimals);
573
637
  return newPrev;
574
638
  }, {});
575
639
  }
@@ -77,12 +77,12 @@ class ZILClient {
77
77
  ?
78
78
  sdk.token.getBlockchainV2(token.denom) == this.blockchain
79
79
  :
80
- blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain;
80
+ (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain;
81
81
  return isCorrectBlockchain && token.tokenAddress.length == 40 && (!whitelistDenoms || whitelistDenoms.includes(token.denom));
82
82
  });
83
83
  const requests = tokens.map((token) => token.tokenAddress === zeroAddress
84
- ? exports.balanceBatchRequest(address.replace(/^0x/i, ""))
85
- : exports.tokenBalanceBatchRequest(token.tokenAddress, address));
84
+ ? (0, exports.balanceBatchRequest)(address.replace(/^0x/i, ""))
85
+ : (0, exports.tokenBalanceBatchRequest)(token.tokenAddress, address));
86
86
  const response = yield fetch(this.getProviderUrl(), {
87
87
  method: "post",
88
88
  headers: { "content-type": "application/json" },
@@ -107,7 +107,7 @@ class ZILClient {
107
107
  // if (!isValidAddress) {
108
108
  // throw new Error("invalid address")
109
109
  // }
110
- return zilliqa_1.fromBech32Address(bech32Address).toLowerCase().substr(2);
110
+ return (0, zilliqa_1.fromBech32Address)(bech32Address).toLowerCase().substr(2);
111
111
  });
112
112
  }
113
113
  // see examplesV2/zil_client.ts on how to confirm the transactions
@@ -153,7 +153,7 @@ class ZILClient {
153
153
  zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
154
154
  }
155
155
  const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
156
- const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
156
+ const balanceAndNonceResp = yield zilliqa.blockchain.getBalance((0, generic_1.stripHexPrefix)(zilAddress));
157
157
  if (balanceAndNonceResp.error !== undefined) {
158
158
  throw new Error(balanceAndNonceResp.error.message);
159
159
  }
@@ -171,7 +171,7 @@ class ZILClient {
171
171
  vname: "spender",
172
172
  type: "ByStr20",
173
173
  // TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
174
- value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : generic_1.appendHexPrefix(token.bridgeAddress),
174
+ value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : (0, generic_1.appendHexPrefix)(token.bridgeAddress),
175
175
  },
176
176
  {
177
177
  vname: "amount",
@@ -189,7 +189,7 @@ class ZILClient {
189
189
  }
190
190
  checkAllowanceZRC2(token, owner, spender) {
191
191
  return __awaiter(this, void 0, void 0, function* () {
192
- const contractAddress = generic_1.appendHexPrefix(token.tokenAddress);
192
+ const contractAddress = (0, generic_1.appendHexPrefix)(token.tokenAddress);
193
193
  const zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
194
194
  const resp = yield zilliqa.blockchain.getSmartContractSubState(contractAddress, "allowances", [owner, spender]);
195
195
  if (resp.error !== undefined) {
@@ -211,13 +211,13 @@ class ZILClient {
211
211
  }
212
212
  const carbonNetwork = networkConfig.network;
213
213
  const fromTokenId = fromToken.id;
214
- const fromTokenAddr = generic_1.appendHexPrefix(fromToken.tokenAddress);
214
+ const fromTokenAddr = (0, generic_1.appendHexPrefix)(fromToken.tokenAddress);
215
215
  const toTokenDenom = toToken.denom;
216
- const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(fromToken));
216
+ const targetProxyHash = (0, generic_1.appendHexPrefix)(this.getTargetProxyHash(fromToken));
217
217
  const recoveryAddressHex = ethers_1.ethers.utils.hexlify(index_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, carbonNetwork));
218
218
  const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
219
219
  const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
220
- const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
220
+ const feeAddress = (0, generic_1.appendHexPrefix)(networkConfig.feeAddress);
221
221
  const contractAddress = this.getBridgeEntranceAddr();
222
222
  let zilliqa;
223
223
  if (typeof signer === "string") {
@@ -232,7 +232,7 @@ class ZILClient {
232
232
  zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
233
233
  }
234
234
  const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
235
- const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(fromAddress));
235
+ const balanceAndNonceResp = yield zilliqa.blockchain.getBalance((0, generic_1.stripHexPrefix)(fromAddress));
236
236
  if (balanceAndNonceResp.error !== undefined) {
237
237
  throw new Error(balanceAndNonceResp.error.message);
238
238
  }
@@ -309,13 +309,13 @@ class ZILClient {
309
309
  return __awaiter(this, void 0, void 0, function* () {
310
310
  const { address, amount, token, gasPrice, gasLimit, zilAddress, signer } = params;
311
311
  const networkConfig = this.getNetworkConfig();
312
- const assetId = generic_1.appendHexPrefix(token.tokenAddress);
313
- const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
314
- const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
312
+ const assetId = (0, generic_1.appendHexPrefix)(token.tokenAddress);
313
+ const targetProxyHash = (0, generic_1.appendHexPrefix)(this.getTargetProxyHash(token));
314
+ const feeAddress = (0, generic_1.appendHexPrefix)(networkConfig.feeAddress);
315
315
  const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
316
316
  const swthAddress = ethers_1.ethers.utils.hexlify(address);
317
317
  // TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
318
- const contractAddress = generic_1.appendHexPrefix(token.bridgeAddress);
318
+ const contractAddress = (0, generic_1.appendHexPrefix)(token.bridgeAddress);
319
319
  let zilliqa;
320
320
  if (typeof signer === "string") {
321
321
  zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
@@ -329,7 +329,7 @@ class ZILClient {
329
329
  zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
330
330
  }
331
331
  const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
332
- const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
332
+ const balanceAndNonceResp = yield zilliqa.blockchain.getBalance((0, generic_1.stripHexPrefix)(zilAddress));
333
333
  if (balanceAndNonceResp.error !== undefined) {
334
334
  throw new Error(balanceAndNonceResp.error.message);
335
335
  }
@@ -414,7 +414,7 @@ class ZILClient {
414
414
  getTargetProxyHash(token) {
415
415
  const networkConfig = this.getNetworkConfig();
416
416
  const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
417
- const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
417
+ const addressHex = (0, generic_1.stripHexPrefix)(ethers_1.ethers.utils.hexlify(addressBytes));
418
418
  return addressHex;
419
419
  }
420
420
  getNetworkConfig() {
@@ -6,6 +6,7 @@ export interface Amm {
6
6
  market: string;
7
7
  reservesHash: Uint8Array;
8
8
  orders: string[];
9
+ poolRoute: Uint8Array;
9
10
  }
10
11
  export declare const Amm: {
11
12
  encode(message: Amm, writer?: _m0.Writer): _m0.Writer;
@@ -23,6 +23,9 @@ exports.Amm = {
23
23
  for (const v of message.orders) {
24
24
  writer.uint32(34).string(v);
25
25
  }
26
+ if (message.poolRoute.length !== 0) {
27
+ writer.uint32(42).bytes(message.poolRoute);
28
+ }
26
29
  return writer;
27
30
  },
28
31
  decode(input, length) {
@@ -31,6 +34,7 @@ exports.Amm = {
31
34
  const message = Object.assign({}, baseAmm);
32
35
  message.orders = [];
33
36
  message.reservesHash = new Uint8Array();
37
+ message.poolRoute = new Uint8Array();
34
38
  while (reader.pos < end) {
35
39
  const tag = reader.uint32();
36
40
  switch (tag >>> 3) {
@@ -46,6 +50,9 @@ exports.Amm = {
46
50
  case 4:
47
51
  message.orders.push(reader.string());
48
52
  break;
53
+ case 5:
54
+ message.poolRoute = reader.bytes();
55
+ break;
49
56
  default:
50
57
  reader.skipType(tag & 7);
51
58
  break;
@@ -69,6 +76,10 @@ exports.Amm = {
69
76
  ? bytesFromBase64(object.reservesHash)
70
77
  : new Uint8Array();
71
78
  message.orders = ((_a = object.orders) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
79
+ message.poolRoute =
80
+ object.poolRoute !== undefined && object.poolRoute !== null
81
+ ? bytesFromBase64(object.poolRoute)
82
+ : new Uint8Array();
72
83
  return message;
73
84
  },
74
85
  toJSON(message) {
@@ -86,10 +97,12 @@ exports.Amm = {
86
97
  else {
87
98
  obj.orders = [];
88
99
  }
100
+ message.poolRoute !== undefined &&
101
+ (obj.poolRoute = base64FromBytes(message.poolRoute !== undefined ? message.poolRoute : new Uint8Array()));
89
102
  return obj;
90
103
  },
91
104
  fromPartial(object) {
92
- var _a, _b, _c;
105
+ var _a, _b, _c, _d;
93
106
  const message = Object.assign({}, baseAmm);
94
107
  message.poolId =
95
108
  object.poolId !== undefined && object.poolId !== null
@@ -98,6 +111,7 @@ exports.Amm = {
98
111
  message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
99
112
  message.reservesHash = (_b = object.reservesHash) !== null && _b !== void 0 ? _b : new Uint8Array();
100
113
  message.orders = ((_c = object.orders) !== null && _c !== void 0 ? _c : []).map((e) => e);
114
+ message.poolRoute = (_d = object.poolRoute) !== null && _d !== void 0 ? _d : new Uint8Array();
101
115
  return message;
102
116
  },
103
117
  };
@@ -159,7 +159,7 @@ exports.QueryProposalsRequest = {
159
159
  const message = Object.assign({}, baseQueryProposalsRequest);
160
160
  message.proposalStatus =
161
161
  object.proposalStatus !== undefined && object.proposalStatus !== null
162
- ? gov_1.proposalStatusFromJSON(object.proposalStatus)
162
+ ? (0, gov_1.proposalStatusFromJSON)(object.proposalStatus)
163
163
  : 0;
164
164
  message.voter =
165
165
  object.voter !== undefined && object.voter !== null
@@ -178,7 +178,7 @@ exports.QueryProposalsRequest = {
178
178
  toJSON(message) {
179
179
  const obj = {};
180
180
  message.proposalStatus !== undefined &&
181
- (obj.proposalStatus = gov_1.proposalStatusToJSON(message.proposalStatus));
181
+ (obj.proposalStatus = (0, gov_1.proposalStatusToJSON)(message.proposalStatus));
182
182
  message.voter !== undefined && (obj.voter = message.voter);
183
183
  message.depositor !== undefined && (obj.depositor = message.depositor);
184
184
  message.pagination !== undefined &&
@@ -185,7 +185,7 @@ exports.MsgVote = {
185
185
  : "";
186
186
  message.option =
187
187
  object.option !== undefined && object.option !== null
188
- ? gov_1.voteOptionFromJSON(object.option)
188
+ ? (0, gov_1.voteOptionFromJSON)(object.option)
189
189
  : 0;
190
190
  return message;
191
191
  },
@@ -195,7 +195,7 @@ exports.MsgVote = {
195
195
  (obj.proposalId = (message.proposalId || long_1.default.UZERO).toString());
196
196
  message.voter !== undefined && (obj.voter = message.voter);
197
197
  message.option !== undefined &&
198
- (obj.option = gov_1.voteOptionToJSON(message.option));
198
+ (obj.option = (0, gov_1.voteOptionToJSON)(message.option));
199
199
  return obj;
200
200
  },
201
201
  fromPartial(object) {