carbon-js-sdk 0.5.8-beta.1 → 0.5.8

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.
@@ -0,0 +1,22 @@
1
+ import { ProtobufRpcClient } from "@cosmjs/stargate";
2
+ import { grpc } from "@improbable-eng/grpc-web";
3
+ export declare class GrpcWebError extends Error {
4
+ code: grpc.Code;
5
+ metadata: grpc.Metadata;
6
+ constructor(message: string, code: grpc.Code, metadata: grpc.Metadata);
7
+ }
8
+ /**
9
+ * Uses grpc-web module on cosmos-sdk to simulate gRPC queries
10
+ * throught HTTP/1.1.
11
+ * see https://github.com/cosmos/cosmos-sdk/issues/7345
12
+ */
13
+ export declare class GrpcQueryClient implements ProtobufRpcClient {
14
+ private host;
15
+ private options;
16
+ constructor(host: string, options?: {
17
+ transport?: grpc.TransportFactory;
18
+ metadata?: grpc.Metadata;
19
+ });
20
+ request(serviceName: string, methodName: string, data: Uint8Array): Promise<Uint8Array>;
21
+ }
22
+ export default GrpcQueryClient;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrpcQueryClient = exports.GrpcWebError = void 0;
4
+ const grpc_web_1 = require("@improbable-eng/grpc-web");
5
+ class GrpcWebError extends Error {
6
+ constructor(message, code, metadata) {
7
+ super(message);
8
+ this.code = code;
9
+ this.metadata = metadata;
10
+ }
11
+ }
12
+ exports.GrpcWebError = GrpcWebError;
13
+ /**
14
+ * Uses grpc-web module on cosmos-sdk to simulate gRPC queries
15
+ * throught HTTP/1.1.
16
+ * see https://github.com/cosmos/cosmos-sdk/issues/7345
17
+ */
18
+ class GrpcQueryClient {
19
+ constructor(host, options = {}) {
20
+ this.host = host;
21
+ this.options = options;
22
+ }
23
+ request(serviceName, methodName, data) {
24
+ return new Promise((resolve, reject) => {
25
+ grpc_web_1.grpc.unary({
26
+ methodName,
27
+ service: { serviceName },
28
+ requestStream: false,
29
+ responseStream: false,
30
+ requestType: {},
31
+ responseType: {
32
+ deserializeBinary: (data) => data,
33
+ },
34
+ }, {
35
+ request: Object.assign(Object.assign({}, data), { toObject: () => data, serializeBinary: () => data }),
36
+ host: this.host,
37
+ metadata: this.options.metadata,
38
+ transport: this.options.transport,
39
+ debug: false,
40
+ onEnd: function (response) {
41
+ if (response.status === grpc_web_1.grpc.Code.OK) {
42
+ resolve(response.message);
43
+ }
44
+ else {
45
+ const err = new Error(response.statusMessage);
46
+ err.code = response.status;
47
+ err.metadata = response.trailers;
48
+ reject(err);
49
+ }
50
+ },
51
+ });
52
+ });
53
+ }
54
+ }
55
+ exports.GrpcQueryClient = GrpcQueryClient;
56
+ exports.default = GrpcQueryClient;
@@ -34,13 +34,10 @@ declare class InsightsQueryClient {
34
34
  LiquidationAndADL(query: Insights.GetLiquidationAndADLQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetLiquidationAndADLResponse>>;
35
35
  PositionsView(req: Insights.GetPositionsViewPathParams, query: Insights.GetPositionsViewQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPositionsViewResponse>>;
36
36
  Leaderboard(req: Insights.GetLeaderboardPathParams, query: Insights.GetLeaderboardQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetLeaderboardResponse>>;
37
- PositionStats(req: Insights.GetPositionStatsPathParams, query: Insights.GetPositionStatsQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPositionStatsResponse>>;
38
37
  DenomToGeckoIdMap(): Promise<Insights.InsightsQueryResponse<Insights.QueryDenomToGeckoIdMap>>;
39
38
  FundingHistory(query: Insights.QueryGetFundingRateRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetFundingRateResponse>>;
40
39
  ProposalVotes(req: Insights.GetProposalVotesPathParams, query: Insights.GetProposalVotesQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetProposalVotesResponse>>;
41
40
  Delegations(req: Insights.GetDelegationsPathParams, query: Insights.GetDelegationsQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetDelegationsResponse>>;
42
41
  OraclePrices(req?: Insights.QueryGetOraclesPriceRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetOraclesPriceResponse>>;
43
- AlliancesStake(req?: Insights.QueryGetAlliancesStakeRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetAlliancesStakeResponse>>;
44
- AlliancesRewards(req?: Insights.QueryGetAlliancesRewardsRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetAlliancesRewardsResponse>>;
45
42
  }
46
43
  export default InsightsQueryClient;
@@ -313,13 +313,6 @@ class InsightsQueryClient {
313
313
  return response.data;
314
314
  });
315
315
  }
316
- PositionStats(req, query) {
317
- return __awaiter(this, void 0, void 0, function* () {
318
- const request = this.apiManager.path("position/stats", req, query);
319
- const response = yield request.get();
320
- return response.data;
321
- });
322
- }
323
316
  //Coin Gecko Tokens
324
317
  DenomToGeckoIdMap() {
325
318
  return __awaiter(this, void 0, void 0, function* () {
@@ -361,19 +354,5 @@ class InsightsQueryClient {
361
354
  return response.data;
362
355
  });
363
356
  }
364
- AlliancesStake(req = {}) {
365
- return __awaiter(this, void 0, void 0, function* () {
366
- const request = this.apiManager.path("alliances/stake", {}, req);
367
- const response = yield request.get();
368
- return response.data;
369
- });
370
- }
371
- AlliancesRewards(req = {}) {
372
- return __awaiter(this, void 0, void 0, function* () {
373
- const request = this.apiManager.path("alliances/rewards", {}, req);
374
- const response = yield request.get();
375
- return response.data;
376
- });
377
- }
378
357
  }
379
358
  exports.default = InsightsQueryClient;
@@ -23,7 +23,6 @@ export declare const InsightsEndpoints: {
23
23
  "position/view": string;
24
24
  "position/liquidation": string;
25
25
  "position/liquidation/engine": string;
26
- "position/stats": string;
27
26
  "competition/list": string;
28
27
  "competition/leaderboard": string;
29
28
  "competition/leaderboardpnl": string;
@@ -34,8 +33,6 @@ export declare const InsightsEndpoints: {
34
33
  "proposal/votes": string;
35
34
  "delegations/delegator": string;
36
35
  "info/oracles_price": string;
37
- "alliances/stake": string;
38
- "alliances/rewards": string;
39
36
  };
40
37
  export declare type Interval = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter";
41
38
  export interface QueryByTimeRequest {
@@ -33,7 +33,6 @@ exports.InsightsEndpoints = {
33
33
  "position/view": "/position/view/:view",
34
34
  "position/liquidation": "/position/liquidation",
35
35
  "position/liquidation/engine": "/position/liquidation/engine",
36
- "position/stats": "/position/stats/:address",
37
36
  // Competition api
38
37
  "competition/list": "/competition/list",
39
38
  "competition/leaderboard": "/competition/leaderboard",
@@ -50,7 +49,4 @@ exports.InsightsEndpoints = {
50
49
  "delegations/delegator": "/delegations/:delegator",
51
50
  // Oracles api
52
51
  "info/oracles_price": "/info/oracles_price",
53
- // Alliances api
54
- "alliances/stake": "/alliances/stake",
55
- "alliances/rewards": "/alliances/rewards",
56
52
  };
@@ -11,4 +11,3 @@ export * from "./funding";
11
11
  export * from "./proposal";
12
12
  export * from "./delegation";
13
13
  export * from "./oracles";
14
- export * from "./alliances";
@@ -23,4 +23,3 @@ __exportStar(require("./funding"), exports);
23
23
  __exportStar(require("./proposal"), exports);
24
24
  __exportStar(require("./delegation"), exports);
25
25
  __exportStar(require("./oracles"), exports);
26
- __exportStar(require("./alliances"), exports);
@@ -1,4 +1,4 @@
1
- import { Entries, PageMeta, QueryByPageRequest, QueryByTimeRequest, TimeMeta } from "./common";
1
+ import { Entries, PageMeta, QueryByPageRequest } from "./common";
2
2
  export interface IndivPnl {
3
3
  address: string;
4
4
  realizedPnl: string;
@@ -83,20 +83,3 @@ export interface QueryGetPositionsViewResponse {
83
83
  entries: GetPositionsViewEntry[];
84
84
  meta: PageMeta;
85
85
  }
86
- export interface GetPositionStatsPathParams {
87
- address: string;
88
- }
89
- export interface GetPositionStatsQueryParams extends QueryByTimeRequest {
90
- }
91
- export interface GetPositionStatsEntry {
92
- time: string;
93
- realizedPnl: string;
94
- makerRebate: string;
95
- takerFee: number;
96
- fundingRate: string;
97
- cumulative: string;
98
- }
99
- export interface QueryGetPositionStatsResponse {
100
- entries: GetPositionStatsEntry[];
101
- meta: TimeMeta;
102
- }
@@ -140,7 +140,7 @@ const CARBON_EVM_TESTNET = {
140
140
  const CARBON_EVM_MAINNET = {
141
141
  chainId: `0x${Number(ethermint_1.parseChainId(constant_1.CarbonEvmChainIDs[constant_1.Network.MainNet])).toString(16)}`,
142
142
  blockExplorerUrls: ["https://evm-scan.carbon.network"],
143
- chainName: "Carbon EVM Mainnet",
143
+ chainName: "Carbon EVM",
144
144
  rpcUrls: [`${constant_1.NetworkConfigs[constant_1.Network.MainNet].evmJsonRpcUrl}`],
145
145
  nativeCurrency: CarbonEvmNativeCurrency,
146
146
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.5.8-beta.1",
3
+ "version": "0.5.8",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",