carbon-js-sdk 0.4.14 → 0.4.16-beta.1

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 (66) hide show
  1. package/lib/CarbonSDK.d.ts +11 -1
  2. package/lib/CarbonSDK.js +33 -2
  3. package/lib/clients/CarbonQueryClient.d.ts +7 -0
  4. package/lib/clients/CarbonQueryClient.js +50 -44
  5. package/lib/clients/ETHClient.d.ts +4 -4
  6. package/lib/clients/ETHClient.js +4 -14
  7. package/lib/codec/cosmos/group/v1/query.d.ts +41 -0
  8. package/lib/codec/cosmos/group/v1/query.js +124 -1
  9. package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +2 -0
  10. package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +3 -0
  11. package/lib/codec/google/protobuf/any.d.ts +4 -1
  12. package/lib/codec/google/protobuf/timestamp.d.ts +0 -2
  13. package/lib/codec/index.d.ts +10 -0
  14. package/lib/codec/index.js +22507 -338
  15. package/lib/codec/tendermint/abci/types.d.ts +1 -1
  16. package/lib/codec/tendermint/crypto/keys.d.ts +1 -1
  17. package/lib/codec/tendermint/types/types.d.ts +1 -1
  18. package/lib/constant/eip712.d.ts +19 -1
  19. package/lib/constant/eip712.js +72 -6
  20. package/lib/constant/network.d.ts +9 -1
  21. package/lib/constant/network.js +16 -2
  22. package/lib/constant/walletProvider.d.ts +4 -1
  23. package/lib/constant/walletProvider.js +8 -1
  24. package/lib/modules/cdp.d.ts +1 -1
  25. package/lib/modules/cdp.js +56 -43
  26. package/lib/modules/evm.js +1 -1
  27. package/lib/modules/gov.js +1 -1
  28. package/lib/modules/index.d.ts +3 -0
  29. package/lib/modules/index.js +3 -0
  30. package/lib/provider/amino/AminoTypesMap.js +1 -1
  31. package/lib/provider/amino/types/evm.d.ts +4 -0
  32. package/lib/provider/amino/types/evm.js +40 -0
  33. package/lib/provider/amino/types/evmmerge.d.ts +4 -0
  34. package/lib/provider/amino/types/evmmerge.js +34 -0
  35. package/lib/provider/amino/types/feemarket.d.ts +4 -0
  36. package/lib/provider/amino/types/feemarket.js +34 -0
  37. package/lib/provider/amino/types/gov.js +21 -1
  38. package/lib/provider/amino/types/index.d.ts +3 -0
  39. package/lib/provider/amino/types/index.js +7 -1
  40. package/lib/provider/amino/types/oracle.js +6 -0
  41. package/lib/provider/keplr/KeplrAccount.d.ts +3 -0
  42. package/lib/provider/keplr/KeplrAccount.js +58 -0
  43. package/lib/provider/leap/LeapAccount.js +4 -0
  44. package/lib/provider/ledger/ledger.d.ts +1 -0
  45. package/lib/provider/ledger/ledger.js +5 -0
  46. package/lib/provider/metamask/MetaMask.d.ts +15 -2
  47. package/lib/provider/metamask/MetaMask.js +248 -6
  48. package/lib/provider/o3/O3Wallet.js +3 -0
  49. package/lib/util/address.d.ts +5 -1
  50. package/lib/util/address.js +11 -0
  51. package/lib/util/blockchain.d.ts +3 -3
  52. package/lib/util/blockchain.js +7 -1
  53. package/lib/util/eip712.d.ts +4 -4
  54. package/lib/util/eip712.js +172 -23
  55. package/lib/util/ethermint.d.ts +4 -0
  56. package/lib/util/ethermint.js +48 -6
  57. package/lib/util/legacyEIP712.d.ts +20 -0
  58. package/lib/util/legacyEIP712.js +98 -0
  59. package/lib/util/tx.d.ts +7 -0
  60. package/lib/wallet/CarbonSigner.d.ts +21 -4
  61. package/lib/wallet/CarbonSigner.js +20 -1
  62. package/lib/wallet/CarbonSigningClient.d.ts +1 -0
  63. package/lib/wallet/CarbonSigningClient.js +52 -4
  64. package/lib/wallet/CarbonWallet.d.ts +8 -1
  65. package/lib/wallet/CarbonWallet.js +64 -7
  66. package/package.json +2 -1
@@ -4,10 +4,12 @@ import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
4
4
  import { CarbonQueryClient, ETHClient, HydrogenClient, InsightsQueryClient, NEOClient, TokenClient, ZILClient } from "./clients";
5
5
  import * as clients from "./clients";
6
6
  import N3Client from "./clients/N3Client";
