@injectivelabs/sdk-ts 1.16.16 → 1.16.17

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 (117) hide show
  1. package/dist/cjs/client/chain/ChainGrpcClient.d.ts +14 -10
  2. package/dist/cjs/client/chain/ChainGrpcClient.js +26 -20
  3. package/dist/cjs/client/chain/grpc/ChainGrpcAuthApi.js +2 -2
  4. package/dist/cjs/client/chain/grpc/ChainGrpcAuthZApi.js +4 -4
  5. package/dist/cjs/client/chain/grpc/ChainGrpcBankApi.js +5 -5
  6. package/dist/cjs/client/chain/grpc/ChainGrpcErc20Api.d.ts +28 -0
  7. package/dist/cjs/client/chain/grpc/ChainGrpcErc20Api.js +124 -0
  8. package/dist/cjs/client/chain/grpc/ChainGrpcEvmApi.d.ts +30 -0
  9. package/dist/cjs/client/chain/grpc/ChainGrpcEvmApi.js +198 -0
  10. package/dist/cjs/client/chain/grpc/ChainGrpcGovApi.js +4 -4
  11. package/dist/cjs/client/chain/grpc/ChainGrpcIbcApi.js +2 -2
  12. package/dist/cjs/client/chain/grpc/ChainGrpcStakingApi.js +14 -14
  13. package/dist/cjs/client/chain/grpc/ChainGrpcWasmApi.js +5 -5
  14. package/dist/cjs/client/chain/grpc/index.d.ts +15 -13
  15. package/dist/cjs/client/chain/grpc/index.js +31 -27
  16. package/dist/cjs/client/chain/transformers/ChainGrpcAuthTransformer.js +2 -2
  17. package/dist/cjs/client/chain/transformers/ChainGrpcAuthZTransformer.js +4 -4
  18. package/dist/cjs/client/chain/transformers/ChainGrpcBankTransformer.js +4 -5
  19. package/dist/cjs/client/chain/transformers/ChainGrpcCommonTransformer.d.ts +5 -0
  20. package/dist/cjs/client/chain/transformers/ChainGrpcCommonTransformer.js +42 -0
  21. package/dist/cjs/client/chain/transformers/ChainGrpcErc20Transformer.d.ts +16 -0
  22. package/dist/cjs/client/chain/transformers/ChainGrpcErc20Transformer.js +31 -0
  23. package/dist/cjs/client/chain/transformers/ChainGrpcEvmTransformer.d.ts +29 -0
  24. package/dist/cjs/client/chain/transformers/ChainGrpcEvmTransformer.js +102 -0
  25. package/dist/cjs/client/chain/transformers/ChainGrpcGovTransformer.js +4 -4
  26. package/dist/cjs/client/chain/transformers/ChainGrpcStakingTransformer.js +5 -5
  27. package/dist/cjs/client/chain/transformers/ChainGrpcWasmTransformer.js +6 -6
  28. package/dist/cjs/client/chain/transformers/index.d.ts +13 -10
  29. package/dist/cjs/client/chain/transformers/index.js +13 -10
  30. package/dist/cjs/client/chain/types/erc20.d.ts +13 -0
  31. package/dist/cjs/client/chain/types/erc20.js +2 -0
  32. package/dist/cjs/client/chain/types/evm.d.ts +62 -0
  33. package/dist/cjs/client/chain/types/evm.js +2 -0
  34. package/dist/cjs/client/chain/types/index.d.ts +20 -16
  35. package/dist/cjs/client/indexer/grpc/IndexerGrpcAuctionApi.d.ts +19 -1
  36. package/dist/cjs/client/indexer/grpc/IndexerGrpcAuctionApi.js +79 -1
  37. package/dist/cjs/client/indexer/grpc/IndexerGrpcMegaVaultApi.d.ts +45 -0
  38. package/dist/cjs/client/indexer/grpc/IndexerGrpcMegaVaultApi.js +207 -0
  39. package/dist/cjs/client/indexer/grpc/index.d.ts +1 -0
  40. package/dist/cjs/client/indexer/grpc/index.js +3 -1
  41. package/dist/cjs/client/indexer/transformers/IndexerAuctionStreamTransformer.d.ts +2 -2
  42. package/dist/cjs/client/indexer/transformers/IndexerGrpcAuctionTransformer.d.ts +18 -6
  43. package/dist/cjs/client/indexer/transformers/IndexerGrpcAuctionTransformer.js +51 -9
  44. package/dist/cjs/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.d.ts +30 -0
  45. package/dist/cjs/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.js +230 -0
  46. package/dist/cjs/client/indexer/transformers/index.d.ts +1 -0
  47. package/dist/cjs/client/indexer/transformers/index.js +1 -0
  48. package/dist/cjs/client/indexer/types/auction.d.ts +49 -5
  49. package/dist/cjs/client/indexer/types/index.d.ts +16 -14
  50. package/dist/cjs/client/indexer/types/mega-vault.d.ts +153 -0
  51. package/dist/cjs/client/indexer/types/mega-vault.js +11 -0
  52. package/dist/cjs/core/modules/exchange/index.d.ts +2 -1
  53. package/dist/cjs/core/modules/exchange/index.js +3 -1
  54. package/dist/cjs/core/modules/exchange/msgs/MsgCancelPostOnlyModeV2.d.ts +44 -0
  55. package/dist/cjs/core/modules/exchange/msgs/MsgCancelPostOnlyModeV2.js +83 -0
  56. package/dist/cjs/core/modules/msgs.d.ts +2 -1
  57. package/dist/cjs/utils/pagination.d.ts +11 -12
  58. package/dist/cjs/utils/pagination.js +14 -72
  59. package/dist/esm/client/chain/ChainGrpcClient.d.ts +14 -10
  60. package/dist/esm/client/chain/ChainGrpcClient.js +26 -20
  61. package/dist/esm/client/chain/grpc/ChainGrpcAuthApi.js +2 -2
  62. package/dist/esm/client/chain/grpc/ChainGrpcAuthZApi.js +4 -4
  63. package/dist/esm/client/chain/grpc/ChainGrpcBankApi.js +5 -5
  64. package/dist/esm/client/chain/grpc/ChainGrpcErc20Api.d.ts +28 -0
  65. package/dist/esm/client/chain/grpc/ChainGrpcErc20Api.js +117 -0
  66. package/dist/esm/client/chain/grpc/ChainGrpcEvmApi.d.ts +30 -0
  67. package/dist/esm/client/chain/grpc/ChainGrpcEvmApi.js +191 -0
  68. package/dist/esm/client/chain/grpc/ChainGrpcGovApi.js +4 -4
  69. package/dist/esm/client/chain/grpc/ChainGrpcIbcApi.js +2 -2
  70. package/dist/esm/client/chain/grpc/ChainGrpcStakingApi.js +14 -14
  71. package/dist/esm/client/chain/grpc/ChainGrpcWasmApi.js +5 -5
  72. package/dist/esm/client/chain/grpc/index.d.ts +15 -13
  73. package/dist/esm/client/chain/grpc/index.js +15 -13
  74. package/dist/esm/client/chain/transformers/ChainGrpcAuthTransformer.js +2 -2
  75. package/dist/esm/client/chain/transformers/ChainGrpcAuthZTransformer.js +4 -4
  76. package/dist/esm/client/chain/transformers/ChainGrpcBankTransformer.js +4 -5
  77. package/dist/esm/client/chain/transformers/ChainGrpcCommonTransformer.d.ts +5 -0
  78. package/dist/esm/client/chain/transformers/ChainGrpcCommonTransformer.js +42 -0
  79. package/dist/esm/client/chain/transformers/ChainGrpcErc20Transformer.d.ts +16 -0
  80. package/dist/esm/client/chain/transformers/ChainGrpcErc20Transformer.js +27 -0
  81. package/dist/esm/client/chain/transformers/ChainGrpcEvmTransformer.d.ts +29 -0
  82. package/dist/esm/client/chain/transformers/ChainGrpcEvmTransformer.js +98 -0
  83. package/dist/esm/client/chain/transformers/ChainGrpcGovTransformer.js +4 -4
  84. package/dist/esm/client/chain/transformers/ChainGrpcStakingTransformer.js +5 -5
  85. package/dist/esm/client/chain/transformers/ChainGrpcWasmTransformer.js +6 -6
  86. package/dist/esm/client/chain/transformers/index.d.ts +13 -10
  87. package/dist/esm/client/chain/transformers/index.js +13 -10
  88. package/dist/esm/client/chain/types/erc20.d.ts +13 -0
  89. package/dist/esm/client/chain/types/erc20.js +1 -0
  90. package/dist/esm/client/chain/types/evm.d.ts +62 -0
  91. package/dist/esm/client/chain/types/evm.js +1 -0
  92. package/dist/esm/client/chain/types/index.d.ts +20 -16
  93. package/dist/esm/client/indexer/grpc/IndexerGrpcAuctionApi.d.ts +19 -1
  94. package/dist/esm/client/indexer/grpc/IndexerGrpcAuctionApi.js +79 -1
  95. package/dist/esm/client/indexer/grpc/IndexerGrpcMegaVaultApi.d.ts +45 -0
  96. package/dist/esm/client/indexer/grpc/IndexerGrpcMegaVaultApi.js +200 -0
  97. package/dist/esm/client/indexer/grpc/index.d.ts +1 -0
  98. package/dist/esm/client/indexer/grpc/index.js +1 -0
  99. package/dist/esm/client/indexer/transformers/IndexerAuctionStreamTransformer.d.ts +2 -2
  100. package/dist/esm/client/indexer/transformers/IndexerGrpcAuctionTransformer.d.ts +18 -6
  101. package/dist/esm/client/indexer/transformers/IndexerGrpcAuctionTransformer.js +51 -9
  102. package/dist/esm/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.d.ts +30 -0
  103. package/dist/esm/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.js +226 -0
  104. package/dist/esm/client/indexer/transformers/index.d.ts +1 -0
  105. package/dist/esm/client/indexer/transformers/index.js +1 -0
  106. package/dist/esm/client/indexer/types/auction.d.ts +49 -5
  107. package/dist/esm/client/indexer/types/index.d.ts +16 -14
  108. package/dist/esm/client/indexer/types/mega-vault.d.ts +153 -0
  109. package/dist/esm/client/indexer/types/mega-vault.js +10 -0
  110. package/dist/esm/core/modules/exchange/index.d.ts +2 -1
  111. package/dist/esm/core/modules/exchange/index.js +2 -1
  112. package/dist/esm/core/modules/exchange/msgs/MsgCancelPostOnlyModeV2.d.ts +44 -0
  113. package/dist/esm/core/modules/exchange/msgs/MsgCancelPostOnlyModeV2.js +77 -0
  114. package/dist/esm/core/modules/msgs.d.ts +2 -1
  115. package/dist/esm/utils/pagination.d.ts +11 -12
  116. package/dist/esm/utils/pagination.js +13 -69
  117. package/package.json +7 -7
