@injectivelabs/sdk-ts 1.16.15 → 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.
- 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/grpc_stream/IndexerGrpcArchiverStream.d.ts +18 -0
- package/dist/cjs/client/indexer/grpc_stream/IndexerGrpcArchiverStream.js +38 -0
- package/dist/cjs/client/indexer/grpc_stream/index.d.ts +1 -0
- package/dist/cjs/client/indexer/grpc_stream/index.js +1 -0
- package/dist/cjs/client/indexer/transformers/IndexerArchiverStreamTransformer.d.ts +11 -0
- package/dist/cjs/client/indexer/transformers/IndexerArchiverStreamTransformer.js +21 -0
- package/dist/cjs/client/indexer/transformers/IndexerAuctionStreamTransformer.d.ts +2 -2
- package/dist/cjs/client/indexer/transformers/IndexerGrpcArchiverTransformer.d.ts +2 -1
- package/dist/cjs/client/indexer/transformers/IndexerGrpcArchiverTransformer.js +8 -0
- 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 +3 -1
- package/dist/cjs/client/indexer/transformers/index.js +3 -1
- package/dist/cjs/client/indexer/types/archiver.d.ts +7 -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/grpc_stream/IndexerGrpcArchiverStream.d.ts +18 -0
- package/dist/esm/client/indexer/grpc_stream/IndexerGrpcArchiverStream.js +34 -0
- package/dist/esm/client/indexer/grpc_stream/index.d.ts +1 -0
- package/dist/esm/client/indexer/grpc_stream/index.js +1 -0
- package/dist/esm/client/indexer/transformers/IndexerArchiverStreamTransformer.d.ts +11 -0
- package/dist/esm/client/indexer/transformers/IndexerArchiverStreamTransformer.js +17 -0
- package/dist/esm/client/indexer/transformers/IndexerAuctionStreamTransformer.d.ts +2 -2
- package/dist/esm/client/indexer/transformers/IndexerGrpcArchiverTransformer.d.ts +2 -1
- package/dist/esm/client/indexer/transformers/IndexerGrpcArchiverTransformer.js +8 -0
- 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 +3 -1
- package/dist/esm/client/indexer/transformers/index.js +3 -1
- package/dist/esm/client/indexer/types/archiver.d.ts +7 -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
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
const snakecase_keys_1 = __importDefault(require("snakecase-keys"));
|
|
7
|
+
const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
|
|
8
|
+
const MsgBase_js_1 = require("../../MsgBase.js");
|
|
9
|
+
const createMessage = (params) => {
|
|
10
|
+
const message = core_proto_ts_1.InjectiveExchangeV2Tx.MsgCancelPostOnlyMode.create();
|
|
11
|
+
message.sender = params.sender;
|
|
12
|
+
return core_proto_ts_1.InjectiveExchangeV2Tx.MsgCancelPostOnlyMode.fromPartial(message);
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @category Messages
|
|
16
|
+
*/
|
|
17
|
+
class MsgCancelPostOnlyModeV2 extends MsgBase_js_1.MsgBase {
|
|
18
|
+
static fromJSON(params) {
|
|
19
|
+
return new MsgCancelPostOnlyModeV2(params);
|
|
20
|
+
}
|
|
21
|
+
toProto() {
|
|
22
|
+
const { params: initialParams } = this;
|
|
23
|
+
const params = {
|
|
24
|
+
...initialParams,
|
|
25
|
+
};
|
|
26
|
+
return createMessage(params);
|
|
27
|
+
}
|
|
28
|
+
toData() {
|
|
29
|
+
const proto = this.toProto();
|
|
30
|
+
return {
|
|
31
|
+
'@type': '/injective.exchange.v2.MsgCancelPostOnlyMode',
|
|
32
|
+
...proto,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
toAmino() {
|
|
36
|
+
const { params } = this;
|
|
37
|
+
const msg = createMessage(params);
|
|
38
|
+
const message = {
|
|
39
|
+
...(0, snakecase_keys_1.default)(msg),
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
type: 'exchange/MsgCancelPostOnlyMode',
|
|
43
|
+
value: message,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
toWeb3Gw() {
|
|
47
|
+
const amino = this.toAmino();
|
|
48
|
+
const { value } = amino;
|
|
49
|
+
return {
|
|
50
|
+
'@type': '/injective.exchange.v2.MsgCancelPostOnlyMode',
|
|
51
|
+
...value,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
toEip712() {
|
|
55
|
+
const amino = this.toAmino();
|
|
56
|
+
const { type, value } = amino;
|
|
57
|
+
const messageAdjusted = {
|
|
58
|
+
...value,
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
type,
|
|
62
|
+
value: messageAdjusted,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
toEip712V2() {
|
|
66
|
+
const web3gw = this.toWeb3Gw();
|
|
67
|
+
const messageAdjusted = {
|
|
68
|
+
...web3gw,
|
|
69
|
+
};
|
|
70
|
+
return messageAdjusted;
|
|
71
|
+
}
|
|
72
|
+
toDirectSign() {
|
|
73
|
+
const proto = this.toProto();
|
|
74
|
+
return {
|
|
75
|
+
type: '/injective.exchange.v2.MsgCancelPostOnlyMode',
|
|
76
|
+
message: proto,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
toBinary() {
|
|
80
|
+
return core_proto_ts_1.InjectiveExchangeV2Tx.MsgCancelPostOnlyMode.encode(this.toProto()).finish();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.default = MsgCancelPostOnlyModeV2;
|
|
@@ -34,6 +34,7 @@ import type MsgBatchCancelBinaryOptionsOrders from './exchange/msgs/MsgBatchCanc
|
|
|
34
34
|
import type MsgCreateBinaryOptionsMarketOrder from './exchange/msgs/MsgCreateBinaryOptionsMarketOrder.js';
|
|
35
35
|
import type MsgSetDelegationTransferReceivers from './exchange/msgs/MsgSetDelegationTransferReceivers.js';
|
|
36
36
|
import type MsgUpdateSpotMarketV2 from './exchange/msgs/MsgUpdateSpotMarketV2.js';
|
|
37
|
+
import type MsgCancelPostOnlyModeV2 from './exchange/msgs/MsgCancelPostOnlyModeV2.js';
|
|
37
38
|
import type MsgUpdateDerivativeMarketV2 from './exchange/msgs/MsgUpdateDerivativeMarketV2.js';
|
|
38
39
|
import type MsgGrantAllowance from './feegrant/msgs/MsgGrantAllowance.js';
|
|
39
40
|
import type MsgRevokeAllowance from './feegrant/msgs/MsgRevokeAllowance.js';
|
|
@@ -69,7 +70,7 @@ export type AuthzMsgs = MsgGrant | MsgRevoke | MsgAuthzExec | MsgGrantWithAuthor
|
|
|
69
70
|
export type BankMsgs = MsgSend | MsgMultiSend;
|
|
70
71
|
export type DistributionMsgs = MsgFundCommunityPool | MsgWithdrawDelegatorReward | MsgWithdrawValidatorCommission;
|
|
71
72
|
export type ExchangeV1Msgs = MsgDeposit | MsgSignData | MsgWithdraw | MsgRewardsOptOut | MsgCancelSpotOrder | MsgExternalTransfer | MsgBatchUpdateOrders | MsgLiquidatePosition | MsgReclaimLockedFunds | MsgAuthorizeStakeGrants | MsgCreateSpotLimitOrder | MsgBatchCancelSpotOrders | MsgCancelDerivativeOrder | MsgCreateSpotMarketOrder | MsgIncreasePositionMargin | MsgInstantSpotMarketLaunch | MsgCancelBinaryOptionsOrder | MsgCreateDerivativeLimitOrder | MsgBatchCancelDerivativeOrders | MsgCreateDerivativeMarketOrder | MsgCreateBinaryOptionsLimitOrder | MsgAdminUpdateBinaryOptionsMarket | MsgBatchCancelBinaryOptionsOrders | MsgCreateBinaryOptionsMarketOrder | MsgSetDelegationTransferReceivers;
|
|
72
|
-
export type ExchangeV2Msgs = MsgUpdateSpotMarketV2 | MsgUpdateDerivativeMarketV2;
|
|
73
|
+
export type ExchangeV2Msgs = MsgUpdateSpotMarketV2 | MsgCancelPostOnlyModeV2 | MsgUpdateDerivativeMarketV2;
|
|
73
74
|
export type FeegrantMsgs = MsgGrantAllowance | MsgRevokeAllowance;
|
|
74
75
|
export type GovMsgs = MsgVote | MsgSubmitProposal | MsgGovDeposit;
|
|
75
76
|
export type IbcMsgs = MsgTransfer;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { CosmosBaseQueryV1Beta1Pagination } from '@injectivelabs/core-proto-ts';
|
|
2
|
-
import type { Pagination, PagePagination } from '../types/pagination.js';
|
|
3
1
|
import type { InjectiveExplorerRpc } from '@injectivelabs/indexer-proto-ts';
|
|
4
|
-
import type {
|
|
2
|
+
import type { CosmosBaseQueryV1Beta1Pagination } from '@injectivelabs/core-proto-ts';
|
|
3
|
+
import type { Pagination, PaginationOption, ExchangePagination } from '../types/pagination.js';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest instead
|
|
6
|
+
*/
|
|
5
7
|
export declare const paginationRequestFromPagination: (pagination?: PaginationOption) => CosmosBaseQueryV1Beta1Pagination.PageRequest | undefined;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
} | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use ChainGrpcCommonTransformer.paginationUint8ArrayToString instead
|
|
10
|
+
*/
|
|
11
11
|
export declare const paginationUint8ArrayToString: (key: any) => string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}) => PagePagination;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use ChainGrpcCommonTransformer.grpcPaginationToPagination instead
|
|
14
|
+
*/
|
|
16
15
|
export declare const grpcPaginationToPagination: (pagination: CosmosBaseQueryV1Beta1Pagination.PageResponse | undefined) => Pagination;
|
|
17
16
|
export declare const grpcPagingToPaging: (pagination: InjectiveExplorerRpc.Paging | undefined) => ExchangePagination;
|
|
18
17
|
export declare const fetchAllWithPagination: <T extends {
|
|
@@ -1,84 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAllWithPagination = exports.grpcPagingToPaging = exports.grpcPaginationToPagination = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.fetchAllWithPagination = exports.grpcPagingToPaging = exports.grpcPaginationToPagination = exports.paginationUint8ArrayToString = exports.paginationRequestFromPagination = void 0;
|
|
4
|
+
const ChainGrpcCommonTransformer_js_1 = require("../client/chain/transformers/ChainGrpcCommonTransformer.js");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest instead
|
|
7
|
+
*/
|
|
5
8
|
const paginationRequestFromPagination = (pagination) => {
|
|
6
|
-
|
|
7
|
-
if (!pagination) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (pagination.key) {
|
|
11
|
-
paginationForRequest.key = Buffer.from(pagination.key, 'base64');
|
|
12
|
-
}
|
|
13
|
-
if (pagination.limit !== undefined) {
|
|
14
|
-
paginationForRequest.limit = pagination.limit.toString();
|
|
15
|
-
}
|
|
16
|
-
if (pagination.offset !== undefined) {
|
|
17
|
-
paginationForRequest.offset = pagination.offset.toString();
|
|
18
|
-
}
|
|
19
|
-
if (pagination.reverse !== undefined) {
|
|
20
|
-
paginationForRequest.reverse = pagination.reverse;
|
|
21
|
-
}
|
|
22
|
-
if (pagination.countTotal !== undefined) {
|
|
23
|
-
paginationForRequest.countTotal = pagination.countTotal;
|
|
24
|
-
}
|
|
25
|
-
return paginationForRequest;
|
|
9
|
+
return ChainGrpcCommonTransformer_js_1.ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
26
10
|
};
|
|
27
11
|
exports.paginationRequestFromPagination = paginationRequestFromPagination;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
if (!pagination.next) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
pagination: {
|
|
37
|
-
key: pagination.next,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
exports.generatePagination = generatePagination;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use ChainGrpcCommonTransformer.paginationUint8ArrayToString instead
|
|
14
|
+
*/
|
|
42
15
|
const paginationUint8ArrayToString = (key) => {
|
|
43
|
-
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
if (key.constructor !== Uint8Array) {
|
|
47
|
-
return key;
|
|
48
|
-
}
|
|
49
|
-
return Buffer.from(key).toString('base64');
|
|
16
|
+
return ChainGrpcCommonTransformer_js_1.ChainGrpcCommonTransformer.paginationUint8ArrayToString(key);
|
|
50
17
|
};
|
|
51
18
|
exports.paginationUint8ArrayToString = paginationUint8ArrayToString;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
prev: null,
|
|
56
|
-
current: null,
|
|
57
|
-
next: null,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const next = (0, exports.paginationUint8ArrayToString)(newPagination.next);
|
|
61
|
-
if (!oldPagination) {
|
|
62
|
-
return {
|
|
63
|
-
prev: null,
|
|
64
|
-
current: null,
|
|
65
|
-
next,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
prev: oldPagination.current,
|
|
70
|
-
current: oldPagination.next,
|
|
71
|
-
next,
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
exports.pageResponseToPagination = pageResponseToPagination;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use ChainGrpcCommonTransformer.grpcPaginationToPagination instead
|
|
21
|
+
*/
|
|
75
22
|
const grpcPaginationToPagination = (pagination) => {
|
|
76
|
-
return
|
|
77
|
-
total: pagination
|
|
78
|
-
? parseInt((0, exports.paginationUint8ArrayToString)(pagination.total), 10)
|
|
79
|
-
: 0,
|
|
80
|
-
next: pagination ? (0, exports.paginationUint8ArrayToString)(pagination.nextKey) : '',
|
|
81
|
-
};
|
|
23
|
+
return ChainGrpcCommonTransformer_js_1.ChainGrpcCommonTransformer.grpcPaginationToPagination(pagination);
|
|
82
24
|
};
|
|
83
25
|
exports.grpcPaginationToPagination = grpcPaginationToPagination;
|
|
84
26
|
const grpcPagingToPaging = (pagination) => {
|
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
26
|
+
evm;
|
|
27
|
+
auth;
|
|
28
|
+
bank;
|
|
30
29
|
mint;
|
|
31
|
-
|
|
30
|
+
wasm;
|
|
32
31
|
peggy;
|
|
33
|
-
|
|
32
|
+
wasmX;
|
|
33
|
+
erc20;
|
|
34
|
+
oracle;
|
|
35
|
+
auction;
|
|
34
36
|
staking;
|
|
37
|
+
exchange;
|
|
38
|
+
permissions;
|
|
39
|
+
distribution;
|
|
35
40
|
tokenfactory;
|
|
36
|
-
|
|
37
|
-
wasmX;
|
|
41
|
+
insuranceFund;
|
|
38
42
|
constructor(endpoint) {
|
|
39
|
-
this.
|
|
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.
|
|
46
|
+
this.auth = new ChainGrpcAuthApi(endpoint);
|
|
47
|
+
this.bank = new ChainGrpcBankApi(endpoint);
|
|
47
48
|
this.mint = new ChainGrpcMintApi(endpoint);
|
|
48
|
-
this.
|
|
49
|
+
this.wasm = new ChainGrpcWasmApi(endpoint);
|
|
50
|
+
this.erc20 = new ChainGrpcErc20Api(endpoint);
|
|
49
51
|
this.peggy = new ChainGrpcPeggyApi(endpoint);
|
|
50
|
-
this.
|
|
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.
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
+
}
|