@injectivelabs/sdk-ts 1.16.20 → 1.16.22
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/indexer/grpc/IndexerGrpcAuctionApi.d.ts +1 -0
- package/dist/cjs/client/indexer/grpc/IndexerGrpcAuctionApi.js +21 -0
- package/dist/cjs/client/indexer/transformers/IndexerGrpcAuctionTransformer.d.ts +2 -1
- package/dist/cjs/client/indexer/transformers/IndexerGrpcAuctionTransformer.js +7 -0
- package/dist/cjs/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.js +2 -0
- package/dist/cjs/client/indexer/types/auction.d.ts +5 -0
- package/dist/cjs/client/indexer/types/mega-vault.d.ts +2 -0
- package/dist/esm/client/indexer/grpc/IndexerGrpcAuctionApi.d.ts +1 -0
- package/dist/esm/client/indexer/grpc/IndexerGrpcAuctionApi.js +21 -0
- package/dist/esm/client/indexer/transformers/IndexerGrpcAuctionTransformer.d.ts +2 -1
- package/dist/esm/client/indexer/transformers/IndexerGrpcAuctionTransformer.js +7 -0
- package/dist/esm/client/indexer/transformers/IndexerGrpcMegaVaultTransformer.js +2 -0
- package/dist/esm/client/indexer/types/auction.d.ts +5 -0
- package/dist/esm/client/indexer/types/mega-vault.d.ts +2 -0
- package/package.json +8 -8
|
@@ -167,5 +167,26 @@ class IndexerGrpcAuctionApi extends BaseIndexerGrpcConsumer_js_1.default {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
+
async fetchAuctionStats() {
|
|
171
|
+
const request = {};
|
|
172
|
+
try {
|
|
173
|
+
const response = await this.retry(() => this.client.AuctionsStats(request, this.metadata));
|
|
174
|
+
return index_js_2.IndexerGrpcAuctionTransformer.auctionStatsResponseToAuctionStats(response);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
if (e instanceof indexer_proto_ts_1.InjectiveAuctionRpc.GrpcWebError) {
|
|
178
|
+
throw new exceptions_1.GrpcUnaryRequestException(new Error(e.toString()), {
|
|
179
|
+
code: (0, exceptions_1.grpcErrorCodeToErrorCode)(e.code),
|
|
180
|
+
context: 'AuctionStats',
|
|
181
|
+
contextModule: this.module,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
throw new exceptions_1.GrpcUnaryRequestException(e, {
|
|
185
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
186
|
+
context: 'AuctionStats',
|
|
187
|
+
contextModule: this.module,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
170
191
|
}
|
|
171
192
|
exports.IndexerGrpcAuctionApi = IndexerGrpcAuctionApi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InjectiveAuctionRpc } from '@injectivelabs/indexer-proto-ts';
|
|
2
|
-
import type { Auction, AuctionV2, AuctionCoin, GrpcAuction, GrpcAuctionV2, GrpcAuctionCoin, AccountAuctionV2, AuctionCoinPrices, IndexerAuctionBid, GrpcAccountAuctionV2, GrpcIndexerAuctionBid, GrpcAuctionCoinPrices } from '../types/auction.js';
|
|
2
|
+
import type { Auction, AuctionV2, AuctionCoin, GrpcAuction, AuctionsStats, GrpcAuctionV2, GrpcAuctionCoin, AccountAuctionV2, AuctionCoinPrices, IndexerAuctionBid, GrpcAccountAuctionV2, GrpcIndexerAuctionBid, GrpcAuctionCoinPrices } from '../types/auction.js';
|
|
3
3
|
/**
|
|
4
4
|
* @category Indexer Grpc Transformer
|
|
5
5
|
*/
|
|
@@ -24,4 +24,5 @@ export declare class IndexerGrpcAuctionTransformer {
|
|
|
24
24
|
auction: Auction;
|
|
25
25
|
bids: IndexerAuctionBid[];
|
|
26
26
|
};
|
|
27
|
+
static auctionStatsResponseToAuctionStats(response: InjectiveAuctionRpc.AuctionsStatsResponse): AuctionsStats;
|
|
27
28
|
}
|
|
@@ -42,6 +42,7 @@ class IndexerGrpcAuctionTransformer {
|
|
|
42
42
|
basket: grpcAuction.basket.map(IndexerGrpcAuctionTransformer.grpcAuctionCoinPricesToAuctionCoinPrices),
|
|
43
43
|
contract: grpcAuction.contract,
|
|
44
44
|
winningBidAmount: grpcAuction.winningBidAmount,
|
|
45
|
+
winningBidAmountUsd: grpcAuction.winningBidAmountUsd,
|
|
45
46
|
round: parseInt(grpcAuction.round, 10),
|
|
46
47
|
endTimestamp: parseInt(grpcAuction.endTimestamp, 10),
|
|
47
48
|
updatedAt: parseInt(grpcAuction.updatedAt, 10),
|
|
@@ -78,5 +79,11 @@ class IndexerGrpcAuctionTransformer {
|
|
|
78
79
|
bids: response.bids.map(IndexerGrpcAuctionTransformer.grpcBidToBid),
|
|
79
80
|
};
|
|
80
81
|
}
|
|
82
|
+
static auctionStatsResponseToAuctionStats(response) {
|
|
83
|
+
return {
|
|
84
|
+
totalBurnt: response.totalBurnt,
|
|
85
|
+
totalBurntInUsd: response.totalUsdValue,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
81
88
|
}
|
|
82
89
|
exports.IndexerGrpcAuctionTransformer = IndexerGrpcAuctionTransformer;
|
|
@@ -64,7 +64,9 @@ class IndexerGrpcMegaVaultTransformer {
|
|
|
64
64
|
return {
|
|
65
65
|
address: operator.address,
|
|
66
66
|
updatedAt: operator.updatedAt,
|
|
67
|
+
percentage: operator.percentage,
|
|
67
68
|
totalAmount: operator.totalAmount,
|
|
69
|
+
subaccountId: operator.subaccountId,
|
|
68
70
|
updatedHeight: operator.updatedHeight,
|
|
69
71
|
totalLiquidAmount: operator.totalLiquidAmount,
|
|
70
72
|
};
|
|
@@ -41,6 +41,7 @@ export interface AuctionV2 {
|
|
|
41
41
|
winner: string;
|
|
42
42
|
basket: AuctionCoinPrices[];
|
|
43
43
|
winningBidAmount: string;
|
|
44
|
+
winningBidAmountUsd: string;
|
|
44
45
|
round: number;
|
|
45
46
|
endTimestamp: number;
|
|
46
47
|
updatedAt: number;
|
|
@@ -53,6 +54,10 @@ export interface AccountAuctionV2 {
|
|
|
53
54
|
isClaimable: boolean;
|
|
54
55
|
claimedAssets: AuctionCoinPrices[];
|
|
55
56
|
}
|
|
57
|
+
export interface AuctionsStats {
|
|
58
|
+
totalBurnt: string;
|
|
59
|
+
totalBurntInUsd: string;
|
|
60
|
+
}
|
|
56
61
|
export type GrpcAuction = InjectiveAuctionRpc.Auction;
|
|
57
62
|
export type GrpcAuctionCoin = InjectiveAuctionRpc.Coin;
|
|
58
63
|
export type GrpcIndexerAuctionBid = InjectiveAuctionRpc.Bid;
|
|
@@ -161,4 +161,25 @@ export class IndexerGrpcAuctionApi extends BaseGrpcConsumer {
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
async fetchAuctionStats() {
|
|
165
|
+
const request = {};
|
|
166
|
+
try {
|
|
167
|
+
const response = await this.retry(() => this.client.AuctionsStats(request, this.metadata));
|
|
168
|
+
return IndexerGrpcAuctionTransformer.auctionStatsResponseToAuctionStats(response);
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
if (e instanceof InjectiveAuctionRpc.GrpcWebError) {
|
|
172
|
+
throw new GrpcUnaryRequestException(new Error(e.toString()), {
|
|
173
|
+
code: grpcErrorCodeToErrorCode(e.code),
|
|
174
|
+
context: 'AuctionStats',
|
|
175
|
+
contextModule: this.module,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
throw new GrpcUnaryRequestException(e, {
|
|
179
|
+
code: UnspecifiedErrorCode,
|
|
180
|
+
context: 'AuctionStats',
|
|
181
|
+
contextModule: this.module,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
164
185
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InjectiveAuctionRpc } from '@injectivelabs/indexer-proto-ts';
|
|
2
|
-
import type { Auction, AuctionV2, AuctionCoin, GrpcAuction, GrpcAuctionV2, GrpcAuctionCoin, AccountAuctionV2, AuctionCoinPrices, IndexerAuctionBid, GrpcAccountAuctionV2, GrpcIndexerAuctionBid, GrpcAuctionCoinPrices } from '../types/auction.js';
|
|
2
|
+
import type { Auction, AuctionV2, AuctionCoin, GrpcAuction, AuctionsStats, GrpcAuctionV2, GrpcAuctionCoin, AccountAuctionV2, AuctionCoinPrices, IndexerAuctionBid, GrpcAccountAuctionV2, GrpcIndexerAuctionBid, GrpcAuctionCoinPrices } from '../types/auction.js';
|
|
3
3
|
/**
|
|
4
4
|
* @category Indexer Grpc Transformer
|
|
5
5
|
*/
|
|
@@ -24,4 +24,5 @@ export declare class IndexerGrpcAuctionTransformer {
|
|
|
24
24
|
auction: Auction;
|
|
25
25
|
bids: IndexerAuctionBid[];
|
|
26
26
|
};
|
|
27
|
+
static auctionStatsResponseToAuctionStats(response: InjectiveAuctionRpc.AuctionsStatsResponse): AuctionsStats;
|
|
27
28
|
}
|
|
@@ -39,6 +39,7 @@ export class IndexerGrpcAuctionTransformer {
|
|
|
39
39
|
basket: grpcAuction.basket.map(IndexerGrpcAuctionTransformer.grpcAuctionCoinPricesToAuctionCoinPrices),
|
|
40
40
|
contract: grpcAuction.contract,
|
|
41
41
|
winningBidAmount: grpcAuction.winningBidAmount,
|
|
42
|
+
winningBidAmountUsd: grpcAuction.winningBidAmountUsd,
|
|
42
43
|
round: parseInt(grpcAuction.round, 10),
|
|
43
44
|
endTimestamp: parseInt(grpcAuction.endTimestamp, 10),
|
|
44
45
|
updatedAt: parseInt(grpcAuction.updatedAt, 10),
|
|
@@ -75,4 +76,10 @@ export class IndexerGrpcAuctionTransformer {
|
|
|
75
76
|
bids: response.bids.map(IndexerGrpcAuctionTransformer.grpcBidToBid),
|
|
76
77
|
};
|
|
77
78
|
}
|
|
79
|
+
static auctionStatsResponseToAuctionStats(response) {
|
|
80
|
+
return {
|
|
81
|
+
totalBurnt: response.totalBurnt,
|
|
82
|
+
totalBurntInUsd: response.totalUsdValue,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
78
85
|
}
|
|
@@ -61,7 +61,9 @@ export class IndexerGrpcMegaVaultTransformer {
|
|
|
61
61
|
return {
|
|
62
62
|
address: operator.address,
|
|
63
63
|
updatedAt: operator.updatedAt,
|
|
64
|
+
percentage: operator.percentage,
|
|
64
65
|
totalAmount: operator.totalAmount,
|
|
66
|
+
subaccountId: operator.subaccountId,
|
|
65
67
|
updatedHeight: operator.updatedHeight,
|
|
66
68
|
totalLiquidAmount: operator.totalLiquidAmount,
|
|
67
69
|
};
|
|
@@ -41,6 +41,7 @@ export interface AuctionV2 {
|
|
|
41
41
|
winner: string;
|
|
42
42
|
basket: AuctionCoinPrices[];
|
|
43
43
|
winningBidAmount: string;
|
|
44
|
+
winningBidAmountUsd: string;
|
|
44
45
|
round: number;
|
|
45
46
|
endTimestamp: number;
|
|
46
47
|
updatedAt: number;
|
|
@@ -53,6 +54,10 @@ export interface AccountAuctionV2 {
|
|
|
53
54
|
isClaimable: boolean;
|
|
54
55
|
claimedAssets: AuctionCoinPrices[];
|
|
55
56
|
}
|
|
57
|
+
export interface AuctionsStats {
|
|
58
|
+
totalBurnt: string;
|
|
59
|
+
totalBurntInUsd: string;
|
|
60
|
+
}
|
|
56
61
|
export type GrpcAuction = InjectiveAuctionRpc.Auction;
|
|
57
62
|
export type GrpcAuctionCoin = InjectiveAuctionRpc.Coin;
|
|
58
63
|
export type GrpcIndexerAuctionBid = InjectiveAuctionRpc.Bid;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.22",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": {
|
|
@@ -122,18 +122,18 @@
|
|
|
122
122
|
"@cosmjs/amino": "^0.33.0",
|
|
123
123
|
"@cosmjs/proto-signing": "^0.33.0",
|
|
124
124
|
"@cosmjs/stargate": "^0.33.0",
|
|
125
|
-
"@injectivelabs/abacus-proto-ts": "1.14.
|
|
125
|
+
"@injectivelabs/abacus-proto-ts": "1.14.1",
|
|
126
126
|
"@injectivelabs/core-proto-ts": "1.16.6",
|
|
127
|
-
"@injectivelabs/exceptions": "1.16.
|
|
127
|
+
"@injectivelabs/exceptions": "1.16.22",
|
|
128
128
|
"@injectivelabs/grpc-web": "^0.0.1",
|
|
129
129
|
"@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
|
|
130
130
|
"@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
|
|
131
|
-
"@injectivelabs/indexer-proto-ts": "1.13.
|
|
131
|
+
"@injectivelabs/indexer-proto-ts": "1.13.23",
|
|
132
132
|
"@injectivelabs/mito-proto-ts": "1.13.2",
|
|
133
|
-
"@injectivelabs/networks": "1.16.
|
|
133
|
+
"@injectivelabs/networks": "1.16.22",
|
|
134
134
|
"@injectivelabs/olp-proto-ts": "1.13.4",
|
|
135
|
-
"@injectivelabs/ts-types": "1.16.
|
|
136
|
-
"@injectivelabs/utils": "1.16.
|
|
135
|
+
"@injectivelabs/ts-types": "1.16.22",
|
|
136
|
+
"@injectivelabs/utils": "1.16.22",
|
|
137
137
|
"@noble/curves": "^1.8.1",
|
|
138
138
|
"@noble/hashes": "^1.7.1",
|
|
139
139
|
"@scure/base": "^1.2.6",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"snakecase-keys": "^5.4.1",
|
|
152
152
|
"viem": "^2.33.2"
|
|
153
153
|
},
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "b1463097f7c8c8156267f3ad09b1d63be6c88a06",
|
|
155
155
|
"typedoc": {
|
|
156
156
|
"entryPoint": "./src/index.ts",
|
|
157
157
|
"readmeFile": "./README.md",
|