@sonarwatch/portfolio-core 0.14.150 → 0.14.152

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-core
2
-
3
- This library is @sonarwatch/portfolio-core
1
+ # @sonarwatch/portfolio-core
2
+
3
+ This library is @sonarwatch/portfolio-core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-core",
3
- "version": "0.14.150",
3
+ "version": "0.14.152",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "dependencies": {
@@ -139,25 +139,36 @@ export type ProxyInfo = {
139
139
  export type Contract = {
140
140
  name: string;
141
141
  address: string;
142
- network: NetworkIdType;
142
+ platformId: string;
143
143
  };
144
144
  /**
145
- * Represents the different configurations of a service
145
+ * Represents a service from a platform
146
146
  */
147
- export type ServiceConfig = {
147
+ export type Service = {
148
+ id: string;
149
+ name: string;
150
+ platformId: string;
148
151
  networkId: NetworkIdType;
149
- integratedOn: number;
150
152
  contracts?: Contract[];
151
153
  link?: string;
154
+ description?: string;
152
155
  };
153
156
  /**
154
- * Represents a service from a platform
157
+ * Represents a transaction
155
158
  */
156
- export type Service = {
157
- id: string;
158
- name: string;
159
- platformId: string;
160
- configs: ServiceConfig[];
159
+ export type BalanceChange = {
160
+ address: string;
161
+ preBalance: number;
162
+ postBalance: number;
163
+ change: number;
164
+ };
165
+ export type Transaction = {
166
+ signature: string;
167
+ blockTime?: number | null;
168
+ service?: Service;
169
+ balanceChanges: BalanceChange[];
170
+ isSigner: boolean;
171
+ success: boolean;
161
172
  };
162
173
  export type SourceRefName = 'Pool' | 'Farm' | 'Market' | 'Vault' | 'Lending Market' | 'Strategy' | 'NFT Mint' | 'Reserve' | 'Proposal';
163
174
  /**
@@ -447,3 +458,14 @@ export type FetchersResult = {
447
458
  duration: number;
448
459
  tokenInfo?: Partial<Record<NetworkIdType, Record<string, TokenInfo>>>;
449
460
  };
461
+ /**
462
+ * Represents the result of transactions.
463
+ */
464
+ export type TransactionsResult = {
465
+ owner: string;
466
+ account: string;
467
+ networkId: NetworkIdType;
468
+ duration: number;
469
+ transactions: Transaction[];
470
+ tokenInfo?: Partial<Record<NetworkIdType, Record<string, TokenInfo>>>;
471
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AA6CX;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACN,CAAC;AAoQX,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
1
+ {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AA6CX;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACN,CAAC;AAgRX,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
@@ -42,3 +42,4 @@ export * from './getLabelFromAsset';
42
42
  export * from './getLabelFromAssets';
43
43
  export * from './healthFactorToHealthRatio';
44
44
  export * from './healthRatioToHealthFactor';
45
+ export * from './promiseTimeout';
@@ -58,4 +58,5 @@ __exportStar(require("./getLabelFromAsset"), exports);
58
58
  __exportStar(require("./getLabelFromAssets"), exports);
59
59
  __exportStar(require("./healthFactorToHealthRatio"), exports);
60
60
  __exportStar(require("./healthRatioToHealthFactor"), exports);
61
+ __exportStar(require("./promiseTimeout"), exports);
61
62
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,oDAAkC;AAClC,kEAAgD;AAChD,sDAAoC;AACpC,iDAA+B;AAC/B,sDAAoC;AACpC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,+DAA6C;AAC7C,gDAA8B;AAC9B,oDAAkC;AAClC,mDAAiC;AACjC,wDAAsC;AACtC,qDAAmC;AACnC,+DAA6C;AAC7C,2DAAyC;AACzC,uDAAqC;AACrC,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,8DAA4C;AAC5C,mDAAiC;AACjC,yDAAuC;AACvC,mEAAiD;AACjD,oEAAkD;AAClD,+CAA6B;AAC7B,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,uDAAqC;AACrC,8DAA4C;AAC5C,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,oDAAkC;AAClC,kEAAgD;AAChD,sDAAoC;AACpC,iDAA+B;AAC/B,sDAAoC;AACpC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,+DAA6C;AAC7C,gDAA8B;AAC9B,oDAAkC;AAClC,mDAAiC;AACjC,wDAAsC;AACtC,qDAAmC;AACnC,+DAA6C;AAC7C,2DAAyC;AACzC,uDAAqC;AACrC,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,8DAA4C;AAC5C,mDAAiC;AACjC,yDAAuC;AACvC,mEAAiD;AACjD,oEAAkD;AAClD,+CAA6B;AAC7B,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,uDAAqC;AACrC,8DAA4C;AAC5C,8DAA4C;AAC5C,mDAAiC"}
@@ -0,0 +1 @@
1
+ export declare function promiseTimeout<T>(promise: Promise<T>, ms: number, message?: string): Promise<T>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promiseTimeout = void 0;
4
+ function promiseTimeout(promise, ms, message) {
5
+ const timeoutPromise = new Promise((resolve, reject) => {
6
+ const id = setTimeout(() => {
7
+ clearTimeout(id);
8
+ reject(new Error(message || `Promise timed out: ${ms}ms.`));
9
+ }, ms);
10
+ });
11
+ return Promise.race([promise, timeoutPromise]);
12
+ }
13
+ exports.promiseTimeout = promiseTimeout;
14
+ //# sourceMappingURL=promiseTimeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promiseTimeout.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/promiseTimeout.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAC5B,OAAmB,EACnB,EAAU,EACV,OAAgB;IAEhB,MAAM,cAAc,GAAe,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE;YACzB,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,sBAAsB,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9D,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AACjD,CAAC;AAZD,wCAYC"}