@@ -1,11 +1,13 @@
1
1
  import { ChainGrpcGovApi } from './grpc/ChainGrpcGovApi.js';
2
2
  import { ChainGrpcIbcApi } from './grpc/ChainGrpcIbcApi.js';
3
+ import { ChainGrpcEvmApi } from './grpc/ChainGrpcEvmApi.js';
3
4
  import { ChainGrpcAuthApi } from './grpc/ChainGrpcAuthApi.js';
4
5
  import { ChainGrpcBankApi } from './grpc/ChainGrpcBankApi.js';
5
6
  import { ChainGrpcMintApi } from './grpc/ChainGrpcMintApi.js';
6
7
  import { ChainGrpcWasmApi } from './grpc/ChainGrpcWasmApi.js';
7
8
  import { ChainGrpcPeggyApi } from './grpc/ChainGrpcPeggyApi.js';
8
9
  import { ChainGrpcWasmXApi } from './grpc/ChainGrpcWasmXApi.js';
10
+ import { ChainGrpcErc20Api } from './grpc/ChainGrpcErc20Api.js';
9
11
  import { ChainGrpcOracleApi } from './grpc/ChainGrpcOracleApi.js';
10
12
  import { ChainGrpcAuctionApi } from './grpc/ChainGrpcAuctionApi.js';
