carbon-js-sdk 0.11.5 → 0.11.7

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.
@@ -18,6 +18,8 @@ declare class InsightsQueryClient {
18
18
  UserPnl(req: Insights.QueryGetUserPnlPathParams, query: Insights.QueryGetUserPnlGraphQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserPnlResponse>>;
19
19
  UserBalanceGraph(req: Insights.QueryGetUserBalanceGraphPathParams, query: Insights.QueryGetUserBalanceGraphQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserBalanceGraphResponse>>;
20
20
  UserPnlGraph(req: Insights.QueryGetUserPnlGraphPathParams, query: Insights.QueryGetUserPnlGraphQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserPnlGraphResponse>>;
21
+ UserFundings(req: Insights.QueryGetUserFundingsPathParams, query: Insights.QueryGetUserFundingsQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserFundingsResponse>>;
22
+ UserFundingBreakdown(req: Insights.QueryGetFundingBreakdownChartPathParams, query: Insights.QueryGetFundingBreakdownChartQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetFundingBreakdownChartResponse>>;
21
23
  Pools(req?: Insights.QueryGetPoolsRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPoolsResponse>>;
22
24
  PoolHistory(query: Insights.QueryGetPoolHistoryRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPoolHistoryResponse>>;
23
25
  PerpPoolHistory(query: Insights.QueryGetPerpPoolHistoryRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPerpPoolHistoryResponse>>;
@@ -140,6 +140,20 @@ class InsightsQueryClient {
140
140
  return response.data;
141
141
  });
142
142
  }
143
+ UserFundings(req, query) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const request = this.apiManager.path("user/fundings", req, query);
146
+ const response = yield request.get();
147
+ return response.data;
148
+ });
149
+ }
150
+ UserFundingBreakdown(req, query) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ const request = this.apiManager.path("user/funding/breakdown", req, query);
153
+ const response = yield request.get();
154
+ return response.data;
155
+ });
156
+ }
143
157
  // Pool api
144
158
  Pools(req = {}) {
145
159
  return __awaiter(this, void 0, void 0, function* () {
@@ -12,6 +12,8 @@ export declare const InsightsEndpoints: {
12
12
  "user/pnl": string;
13
13
  "user/balance/graph": string;
14
14
  "user/pnl/graph": string;
15
+ "user/fundings": string;
16
+ "user/funding/breakdown": string;
15
17
  "user/connected/wallet": string;
16
18
  "pool/list": string;
17
19
  "pool/volume": string;
@@ -74,6 +76,10 @@ export interface TimeMeta {
74
76
  until: string;
75
77
  interval: Interval;
76
78
  }
79
+ export interface NoIntervalTimeMeta {
80
+ from: string;
81
+ until: string;
82
+ }
77
83
  export interface ParsedTimeMeta {
78
84
  from: Dayjs;
79
85
  until: Dayjs;
@@ -16,6 +16,8 @@ exports.InsightsEndpoints = {
16
16
  "user/pnl": "/user/:address/pnl",
17
17
  "user/balance/graph": "/user/:address/balance/graph",
18
18
  "user/pnl/graph": "/user/:address/pnl/graph",
19
+ "user/fundings": "/user/:address/fundings",
20
+ "user/funding/breakdown": "/user/:address/funding/breakdown",
19
21
  "user/connected/wallet": "/user/connected/wallet",
20
22
  // Pool api
21
23
  "pool/list": "/pool/list",
@@ -1,5 +1,5 @@
1
1
  import { Dayjs } from "dayjs";
2
- import { ParsedTimeMeta, QueryByTimeRequest, TimeMeta } from "./common";
2
+ import { ParsedTimeMeta, QueryByTimeRequest, TimeMeta, NoIntervalTimeMeta } from "./common";
3
3
  import BigNumber from "bignumber.js";
4
4
  export interface ActiveAccounts {
5
5
  date: string;
@@ -50,6 +50,15 @@ export interface RawUserPnlGraphCoordinate {
50
50
  pnl: string;
51
51
  cumulativePnl: string;
52
52
  }
53
+ export interface RawUserFundings {
54
+ time: string;
55
+ market: string;
56
+ amount: string;
57
+ }
58
+ export interface RawFundingBreakdown {
59
+ market: string;
60
+ amount: string;
61
+ }
53
62
  export interface QueryGetUserProfileRequest {
54
63
  username?: string;
55
64
  address?: string;
@@ -111,6 +120,25 @@ export interface QueryGetUserPnlGraphResponse {
111
120
  entries: RawUserPnlGraphCoordinate[];
112
121
  meta: TimeMeta;
113
122
  }
123
+ export interface QueryGetUserFundingsPathParams {
124
+ address: string;
125
+ }
126
+ export interface QueryGetUserFundingsQueryParams extends QueryByTimeRequest {
127
+ }
128
+ export interface QueryGetUserFundingsResponse {
129
+ entries: RawUserFundings[];
130
+ meta: NoIntervalTimeMeta;
131
+ }
132
+ export interface QueryGetFundingBreakdownChartPathParams {
133
+ address: string;
134
+ }
135
+ export interface QueryGetFundingBreakdownChartQueryParams extends QueryByTimeRequest {
136
+ }
137
+ export interface QueryGetFundingBreakdownChartResponse {
138
+ paid: RawFundingBreakdown[];
139
+ received: RawFundingBreakdown[];
140
+ meta: NoIntervalTimeMeta;
141
+ }
114
142
  export interface ConnectedWalletParams {
115
143
  address: string;
116
144
  walletType: string;
@@ -11,7 +11,7 @@ export declare class IBCModule extends BaseModule {
11
11
  sendIBCTransfer(params: IBCModule.SendIBCTransferParams, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
12
12
  sendIbcTransferV2(params: IBCModule.SendIBCTransferV2Params, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
13
13
  getChainInfoMap(denomTraces?: TypeUtils.SimpleMap<DenomTrace>): Promise<TypeUtils.SimpleMap<ExtendedChainInfo>>;
14
- getAppCurrency(coinMinimalDenom: string, coinGeckoId: string, tokenInfo?: Token, cw20RegexArr?: RegExpMatchArray | null): AppCurrency;
14
+ getAppCurrency(coinMinimalDenom: string, coinGeckoId?: string, tokenInfo?: Token, cw20RegexArr?: RegExpMatchArray | null): AppCurrency;
15
15
  getChainInfo(chainName: string): Promise<ChainInfo | undefined>;
16
16
  getAssembledChainInfo(chainId: string, chainData?: ChainRegistryItem): Promise<ChainInfo | undefined>;
17
17
  }
@@ -67,7 +67,7 @@ class IBCModule extends base_1.default {
67
67
  });
68
68
  }
69
69
  getChainInfoMap(denomTraces = {}) {
70
- var _a, _b, _c, _d, _e, _f, _g;
70
+ var _a, _b, _c, _d, _e, _f;
71
71
  return __awaiter(this, void 0, void 0, function* () {
72
72
  const tokenClient = this.sdkProvider.getTokenClient();
73
73
  const ibcBridges = tokenClient.bridges.ibc;
@@ -102,12 +102,16 @@ class IBCModule extends base_1.default {
102
102
  const chainId = tokenClient.getIbcChainIdFromToken(token);
103
103
  if (chainId && chainInfoMap[chainId]) {
104
104
  const cw20RegexArr = denomTrace.baseDenom.match(constant_1.cw20TokenRegex);
105
- const coinGeckoId = (_g = (_e = (_d = tokenClient.geckoTokenNames) === null || _d === void 0 ? void 0 : _d[denom]) !== null && _e !== void 0 ? _e : (_f = tokenClient.geckoTokenNames) === null || _f === void 0 ? void 0 : _f[denomTrace.baseDenom]) !== null && _g !== void 0 ? _g : "";
105
+ const coinGeckoId = (_e = (_d = tokenClient.geckoTokenNames) === null || _d === void 0 ? void 0 : _d[denom]) !== null && _e !== void 0 ? _e : (_f = tokenClient.geckoTokenNames) === null || _f === void 0 ? void 0 : _f[denomTrace.baseDenom];
106
106
  const dstDenom = isChainNativeToken ? denomTrace.baseDenom.replace(/:/g, '/') : util_1.IBCUtils.makeIBCMinimalDenom(denomTrace.path.replace(constant_1.ibcTransferChannelRegex, "").replace(/^\//, ''), denomTrace.baseDenom);
107
- const currency = this.getAppCurrency(dstDenom, coinGeckoId, token, cw20RegexArr);
108
107
  const chainInfo = chainInfoMap[chainId];
109
- chainInfo.currencies.push(currency);
110
108
  chainInfo.minimalDenomMap[token.denom] = dstDenom;
109
+ const existingCurrencyIndex = chainInfo.currencies.findIndex(c => c.coinMinimalDenom === dstDenom);
110
+ if (existingCurrencyIndex !== -1) {
111
+ continue;
112
+ }
113
+ const currency = this.getAppCurrency(dstDenom, coinGeckoId, token, cw20RegexArr);
114
+ chainInfo.currencies.push(currency);
111
115
  }
112
116
  }
113
117
  return chainInfoMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",