@augustdigital/sdk 4.20.1 → 4.20.2-alpha.0

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 @@
1
+ export declare const SDK_VERSION = '4.17.0-alpha.3';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDK_VERSION = void 0;
4
+ exports.SDK_VERSION = '4.17.0-alpha.3';
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src.ts/core/analytics/version.ts"],"names":[],"mappings":";;;AAKa,QAAA,WAAW,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { IFetchAugustOptions } from '../../core';
2
+ import { IAddress, IOTCPosition, IWSSubaccountCefi, IWSSubAccountHealthFactor, IWSSubaccountLoan } from '../../types';
3
+ export declare const fetchSubaccountHeathFactor: (address: IAddress, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IWSSubAccountHealthFactor>;
4
+ export declare const fetchSubaccountLoans: (payload: {
5
+ address: IAddress;
6
+ side?: "BOTH" | "BORROWER" | "LENDER";
7
+ active?: boolean;
8
+ }, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IWSSubaccountLoan[]>;
9
+ export declare const fetchSubaccountCefiPositions: (address: IAddress, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IWSSubaccountCefi[]>;
10
+ export declare const fetchSubaccountOtcPositions: (address: IAddress, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IOTCPosition[]>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchSubaccountOtcPositions = exports.fetchSubaccountCefiPositions = exports.fetchSubaccountLoans = exports.fetchSubaccountHeathFactor = void 0;
4
+ const core_1 = require("../../core");
5
+ const fetchSubaccountHeathFactor = async (address, augustKey, headers) => {
6
+ const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.subaccount.health_factor(address), {
7
+ headers,
8
+ });
9
+ return response.json();
10
+ };
11
+ exports.fetchSubaccountHeathFactor = fetchSubaccountHeathFactor;
12
+ const fetchSubaccountLoans = async (payload, augustKey, headers) => {
13
+ const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.subaccount.loans(payload.address, payload.side, payload.active), {
14
+ headers,
15
+ });
16
+ return response.json();
17
+ };
18
+ exports.fetchSubaccountLoans = fetchSubaccountLoans;
19
+ const fetchSubaccountCefiPositions = async (address, augustKey, headers) => {
20
+ const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.subaccount.cefi(address), {
21
+ headers,
22
+ });
23
+ return response.json();
24
+ };
25
+ exports.fetchSubaccountCefiPositions = fetchSubaccountCefiPositions;
26
+ const fetchSubaccountOtcPositions = async (address, augustKey, headers) => {
27
+ const response = await (0, core_1.fetchAugustWithKey)(augustKey, core_1.WEBSERVER_ENDPOINTS.subaccount.otc_positions(address), {
28
+ headers,
29
+ });
30
+ return response.json();
31
+ };
32
+ exports.fetchSubaccountOtcPositions = fetchSubaccountOtcPositions;
33
+ //# sourceMappingURL=fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../../../src.ts/modules/sub-accounts/fetcher.ts"],"names":[],"mappings":";;;AAAA,qCAIoB;AAYb,MAAM,0BAA0B,GAAG,KAAK,EAC7C,OAAiB,EACjB,SAAiB,EACjB,OAAwC,EACJ,EAAE;IACtC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAkB,EACvC,SAAS,EACT,0BAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,EACrD;QACE,OAAO;KACR,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAdW,QAAA,0BAA0B,8BAcrC;AAKK,MAAM,oBAAoB,GAAG,KAAK,EACvC,OAIC,EACD,SAAiB,EACjB,OAAwC,EACV,EAAE;IAChC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAkB,EACvC,SAAS,EACT,0BAAmB,CAAC,UAAU,CAAC,KAAK,CAClC,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,MAAM,CACf,EACD;QACE,OAAO;KACR,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B;AAKK,MAAM,4BAA4B,GAAG,KAAK,EAC/C,OAAiB,EACjB,SAAiB,EACjB,OAAwC,EACV,EAAE;IAChC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAkB,EACvC,SAAS,EACT,0BAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAC5C;QACE,OAAO;KACR,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAdW,QAAA,4BAA4B,gCAcvC;AAKK,MAAM,2BAA2B,GAAG,KAAK,EAC9C,OAAiB,EACjB,SAAiB,EACjB,OAAwC,EACf,EAAE;IAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAkB,EACvC,SAAS,EACT,0BAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,EACrD;QACE,OAAO;KACR,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAdW,QAAA,2BAA2B,+BActC"}
@@ -0,0 +1,2 @@
1
+ export * from './fetcher';
2
+ export * from './main';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./fetcher"), exports);
18
+ __exportStar(require("./main"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src.ts/modules/sub-accounts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB"}
@@ -0,0 +1,16 @@
1
+ import { AugustBase, IAugustBase } from '../../core';
2
+ import { IAddress } from '../../types';
3
+ export declare class AugustSubAccounts extends AugustBase {
4
+ private headers;
5
+ constructor(baseConfig: IAugustBase);
6
+ getSubaccountHealthFactor(subaccountAddress: IAddress): Promise<{
7
+ id: `0x${string}`;
8
+ dateTime: string;
9
+ healthFactor: number;
10
+ totalCollateral: number;
11
+ totalLoan: number;
12
+ }>;
13
+ getSubaccountLoans(subaccountAddress: IAddress, side: 'BOTH' | 'LENDER' | 'BORROWER', active: boolean): Promise<import("../../types").IWSSubaccountLoan[]>;
14
+ getSubaccountCefiPositions(subaccountAddress: IAddress): Promise<import("../../types").IWSSubaccountCefi[]>;
15
+ getSubaccountOtcPositions(subaccountAddress: IAddress): Promise<import("../../types").IOTCPosition[]>;
16
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AugustSubAccounts = void 0;
4
+ const fetcher_1 = require("./fetcher");
5
+ const core_1 = require("../../core");
6
+ class AugustSubAccounts extends core_1.AugustBase {
7
+ constructor(baseConfig) {
8
+ super(baseConfig);
9
+ this.headers = null;
10
+ this.headers = {
11
+ 'x-environment': this.monitoring?.['x-environment'],
12
+ 'x-user-id': this.monitoring?.['x-user-id'],
13
+ };
14
+ }
15
+ async getSubaccountHealthFactor(subaccountAddress) {
16
+ const response = await (0, fetcher_1.fetchSubaccountHeathFactor)(subaccountAddress, this.keys.august, this.headers);
17
+ return {
18
+ id: response.id,
19
+ dateTime: response.datetime,
20
+ healthFactor: response.health_factor,
21
+ totalCollateral: response.total_collateral_value,
22
+ totalLoan: response.total_loan_value,
23
+ };
24
+ }
25
+ async getSubaccountLoans(subaccountAddress, side, active) {
26
+ const response = await (0, fetcher_1.fetchSubaccountLoans)({ address: subaccountAddress, active, side }, this.keys.august, this.headers);
27
+ return response;
28
+ }
29
+ async getSubaccountCefiPositions(subaccountAddress) {
30
+ const response = await (0, fetcher_1.fetchSubaccountCefiPositions)(subaccountAddress, this.keys.august, this.headers);
31
+ return response;
32
+ }
33
+ async getSubaccountOtcPositions(subaccountAddress) {
34
+ const response = await (0, fetcher_1.fetchSubaccountOtcPositions)(subaccountAddress, this.keys.august, this.headers);
35
+ return response;
36
+ }
37
+ }
38
+ exports.AugustSubAccounts = AugustSubAccounts;
39
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src.ts/modules/sub-accounts/main.ts"],"names":[],"mappings":";;;AAKA,uCAKmB;AACnB,qCAAqD;AASrD,MAAa,iBAAkB,SAAQ,iBAAU;IAG/C,YAAY,UAAuB;QACjC,KAAK,CAAC,UAAU,CAAC,CAAC;QAHZ,YAAO,GAAkC,IAAI,CAAC;QAIpD,IAAI,CAAC,OAAO,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,eAAe,CAAC;YACnD,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,WAAW,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ddress;
4
+ datetime: string;
5
+ health_factor: number;
6
+ total_collateral_value: number;
7
+ total_loan_value: number;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=sub-accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-accounts.js","sourceRoot":"","sources":["../../src.ts/types/sub-accounts.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augustdigital/sdk",
3
- "version": "4.20.1",
3
+ "version": "4.20.2-alpha.0",
4
4
  "main": "lib/index.js",
5
5
  "keywords": [
6
6
  "augustdigital",
@@ -12,6 +12,16 @@
12
12
  "author": "August Digital",
13
13
  "license": "MIT",
14
14
  "description": "JS SDK powering the August Digital ecosystem.",
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "test": "pnpm build && cross-env node dist/test",
18
+ "test:jest": "jest",
19
+ "test:jest:watch": "jest --watch",
20
+ "test:jest:coverage": "jest --coverage",
21
+ "clean": "rm -rf ./lib",
22
+ "format": "eslint . --fix",
23
+ "lint-sdk": "lint-staged"
24
+ },
15
25
  "lint-staged": {
16
26
  "*.{ts,tsx,js,jsx,json}": [
17
27
  "eslint --fix"
@@ -37,7 +47,7 @@
37
47
  "ethereum-block-by-date": "^1.5.0",
38
48
  "ethers": "^6.13.1",
39
49
  "lru-cache": "^11.2.2",
40
- "uuid": "^13.0.0"
50
+ "uuid": "^11.1.0"
41
51
  },
42
52
  "devDependencies": {
43
53
  "@types/jest": "^29.5.0",
@@ -53,15 +63,5 @@
53
63
  "viem": {
54
64
  "optional": true
55
65
  }
56
- },
57
- "scripts": {
58
- "build": "tsc",
59
- "test": "pnpm build && cross-env node dist/test",
60
- "test:jest": "jest",
61
- "test:jest:watch": "jest --watch",
62
- "test:jest:coverage": "jest --coverage",
63
- "clean": "rm -rf ./lib",
64
- "format": "eslint . --fix",
65
- "lint-sdk": "lint-staged"
66
66
  }
67
- }
67
+ }