11
13
  import { ChainGrpcStakingApi } from './grpc/ChainGrpcStakingApi.js';
@@ -19,38 +21,42 @@ import { ChainGrpcInsuranceFundApi } from './grpc/ChainGrpcInsuranceFundApi.js';
19
21
  * @hidden
20
22
  */
21
23
  export class ChainGrpcClient {
22
- auction;
23
- auth;
24
- bank;
25
- distribution;
26
- exchange;
27
24
  gov;
28
25
  ibc;
29
- insuranceFund;
26
+ evm;
27
+ auth;
28
+ bank;
30
29
  mint;
31
- oracle;
30
+ wasm;
32
31
  peggy;
33
- permissions;
32
+ wasmX;
33
+ erc20;
34
+ oracle;
35
+ auction;
34
36
  staking;
37
+ exchange;
38
+ permissions;
39
+ distribution;
35
40
  tokenfactory;
36
- wasm;
37
- wasmX;
41
+ insuranceFund;
38
42
  constructor(endpoint) {
39
- this.auction = new ChainGrpcAuctionApi(endpoint);
40
- this.auth = new ChainGrpcAuthApi(endpoint);
41
- this.bank = new ChainGrpcBankApi(endpoint);
42
- this.distribution = new ChainGrpcDistributionApi(endpoint);
43
- this.exchange = new ChainGrpcExchangeApi(endpoint);
43
+ this.evm = new ChainGrpcEvmApi(endpoint);
44
44
  this.gov = new ChainGrpcGovApi(endpoint);
45
45
  this.ibc = new ChainGrpcIbcApi(endpoint);
46
- this.insuranceFund = new ChainGrpcInsuranceFundApi(endpoint);
46
+ this.auth = new ChainGrpcAuthApi(endpoint);
47
+ this.bank = new ChainGrpcBankApi(endpoint);
47
48
  this.mint = new ChainGrpcMintApi(endpoint);
48
- this.oracle = new ChainGrpcOracleApi(endpoint);
49
+ this.wasm = new ChainGrpcWasmApi(endpoint);
50
+ this.erc20 = new ChainGrpcErc20Api(endpoint);
49
51
  this.peggy = new ChainGrpcPeggyApi(endpoint);
50
- this.permissions = new ChainGrpcPermissionsApi(endpoint);
52
+ this.wasmX = new ChainGrpcWasmXApi(endpoint);
53
+ this.oracle = new ChainGrpcOracleApi(endpoint);
54
+ this.auction = new ChainGrpcAuctionApi(endpoint);
51
55
  this.staking = new ChainGrpcStakingApi(endpoint);
56
+ this.exchange = new ChainGrpcExchangeApi(endpoint);
57
+ this.permissions = new ChainGrpcPermissionsApi(endpoint);
58
+ this.distribution = new ChainGrpcDistributionApi(endpoint);
52
59
  this.tokenfactory = new ChainGrpcTokenFactoryApi(endpoint);
53
- this.wasm = new ChainGrpcWasmApi(endpoint);
54
- this.wasmX = new ChainGrpcWasmXApi(endpoint);
60
+ this.insuranceFund = new ChainGrpcInsuranceFundApi(endpoint);
55
61
  }
56
62
  }
