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