@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,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 =
|
|
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 =
|
|
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 =
|
|
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 {
|
|
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 =
|
|
40
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
41
41
|
if (paginationForRequest) {
|
|
42
42
|
request.pagination = paginationForRequest;
|
|
43
43
|
}
|
|
@@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestExcepti
|
|
|
3
3
|
import { ChainModule } from '../types/index.js';
|
|
4
4
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
5
5
|
import { ChainGrpcStakingTransformer } from '../transformers/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
|
|
7
7
|
/**
|
|
8
8
|
* @category Chain Grpc API
|
|
9
9
|
*/
|
|
@@ -58,7 +58,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
58
58
|
}
|
|
59
59
|
async fetchValidators(pagination) {
|
|
60
60
|
const request = CosmosStakingV1Beta1Query.QueryValidatorsRequest.create();
|
|
61
|
-
const paginationForRequest =
|
|
61
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
62
62
|
if (paginationForRequest) {
|
|
63
63
|
request.pagination = paginationForRequest;
|
|
64
64
|
}
|
|
@@ -106,7 +106,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
106
106
|
async fetchValidatorDelegations({ validatorAddress, pagination, }) {
|
|
107
107
|
const request = CosmosStakingV1Beta1Query.QueryValidatorDelegationsRequest.create();
|
|
108
108
|
request.validatorAddr = validatorAddress;
|
|
109
|
-
const paginationForRequest =
|
|
109
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
110
110
|
if (paginationForRequest) {
|
|
111
111
|
request.pagination = paginationForRequest;
|
|
112
112
|
}
|
|
@@ -132,7 +132,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
132
132
|
async fetchValidatorDelegationsNoThrow({ validatorAddress, pagination, }) {
|
|
133
133
|
const request = CosmosStakingV1Beta1Query.QueryValidatorDelegationsRequest.create();
|
|
134
134
|
request.validatorAddr = validatorAddress;
|
|
135
|
-
const paginationForRequest =
|
|
135
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
136
136
|
if (paginationForRequest) {
|
|
137
137
|
request.pagination = paginationForRequest;
|
|
138
138
|
}
|
|
@@ -161,7 +161,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
161
161
|
async fetchValidatorUnbondingDelegations({ validatorAddress, pagination, }) {
|
|
162
162
|
const request = CosmosStakingV1Beta1Query.QueryValidatorUnbondingDelegationsRequest.create();
|
|
163
163
|
request.validatorAddr = validatorAddress;
|
|
164
|
-
const paginationForRequest =
|
|
164
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
165
165
|
if (paginationForRequest) {
|
|
166
166
|
request.pagination = paginationForRequest;
|
|
167
167
|
}
|
|
@@ -187,7 +187,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
187
187
|
async fetchValidatorUnbondingDelegationsNoThrow({ validatorAddress, pagination, }) {
|
|
188
188
|
const request = CosmosStakingV1Beta1Query.QueryValidatorUnbondingDelegationsRequest.create();
|
|
189
189
|
request.validatorAddr = validatorAddress;
|
|
190
|
-
const paginationForRequest =
|
|
190
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
191
191
|
if (paginationForRequest) {
|
|
192
192
|
request.pagination = paginationForRequest;
|
|
193
193
|
}
|
|
@@ -239,7 +239,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
239
239
|
async fetchDelegations({ injectiveAddress, pagination, }) {
|
|
240
240
|
const request = CosmosStakingV1Beta1Query.QueryDelegatorDelegationsRequest.create();
|
|
241
241
|
request.delegatorAddr = injectiveAddress;
|
|
242
|
-
const paginationForRequest =
|
|
242
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
243
243
|
if (paginationForRequest) {
|
|
244
244
|
request.pagination = paginationForRequest;
|
|
245
245
|
}
|
|
@@ -265,7 +265,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
265
265
|
async fetchDelegationsNoThrow({ injectiveAddress, pagination, }) {
|
|
266
266
|
const request = CosmosStakingV1Beta1Query.QueryDelegatorDelegationsRequest.create();
|
|
267
267
|
request.delegatorAddr = injectiveAddress;
|
|
268
|
-
const paginationForRequest =
|
|
268
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
269
269
|
if (paginationForRequest) {
|
|
270
270
|
request.pagination = paginationForRequest;
|
|
271
271
|
}
|
|
@@ -294,7 +294,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
294
294
|
async fetchDelegators({ validatorAddress, pagination, }) {
|
|
295
295
|
const request = CosmosStakingV1Beta1Query.QueryValidatorDelegationsRequest.create();
|
|
296
296
|
request.validatorAddr = validatorAddress;
|
|
297
|
-
const paginationForRequest =
|
|
297
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
298
298
|
if (paginationForRequest) {
|
|
299
299
|
request.pagination = paginationForRequest;
|
|
300
300
|
}
|
|
@@ -320,7 +320,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
320
320
|
async fetchDelegatorsNoThrow({ validatorAddress, pagination, }) {
|
|
321
321
|
const request = CosmosStakingV1Beta1Query.QueryValidatorDelegationsRequest.create();
|
|
322
322
|
request.validatorAddr = validatorAddress;
|
|
323
|
-
const paginationForRequest =
|
|
323
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
324
324
|
if (paginationForRequest) {
|
|
325
325
|
request.pagination = paginationForRequest;
|
|
326
326
|
}
|
|
@@ -349,7 +349,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
349
349
|
async fetchUnbondingDelegations({ injectiveAddress, pagination, }) {
|
|
350
350
|
const request = CosmosStakingV1Beta1Query.QueryDelegatorUnbondingDelegationsRequest.create();
|
|
351
351
|
request.delegatorAddr = injectiveAddress;
|
|
352
|
-
const paginationForRequest =
|
|
352
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
353
353
|
if (paginationForRequest) {
|
|
354
354
|
request.pagination = paginationForRequest;
|
|
355
355
|
}
|
|
@@ -375,7 +375,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
375
375
|
async fetchUnbondingDelegationsNoThrow({ injectiveAddress, pagination, }) {
|
|
376
376
|
const request = CosmosStakingV1Beta1Query.QueryDelegatorUnbondingDelegationsRequest.create();
|
|
377
377
|
request.delegatorAddr = injectiveAddress;
|
|
378
|
-
const paginationForRequest =
|
|
378
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
379
379
|
if (paginationForRequest) {
|
|
380
380
|
request.pagination = paginationForRequest;
|
|
381
381
|
}
|
|
@@ -404,7 +404,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
404
404
|
async fetchReDelegations({ injectiveAddress, pagination, }) {
|
|
405
405
|
const request = CosmosStakingV1Beta1Query.QueryRedelegationsRequest.create();
|
|
406
406
|
request.delegatorAddr = injectiveAddress;
|
|
407
|
-
const paginationForRequest =
|
|
407
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
408
408
|
if (paginationForRequest) {
|
|
409
409
|
request.pagination = paginationForRequest;
|
|
410
410
|
}
|
|
@@ -430,7 +430,7 @@ export class ChainGrpcStakingApi extends BaseGrpcConsumer {
|
|
|
430
430
|
async fetchReDelegationsNoThrow({ injectiveAddress, pagination, }) {
|
|
431
431
|
const request = CosmosStakingV1Beta1Query.QueryRedelegationsRequest.create();
|
|
432
432
|
request.delegatorAddr = injectiveAddress;
|
|
433
|
-
const paginationForRequest =
|
|
433
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
434
434
|
if (paginationForRequest) {
|
|
435
435
|
request.pagination = paginationForRequest;
|
|
436
436
|
}
|
|
@@ -4,7 +4,7 @@ import { ChainModule } from '../types/index.js';
|
|
|
4
4
|
import { toBase64 } from '../../../utils/utf8.js';
|
|
5
5
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
6
6
|
import { ChainGrpcWasmTransformer } from '../transformers/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { ChainGrpcCommonTransformer } from '../transformers/ChainGrpcCommonTransformer.js';
|
|
8
8
|
/**
|
|
9
9
|
* @category Chain Grpc API
|
|
10
10
|
*/
|
|
@@ -18,7 +18,7 @@ export class ChainGrpcWasmApi extends BaseGrpcConsumer {
|
|
|
18
18
|
async fetchContractAccountsBalance({ contractAddress, pagination, }) {
|
|
19
19
|
const request = CosmwasmWasmV1Query.QueryAllContractStateRequest.create();
|
|
20
20
|
request.address = contractAddress;
|
|
21
|
-
const paginationForRequest =
|
|
21
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
22
22
|
if (paginationForRequest) {
|
|
23
23
|
request.pagination = paginationForRequest;
|
|
24
24
|
}
|
|
@@ -44,7 +44,7 @@ export class ChainGrpcWasmApi extends BaseGrpcConsumer {
|
|
|
44
44
|
async fetchContractState({ contractAddress, pagination, }) {
|
|
45
45
|
const request = CosmwasmWasmV1Query.QueryAllContractStateRequest.create();
|
|
46
46
|
request.address = contractAddress;
|
|
47
|
-
const paginationForRequest =
|
|
47
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
48
48
|
if (paginationForRequest) {
|
|
49
49
|
request.pagination = paginationForRequest;
|
|
50
50
|
}
|
|
@@ -167,7 +167,7 @@ export class ChainGrpcWasmApi extends BaseGrpcConsumer {
|
|
|
167
167
|
}
|
|
168
168
|
async fetchContractCodes(pagination) {
|
|
169
169
|
const request = CosmwasmWasmV1Query.QueryCodesRequest.create();
|
|
170
|
-
const paginationForRequest =
|
|
170
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
171
171
|
if (paginationForRequest) {
|
|
172
172
|
request.pagination = paginationForRequest;
|
|
173
173
|
}
|
|
@@ -215,7 +215,7 @@ export class ChainGrpcWasmApi extends BaseGrpcConsumer {
|
|
|
215
215
|
async fetchContractCodeContracts(codeId, pagination) {
|
|
216
216
|
const request = CosmwasmWasmV1Query.QueryContractsByCodeRequest.create();
|
|
217
217
|
request.codeId = codeId.toString();
|
|
218
|
-
const paginationForRequest =
|
|
218
|
+
const paginationForRequest = ChainGrpcCommonTransformer.pageRequestToGrpcPageRequest(pagination);
|
|
219
219
|
if (paginationForRequest) {
|
|
220
220
|
request.pagination = paginationForRequest;
|
|
221
221
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export { ChainGrpcAuctionApi } from './ChainGrpcAuctionApi.js';
|
|
2
|
-
export { ChainGrpcAuthApi } from './ChainGrpcAuthApi.js';
|
|
3
|
-
export { ChainGrpcAuthZApi } from './ChainGrpcAuthZApi.js';
|
|
4
|
-
export { ChainGrpcBankApi } from './ChainGrpcBankApi.js';
|
|
5
|
-
export { ChainGrpcDistributionApi } from './ChainGrpcDistributionApi.js';
|
|
6
|
-
export { ChainGrpcExchangeApi } from './ChainGrpcExchangeApi.js';
|
|
7
1
|
export { ChainGrpcGovApi } from './ChainGrpcGovApi.js';
|
|
8
2
|
export { ChainGrpcIbcApi } from './ChainGrpcIbcApi.js';
|
|
9
|
-
export {
|
|
3
|
+
export { ChainGrpcEvmApi } from './ChainGrpcEvmApi.js';
|
|
4
|
+
export { ChainGrpcAuthApi } from './ChainGrpcAuthApi.js';
|
|
5
|
+
export { ChainGrpcBankApi } from './ChainGrpcBankApi.js';
|
|
10
6
|
export { ChainGrpcMintApi } from './ChainGrpcMintApi.js';
|
|
11
|
-
export { ChainGrpcOracleApi } from './ChainGrpcOracleApi.js';
|
|
12
|
-
export { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi.js';
|
|
13
|
-
export { ChainGrpcPermissionsApi } from './ChainGrpcPermissionsApi.js';
|
|
14
|
-
export { ChainGrpcStakingApi } from './ChainGrpcStakingApi.js';
|
|
15
|
-
export { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi.js';
|
|
16
7
|
export { ChainGrpcWasmApi } from './ChainGrpcWasmApi.js';
|
|
8
|
+
export { ChainGrpcAuthZApi } from './ChainGrpcAuthZApi.js';
|
|
9
|
+
export { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi.js';
|
|
17
10
|
export { ChainGrpcWasmXApi } from './ChainGrpcWasmXApi.js';
|
|
18
|
-
export {
|
|
11
|
+
export { ChainGrpcErc20Api } from './ChainGrpcErc20Api.js';
|
|
12
|
+
export { ChainGrpcOracleApi } from './ChainGrpcOracleApi.js';
|
|
19
13
|
export { ChainGrpcTxFeesApi } from './ChainGrpcTxFeesApi.js';
|
|
14
|
+
export { ChainGrpcAuctionApi } from './ChainGrpcAuctionApi.js';
|
|
15
|
+
export { ChainGrpcStakingApi } from './ChainGrpcStakingApi.js';
|
|
16
|
+
export { ChainGrpcExchangeApi } from './ChainGrpcExchangeApi.js';
|
|
17
|
+
export { ChainGrpcTendermintApi } from './ChainGrpcTendermintApi.js';
|
|
18
|
+
export { ChainGrpcPermissionsApi } from './ChainGrpcPermissionsApi.js';
|
|
19
|
+
export { ChainGrpcDistributionApi } from './ChainGrpcDistributionApi.js';
|
|
20
|
+
export { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi.js';
|
|
21
|
+
export { ChainGrpcInsuranceFundApi } from './ChainGrpcInsuranceFundApi.js';
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export { ChainGrpcAuctionApi } from './ChainGrpcAuctionApi.js';
|
|
2
|
-
export { ChainGrpcAuthApi } from './ChainGrpcAuthApi.js';
|
|
3
|
-
export { ChainGrpcAuthZApi } from './ChainGrpcAuthZApi.js';
|
|
4
|
-
export { ChainGrpcBankApi } from './ChainGrpcBankApi.js';
|
|
5
|
-
export { ChainGrpcDistributionApi } from './ChainGrpcDistributionApi.js';
|
|
6
|
-
export { ChainGrpcExchangeApi } from './ChainGrpcExchangeApi.js';
|
|
7
1
|
export { ChainGrpcGovApi } from './ChainGrpcGovApi.js';
|
|
8
2
|
export { ChainGrpcIbcApi } from './ChainGrpcIbcApi.js';
|
|
9
|
-
export {
|
|
3
|
+
export { ChainGrpcEvmApi } from './ChainGrpcEvmApi.js';
|
|
4
|
+
export { ChainGrpcAuthApi } from './ChainGrpcAuthApi.js';
|
|
5
|
+
export { ChainGrpcBankApi } from './ChainGrpcBankApi.js';
|
|
10
6
|
export { ChainGrpcMintApi } from './ChainGrpcMintApi.js';
|
|
11
|
-
export { ChainGrpcOracleApi } from './ChainGrpcOracleApi.js';
|
|
12
|
-
export { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi.js';
|
|
13
|
-
export { ChainGrpcPermissionsApi } from './ChainGrpcPermissionsApi.js';
|
|
14
|
-
export { ChainGrpcStakingApi } from './ChainGrpcStakingApi.js';
|
|
15
|
-
export { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi.js';
|
|
16
7
|
export { ChainGrpcWasmApi } from './ChainGrpcWasmApi.js';
|
|
8
|
+
export { ChainGrpcAuthZApi } from './ChainGrpcAuthZApi.js';
|
|
9
|
+
export { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi.js';
|
|
17
10
|
export { ChainGrpcWasmXApi } from './ChainGrpcWasmXApi.js';
|
|
18
|
-
export {
|
|
11
|
+
export { ChainGrpcErc20Api } from './ChainGrpcErc20Api.js';
|
|
12
|
+
export { ChainGrpcOracleApi } from './ChainGrpcOracleApi.js';
|
|
19
13
|
export { ChainGrpcTxFeesApi } from './ChainGrpcTxFeesApi.js';
|
|
14
|
+
export { ChainGrpcAuctionApi } from './ChainGrpcAuctionApi.js';
|
|
15
|
+
export { ChainGrpcStakingApi } from './ChainGrpcStakingApi.js';
|
|
16
|
+
export { ChainGrpcExchangeApi } from './ChainGrpcExchangeApi.js';
|
|
17
|
+
export { ChainGrpcTendermintApi } from './ChainGrpcTendermintApi.js';
|
|
18
|
+
export { ChainGrpcPermissionsApi } from './ChainGrpcPermissionsApi.js';
|
|
19
|
+
export { ChainGrpcDistributionApi } from './ChainGrpcDistributionApi.js';
|
|
20
|
+
export { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi.js';
|
|
21
|
+
export { ChainGrpcInsuranceFundApi } from './ChainGrpcInsuranceFundApi.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectiveTypesV1Beta1Account, InjectiveCryptoV1Beta1Ethsecp256k1Keys, } from '@injectivelabs/core-proto-ts';
|
|
2
2
|
import { uint8ArrayToString } from '../../../utils/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { ChainGrpcCommonTransformer } from './ChainGrpcCommonTransformer.js';
|
|
4
4
|
/**
|
|
5
5
|
* @category Chain Grpc Transformer
|
|
6
6
|
*/
|
|
@@ -39,7 +39,7 @@ export class ChainGrpcAuthTransformer {
|
|
|
39
39
|
}
|
|
40
40
|
static accountsResponseToAccounts(response) {
|
|
41
41
|
return {
|
|
42
|
-
pagination: grpcPaginationToPagination(response.pagination),
|
|
42
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(response.pagination),
|
|
43
43
|
accounts: response.accounts.map(ChainGrpcAuthTransformer.grpcAccountToAccount),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneralException } from '@injectivelabs/exceptions';
|
|
2
2
|
import { CosmosAuthzV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
3
|
-
import {
|
|
3
|
+
import { ChainGrpcCommonTransformer } from './ChainGrpcCommonTransformer.js';
|
|
4
4
|
/**
|
|
5
5
|
* @category Chain Grpc Transformer
|
|
6
6
|
*/
|
|
@@ -25,19 +25,19 @@ export class ChainGrpcAuthZTransformer {
|
|
|
25
25
|
}
|
|
26
26
|
static grpcGrantsToGrants(response) {
|
|
27
27
|
return {
|
|
28
|
-
pagination: grpcPaginationToPagination(response.pagination),
|
|
28
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(response.pagination),
|
|
29
29
|
grants: response.grants.map(ChainGrpcAuthZTransformer.grpcGrantToGrant),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
static grpcGranteeGrantsToGranteeGrants(response) {
|
|
33
33
|
return {
|
|
34
|
-
pagination: grpcPaginationToPagination(response.pagination),
|
|
34
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(response.pagination),
|
|
35
35
|
grants: response.grants.map(ChainGrpcAuthZTransformer.grpcGrantAuthorizationToGrantAuthorization),
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
static grpcGranterGrantsToGranterGrants(response) {
|
|
39
39
|
return {
|
|
40
|
-
pagination: grpcPaginationToPagination(response.pagination),
|
|
40
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(response.pagination),
|
|
41
41
|
grants: response.grants.map(ChainGrpcAuthZTransformer.grpcGrantAuthorizationToGrantAuthorization),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { grpcPaginationToPagination } from '../../../utils/pagination.js';
|
|
2
1
|
import { ChainGrpcCommonTransformer } from './ChainGrpcCommonTransformer.js';
|
|
3
2
|
/**
|
|
4
3
|
* @category Chain Grpc Transformer
|
|
@@ -19,7 +18,7 @@ export class ChainGrpcBankTransformer {
|
|
|
19
18
|
const pagination = response.pagination;
|
|
20
19
|
return {
|
|
21
20
|
denomOwners,
|
|
22
|
-
pagination: grpcPaginationToPagination(pagination),
|
|
21
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(pagination),
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
static totalSupplyResponseToTotalSupply(response) {
|
|
@@ -27,7 +26,7 @@ export class ChainGrpcBankTransformer {
|
|
|
27
26
|
const pagination = response.pagination;
|
|
28
27
|
return {
|
|
29
28
|
supply: balances.map(ChainGrpcCommonTransformer.grpcCoinToCoin),
|
|
30
|
-
pagination: grpcPaginationToPagination(pagination),
|
|
29
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(pagination),
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
static denomsMetadataResponseToDenomsMetadata(response) {
|
|
@@ -35,7 +34,7 @@ export class ChainGrpcBankTransformer {
|
|
|
35
34
|
const pagination = response.pagination;
|
|
36
35
|
return {
|
|
37
36
|
metadatas: metadatas.map(ChainGrpcBankTransformer.metadataToMetadata),
|
|
38
|
-
pagination: grpcPaginationToPagination(pagination),
|
|
37
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(pagination),
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
40
|
static balanceResponseToBalance(response) {
|
|
@@ -46,7 +45,7 @@ export class ChainGrpcBankTransformer {
|
|
|
46
45
|
const pagination = response.pagination;
|
|
47
46
|
return {
|
|
48
47
|
balances: balances.map(ChainGrpcCommonTransformer.grpcCoinToCoin),
|
|
49
|
-
pagination: grpcPaginationToPagination(pagination),
|
|
48
|
+
pagination: ChainGrpcCommonTransformer.grpcPaginationToPagination(pagination),
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { CosmosBaseQueryV1Beta1Pagination } from '@injectivelabs/core-proto-ts';
|
|
1
2
|
import type { Coin } from '@injectivelabs/ts-types';
|
|
2
3
|
import type { GrpcCoin } from '../../../types/index.js';
|
|
4
|
+
import type { Pagination, PaginationOption } from '../../../types/pagination.js';
|
|
3
5
|
export declare class ChainGrpcCommonTransformer {
|
|
4
6
|
static grpcCoinToCoin(coin: GrpcCoin): Coin;
|
|
7
|
+
static pageRequestToGrpcPageRequest(pageRequest?: PaginationOption): CosmosBaseQueryV1Beta1Pagination.PageRequest | undefined;
|
|
8
|
+
static paginationUint8ArrayToString(key: any): string;
|
|
9
|
+
static grpcPaginationToPagination(pagination: CosmosBaseQueryV1Beta1Pagination.PageResponse | undefined): Pagination;
|
|
5
10
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CosmosBaseQueryV1Beta1Pagination } from '@injectivelabs/core-proto-ts';
|
|
1
2
|
export class ChainGrpcCommonTransformer {
|
|
2
3
|
static grpcCoinToCoin(coin) {
|
|
3
4
|
return {
|
|
@@ -5,4 +6,45 @@ export class ChainGrpcCommonTransformer {
|
|
|
5
6
|
amount: coin.amount,
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
static pageRequestToGrpcPageRequest(pageRequest) {
|
|
10
|
+
const paginationForRequest = CosmosBaseQueryV1Beta1Pagination.PageRequest.create();
|
|
11
|
+
if (!pageRequest) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (pageRequest.key) {
|
|
15
|
+
paginationForRequest.key = Buffer.from(pageRequest.key, 'base64');
|
|
16
|
+
}
|
|
17
|
+
if (pageRequest.limit !== undefined) {
|
|
18
|
+
paginationForRequest.limit = pageRequest.limit.toString();
|
|
19
|
+
}
|
|
20
|
+
if (pageRequest.offset !== undefined) {
|
|
21
|
+
paginationForRequest.offset = pageRequest.offset.toString();
|
|
22
|
+
}
|
|
23
|
+
if (pageRequest.reverse !== undefined) {
|
|
24
|
+
paginationForRequest.reverse = pageRequest.reverse;
|
|
25
|
+
}
|
|
26
|
+
if (pageRequest.countTotal !== undefined) {
|
|
27
|
+
paginationForRequest.countTotal = pageRequest.countTotal;
|
|
28
|
+
}
|
|
29
|
+
return paginationForRequest;
|
|
30
|
+
}
|
|
31
|
+
static paginationUint8ArrayToString(key) {
|
|
32
|
+
if (!key) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
if (key.constructor !== Uint8Array) {
|
|
36
|
+
return key;
|
|
37
|
+
}
|
|
38
|
+
return Buffer.from(key).toString('base64');
|
|
39
|
+
}
|
|
40
|
+
static grpcPaginationToPagination(pagination) {
|
|
41
|
+
return {
|
|
42
|
+
total: pagination
|
|
43
|
+
? parseInt(ChainGrpcCommonTransformer.paginationUint8ArrayToString(pagination.total), 10)
|
|
44
|
+
: 0,
|
|
45
|
+
next: pagination
|
|
46
|
+
? ChainGrpcCommonTransformer.paginationUint8ArrayToString(pagination.nextKey)
|
|
47
|
+
: '',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
8
50
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GrpcTokenPair, TokenPair, Params } from '../types/erc20.js';
|
|
2
|
+
import type { InjectiveErc20V1Beta1Query } from '@injectivelabs/core-proto-ts';
|
|
3
|
+
/**
|
|
4
|
+
* @category Chain Grpc Transformer
|
|
5
|
+
*/
|
|
6
|
+
export declare class ChainGrpcErc20Transformer {
|
|
7
|
+
static grpcTokenPairToTokenPair(grpcTokenPair: GrpcTokenPair): TokenPair;
|
|
8
|
+
static paramsResponseToParams(response: InjectiveErc20V1Beta1Query.QueryParamsResponse): Params;
|
|
9
|
+
static tokenPairsResponseToTokenPairs(response: InjectiveErc20V1Beta1Query.QueryAllTokenPairsResponse): {
|
|
10
|
+
tokenPairs: {
|
|
11
|
+
bankDenom: string;
|
|
12
|
+
erc20Address: string;
|
|
13
|
+
}[];
|
|
14
|
+
pagination: import("../../../index.js").Pagination;
|
|
15
|
+
};
|
|
16
|
+
}
|