@@ -2,8 +2,8 @@ import { CosmosAuthV1Beta1Query } from '@injectivelabs/core-proto-ts';
2
2
  import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
3
  import { ChainModule } from '../types/index.js';
4
4
  import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
- import { paginationRequestFromPagination } from '../../../utils/pagination.js';
6
5
  import { ChainGrpcAuthTransformer } from '../transformers/ChainGrpcAuthTransformer.js';
6
+ import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
7
7
  /**
8
8
  * @category Chain Grpc API
9
9
  */
@@ -59,7 +59,7 @@ export class ChainGrpcAuthApi extends BaseGrpcConsumer {
59
59
  }
60
60
  async fetchAccounts(pagination) {
61
61
  const request = CosmosAuthV1Beta1Query.QueryAccountsRequest.create();
62
- const paginationForRequest = paginationRequestFromPagination(pagination);
62
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
63
63
  if (paginationForRequest) {
64
64
  request.pagination = paginationForRequest;
65
65
  }
@@ -2,8 +2,8 @@ import { CosmosAuthzV1Beta1Query } from '@injectivelabs/core-proto-ts';
2
2
  import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
3
  import { ChainModule } from '../types/index.js';
4
4
  import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
- import { paginationRequestFromPagination } from '../../../utils/pagination.js';
6
5
  import { ChainGrpcAuthZTransformer } from '../transformers/ChainGrpcAuthZTransformer.js';
6
+ import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
7
7
  /**
8
8
  * @category Chain Grpc API
9
9
  */
@@ -25,7 +25,7 @@ export class ChainGrpcAuthZApi extends BaseGrpcConsumer {
25
25
  if (msgTypeUrl) {
26
26
  request.msgTypeUrl = msgTypeUrl;
27
27
  }
28
- const paginationForRequest = paginationRequestFromPagination(pagination);
28
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
29
29
  if (paginationForRequest) {
30
30
  request.pagination = paginationForRequest;
31
31
  }
@@ -53,7 +53,7 @@ export class ChainGrpcAuthZApi extends BaseGrpcConsumer {
53
53
  if (granter) {
54
54
  request.granter = granter;
55
55
  }
56
- const paginationForRequest = paginationRequestFromPagination(pagination);
56
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
57
57
  if (paginationForRequest) {
58
58
  request.pagination = paginationForRequest;
59
59
  }
@@ -81,7 +81,7 @@ export class ChainGrpcAuthZApi extends BaseGrpcConsumer {
81
81
  if (grantee) {
82
82
  request.grantee = grantee;
83
83
  }
84
- const paginationForRequest = paginationRequestFromPagination(pagination);
84
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
85
85
  if (paginationForRequest) {
86
86
  request.pagination = paginationForRequest;
87
87
  }
@@ -3,8 +3,8 @@ import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestExcepti
3
3
  import { ChainModule } from '../types/index.js';
4
4
  import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
5
  import { ChainGrpcBankTransformer } from '../transformers/index.js';
6
+ import { fetchAllWithPagination } from '../../../utils/pagination.js';
6
7
  import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
7
- import { fetchAllWithPagination, paginationRequestFromPagination, } from '../../../utils/pagination.js';
8
8
  const MAX_LIMIT_FOR_SUPPLY = 10000;
9
9
  /**
10
10
  * @category Chain Grpc API
@@ -63,7 +63,7 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer {
63
63
  async fetchBalances(address, pagination) {
64
64
  const request = CosmosBankV1Beta1Query.QueryAllBalancesRequest.create();
65
65
  request.address = address;
66
- const paginationForRequest = paginationRequestFromPagination(pagination);
66
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
67
67
  if (paginationForRequest) {
68
68
  request.pagination = paginationForRequest;
69
69
  }
@@ -88,7 +88,7 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer {
88
88
  }
89
89
  async fetchTotalSupply(pagination) {
90
90
  const request = CosmosBankV1Beta1Query.QueryTotalSupplyRequest.create();
91
- const paginationForRequest = paginationRequestFromPagination(pagination);
91
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
92
92
  if (paginationForRequest) {
93
93
  request.pagination = paginationForRequest;
94
94
  }
@@ -139,7 +139,7 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer {
139
139
  }
140
140
  async fetchDenomsMetadata(pagination) {
141
141
  const request = CosmosBankV1Beta1Query.QueryDenomsMetadataRequest.create();
142
- const paginationForRequest = paginationRequestFromPagination(pagination);
142
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
143
143
  if (paginationForRequest) {
144
144
  request.pagination = paginationForRequest;
145
145
  }
@@ -187,7 +187,7 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer {
187
187
  async fetchDenomOwners(denom, pagination) {
188
188
  const request = CosmosBankV1Beta1Query.QueryDenomOwnersRequest.create();
189
189
  request.denom = denom;
190
- const paginationForRequest = paginationRequestFromPagination(pagination);
190
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
191
191
  if (paginationForRequest) {
192
192
  request.pagination = paginationForRequest;
193
193
  }
@@ -0,0 +1,28 @@
1
+ import { InjectiveErc20V1Beta1Query } from '@injectivelabs/core-proto-ts';
2
+ import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
3
+ import type { PaginationOption } from '../../../types/pagination.js';
4
+ /**
5
+ * @category Chain Grpc API
6
+ */
7
+ export declare class ChainGrpcErc20Api extends BaseGrpcConsumer {
8
+ protected module: string;
9
+ protected client: InjectiveErc20V1Beta1Query.QueryClientImpl;
10
+ constructor(endpoint: string);
11
+ fetchModuleParams(): Promise<import("../types/erc20.js").Params>;
12
+ fetchTokenPairs(pagination?: PaginationOption): Promise<{
13
+ tokenPairs: {
14
+ bankDenom: string;
15
+ erc20Address: string;
16
+ }[];
17
+ pagination: import("../../../types/pagination.js").Pagination;
18
+ }>;
19
+ fetchAllTokenPairsWithPagination(pagination?: PaginationOption): Promise<{
20
+ tokenPairs: {
21
+ bankDenom: string;
22
+ erc20Address: string;
23
+ }[];
24
+ pagination: import("../../../types/pagination.js").Pagination;
25
+ }>;
26
+ fetchTokenPairByDenom(denom: string): Promise<import("../types/erc20.js").TokenPair | undefined>;
27
+ fetchTokenPairByErc20Address(erc20Address: string): Promise<import("../types/erc20.js").TokenPair | undefined>;
28
+ }
@@ -0,0 +1,117 @@
1
+ import { InjectiveErc20V1Beta1Query } from '@injectivelabs/core-proto-ts';
2
+ import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
+ import { ChainModule } from '../types/index.js';
4
+ import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
+ import { fetchAllWithPagination } from '../../../utils/pagination.js';
6
+ import { ChainGrpcErc20Transformer, ChainGrpcCommonTransformer, } from '../transformers/index.js';
7
+ const MAX_LIMIT_FOR_SUPPLY = 10000;
8
+ /**
9
+ * @category Chain Grpc API
10
+ */
11
+ export class ChainGrpcErc20Api extends BaseGrpcConsumer {
12
+ module = ChainModule.Erc20;
13
+ client;
14
+ constructor(endpoint) {
15
+ super(endpoint);
16
+ this.client = new InjectiveErc20V1Beta1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
17
+ }
18
+ async fetchModuleParams() {
19
+ const request = InjectiveErc20V1Beta1Query.QueryParamsRequest.create();
20
+ try {
21
+ const response = await this.retry(() => this.client.Params(request, this.metadata));
22
+ return ChainGrpcErc20Transformer.paramsResponseToParams(response);
23
+ }
24
+ catch (e) {
25
+ if (e instanceof InjectiveErc20V1Beta1Query.GrpcWebError) {
26
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
27
+ code: grpcErrorCodeToErrorCode(e.code),
28
+ context: 'Erc20Params',
29
+ contextModule: this.module,
30
+ });
31
+ }
32
+ throw new GrpcUnaryRequestException(e, {
33
+ code: UnspecifiedErrorCode,
34
+ context: 'Erc20Params',
35
+ contextModule: this.module,
36
+ });
37
+ }
38
+ }
39
+ async fetchTokenPairs(pagination) {
40
+ const request = InjectiveErc20V1Beta1Query.QueryAllTokenPairsRequest.create();
41
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
42
+ if (paginationForRequest) {
43
+ request.pagination = paginationForRequest;
44
+ }
45
+ try {
46
+ const response = await this.retry(() => this.client.AllTokenPairs(request, this.metadata));
47
+ return ChainGrpcErc20Transformer.tokenPairsResponseToTokenPairs(response);
48
+ }
49
+ catch (e) {
50
+ if (e instanceof InjectiveErc20V1Beta1Query.GrpcWebError) {
51
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
52
+ code: grpcErrorCodeToErrorCode(e.code),
53
+ context: 'Erc20TokenPairs',
54
+ contextModule: this.module,
55
+ });
56
+ }
57
+ throw new GrpcUnaryRequestException(e, {
58
+ code: UnspecifiedErrorCode,
59
+ context: 'Erc20TokenPairs',
60
+ contextModule: this.module,
61
+ });
62
+ }
63
+ }
64
+ async fetchAllTokenPairsWithPagination(pagination = { limit: MAX_LIMIT_FOR_SUPPLY }) {
65
+ return fetchAllWithPagination(pagination, this.fetchTokenPairs.bind(this));
66
+ }
67
+ async fetchTokenPairByDenom(denom) {
68
+ const request = InjectiveErc20V1Beta1Query.QueryTokenPairByDenomRequest.create();
69
+ request.bankDenom = denom;
70
+ try {
71
+ const response = await this.retry(() => this.client.TokenPairByDenom(request, this.metadata));
72
+ if (!response.tokenPair) {
73
+ return undefined;
74
+ }
75
+ return ChainGrpcErc20Transformer.grpcTokenPairToTokenPair(response.tokenPair);
76
+ }
77
+ catch (e) {
78
+ if (e instanceof InjectiveErc20V1Beta1Query.GrpcWebError) {
79
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
80
+ code: grpcErrorCodeToErrorCode(e.code),
81
+ context: 'Erc20TokenPairByDenom',
82
+ contextModule: this.module,
83
+ });
84
+ }
85
+ throw new GrpcUnaryRequestException(e, {
86
+ code: UnspecifiedErrorCode,
87
+ context: 'Erc20TokenPairByDenom',
88
+ contextModule: this.module,
89
+ });
90
+ }
91
+ }
92
+ async fetchTokenPairByErc20Address(erc20Address) {
93
+ const request = InjectiveErc20V1Beta1Query.QueryTokenPairByERC20AddressRequest.create();
94
+ request.erc20Address = erc20Address;
95
+ try {
96
+ const response = await this.retry(() => this.client.TokenPairByERC20Address(request, this.metadata));
97
+ if (!response.tokenPair) {
98
+ return undefined;
99
+ }
100
+ return ChainGrpcErc20Transformer.grpcTokenPairToTokenPair(response.tokenPair);
101
+ }
102
+ catch (e) {
103
+ if (e instanceof InjectiveErc20V1Beta1Query.GrpcWebError) {
104
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
105
+ code: grpcErrorCodeToErrorCode(e.code),
106
+ context: 'Erc20TokenPairByErc20Address',
107
+ contextModule: this.module,
108
+ });
109
+ }
110
+ throw new GrpcUnaryRequestException(e, {
111
+ code: UnspecifiedErrorCode,
112
+ context: 'Erc20TokenPairByErc20Address',
113
+ contextModule: this.module,
114
+ });
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,30 @@
1
+ import { InjectiveEvmV1Query } from '@injectivelabs/core-proto-ts';
2
+ import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
3
+ /**
4
+ * @category Chain Grpc API
5
+ */
6
+ export declare class ChainGrpcEvmApi extends BaseGrpcConsumer {
7
+ protected module: string;
8
+ protected client: InjectiveEvmV1Query.QueryClientImpl;
9
+ constructor(endpoint: string);
10
+ fetchAccount(ethAddress: string): Promise<{
11
+ balance: string;
12
+ codeHash: string;
13
+ nonce: string;
14
+ }>;
15
+ fetchCosmosAccount(ethAddress: string): Promise<{
16
+ sequence: string;
17
+ cosmosAddress: string;
18
+ accountNumber: string;
19
+ }>;
20
+ fetchValidatorAccount(consAddress: string): Promise<{
21
+ sequence: string;
22
+ accountNumber: string;
23
+ accountAddress: string;
24
+ }>;
25
+ fetchBalance(ethAddress: string): Promise<string>;
26
+ fetchStorage(ethAddress: string, key: string): Promise<string>;
27
+ fetchCode(ethAddress: string): Promise<Uint8Array<ArrayBufferLike>>;
28
+ fetchParams(): Promise<import("../types/evm.js").EvmParams | undefined>;
29
+ fetchBaseFee(): Promise<string>;
30
+ }
@@ -0,0 +1,191 @@
1
+ import { InjectiveEvmV1Query } from '@injectivelabs/core-proto-ts';
2
+ import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
+ import { ChainModule } from '../types/index.js';
4
+ import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
+ import { ChainGrpcEvmTransformer } from '../transformers/index.js';
6
+ /**
7
+ * @category Chain Grpc API
8
+ */
9
+ export class ChainGrpcEvmApi extends BaseGrpcConsumer {
10
+ module = ChainModule.Evm;
11
+ client;
12
+ constructor(endpoint) {
13
+ super(endpoint);
14
+ this.client = new InjectiveEvmV1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
15
+ }
16
+ async fetchAccount(ethAddress) {
17
+ const request = InjectiveEvmV1Query.QueryAccountRequest.create();
18
+ request.address = ethAddress;
19
+ try {
20
+ const response = await this.retry(() => this.client.Account(request, this.metadata));
21
+ return ChainGrpcEvmTransformer.accountResponseToAccount(response);
22
+ }
23
+ catch (e) {
24
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
25
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
26
+ code: grpcErrorCodeToErrorCode(e.code),
27
+ context: 'EvmAccount',
28
+ contextModule: this.module,
29
+ });
30
+ }
31
+ throw new GrpcUnaryRequestException(e, {
32
+ code: UnspecifiedErrorCode,
33
+ context: 'EvmAccount',
34
+ contextModule: this.module,
35
+ });
36
+ }
37
+ }
38
+ async fetchCosmosAccount(ethAddress) {
39
+ const request = InjectiveEvmV1Query.QueryCosmosAccountRequest.create();
40
+ request.address = ethAddress;
41
+ try {
42
+ const response = await this.retry(() => this.client.CosmosAccount(request, this.metadata));
43
+ return ChainGrpcEvmTransformer.cosmosAccountResponseToCosmosAccount(response);
44
+ }
45
+ catch (e) {
46
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
47
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
48
+ code: grpcErrorCodeToErrorCode(e.code),
49
+ context: 'CosmosAccount',
50
+ contextModule: this.module,
51
+ });
52
+ }
53
+ throw new GrpcUnaryRequestException(e, {
54
+ code: UnspecifiedErrorCode,
55
+ context: 'CosmosAccount',
56
+ contextModule: this.module,
57
+ });
58
+ }
59
+ }
60
+ async fetchValidatorAccount(consAddress) {
61
+ const request = InjectiveEvmV1Query.QueryValidatorAccountRequest.create();
62
+ request.consAddress = consAddress;
63
+ try {
64
+ const response = await this.retry(() => this.client.ValidatorAccount(request, this.metadata));
65
+ return ChainGrpcEvmTransformer.validatorAccountResponseToValidatorAccount(response);
66
+ }
67
+ catch (e) {
68
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
69
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
70
+ code: grpcErrorCodeToErrorCode(e.code),
71
+ context: 'EvmValidatorAccount',
72
+ contextModule: this.module,
73
+ });
74
+ }
75
+ throw new GrpcUnaryRequestException(e, {
76
+ code: UnspecifiedErrorCode,
77
+ context: 'EvmValidatorAccount',
78
+ contextModule: this.module,
79
+ });
80
+ }
81
+ }
82
+ async fetchBalance(ethAddress) {
83
+ const request = InjectiveEvmV1Query.QueryBalanceRequest.create();
84
+ request.address = ethAddress;
85
+ try {
86
+ const response = await this.retry(() => this.client.Balance(request, this.metadata));
87
+ return response.balance;
88
+ }
89
+ catch (e) {
90
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
91
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
92
+ code: grpcErrorCodeToErrorCode(e.code),
93
+ context: 'EvmBalance',
94
+ contextModule: this.module,
95
+ });
96
+ }
97
+ throw new GrpcUnaryRequestException(e, {
98
+ code: UnspecifiedErrorCode,
99
+ context: 'EvmBalance',
100
+ contextModule: this.module,
101
+ });
102
+ }
103
+ }
104
+ async fetchStorage(ethAddress, key) {
105
+ const request = InjectiveEvmV1Query.QueryStorageRequest.create();
106
+ request.address = ethAddress;
107
+ request.key = key;
108
+ try {
109
+ const response = await this.retry(() => this.client.Storage(request, this.metadata));
110
+ return response.value;
111
+ }
112
+ catch (e) {
113
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
114
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
115
+ code: grpcErrorCodeToErrorCode(e.code),
116
+ context: 'EvmStorage',
117
+ contextModule: this.module,
118
+ });
119
+ }
120
+ throw new GrpcUnaryRequestException(e, {
121
+ code: UnspecifiedErrorCode,
122
+ context: 'EvmStorage',
123
+ contextModule: this.module,
124
+ });
125
+ }
126
+ }
127
+ async fetchCode(ethAddress) {
128
+ const request = InjectiveEvmV1Query.QueryCodeRequest.create();
129
+ request.address = ethAddress;
130
+ try {
131
+ const response = await this.retry(() => this.client.Code(request, this.metadata));
132
+ return response.code;
133
+ }
134
+ catch (e) {
135
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
136
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
137
+ code: grpcErrorCodeToErrorCode(e.code),
138
+ context: 'EvmCode',
139
+ contextModule: this.module,
140
+ });
141
+ }
142
+ throw new GrpcUnaryRequestException(e, {
143
+ code: UnspecifiedErrorCode,
144
+ context: 'EvmCode',
145
+ contextModule: this.module,
146
+ });
147
+ }
148
+ }
149
+ async fetchParams() {
150
+ const request = InjectiveEvmV1Query.QueryParamsRequest.create();
151
+ try {
152
+ const response = await this.retry(() => this.client.Params(request, this.metadata));
153
+ return ChainGrpcEvmTransformer.paramsResponseToParams(response);
154
+ }
155
+ catch (e) {
156
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
157
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
158
+ code: grpcErrorCodeToErrorCode(e.code),
159
+ context: 'EvmParams',
160
+ contextModule: this.module,
161
+ });
162
+ }
163
+ throw new GrpcUnaryRequestException(e, {
164
+ code: UnspecifiedErrorCode,
165
+ context: 'EvmParams',
166
+ contextModule: this.module,
167
+ });
168
+ }
169
+ }
170
+ async fetchBaseFee() {
171
+ const request = InjectiveEvmV1Query.QueryBaseFeeRequest.create();
172
+ try {
173
+ const response = await this.retry(() => this.client.BaseFee(request, this.metadata));
174
+ return response.baseFee;
175
+ }
176
+ catch (e) {
177
+ if (e instanceof InjectiveEvmV1Query.GrpcWebError) {
178
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
179
+ code: grpcErrorCodeToErrorCode(e.code),
180
+ context: 'EvmBaseFee',
181
+ contextModule: this.module,
182
+ });
183
+ }
184
+ throw new GrpcUnaryRequestException(e, {
185
+ code: UnspecifiedErrorCode,
186
+ context: 'EvmBaseFee',
187
+ contextModule: this.module,
188
+ });
189
+ }
190
+ }
191
+ }
@@ -2,8 +2,8 @@ import { CosmosGovV1Query } from '@injectivelabs/core-proto-ts';
2
2
  import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