7
- import { AdminModule, BankModule, BrokerModule, CDPModule, CoinModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
7
+ import { AdminModule, BankModule, BrokerModule, CDPModule, CoinModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule, EvmModule, FeemarketModule, EvmMergeModule } from "./modules";
8
8
  import { StakingModule } from "./modules/staking";
9
9
  import { CosmosLedger, Keplr, LeapExtended } from "./provider";
10
10
  import { CarbonSigner, CarbonWallet, CarbonWalletGenericOpts } from "./wallet";
11
+ import { MetaMask } from "./provider/metamask/MetaMask";
12
+ import { ethers } from "ethers";
11
13
  export { CarbonTx } from "./util";
12
14
  export { CarbonSigner, CarbonSignerTypes, CarbonWallet, CarbonWalletGenericOpts, CarbonWalletInitOpts } from "./wallet";
13
15
  export { DenomPrefix } from "./constant";
@@ -15,6 +17,7 @@ export interface CarbonSDKOpts {
15
17
  network: Network;
16
18
  tmClient: Tendermint34Client;
17
19
  chainId?: string;
20
+ evmChainId?: string;
18
21
  token?: TokenClient;
19
22
  config?: Partial<NetworkConfig>;
20
23
  defaultTimeoutBlocks?: number;
@@ -41,6 +44,7 @@ declare class CarbonSDK {
41
44
  readonly query: CarbonQueryClient;
42
45
  insights: InsightsQueryClient;
43
46
  hydrogen: HydrogenClient;
47
+ evmJsonRpc: ethers.providers.JsonRpcProvider;
44
48
  wallet?: CarbonWallet;
45
49
  network: Network;
46
50
  configOverride: Partial<NetworkConfig>;
@@ -65,6 +69,9 @@ declare class CarbonSDK {
65
69
  fee: FeeModule;
66
70
  ibc: IBCModule;
67
71
  xchain: XChainModule;
72
+ evm: EvmModule;
73
+ evmmerge: EvmMergeModule;
74
+ feemarket: FeemarketModule;
68
75
  neo: NEOClient;
69
76
  eth: ETHClient;
70
77
  bsc: ETHClient;
@@ -74,6 +81,7 @@ declare class CarbonSDK {
74
81
  zil: ZILClient;
75
82
  n3: N3Client;
76
83
  chainId: string;
84
+ evmChainId: string;
77
85
  constructor(opts: CarbonSDKOpts);
78
86
  static instance(opts?: CarbonSDKInitOpts): Promise<CarbonSDK>;
79
87
  static instanceWithWallet(wallet: CarbonWallet, sdkOpts?: CarbonSDKInitOpts): Promise<ConnectedCarbonSDK>;
@@ -83,6 +91,7 @@ declare class CarbonSDK {
83
91
  static instanceWithLedger(ledger: CosmosLedger, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
84
92
  static instanceWithKeplr(keplr: Keplr, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
85
93
  static instanceWithLeap(leap: LeapExtended, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
94
+ static instanceWithMetamask(metamask: MetaMask, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
86
95
  static instanceViewOnly(bech32Address: string, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
87
96
  initialize(): Promise<CarbonSDK>;
88
97
  clone(): CarbonSDK;
@@ -95,6 +104,7 @@ declare class CarbonSDK {
95
104
  connectWithLedger(ledger: CosmosLedger, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
96
105
  connectWithKeplr(keplr: Keplr, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
97
106
  connectWithLeap(leap: LeapExtended, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
107
+ connectWithMetamask(metamask: MetaMask, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
98
108
  connectViewOnly(bech32Address: string, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
99
109
  getConfig(): NetworkConfig;
100
110
  getTokenClient(): TokenClient;
package/lib/CarbonSDK.js CHANGED
@@ -43,6 +43,7 @@ const staking_1 = require("./modules/staking");
43
43
  const provider_1 = require("./provider");
44
44
  const blockchain_1 = require("./util/blockchain");
45
45
  const wallet_1 = require("./wallet");
46
+ const ethers_1 = require("ethers");
46
47
  var util_2 = require("./util");
47
48
  Object.defineProperty(exports, "CarbonTx", { enumerable: true, get: function () { return util_2.CarbonTx; } });
48
49
  var wallet_2 = require("./wallet");
@@ -60,15 +61,18 @@ const DEFAULT_SDK_INIT_OPTS = {
60
61
  */
61
62
  class CarbonSDK {
62
63
  constructor(opts) {
63
- var _a, _b, _c, _d, _e;
64
+ var _a, _b, _c, _d, _e, _f, _g;
64
65
  this.network = (_a = opts.network) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_NETWORK;
65
66
  this.configOverride = (_b = opts.config) !== null && _b !== void 0 ? _b : {};
66
67
  this.networkConfig = util_1.GenericUtils.overrideConfig(constant_1.NetworkConfigs[this.network], this.configOverride);
67
68
  this.tmClient = opts.tmClient;
68
69
  this.chainId = (_d = (_c = opts.chainId) !== null && _c !== void 0 ? _c : constant_1.CarbonChainIDs[this.network]) !== null && _d !== void 0 ? _d : constant_1.CarbonChainIDs[constant_1.Network.MainNet];
70
+ this.evmChainId = (_f = (_e = opts.evmChainId) !== null && _e !== void 0 ? _e : constant_1.CarbonEvmChainIDs[this.network]) !== null && _f !== void 0 ? _f : constant_1.CarbonEvmChainIDs[constant_1.Network.MainNet];
69
71
  this.query = new clients_1.CarbonQueryClient(opts.tmClient);
70
72
  this.insights = new clients_1.InsightsQueryClient(this.networkConfig);
71
- this.token = (_e = opts.token) !== null && _e !== void 0 ? _e : clients_1.TokenClient.instance(this.query, this);
73
+ this.token = (_g = opts.token) !== null && _g !== void 0 ? _g : clients_1.TokenClient.instance(this.query, this);
74
+ this.hydrogen = new clients_1.HydrogenClient(this.networkConfig, this.token);
75
+ this.evmJsonRpc = new ethers_1.ethers.providers.JsonRpcProvider(constant_1.NetworkConfigs[this.network].evmJsonRpcUrl);
72
76
  this.hydrogen = clients_1.HydrogenClient.instance(this.networkConfig, this.token);
73
77
  this.admin = new modules_1.AdminModule(this);
74
78
  this.order = new modules_1.OrderModule(this);
@@ -88,6 +92,9 @@ class CarbonSDK {
88
92
  this.fee = new modules_1.FeeModule(this);
89
93
  this.ibc = new modules_1.IBCModule(this);
90
94
  this.xchain = new modules_1.XChainModule(this);
95
+ this.evm = new modules_1.EvmModule(this);
96
+ this.evmmerge = new modules_1.EvmMergeModule(this);
97
+ this.feemarket = new modules_1.FeemarketModule(this);
91
98
  this.neo = clients_1.NEOClient.instance({
92
99
  configProvider: this,
93
100
  blockchain: blockchain_1.Blockchain.Neo,
@@ -187,6 +194,12 @@ class CarbonSDK {
187
194
  return sdk.connectWithLeap(leap, walletOpts);
188
195
  });
189
196
  }
197
+ static instanceWithMetamask(metamask, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ const sdk = yield CarbonSDK.instance(sdkOpts);
200
+ return sdk.connectWithMetamask(metamask, walletOpts);
201
+ });
202
+ }
190
203
  static instanceViewOnly(bech32Address, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
191
204
  return __awaiter(this, void 0, void 0, function* () {
192
205
  const sdk = yield CarbonSDK.instance(sdkOpts);
@@ -236,6 +249,10 @@ class CarbonSDK {
236
249
  });
237
250
  }
238
251
  disconnect() {
252
+ var _a;
253
+ if ((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.isLedgerSigner()) {
254
+ this.wallet.signer.ledger.disconnect();
255
+ }
239
256
  return new CarbonSDK(Object.assign(Object.assign({}, this), { wallet: null, skipInit: true }));
240
257
  }
241
258
  connectWithPrivateKey(privateKey, opts) {
@@ -286,6 +303,20 @@ class CarbonSDK {
286
303
  return this.connect(wallet);
287
304
  });
288
305
  }
306
+ connectWithMetamask(metamask, opts) {
307
+ return __awaiter(this, void 0, void 0, function* () {
308
+ const evmChainId = this.evmChainId;
309
+ const addressOptions = {
310
+ network: this.networkConfig.network,
311
+ bech32Prefix: this.networkConfig.Bech32Prefix
312
+ };
313
+ const address = yield metamask.defaultAccount();
314
+ const publicKeyHex = yield metamask.getPublicKey(address);
315
+ const publicKeyBase64 = Buffer.from(publicKeyHex, 'hex').toString('base64');
316
+ const wallet = wallet_1.CarbonWallet.withMetamask(metamask, evmChainId, publicKeyBase64, addressOptions, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
317
+ return this.connect(wallet);
318
+ });
319
+ }
289
320
  connectViewOnly(bech32Address, opts) {
290
321
  return __awaiter(this, void 0, void 0, function* () {
291
322
  const wallet = wallet_1.CarbonWallet.withAddress(bech32Address, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
@@ -14,6 +14,8 @@ import { QueryClientImpl as ParamsQueryClient } from "../codec/cosmos/params/v1b
14
14
  import { QueryClientImpl as SlashingQueryClient } from "../codec/cosmos/slashing/v1beta1/query";
15
15
  import { QueryClientImpl as StakingQueryClient } from "../codec/cosmos/staking/v1beta1/query";
16
16
  import { QueryClientImpl as UpgradeQueryClient } from "../codec/cosmos/upgrade/v1beta1/query";
17
+ import { QueryClientImpl as EthermintEVMQueryClient } from "../codec/ethermint/evm/v1/query";
18
+ import { QueryClientImpl as EthermintFeeMarketQueryClient } from "../codec/ethermint/feemarket/v1/query";
17
19
  import { QueryClientImpl as FeeQueryClient } from "../codec/fee/query";
18
20
  import { QueryClientImpl as HeadersyncQueryClient } from "../codec/headersync/query";
19
21
  import { QueryClientImpl as IBCInterchainControlQueryClient } from "../codec/ibc/applications/interchain_accounts/controller/v1/query";
@@ -46,6 +48,10 @@ export interface IBCClientGroup {
46
48
  connection: IBCConnectionQueryClient;
47
49
  channel: IBCChannelQueryClient;
48
50
  }
51
+ export interface EthermintClientGroup {
52
+ evm: EthermintEVMQueryClient;
53
+ feeMarket: EthermintFeeMarketQueryClient;
54
+ }
49
55
  declare class CarbonQueryClient {
50
56
  private readonly tmClient;
51
57
  adl: ADLQueryClient;
@@ -82,6 +88,7 @@ declare class CarbonQueryClient {
82
88
  cosmosTm: CosmosTmClient;
83
89
  chain: BlockchainClient;
84
90
  ibc: IBCClientGroup;
91
+ ethermint: EthermintClientGroup;
85
92
  private baseClient;
86
93
  constructor(tmClient: Tendermint34Client);
87
94
  getProtobufRpcClient(): import("@cosmjs/stargate").ProtobufRpcClient;
@@ -19,28 +19,30 @@ const query_13 = require("../codec/cosmos/params/v1beta1/query");
19
19
  const query_14 = require("../codec/cosmos/slashing/v1beta1/query");
20
20
  const query_15 = require("../codec/cosmos/staking/v1beta1/query");
21
21
  const query_16 = require("../codec/cosmos/upgrade/v1beta1/query");
22
- const query_17 = require("../codec/fee/query");
23
- const query_18 = require("../codec/headersync/query");
24
- const query_19 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
25
- const query_20 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
26
- const query_21 = require("../codec/ibc/applications/transfer/v1/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");
22
+ const query_17 = require("../codec/ethermint/evm/v1/query");
23
+ const query_18 = require("../codec/ethermint/feemarket/v1/query");
24
+ const query_19 = require("../codec/fee/query");
25
+ const query_20 = require("../codec/headersync/query");
26
+ const query_21 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
27
+ const query_22 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
28
+ const query_23 = require("../codec/ibc/applications/transfer/v1/query");
29
+ const query_24 = require("../codec/ibc/core/client/v1/query");
30
+ const query_25 = require("../codec/ibc/core/connection/v1/query");
31
+ const query_26 = require("../codec/ibc/core/channel/v1/query");
32
+ const query_27 = require("../codec/inflation/query");
33
+ const query_28 = require("../codec/insurance/query");
34
+ const query_29 = require("../codec/leverage/query");
35
+ const query_30 = require("../codec/liquidation/query");
36
+ const query_31 = require("../codec/liquiditypool/query");
37
+ const query_32 = require("../codec/market/query");
38
+ const query_33 = require("../codec/marketstats/query");
39
+ const query_34 = require("../codec/misc/query");
40
+ const query_35 = require("../codec/oracle/query");
41
+ const query_36 = require("../codec/order/query");
42
+ const query_37 = require("../codec/position/query");
43
+ const query_38 = require("../codec/pricing/query");
44
+ const query_39 = require("../codec/profile/query");
45
+ const query_40 = require("../codec/subaccount/query");
44
46
  const stargate_1 = require("@cosmjs/stargate");
45
47
  const BlockchainClient_1 = __importDefault(require("./BlockchainClient"));
46
48
  class CarbonQueryClient {
@@ -54,22 +56,22 @@ class CarbonQueryClient {
54
56
  this.broker = new query_3.QueryClientImpl(rpcClient);
55
57
  this.coin = new query_5.QueryClientImpl(rpcClient);
56
58
  this.cdp = new query_4.QueryClientImpl(rpcClient);
57
- this.fee = new query_17.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);
72
- this.headersync = new query_18.QueryClientImpl(rpcClient);
59
+ this.fee = new query_19.QueryClientImpl(rpcClient);
60
+ this.inflation = new query_27.QueryClientImpl(rpcClient);
61
+ this.insurance = new query_28.QueryClientImpl(rpcClient);
62
+ this.leverage = new query_29.QueryClientImpl(rpcClient);
63
+ this.liquidation = new query_30.QueryClientImpl(rpcClient);
64
+ this.liquiditypool = new query_31.QueryClientImpl(rpcClient);
65
+ this.market = new query_32.QueryClientImpl(rpcClient);
66
+ this.marketstats = new query_33.QueryClientImpl(rpcClient);
67
+ this.misc = new query_34.QueryClientImpl(rpcClient);
68
+ this.oracle = new query_35.QueryClientImpl(rpcClient);
69
+ this.order = new query_36.QueryClientImpl(rpcClient);
70
+ this.position = new query_37.QueryClientImpl(rpcClient);
71
+ this.pricing = new query_38.QueryClientImpl(rpcClient);
72
+ this.profile = new query_39.QueryClientImpl(rpcClient);
73
+ this.subaccount = new query_40.QueryClientImpl(rpcClient);
74
+ this.headersync = new query_20.QueryClientImpl(rpcClient);
73
75
  this.auth = new query_6.QueryClientImpl(rpcClient);
74
76
  this.bank = new query_7.QueryClientImpl(rpcClient);
75
77
  this.distribution = new query_9.QueryClientImpl(rpcClient);
@@ -82,12 +84,16 @@ class CarbonQueryClient {
82
84
  this.upgrade = new query_16.QueryClientImpl(rpcClient);
83
85
  this.cosmosTm = new query_8.ServiceClientImpl(rpcClient);
84
86
  this.ibc = {
85
- controller: new query_19.QueryClientImpl(rpcClient),
86
- host: new query_20.QueryClientImpl(rpcClient),
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),
87
+ controller: new query_21.QueryClientImpl(rpcClient),
88
+ host: new query_22.QueryClientImpl(rpcClient),
89
+ transfer: new query_23.QueryClientImpl(rpcClient),
90
+ client: new query_24.QueryClientImpl(rpcClient),
91
+ connection: new query_25.QueryClientImpl(rpcClient),
92
+ channel: new query_26.QueryClientImpl(rpcClient),
93
+ };
94
+ this.ethermint = {
95
+ evm: new query_17.QueryClientImpl(rpcClient),
96
+ feeMarket: new query_18.QueryClientImpl(rpcClient),
91
97
  };
92
98
  }
93
99
  getProtobufRpcClient() {
@@ -12,8 +12,8 @@ export interface ETHClientOpts {
12
12
  blockchain: typeof ETHClient.SUPPORTED_BLOCKCHAINS[number];
13
13
  }
14
14
  interface ETHTxParams {
15
- gasPriceGwei: BigNumber;
16
- gasLimit: BigNumber;
15
+ gasPriceGwei?: BigNumber;
16
+ gasLimit?: BigNumber;
17
17
  ethAddress: string;
18
18
  signer: ethers.Signer;
19
19
  nonce?: number;
@@ -26,8 +26,8 @@ export interface BridgeParams {
26
26
  recoveryAddress: string;
27
27
  toAddress: string;
28
28
  feeAmount: BigNumber;
29
- gasPriceGwei: BigNumber;
30
- gasLimit: BigNumber;
29
+ gasPriceGwei?: BigNumber;
30
+ gasLimit?: BigNumber;
31
31
  signer: ethers.Signer;
32
32
  signCompleteCallback?: () => void;
33
33
  nonce?: number;
@@ -75,11 +75,7 @@ class ETHClient {
75
75
  const rpcProvider = this.getProvider();
76
76
  const contract = new ethers_1.ethers.Contract(contractAddress, eth_1.ABIs.erc20, rpcProvider);
77
77
  const nonce = yield this.getTxNonce(ethAddress, params.nonce, rpcProvider);
78
- const approveResultTx = yield contract.connect(signer).approve(spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : token.bridgeAddress, ethers_1.ethers.constants.MaxUint256, {
79
- nonce,
80
- gasPrice: gasPriceGwei.shiftedBy(9).toString(10),
81
- gasLimit: gasLimit.toString(10),
82
- });
78
+ const approveResultTx = yield contract.connect(signer).approve(spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : token.bridgeAddress, ethers_1.ethers.constants.MaxUint256, Object.assign(Object.assign({ nonce }, gasPriceGwei && ({ gasPrice: gasPriceGwei.shiftedBy(9).toString(10) })), gasLimit && ({ gasLimit: gasLimit.toString(10) })));
83
79
  return approveResultTx;
84
80
  });
85
81
  }
@@ -127,13 +123,7 @@ class ETHClient {
127
123
  amount.toString(10),
128
124
  feeAmount.toString(10),
129
125
  amount.toString(10),
130
- ], // callAmount
131
- {
132
- gasLimit: gasLimit.toString(10),
133
- gasPrice: gasPriceGwei.shiftedBy(9).toString(10),
134
- nonce,
135
- value: ethAmount.toString(10),
136
- });
126
+ ], Object.assign(Object.assign(Object.assign({}, gasPriceGwei && ({ gasPrice: gasPriceGwei.shiftedBy(9).toString(10) })), gasLimit && ({ gasLimit: gasLimit.toString(10) })), { nonce, value: ethAmount.toString(10) }));
137
127
  signCompleteCallback === null || signCompleteCallback === void 0 ? void 0 : signCompleteCallback();
138
128
  return bridgeResultTx;
139
129
  });
@@ -141,7 +131,7 @@ class ETHClient {
141
131
  lockDeposit(params) {
142
132
  return __awaiter(this, void 0, void 0, function* () {
143
133
  const { address, token, amount, gasPriceGwei, gasLimit, ethAddress, signer, signCompleteCallback } = params;
144
- if (gasLimit.lt(150000)) {
134
+ if (gasLimit === null || gasLimit === void 0 ? void 0 : gasLimit.lt(150000)) {
145
135
  throw new Error("Minimum gas required: 150,000");
146
136
  }
147
137
  const networkConfig = this.getNetworkConfig();
@@ -164,7 +154,7 @@ class ETHClient {
164
154
  amount.toString(),
165
155
  "0",
166
156
  amount.toString(), // callAmount
167
- ], Object.assign({ nonce, value: "0", gasPrice: gasPriceGwei.shiftedBy(9).toString(10), gasLimit: gasLimit.toString(10) }, (token.tokenAddress === "0000000000000000000000000000000000000000" && {
157
+ ], Object.assign(Object.assign(Object.assign({ nonce, value: "0" }, gasPriceGwei && ({ gasPrice: gasPriceGwei.shiftedBy(9).toString(10) })), gasLimit && ({ gasLimit: gasLimit.toString(10) })), (token.tokenAddress === "0000000000000000000000000000000000000000" && {
168
158
  value: amount.toString(),
169
159
  })));
170
160
  signCompleteCallback === null || signCompleteCallback === void 0 ? void 0 : signCompleteCallback();
@@ -168,6 +168,26 @@ export interface QueryTallyResultResponse {
168
168
  /** tally defines the requested tally. */
169
169
  tally?: TallyResult;
170
170
  }
171
+ /**
172
+ * QueryGroupsRequest is the Query/Groups request type.
173
+ *
174
+ * Since: cosmos-sdk 0.47.1
175
+ */
176
+ export interface QueryGroupsRequest {
177
+ /** pagination defines an optional pagination for the request. */
178
+ pagination?: PageRequest;
179
+ }
180
+ /**
181
+ * QueryGroupsResponse is the Query/Groups response type.
182
+ *
183
+ * Since: cosmos-sdk 0.47.1
184
+ */
185
+ export interface QueryGroupsResponse {
186
+ /** `groups` is all the groups present in state. */
187
+ groups: GroupInfo[];
188
+ /** pagination defines the pagination in the response. */
189
+ pagination?: PageResponse;
190
+ }
171
191
  export declare const QueryGroupInfoRequest: {
172
192
  encode(message: QueryGroupInfoRequest, writer?: _m0.Writer): _m0.Writer;
173
193
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): QueryGroupInfoRequest;
@@ -350,6 +370,20 @@ export declare const QueryTallyResultResponse: {
350
370
  toJSON(message: QueryTallyResultResponse): unknown;
351
371
  fromPartial(object: DeepPartial<QueryTallyResultResponse>): QueryTallyResultResponse;
352
372
  };
373
+ export declare const QueryGroupsRequest: {
374
+ encode(message: QueryGroupsRequest, writer?: _m0.Writer): _m0.Writer;
375
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): QueryGroupsRequest;
376
+ fromJSON(object: any): QueryGroupsRequest;
377
+ toJSON(message: QueryGroupsRequest): unknown;
378
+ fromPartial(object: DeepPartial<QueryGroupsRequest>): QueryGroupsRequest;
379
+ };
380
+ export declare const QueryGroupsResponse: {
381
+ encode(message: QueryGroupsResponse, writer?: _m0.Writer): _m0.Writer;
382
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): QueryGroupsResponse;
383
+ fromJSON(object: any): QueryGroupsResponse;
384
+ toJSON(message: QueryGroupsResponse): unknown;
385
+ fromPartial(object: DeepPartial<QueryGroupsResponse>): QueryGroupsResponse;
386
+ };
353
387
  /** Query is the cosmos.group.v1 Query service. */
354
388
  export interface Query {
355
389
  /** GroupInfo queries group info based on group id. */
@@ -384,6 +418,12 @@ export interface Query {
384
418
  * proposal itself.
385
419
  */
386
420
  TallyResult(request: QueryTallyResultRequest): Promise<QueryTallyResultResponse>;
421
+ /**
422
+ * Groups queries all groups in state.
423
+ *
424
+ * Since: cosmos-sdk 0.47.1
425
+ */
426
+ Groups(request: QueryGroupsRequest): Promise<QueryGroupsResponse>;
387
427
  }
388
428
  export declare class QueryClientImpl implements Query {
389
429
  private readonly rpc;
@@ -401,6 +441,7 @@ export declare class QueryClientImpl implements Query {
401
441
  VotesByVoter(request: QueryVotesByVoterRequest): Promise<QueryVotesByVoterResponse>;
402
442
  GroupsByMember(request: QueryGroupsByMemberRequest): Promise<QueryGroupsByMemberResponse>;
403
443
  TallyResult(request: QueryTallyResultRequest): Promise<QueryTallyResultResponse>;
444
+ Groups(request: QueryGroupsRequest): Promise<QueryGroupsResponse>;
404
445
  }
405
446
  interface Rpc {
406
447
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
@@ -3,7 +3,7 @@ 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.QueryClientImpl = exports.QueryTallyResultResponse = exports.QueryTallyResultRequest = exports.QueryGroupsByMemberResponse = exports.QueryGroupsByMemberRequest = exports.QueryVotesByVoterResponse = exports.QueryVotesByVoterRequest = exports.QueryVotesByProposalResponse = exports.QueryVotesByProposalRequest = exports.QueryVoteByProposalVoterResponse = exports.QueryVoteByProposalVoterRequest = exports.QueryProposalsByGroupPolicyResponse = exports.QueryProposalsByGroupPolicyRequest = exports.QueryProposalResponse = exports.QueryProposalRequest = exports.QueryGroupPoliciesByAdminResponse = exports.QueryGroupPoliciesByAdminRequest = exports.QueryGroupPoliciesByGroupResponse = exports.QueryGroupPoliciesByGroupRequest = exports.QueryGroupsByAdminResponse = exports.QueryGroupsByAdminRequest = exports.QueryGroupMembersResponse = exports.QueryGroupMembersRequest = exports.QueryGroupPolicyInfoResponse = exports.QueryGroupPolicyInfoRequest = exports.QueryGroupInfoResponse = exports.QueryGroupInfoRequest = exports.protobufPackage = void 0;
6
+ exports.QueryClientImpl = exports.QueryGroupsResponse = exports.QueryGroupsRequest = exports.QueryTallyResultResponse = exports.QueryTallyResultRequest = exports.QueryGroupsByMemberResponse = exports.QueryGroupsByMemberRequest = exports.QueryVotesByVoterResponse = exports.QueryVotesByVoterRequest = exports.QueryVotesByProposalResponse = exports.QueryVotesByProposalRequest = exports.QueryVoteByProposalVoterResponse = exports.QueryVoteByProposalVoterRequest = exports.QueryProposalsByGroupPolicyResponse = exports.QueryProposalsByGroupPolicyRequest = exports.QueryProposalResponse = exports.QueryProposalRequest = exports.QueryGroupPoliciesByAdminResponse = exports.QueryGroupPoliciesByAdminRequest = exports.QueryGroupPoliciesByGroupResponse = exports.QueryGroupPoliciesByGroupRequest = exports.QueryGroupsByAdminResponse = exports.QueryGroupsByAdminRequest = exports.QueryGroupMembersResponse = exports.QueryGroupMembersRequest = exports.QueryGroupPolicyInfoResponse = exports.QueryGroupPolicyInfoRequest = exports.QueryGroupInfoResponse = exports.QueryGroupInfoRequest = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
@@ -1558,6 +1558,123 @@ exports.QueryTallyResultResponse = {
1558
1558
  return message;
1559
1559
  },
1560
1560
  };
1561
+ const baseQueryGroupsRequest = {};
1562
+ exports.QueryGroupsRequest = {
1563
+ encode(message, writer = minimal_1.default.Writer.create()) {
1564
+ if (message.pagination !== undefined) {
1565
+ pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
1566
+ }
1567
+ return writer;
1568
+ },
1569
+ decode(input, length) {
1570
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1571
+ let end = length === undefined ? reader.len : reader.pos + length;
1572
+ const message = Object.assign({}, baseQueryGroupsRequest);
1573
+ while (reader.pos < end) {
1574
+ const tag = reader.uint32();
1575
+ switch (tag >>> 3) {
1576
+ case 2:
1577
+ message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
1578
+ break;
1579
+ default:
1580
+ reader.skipType(tag & 7);
1581
+ break;
1582
+ }
1583
+ }
1584
+ return message;
1585
+ },
1586
+ fromJSON(object) {
1587
+ const message = Object.assign({}, baseQueryGroupsRequest);
1588
+ message.pagination =
1589
+ object.pagination !== undefined && object.pagination !== null
1590
+ ? pagination_1.PageRequest.fromJSON(object.pagination)
1591
+ : undefined;
1592
+ return message;
1593
+ },
1594
+ toJSON(message) {
1595
+ const obj = {};
1596
+ message.pagination !== undefined &&
1597
+ (obj.pagination = message.pagination
1598
+ ? pagination_1.PageRequest.toJSON(message.pagination)
1599
+ : undefined);
1600
+ return obj;
1601
+ },
1602
+ fromPartial(object) {
1603
+ const message = Object.assign({}, baseQueryGroupsRequest);
1604
+ message.pagination =
1605
+ object.pagination !== undefined && object.pagination !== null
1606
+ ? pagination_1.PageRequest.fromPartial(object.pagination)
1607
+ : undefined;
1608
+ return message;
1609
+ },
1610
+ };
1611
+ const baseQueryGroupsResponse = {};
1612
+ exports.QueryGroupsResponse = {
1613
+ encode(message, writer = minimal_1.default.Writer.create()) {
1614
+ for (const v of message.groups) {
1615
+ types_1.GroupInfo.encode(v, writer.uint32(10).fork()).ldelim();
1616
+ }
1617
+ if (message.pagination !== undefined) {
1618
+ pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
1619
+ }
1620
+ return writer;
1621
+ },
1622
+ decode(input, length) {
1623
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1624
+ let end = length === undefined ? reader.len : reader.pos + length;
1625
+ const message = Object.assign({}, baseQueryGroupsResponse);
1626
+ message.groups = [];
1627
+ while (reader.pos < end) {
1628
+ const tag = reader.uint32();
1629
+ switch (tag >>> 3) {
1630
+ case 1:
1631
+ message.groups.push(types_1.GroupInfo.decode(reader, reader.uint32()));
1632
+ break;
1633
+ case 2:
1634
+ message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
1635
+ break;
1636
+ default:
1637
+ reader.skipType(tag & 7);
1638
+ break;
1639
+ }
1640
+ }
1641
+ return message;
1642
+ },
1643
+ fromJSON(object) {
1644
+ var _a;
1645
+ const message = Object.assign({}, baseQueryGroupsResponse);
1646
+ message.groups = ((_a = object.groups) !== null && _a !== void 0 ? _a : []).map((e) => types_1.GroupInfo.fromJSON(e));
1647
+ message.pagination =
1648
+ object.pagination !== undefined && object.pagination !== null
1649
+ ? pagination_1.PageResponse.fromJSON(object.pagination)
1650
+ : undefined;
1651
+ return message;
1652
+ },
1653
+ toJSON(message) {
1654
+ const obj = {};
1655
+ if (message.groups) {
1656
+ obj.groups = message.groups.map((e) => e ? types_1.GroupInfo.toJSON(e) : undefined);
1657
+ }
1658
+ else {
1659
+ obj.groups = [];
1660
+ }
1661
+ message.pagination !== undefined &&
1662
+ (obj.pagination = message.pagination
1663
+ ? pagination_1.PageResponse.toJSON(message.pagination)
1664
+ : undefined);
1665
+ return obj;
1666
+ },
1667
+ fromPartial(object) {
1668
+ var _a;
1669
+ const message = Object.assign({}, baseQueryGroupsResponse);
1670
+ message.groups = ((_a = object.groups) !== null && _a !== void 0 ? _a : []).map((e) => types_1.GroupInfo.fromPartial(e));
1671
+ message.pagination =
1672
+ object.pagination !== undefined && object.pagination !== null
1673
+ ? pagination_1.PageResponse.fromPartial(object.pagination)
1674
+ : undefined;
1675
+ return message;
1676
+ },
1677
+ };
1561
1678
  class QueryClientImpl {
1562
1679
  constructor(rpc) {
1563
1680
  this.rpc = rpc;
@@ -1574,6 +1691,7 @@ class QueryClientImpl {
1574
1691
  this.VotesByVoter = this.VotesByVoter.bind(this);
1575
1692
  this.GroupsByMember = this.GroupsByMember.bind(this);
1576
1693
  this.TallyResult = this.TallyResult.bind(this);
1694
+ this.Groups = this.Groups.bind(this);
1577
1695
  }
1578
1696
  GroupInfo(request) {
1579
1697
  const data = exports.QueryGroupInfoRequest.encode(request).finish();
@@ -1640,6 +1758,11 @@ class QueryClientImpl {
1640
1758
  const promise = this.rpc.request("cosmos.group.v1.Query", "TallyResult", data);
1641
1759
  return promise.then((data) => exports.QueryTallyResultResponse.decode(new minimal_1.default.Reader(data)));
1642
1760
  }
1761
+ Groups(request) {
1762
+ const data = exports.QueryGroupsRequest.encode(request).finish();
1763
+ const promise = this.rpc.request("cosmos.group.v1.Query", "Groups", data);
1764
+ return promise.then((data) => exports.QueryGroupsResponse.decode(new minimal_1.default.Reader(data)));
1765
+ }
1643
1766
  }
1644
1767
  exports.QueryClientImpl = QueryClientImpl;
1645
1768
  if (minimal_1.default.util.Long !== long_1.default) {
@@ -11,6 +11,7 @@ export interface MsgCreateVestingAccount {
11
11
  fromAddress: string;
12
12
  toAddress: string;
13
13
  amount: Coin[];
14
+ /** end of vesting as unix time (in seconds). */
14
15
  endTime: Long;
15
16
  delayed: boolean;
16
17
  }
@@ -44,6 +45,7 @@ export interface MsgCreatePermanentLockedAccountResponse {
44
45
  export interface MsgCreatePeriodicVestingAccount {
45
46
  fromAddress: string;
46
47
  toAddress: string;
48
+ /** start of vesting as unix time (in seconds). */
47
49
  startTime: Long;
48
50
  vestingPeriods: Period[];
49
51
  }
@@ -12,6 +12,7 @@ export interface BaseVestingAccount {
12
12
  originalVesting: Coin[];
13
13
  delegatedFree: Coin[];
14
14
  delegatedVesting: Coin[];
15
+ /** Vesting end time, as unix timestamp (in seconds). */
15
16
  endTime: Long;
16
17
  }
17
18
  /**
@@ -20,6 +21,7 @@ export interface BaseVestingAccount {
20
21
  */
21
22
  export interface ContinuousVestingAccount {
22
23
  baseVestingAccount?: BaseVestingAccount;
24
+ /** Vesting start time, as unix timestamp (in seconds). */
23
25
  startTime: Long;
24
26
  }
25
27
  /**
@@ -32,6 +34,7 @@ export interface DelayedVestingAccount {
32
34
  }
33
35
  /** Period defines a length of time and amount of coins that will vest. */
34
36
  export interface Period {
37
+ /** Period duration in seconds. */
35
38
  length: Long;
36
39
  amount: Coin[];
37
40
  }
@@ -26,6 +26,10 @@ export declare const protobufPackage = "google.protobuf";
26
26
  * if (any.is(Foo.class)) {
27
27
  * foo = any.unpack(Foo.class);
28
28
  * }
29
+ * // or ...
30
+ * if (any.isSameTypeAs(Foo.getDefaultInstance())) {
31
+ * foo = any.unpack(Foo.getDefaultInstance());
32
+ * }
29
33
  *
30
34
  * Example 3: Pack and unpack a message in Python.
31
35
  *
@@ -56,7 +60,6 @@ export declare const protobufPackage = "google.protobuf";
56
60
  * in the type URL, for example "foo.bar.com/x/y.z" will yield type
57
61
  * name "y.z".
58
62
  *
59
- *
60
63
  * JSON
61
64
  *
62
65
  * The JSON representation of an `Any` value uses the regular