3
  import { ChainModule } from '../types/index.js';
4
4
  import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
- import { paginationRequestFromPagination } from '../../../utils/pagination.js';
6
5
  import { ChainGrpcGovTransformer } from '../transformers/ChainGrpcGovTransformer.js';
6
+ import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
7
7
  /**
8
8
  * @category Chain Grpc API
9
9
  */
@@ -48,7 +48,7 @@ export class ChainGrpcGovApi extends BaseGrpcConsumer {
48
48
  async fetchProposals({ status, pagination, }) {
49
49
  const request = CosmosGovV1Query.QueryProposalsRequest.create();
50
50
  request.proposalStatus = status;
51
- const paginationForRequest = paginationRequestFromPagination(pagination);
51
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
52
52
  if (paginationForRequest) {
53
53
  request.pagination = paginationForRequest;
54
54
  }
@@ -96,7 +96,7 @@ export class ChainGrpcGovApi extends BaseGrpcConsumer {
96
96
  async fetchProposalDeposits({ proposalId, pagination, }) {
97
97
  const request = CosmosGovV1Query.QueryDepositsRequest.create();
98
98
  request.proposalId = proposalId.toString();
99
- const paginationForRequest = paginationRequestFromPagination(pagination);
99
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
100
100
  if (paginationForRequest) {
101
101
  request.pagination = paginationForRequest;
102
102
  }
@@ -122,7 +122,7 @@ export class ChainGrpcGovApi extends BaseGrpcConsumer {
122
122
  async fetchProposalVotes({ proposalId, pagination, }) {
123
123
  const request = CosmosGovV1Query.QueryVotesRequest.create();
124
124
  request.proposalId = proposalId.toString();
125
- const paginationForRequest = paginationRequestFromPagination(pagination);
125
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
126
126
  if (paginationForRequest) {
127
127
  request.pagination = paginationForRequest;
128
128
  }
@@ -2,7 +2,7 @@ import { IbcApplicationsTransferV1Query } from '@injectivelabs/core-proto-ts';
2
2
  import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
3
3
  import { ChainModule } from '../types/index.js';
4
4
  import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
5
- import { paginationRequestFromPagination } from '../../../utils/pagination.js';
5
+ import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
6
6
  /**
7
7
  * @category Chain Grpc API
8
8
  */
@@ -37,7 +37,7 @@ export class ChainGrpcIbcApi extends BaseGrpcConsumer {
37
37
  }
38
38
  async fetchDenomsTrace(pagination) {
39
39
  const request = IbcApplicationsTransferV1Query.QueryDenomTracesRequest.create();
40
- const paginationForRequest = paginationRequestFromPagination(pagination);
40
+ const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
41
41
  if (paginationForRequest) {
42
42
  request.pagination = paginationForRequest;
43
43
  }