@drift-labs/sdk 0.1.13 → 0.1.14
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/lib/accounts/defaultClearingHouseAccountSubscriber.d.ts +1 -0
- package/lib/accounts/defaultClearingHouseAccountSubscriber.d.ts.map +1 -1
- package/lib/accounts/defaultClearingHouseAccountSubscriber.js +17 -0
- package/lib/accounts/defaultUserAccountSubscriber.d.ts +2 -0
- package/lib/accounts/defaultUserAccountSubscriber.d.ts.map +1 -1
- package/lib/accounts/defaultUserAccountSubscriber.js +16 -0
- package/lib/accounts/types.d.ts +3 -0
- package/lib/accounts/types.d.ts.map +1 -1
- package/lib/accounts/webSocketAccountSubscriber.d.ts +2 -0
- package/lib/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/accounts/webSocketAccountSubscriber.js +13 -3
- package/lib/clearingHouse.d.ts +4 -0
- package/lib/clearingHouse.d.ts.map +1 -1
- package/lib/clearingHouse.js +8 -0
- package/lib/clearingHouseUser.d.ts +4 -0
- package/lib/clearingHouseUser.d.ts.map +1 -1
- package/lib/clearingHouseUser.js +24 -6
- package/lib/constants/markets.d.ts.map +1 -1
- package/lib/constants/markets.js +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/math/amm.d.ts.map +1 -1
- package/lib/math/amm.js +2 -1
- package/lib/math/insuranceFund.d.ts +4 -3
- package/lib/math/insuranceFund.d.ts.map +1 -1
- package/lib/math/insuranceFund.js +1 -0
- package/lib/math/position.d.ts.map +1 -1
- package/lib/util/computeUnits.d.ts +3 -0
- package/lib/util/computeUnits.d.ts.map +1 -0
- package/lib/util/computeUnits.js +27 -0
- package/lib/wallet.d.ts +2 -2
- package/lib/wallet.d.ts.map +1 -1
- package/package.json +2 -12
- package/src/accounts/defaultClearingHouseAccountSubscriber.ts +18 -0
- package/src/accounts/defaultUserAccountSubscriber.ts +18 -0
- package/src/accounts/types.ts +3 -1
- package/src/accounts/webSocketAccountSubscriber.ts +16 -6
- package/src/clearingHouse.ts +7 -1
- package/src/clearingHouseUser.ts +32 -8
- package/src/constants/markets.ts +7 -0
- package/src/constants/numericConstants.ts +0 -1
- package/src/examples/makeTradeExample.ts +1 -1
- package/src/index.ts +1 -0
- package/src/math/amm.ts +2 -2
- package/src/math/insuranceFund.ts +16 -9
- package/src/math/position.ts +6 -5
- package/src/util/computeUnits.ts +21 -0
- package/src/wallet.ts +17 -17
- package/.eslintrc.json +0 -36
- package/.prettierignore +0 -1
- package/.prettierrc.js +0 -9
|
@@ -23,6 +23,7 @@ export declare class DefaultClearingHouseAccountSubscriber implements ClearingHo
|
|
|
23
23
|
private subscriptionPromiseResolver;
|
|
24
24
|
constructor(program: Program);
|
|
25
25
|
subscribe(optionalSubscriptions?: ClearingHouseAccountTypes[]): Promise<boolean>;
|
|
26
|
+
fetch(): Promise<void>;
|
|
26
27
|
unsubscribe(): Promise<void>;
|
|
27
28
|
assertIsSubscribed(): void;
|
|
28
29
|
assertOptionalIsSubscribed(optionalSubscription: ClearingHouseAccountTypes): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultClearingHouseAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/defaultClearingHouseAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAsB,MAAM,SAAS,CAAC;AAChE,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EA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AMzD,sBAAsB,IAAI,mBAAmB;IAM7C,4BAA4B,IAAI,yBAAyB;CAKhE"}
|
|
1
|
+
{"version":3,"file":"defaultClearingHouseAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/defaultClearingHouseAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAsB,MAAM,SAAS,CAAC;AAChE,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,qBAAa,qCACZ,YAAW,8BAA8B;IAEzC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,0BAA0B,CAAC,CAAC;IAC3E,sBAAsB,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACzD,wBAAwB,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAC7D,6BAA6B,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACvE,+BAA+B,CAAC,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IAC3E,sCAAsC,CAAC,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;IACzF,mCAAmC,CAAC,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;IACnF,6BAA6B,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACvE,mCAAmC,CAAC,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;IAEnF,0BAA0B,EAAE,yBAAyB,EAAE,CAAM;IAE7D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAmB;IAC9C,OAAO,CAAC,2BAA2B,CAAyB;gBAEzC,OAAO,EAAE,OAAO;IAMtB,SAAS,CACrB,qBAAqB,CAAC,EAAE,yBAAyB,EAAE,GACjD,OAAO,CAAC,OAAO,CAAC;IAiJN,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCzC,kBAAkB,IAAI,IAAI;IAQ1B,0BAA0B,CACzB,oBAAoB,EAAE,yBAAyB,GAC7C,IAAI;IAcA,eAAe,IAAI,YAAY;IAK/B,iBAAiB,IAAI,cAAc;IAKnC,sBAAsB,IAAI,mBAAmB;IAM7C,wBAAwB,IAAI,qBAAqB;IAMjD,+BAA+B,IAAI,4BAA4B;IAM/D,4BAA4B,IAAI,yBAAyB;IAMzD,sBAAsB,IAAI,mBAAmB;IAM7C,4BAA4B,IAAI,yBAAyB;CAKhE"}
|
|
@@ -100,6 +100,23 @@ class DefaultClearingHouseAccountSubscriber {
|
|
|
100
100
|
return true;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
+
fetch() {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
if (!this.isSubscribed) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const promises = this.optionalExtraSubscriptions
|
|
109
|
+
.map((optionalSubscription) => {
|
|
110
|
+
const subscriber = `${optionalSubscription}Subscriber`;
|
|
111
|
+
return this[subscriber].fetch();
|
|
112
|
+
})
|
|
113
|
+
.concat([
|
|
114
|
+
this.stateAccountSubscriber.fetch(),
|
|
115
|
+
this.marketsAccountSubscriber.fetch(),
|
|
116
|
+
]);
|
|
117
|
+
yield Promise.all(promises);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
103
120
|
unsubscribe() {
|
|
104
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
122
|
if (!this.isSubscribed) {
|
|
@@ -14,7 +14,9 @@ export declare class DefaultUserAccountSubscriber implements UserAccountSubscrib
|
|
|
14
14
|
userPositionsAccountSubscriber: AccountSubscriber<UserPositionsAccount>;
|
|
15
15
|
constructor(program: Program, authority: PublicKey);
|
|
16
16
|
subscribe(): Promise<boolean>;
|
|
17
|
+
fetch(): Promise<void>;
|
|
17
18
|
unsubscribe(): Promise<void>;
|
|
19
|
+
assertIsSubscribed(): void;
|
|
18
20
|
getUserAccount(): UserAccount;
|
|
19
21
|
getUserPositionsAccount(): UserPositionsAccount;
|
|
20
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/defaultUserAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,iBAAiB,
|
|
1
|
+
{"version":3,"file":"defaultUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/defaultUserAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,iBAAiB,EAEjB,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE7D,qBAAa,4BAA6B,YAAW,qBAAqB;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAClE,SAAS,EAAE,SAAS,CAAC;IAErB,yBAAyB,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC1D,8BAA8B,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;gBAErD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;IAOnD,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAsC7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAWlC,kBAAkB,IAAI,IAAI;IAQnB,cAAc,IAAI,WAAW;IAK7B,uBAAuB,IAAI,oBAAoB;CAItD"}
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DefaultUserAccountSubscriber = void 0;
|
|
13
|
+
const types_1 = require("./types");
|
|
13
14
|
const events_1 = require("events");
|
|
14
15
|
const addresses_1 = require("../addresses");
|
|
15
16
|
const webSocketAccountSubscriber_1 = require("./webSocketAccountSubscriber");
|
|
@@ -42,6 +43,14 @@ class DefaultUserAccountSubscriber {
|
|
|
42
43
|
return true;
|
|
43
44
|
});
|
|
44
45
|
}
|
|
46
|
+
fetch() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
yield Promise.all([
|
|
49
|
+
this.userDataAccountSubscriber.fetch(),
|
|
50
|
+
this.userPositionsAccountSubscriber.fetch(),
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
45
54
|
unsubscribe() {
|
|
46
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
56
|
if (!this.isSubscribed) {
|
|
@@ -52,10 +61,17 @@ class DefaultUserAccountSubscriber {
|
|
|
52
61
|
this.isSubscribed = false;
|
|
53
62
|
});
|
|
54
63
|
}
|
|
64
|
+
assertIsSubscribed() {
|
|
65
|
+
if (!this.isSubscribed) {
|
|
66
|
+
throw new types_1.NotSubscribedError('You must call `subscribe` before using this function');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
55
69
|
getUserAccount() {
|
|
70
|
+
this.assertIsSubscribed();
|
|
56
71
|
return this.userDataAccountSubscriber.data;
|
|
57
72
|
}
|
|
58
73
|
getUserPositionsAccount() {
|
|
74
|
+
this.assertIsSubscribed();
|
|
59
75
|
return this.userPositionsAccountSubscriber.data;
|
|
60
76
|
}
|
|
61
77
|
}
|
package/lib/accounts/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { EventEmitter } from 'events';
|
|
|
5
5
|
export interface AccountSubscriber<T> {
|
|
6
6
|
data?: T;
|
|
7
7
|
subscribe(onChange: (data: T) => void): Promise<void>;
|
|
8
|
+
fetch(): Promise<void>;
|
|
8
9
|
unsubscribe(): void;
|
|
9
10
|
}
|
|
10
11
|
export declare class NotSubscribedError extends Error {
|
|
@@ -27,6 +28,7 @@ export interface ClearingHouseAccountSubscriber {
|
|
|
27
28
|
isSubscribed: boolean;
|
|
28
29
|
optionalExtraSubscriptions: ClearingHouseAccountTypes[];
|
|
29
30
|
subscribe(optionalSubscriptions?: ClearingHouseAccountTypes[]): Promise<boolean>;
|
|
31
|
+
fetch(): Promise<void>;
|
|
30
32
|
unsubscribe(): Promise<void>;
|
|
31
33
|
getStateAccount(): StateAccount;
|
|
32
34
|
getMarketsAccount(): MarketsAccount;
|
|
@@ -46,6 +48,7 @@ export interface UserAccountSubscriber {
|
|
|
46
48
|
eventEmitter: StrictEventEmitter<EventEmitter, UserAccountEvents>;
|
|
47
49
|
isSubscribed: boolean;
|
|
48
50
|
subscribe(): Promise<boolean>;
|
|
51
|
+
fetch(): Promise<void>;
|
|
49
52
|
unsubscribe(): Promise<void>;
|
|
50
53
|
getUserAccount(): UserAccount;
|
|
51
54
|
getUserPositionsAccount(): UserPositionsAccount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/accounts/types.ts"],"names":[],"m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IACrC,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAClE,YAAY,EAAE,OAAO,CAAC;IAEtB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,cAAc,IAAI,WAAW,CAAC;IAC9B,uBAAuB,IAAI,oBAAoB,CAAC;CAChD"}
|
|
@@ -6,8 +6,10 @@ export declare class WebSocketAccountSubscriber<T> implements AccountSubscriber<
|
|
|
6
6
|
accountName: string;
|
|
7
7
|
program: Program;
|
|
8
8
|
accountPublicKey: PublicKey;
|
|
9
|
+
onChange: (data: T) => void;
|
|
9
10
|
constructor(accountName: string, program: Program, accountPublicKey: PublicKey);
|
|
10
11
|
subscribe(onChange: (data: T) => void): Promise<void>;
|
|
12
|
+
fetch(): Promise<void>;
|
|
11
13
|
unsubscribe(): Promise<void>;
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=webSocketAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webSocketAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/webSocketAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,0BAA0B,CAAC,CAAC,CAAE,YAAW,iBAAiB,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,SAAS,CAAC;gBAG3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,SAAS;IAOtB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"webSocketAccountSubscriber.d.ts","sourceRoot":"","sources":["../../src/accounts/webSocketAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,0BAA0B,CAAC,CAAC,CAAE,YAAW,iBAAiB,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;gBAG3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,SAAS;IAOtB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
|
|
@@ -18,16 +18,26 @@ class WebSocketAccountSubscriber {
|
|
|
18
18
|
}
|
|
19
19
|
subscribe(onChange) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
this.
|
|
22
|
-
|
|
21
|
+
this.onChange = onChange;
|
|
22
|
+
yield this.fetch();
|
|
23
23
|
this.program.account[this.accountName]
|
|
24
24
|
.subscribe(this.accountPublicKey, this.program.provider.opts.commitment)
|
|
25
25
|
.on('change', (data) => __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
this.data = data;
|
|
27
|
-
onChange(data);
|
|
27
|
+
this.onChange(data);
|
|
28
28
|
}));
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
fetch() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const newData = (yield this.program.account[this.accountName].fetch(this.accountPublicKey));
|
|
34
|
+
// if data has changed trigger update
|
|
35
|
+
if (JSON.stringify(newData) !== JSON.stringify(this.data)) {
|
|
36
|
+
this.data = newData;
|
|
37
|
+
this.onChange(this.data);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
31
41
|
unsubscribe() {
|
|
32
42
|
return this.program.account[this.accountName].unsubscribe(this.accountPublicKey);
|
|
33
43
|
}
|
package/lib/clearingHouse.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export declare class ClearingHouse {
|
|
|
38
38
|
* @returns Promise<boolean> : SubscriptionSuccess
|
|
39
39
|
*/
|
|
40
40
|
subscribeToAll(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
43
|
+
*/
|
|
44
|
+
fetchAccounts(): Promise<void>;
|
|
41
45
|
/**
|
|
42
46
|
* Unsubscribe from all currently subscribed state accounts
|
|
43
47
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearingHouse.d.ts","sourceRoot":"","sources":["../src/clearingHouse.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAO,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMnE,OAAO,EACN,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,OAAO,EACP,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,
|
|
1
|
+
{"version":3,"file":"clearingHouse.d.ts","sourceRoot":"","sources":["../src/clearingHouse.ts"],"names":[],"mapp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,EAAE,EACf,aAAa,CAAC,EAAE,SAAS,EACzB,QAAQ,CAAC,EAAE,SAAS,GAClB,OAAO,CAAC,sBAAsB,CAAC;IAkDrB,SAAS,CACrB,8BAA8B,EAAE,SAAS,GACvC,OAAO,CAAC,oBAAoB,CAAC;IAQnB,cAAc,CAC1B,8BAA8B,EAAE,SAAS,GACvC,OAAO,CAAC,sBAAsB,CAAC;IA8CrB,iBAAiB,CAC7B,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,EAAE,GACb,OAAO,CAAC,oBAAoB,CAAC;IAQnB,sBAAsB,CAClC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,EAAE,GACb,OAAO,CAAC,sBAAsB,CAAC;IAYrB,oBAAoB,CAChC,WAAW,EAAE,SAAS,EACtB,oBAAoB,EAAE,SAAS,GAC7B,OAAO,CAAC,oBAAoB,CAAC;IAUnB,yBAAyB,CACrC,WAAW,EAAE,SAAS,EACtB,oBAAoB,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAa3B,YAAY,CAAC,SAAS,EAAE,MAAM,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG;CAG3E"}
|
package/lib/clearingHouse.js
CHANGED
|
@@ -93,6 +93,14 @@ class ClearingHouse {
|
|
|
93
93
|
]);
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
98
|
+
*/
|
|
99
|
+
fetchAccounts() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
yield this.accountSubscriber.fetch();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
96
104
|
/**
|
|
97
105
|
* Unsubscribe from all currently subscribed state accounts
|
|
98
106
|
*/
|
|
@@ -21,6 +21,10 @@ export declare class ClearingHouseUser {
|
|
|
21
21
|
* @returns SusbcriptionSuccess result
|
|
22
22
|
*/
|
|
23
23
|
subscribe(): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
26
|
+
*/
|
|
27
|
+
fetchAccounts(): Promise<void>;
|
|
24
28
|
unsubscribe(): Promise<void>;
|
|
25
29
|
getUserAccount(): UserAccount;
|
|
26
30
|
getUserPositionsAccount(): UserPositionsAccount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearingHouseUser.d.ts","sourceRoot":"","sources":["../src/clearingHouseUser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAc1E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAKN,iBAAiB,
|
|
1
|
+
{"version":3,"file":"clearingHouseUser.d.ts","sourceRoot":"","sources":["../src/clearingHouseUser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAc1E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAKN,iBAAiB,EAEjB,MAAM,GAAG,CAAC;AAGX,qBAA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package/lib/clearingHouseUser.js
CHANGED
|
@@ -43,6 +43,14 @@ class ClearingHouseUser {
|
|
|
43
43
|
return this.isSubscribed;
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
48
|
+
*/
|
|
49
|
+
fetchAccounts() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield this.accountSubscriber.fetch();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
46
54
|
unsubscribe() {
|
|
47
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
56
|
yield this.accountSubscriber.unsubscribe();
|
|
@@ -404,21 +412,28 @@ class ClearingHouseUser {
|
|
|
404
412
|
.div(this.getMaxLeverage('Partial')));
|
|
405
413
|
}
|
|
406
414
|
let priceDelt;
|
|
407
|
-
if (
|
|
408
|
-
priceDelt = tc
|
|
415
|
+
if (proposedBaseAssetAmount.lt(numericConstants_1.ZERO)) {
|
|
416
|
+
priceDelt = (tc
|
|
409
417
|
.mul(thisLev)
|
|
410
|
-
.sub(tpv)
|
|
418
|
+
.sub(tpv))
|
|
411
419
|
.mul(numericConstants_1.PRICE_TO_QUOTE_PRECISION)
|
|
412
420
|
.div(thisLev.add(new bn_js_1.default(1)));
|
|
413
421
|
}
|
|
414
422
|
else {
|
|
415
|
-
priceDelt = tc
|
|
423
|
+
priceDelt = (tc
|
|
416
424
|
.mul(thisLev)
|
|
417
|
-
.sub(tpv)
|
|
425
|
+
.sub(tpv))
|
|
418
426
|
.mul(numericConstants_1.PRICE_TO_QUOTE_PRECISION)
|
|
419
427
|
.div(thisLev.sub(new bn_js_1.default(1)));
|
|
420
428
|
}
|
|
421
|
-
|
|
429
|
+
let currentPrice;
|
|
430
|
+
if (positionBaseSizeChange.eq(numericConstants_1.ZERO)) {
|
|
431
|
+
currentPrice = _1.calculateMarkPrice(this.clearingHouse.getMarket(targetMarket.marketIndex));
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
const direction = positionBaseSizeChange.gt(numericConstants_1.ZERO) ? _1.PositionDirection.LONG : _1.PositionDirection.SHORT;
|
|
435
|
+
currentPrice = _1.calculateTradeSlippage(direction, positionBaseSizeChange.abs(), this.clearingHouse.getMarket(targetMarket.marketIndex), 'base')[3]; // newPrice after swap
|
|
436
|
+
}
|
|
422
437
|
// if the position value after the trade is less than total collateral, there is no liq price
|
|
423
438
|
if (targetTotalPositionValueUSDC.lte(totalFreeCollateralUSDC) &&
|
|
424
439
|
proposedMarketPosition.baseAssetAmount.gt(numericConstants_1.ZERO)) {
|
|
@@ -429,6 +444,9 @@ class ClearingHouseUser {
|
|
|
429
444
|
const eatMargin2 = priceDelt
|
|
430
445
|
.mul(numericConstants_1.AMM_RESERVE_PRECISION)
|
|
431
446
|
.div(proposedBaseAssetAmount);
|
|
447
|
+
if (eatMargin2.gt(currentPrice)) {
|
|
448
|
+
return new bn_js_1.default(-1);
|
|
449
|
+
}
|
|
432
450
|
const liqPrice = currentPrice.sub(eatMargin2);
|
|
433
451
|
return liqPrice;
|
|
434
452
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markets.d.ts","sourceRoot":"","sources":["../../src/constants/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,aAAK,MAAM,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,EAAE,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"markets.d.ts","sourceRoot":"","sources":["../../src/constants/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,aAAK,MAAM,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,EAAE,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,EAyD3B,CAAC"}
|
package/lib/constants/markets.js
CHANGED
|
@@ -55,4 +55,11 @@ exports.Markets = [
|
|
|
55
55
|
devnetPythOracle: 'FBirwuDFuRAu4iSGc7RGxN5koHB7EJM1wbCmyPuQoGur',
|
|
56
56
|
mainnetPythOracle: '7KVswB9vkCgeM3SHP7aGDijvdRAHK8P5wi9JXViCrtYh',
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
symbol: 'ATOM-PERP',
|
|
60
|
+
baseAssetSymbol: 'ATOM',
|
|
61
|
+
marketIndex: new bn_js_1.default(7),
|
|
62
|
+
devnetPythOracle: '7YAze8qFUMkBnyLVdKT4TFUUFui99EwS5gfRArMcrvFk',
|
|
63
|
+
mainnetPythOracle: 'CrCpTerNqtZvqLcKqz1k13oVeXV9WkMD2zA9hBKXrsbN',
|
|
64
|
+
},
|
|
58
65
|
];
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kDAAkD,CAAC;AACjE,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kDAAkD,CAAC;AACjE,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/math/amm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm.d.ts","sourceRoot":"","sources":["../../src/math/amm.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"amm.d.ts","sourceRoot":"","sources":["../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esAfterSwap(amm, inputAssetType, swapAmount, swapDire
|
|
|
40
40
|
let newQuoteAssetReserve;
|
|
41
41
|
let newBaseAssetReserve;
|
|
42
42
|
if (inputAssetType === 'quote') {
|
|
43
|
-
swapAmount = swapAmount
|
|
43
|
+
swapAmount = swapAmount
|
|
44
|
+
.mul(numericConstants_1.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO)
|
|
44
45
|
.div(amm.pegMultiplier);
|
|
45
46
|
[newQuoteAssetReserve, newBaseAssetReserve] = calculateSwapOutput(amm.quoteAssetReserve, swapAmount, swapDirection, amm.sqrtK.mul(amm.sqrtK));
|
|
46
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MarketsAccount, StateAccount } from
|
|
2
|
-
import BN from
|
|
3
|
-
import { Connection } from
|
|
1
|
+
import { MarketsAccount, StateAccount } from '../types';
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
import { Connection } from '@solana/web3.js';
|
|
4
4
|
/**
|
|
5
5
|
* In the case of a levered loss, the exchange first pays out undistributed fees and then the insurance fund.
|
|
6
6
|
* Thus the de facto size of the insurance fund is the amount in the insurance vault plus the sum of each markets
|
|
@@ -9,6 +9,7 @@ import { Connection } from "@solana/web3.js";
|
|
|
9
9
|
* @param connection
|
|
10
10
|
* @param state
|
|
11
11
|
* @param marketsAccount
|
|
12
|
+
* @returns Precision : QUOTE_ASSET_PRECISION
|
|
12
13
|
*/
|
|
13
14
|
export declare function calculateInsuranceFundSize(connection: Connection, state: StateAccount, marketsAccount: MarketsAccount): Promise<BN>;
|
|
14
15
|
//# sourceMappingURL=insuranceFund.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insuranceFund.d.ts","sourceRoot":"","sources":["../../src/math/insuranceFund.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"insuranceFund.d.ts","sourceRoot":"","sources":["../../src/math/insuranceFund.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAC/C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,YAAY,EACnB,cAAc,EAAE,cAAc,GAC5B,OAAO,CAAC,EAAE,CAAC,CAUb"}
|
|
@@ -22,6 +22,7 @@ const bn_js_1 = __importDefault(require("bn.js"));
|
|
|
22
22
|
* @param connection
|
|
23
23
|
* @param state
|
|
24
24
|
* @param marketsAccount
|
|
25
|
+
* @returns Precision : QUOTE_ASSET_PRECISION
|
|
25
26
|
*/
|
|
26
27
|
function calculateInsuranceFundSize(connection, state, marketsAccount) {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/math/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/math/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;AAWvB,OAAO,EAAE,MAAM,EAAqB,YAAY,EAAE,MAAM,UAAU,CAAC;AAGnE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GACxB,EAAE,CA6BJ;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,YAAY,EAC5B,WAAW,UAAQ,GACjB,EAAE,CAwBJ;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,YAAY,GAC1B,EAAE,CAoBJ;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,EAAE,CAUlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeUnits.d.ts","sourceRoot":"","sources":["../../src/util/computeUnits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElE,wBAAsB,0BAA0B,CAC/C,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,QAAsB,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.findComputeUnitConsumption = void 0;
|
|
13
|
+
function findComputeUnitConsumption(programId, connection, txSignature, commitment = 'confirmed') {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const tx = yield connection.getTransaction(txSignature, { commitment });
|
|
16
|
+
const computeUnits = [];
|
|
17
|
+
const regex = new RegExp(`Program ${programId.toString()} consumed ([0-9]{0,6}) of 200000 compute units`);
|
|
18
|
+
tx.meta.logMessages.forEach((logMessage) => {
|
|
19
|
+
const match = logMessage.match(regex);
|
|
20
|
+
if (match && match[1]) {
|
|
21
|
+
computeUnits.push(match[1]);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return computeUnits;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.findComputeUnitConsumption = findComputeUnitConsumption;
|
package/lib/wallet.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Keypair, PublicKey, Transaction } from
|
|
2
|
-
import { IWallet } from
|
|
1
|
+
import { Keypair, PublicKey, Transaction } from '@solana/web3.js';
|
|
2
|
+
import { IWallet } from './types';
|
|
3
3
|
export declare class Wallet implements IWallet {
|
|
4
4
|
readonly payer: Keypair;
|
|
5
5
|
constructor(payer: Keypair);
|
package/lib/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qBAAa,MAAO,YAAW,OAAO;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO;gBAAd,KAAK,EAAE,OAAO;IAE7B,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAKtD,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAOrE,IAAI,SAAS,IAAI,SAAS,CAEzB;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"author": "crispheaney",
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "yarn clean && tsc",
|
|
14
14
|
"clean": "rm -rf lib",
|
|
15
|
-
"patch-and-pub": "npm version patch --force && npm publish"
|
|
16
|
-
"prettify": "prettier --write './src/**/*.{ts,tsx}'",
|
|
17
|
-
"lint": "eslint . --ext ts --ext tsx --ext js --quiet"
|
|
15
|
+
"patch-and-pub": "npm version patch --force && npm publish"
|
|
18
16
|
},
|
|
19
17
|
"keywords": [
|
|
20
18
|
"drift-labs",
|
|
@@ -36,14 +34,6 @@
|
|
|
36
34
|
"@types/bn.js": "^5.1.0",
|
|
37
35
|
"strict-event-emitter-types": "^2.0.0"
|
|
38
36
|
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
|
41
|
-
"@typescript-eslint/parser": "^4.28.0",
|
|
42
|
-
"eslint": "^7.29.0",
|
|
43
|
-
"eslint-config-prettier": "^8.3.0",
|
|
44
|
-
"eslint-plugin-prettier": "^3.4.0",
|
|
45
|
-
"prettier": "^2.4.1"
|
|
46
|
-
},
|
|
47
37
|
"description": "SDK for Drift Protocol v1",
|
|
48
38
|
"engines": {
|
|
49
39
|
"node": ">=12"
|
|
@@ -194,6 +194,24 @@ export class DefaultClearingHouseAccountSubscriber
|
|
|
194
194
|
return true;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
public async fetch(): Promise<void> {
|
|
198
|
+
if (!this.isSubscribed) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const promises = this.optionalExtraSubscriptions
|
|
203
|
+
.map((optionalSubscription) => {
|
|
204
|
+
const subscriber = `${optionalSubscription}Subscriber`;
|
|
205
|
+
return this[subscriber].fetch();
|
|
206
|
+
})
|
|
207
|
+
.concat([
|
|
208
|
+
this.stateAccountSubscriber.fetch(),
|
|
209
|
+
this.marketsAccountSubscriber.fetch(),
|
|
210
|
+
]);
|
|
211
|
+
|
|
212
|
+
await Promise.all(promises);
|
|
213
|
+
}
|
|
214
|
+
|
|
197
215
|
public async unsubscribe(): Promise<void> {
|
|
198
216
|
if (!this.isSubscribed) {
|
|
199
217
|
return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccountSubscriber,
|
|
3
|
+
NotSubscribedError,
|
|
3
4
|
UserAccountEvents,
|
|
4
5
|
UserAccountSubscriber,
|
|
5
6
|
} from './types';
|
|
@@ -65,6 +66,13 @@ export class DefaultUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
65
66
|
return true;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
async fetch(): Promise<void> {
|
|
70
|
+
await Promise.all([
|
|
71
|
+
this.userDataAccountSubscriber.fetch(),
|
|
72
|
+
this.userPositionsAccountSubscriber.fetch(),
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
async unsubscribe(): Promise<void> {
|
|
69
77
|
if (!this.isSubscribed) {
|
|
70
78
|
return;
|
|
@@ -76,11 +84,21 @@ export class DefaultUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
76
84
|
this.isSubscribed = false;
|
|
77
85
|
}
|
|
78
86
|
|
|
87
|
+
assertIsSubscribed(): void {
|
|
88
|
+
if (!this.isSubscribed) {
|
|
89
|
+
throw new NotSubscribedError(
|
|
90
|
+
'You must call `subscribe` before using this function'
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
public getUserAccount(): UserAccount {
|
|
96
|
+
this.assertIsSubscribed();
|
|
80
97
|
return this.userDataAccountSubscriber.data;
|
|
81
98
|
}
|
|
82
99
|
|
|
83
100
|
public getUserPositionsAccount(): UserPositionsAccount {
|
|
101
|
+
this.assertIsSubscribed();
|
|
84
102
|
return this.userPositionsAccountSubscriber.data;
|
|
85
103
|
}
|
|
86
104
|
}
|
package/src/accounts/types.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { EventEmitter } from 'events';
|
|
|
16
16
|
export interface AccountSubscriber<T> {
|
|
17
17
|
data?: T;
|
|
18
18
|
subscribe(onChange: (data: T) => void): Promise<void>;
|
|
19
|
+
fetch(): Promise<void>;
|
|
19
20
|
unsubscribe(): void;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -54,7 +55,7 @@ export interface ClearingHouseAccountSubscriber {
|
|
|
54
55
|
subscribe(
|
|
55
56
|
optionalSubscriptions?: ClearingHouseAccountTypes[]
|
|
56
57
|
): Promise<boolean>;
|
|
57
|
-
|
|
58
|
+
fetch(): Promise<void>;
|
|
58
59
|
unsubscribe(): Promise<void>;
|
|
59
60
|
|
|
60
61
|
getStateAccount(): StateAccount;
|
|
@@ -78,6 +79,7 @@ export interface UserAccountSubscriber {
|
|
|
78
79
|
isSubscribed: boolean;
|
|
79
80
|
|
|
80
81
|
subscribe(): Promise<boolean>;
|
|
82
|
+
fetch(): Promise<void>;
|
|
81
83
|
unsubscribe(): Promise<void>;
|
|
82
84
|
|
|
83
85
|
getUserAccount(): UserAccount;
|
|
@@ -7,6 +7,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
7
7
|
accountName: string;
|
|
8
8
|
program: Program;
|
|
9
9
|
accountPublicKey: PublicKey;
|
|
10
|
+
onChange: (data: T) => void;
|
|
10
11
|
|
|
11
12
|
public constructor(
|
|
12
13
|
accountName: string,
|
|
@@ -19,20 +20,29 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async subscribe(onChange: (data: T) => void): Promise<void> {
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
)) as T;
|
|
25
|
-
|
|
26
|
-
onChange(this.data);
|
|
23
|
+
this.onChange = onChange;
|
|
24
|
+
await this.fetch();
|
|
27
25
|
|
|
28
26
|
this.program.account[this.accountName]
|
|
29
27
|
.subscribe(this.accountPublicKey, this.program.provider.opts.commitment)
|
|
30
28
|
.on('change', async (data: T) => {
|
|
31
29
|
this.data = data;
|
|
32
|
-
onChange(data);
|
|
30
|
+
this.onChange(data);
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
|
|
34
|
+
async fetch(): Promise<void> {
|
|
35
|
+
const newData = (await this.program.account[this.accountName].fetch(
|
|
36
|
+
this.accountPublicKey
|
|
37
|
+
)) as T;
|
|
38
|
+
|
|
39
|
+
// if data has changed trigger update
|
|
40
|
+
if (JSON.stringify(newData) !== JSON.stringify(this.data)) {
|
|
41
|
+
this.data = newData;
|
|
42
|
+
this.onChange(this.data);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
unsubscribe(): Promise<void> {
|
|
37
47
|
return this.program.account[this.accountName].unsubscribe(
|
|
38
48
|
this.accountPublicKey
|
package/src/clearingHouse.ts
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
PositionDirection,
|
|
17
17
|
TradeHistoryAccount,
|
|
18
18
|
UserAccount,
|
|
19
|
-
UserPositionsAccount,
|
|
20
19
|
Market,
|
|
21
20
|
} from './types';
|
|
22
21
|
import * as anchor from '@project-serum/anchor';
|
|
@@ -140,6 +139,13 @@ export class ClearingHouse {
|
|
|
140
139
|
]);
|
|
141
140
|
}
|
|
142
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
144
|
+
*/
|
|
145
|
+
public async fetchAccounts(): Promise<void> {
|
|
146
|
+
await this.accountSubscriber.fetch();
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
/**
|
|
144
150
|
* Unsubscribe from all currently subscribed state accounts
|
|
145
151
|
*/
|
package/src/clearingHouseUser.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
calculatePositionFundingPNL,
|
|
26
26
|
calculatePositionPNL,
|
|
27
27
|
PositionDirection,
|
|
28
|
+
calculateTradeSlippage,
|
|
28
29
|
} from '.';
|
|
29
30
|
import { getUserAccountPublicKey } from './addresses';
|
|
30
31
|
|
|
@@ -70,6 +71,13 @@ export class ClearingHouseUser {
|
|
|
70
71
|
return this.isSubscribed;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
76
|
+
*/
|
|
77
|
+
public async fetchAccounts(): Promise<void> {
|
|
78
|
+
await this.accountSubscriber.fetch();
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
public async unsubscribe(): Promise<void> {
|
|
74
82
|
await this.accountSubscriber.unsubscribe();
|
|
75
83
|
this.isSubscribed = false;
|
|
@@ -570,23 +578,35 @@ export class ClearingHouseUser {
|
|
|
570
578
|
}
|
|
571
579
|
|
|
572
580
|
let priceDelt;
|
|
573
|
-
if (
|
|
574
|
-
priceDelt = tc
|
|
581
|
+
if (proposedBaseAssetAmount.lt(ZERO)) {
|
|
582
|
+
priceDelt = (tc
|
|
575
583
|
.mul(thisLev)
|
|
576
|
-
.sub(tpv)
|
|
584
|
+
.sub(tpv))
|
|
577
585
|
.mul(PRICE_TO_QUOTE_PRECISION)
|
|
578
586
|
.div(thisLev.add(new BN(1)));
|
|
579
587
|
} else {
|
|
580
|
-
priceDelt = tc
|
|
588
|
+
priceDelt = (tc
|
|
581
589
|
.mul(thisLev)
|
|
582
|
-
.sub(tpv)
|
|
590
|
+
.sub(tpv))
|
|
583
591
|
.mul(PRICE_TO_QUOTE_PRECISION)
|
|
584
592
|
.div(thisLev.sub(new BN(1)));
|
|
585
593
|
}
|
|
586
594
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
let currentPrice;
|
|
596
|
+
if(positionBaseSizeChange.eq(ZERO)){
|
|
597
|
+
currentPrice = calculateMarkPrice(
|
|
598
|
+
this.clearingHouse.getMarket(targetMarket.marketIndex)
|
|
599
|
+
);
|
|
600
|
+
} else{
|
|
601
|
+
const direction = positionBaseSizeChange.gt(ZERO) ? PositionDirection.LONG : PositionDirection.SHORT;
|
|
602
|
+
currentPrice = calculateTradeSlippage(
|
|
603
|
+
direction,
|
|
604
|
+
positionBaseSizeChange.abs(),
|
|
605
|
+
this.clearingHouse.getMarket(targetMarket.marketIndex),
|
|
606
|
+
'base',
|
|
607
|
+
)[3]; // newPrice after swap
|
|
608
|
+
}
|
|
609
|
+
|
|
590
610
|
|
|
591
611
|
// if the position value after the trade is less than total collateral, there is no liq price
|
|
592
612
|
if (
|
|
@@ -602,6 +622,10 @@ export class ClearingHouseUser {
|
|
|
602
622
|
.mul(AMM_RESERVE_PRECISION)
|
|
603
623
|
.div(proposedBaseAssetAmount);
|
|
604
624
|
|
|
625
|
+
if(eatMargin2.gt(currentPrice)){
|
|
626
|
+
return new BN(-1);
|
|
627
|
+
}
|
|
628
|
+
|
|
605
629
|
const liqPrice = currentPrice.sub(eatMargin2);
|
|
606
630
|
return liqPrice;
|
|
607
631
|
}
|
package/src/constants/markets.ts
CHANGED
|
@@ -58,4 +58,11 @@ export const Markets: Market[] = [
|
|
|
58
58
|
devnetPythOracle: 'FBirwuDFuRAu4iSGc7RGxN5koHB7EJM1wbCmyPuQoGur',
|
|
59
59
|
mainnetPythOracle: '7KVswB9vkCgeM3SHP7aGDijvdRAHK8P5wi9JXViCrtYh',
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
symbol: 'ATOM-PERP',
|
|
63
|
+
baseAssetSymbol: 'ATOM',
|
|
64
|
+
marketIndex: new BN(7),
|
|
65
|
+
devnetPythOracle: '7YAze8qFUMkBnyLVdKT4TFUUFui99EwS5gfRArMcrvFk',
|
|
66
|
+
mainnetPythOracle: 'CrCpTerNqtZvqLcKqz1k13oVeXV9WkMD2zA9hBKXrsbN',
|
|
67
|
+
},
|
|
61
68
|
];
|
package/src/index.ts
CHANGED
package/src/math/amm.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { BN } from '@project-serum/anchor';
|
|
|
2
2
|
import {
|
|
3
3
|
AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO,
|
|
4
4
|
MARK_PRICE_PRECISION,
|
|
5
|
-
ONE,
|
|
6
5
|
PEG_PRECISION,
|
|
7
6
|
ZERO,
|
|
8
7
|
} from '../constants/numericConstants';
|
|
@@ -58,7 +57,8 @@ export function calculateAmmReservesAfterSwap(
|
|
|
58
57
|
let newBaseAssetReserve;
|
|
59
58
|
|
|
60
59
|
if (inputAssetType === 'quote') {
|
|
61
|
-
swapAmount = swapAmount
|
|
60
|
+
swapAmount = swapAmount
|
|
61
|
+
.mul(AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO)
|
|
62
62
|
.div(amm.pegMultiplier);
|
|
63
63
|
|
|
64
64
|
[newQuoteAssetReserve, newBaseAssetReserve] = calculateSwapOutput(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {MarketsAccount, StateAccount} from
|
|
2
|
-
import BN from
|
|
3
|
-
import {Connection} from
|
|
1
|
+
import { MarketsAccount, StateAccount } from '../types';
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
import { Connection } from '@solana/web3.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* In the case of a levered loss, the exchange first pays out undistributed fees and then the insurance fund.
|
|
@@ -10,13 +10,20 @@ import {Connection} from "@solana/web3.js";
|
|
|
10
10
|
* @param connection
|
|
11
11
|
* @param state
|
|
12
12
|
* @param marketsAccount
|
|
13
|
+
* @returns Precision : QUOTE_ASSET_PRECISION
|
|
13
14
|
*/
|
|
14
|
-
export async function calculateInsuranceFundSize(
|
|
15
|
+
export async function calculateInsuranceFundSize(
|
|
16
|
+
connection: Connection,
|
|
17
|
+
state: StateAccount,
|
|
18
|
+
marketsAccount: MarketsAccount
|
|
19
|
+
): Promise<BN> {
|
|
15
20
|
const insuranceVaultPublicKey = state.insuranceVault;
|
|
16
|
-
const insuranceVaultAmount = new BN(
|
|
21
|
+
const insuranceVaultAmount = new BN(
|
|
22
|
+
(
|
|
23
|
+
await connection.getTokenAccountBalance(insuranceVaultPublicKey)
|
|
24
|
+
).value.amount
|
|
25
|
+
);
|
|
17
26
|
return marketsAccount.markets.reduce((insuranceVaultAmount, market) => {
|
|
18
|
-
return insuranceVaultAmount.add(
|
|
19
|
-
market.amm.totalFee.div(new BN(2))
|
|
20
|
-
)
|
|
27
|
+
return insuranceVaultAmount.add(market.amm.totalFee.div(new BN(2)));
|
|
21
28
|
}, insuranceVaultAmount);
|
|
22
|
-
}
|
|
29
|
+
}
|
package/src/math/position.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
2
|
import {
|
|
3
|
-
AMM_RESERVE_PRECISION,
|
|
3
|
+
AMM_RESERVE_PRECISION,
|
|
4
|
+
AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO,
|
|
4
5
|
AMM_TO_QUOTE_PRECISION_RATIO,
|
|
5
6
|
FUNDING_PAYMENT_PRECISION,
|
|
6
|
-
MARK_PRICE_PRECISION,
|
|
7
|
-
|
|
7
|
+
MARK_PRICE_PRECISION,
|
|
8
|
+
ONE,
|
|
8
9
|
PRICE_TO_QUOTE_PRECISION,
|
|
9
10
|
ZERO,
|
|
10
11
|
} from '../constants/numericConstants';
|
|
@@ -42,13 +43,13 @@ export function calculateBaseAssetValue(
|
|
|
42
43
|
return market.amm.quoteAssetReserve
|
|
43
44
|
.sub(newQuoteAssetReserve)
|
|
44
45
|
.mul(market.amm.pegMultiplier)
|
|
45
|
-
.div(AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO)
|
|
46
|
+
.div(AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO);
|
|
46
47
|
|
|
47
48
|
case PositionDirection.LONG:
|
|
48
49
|
return newQuoteAssetReserve
|
|
49
50
|
.sub(market.amm.quoteAssetReserve)
|
|
50
51
|
.mul(market.amm.pegMultiplier)
|
|
51
|
-
.div(AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO)
|
|
52
|
+
.div(AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Connection, Finality, PublicKey } from '@solana/web3.js';
|
|
2
|
+
|
|
3
|
+
export async function findComputeUnitConsumption(
|
|
4
|
+
programId: PublicKey,
|
|
5
|
+
connection: Connection,
|
|
6
|
+
txSignature: string,
|
|
7
|
+
commitment: Finality = 'confirmed'
|
|
8
|
+
): Promise<number[]> {
|
|
9
|
+
const tx = await connection.getTransaction(txSignature, { commitment });
|
|
10
|
+
const computeUnits = [];
|
|
11
|
+
const regex = new RegExp(
|
|
12
|
+
`Program ${programId.toString()} consumed ([0-9]{0,6}) of 200000 compute units`
|
|
13
|
+
);
|
|
14
|
+
tx.meta.logMessages.forEach((logMessage) => {
|
|
15
|
+
const match = logMessage.match(regex);
|
|
16
|
+
if (match && match[1]) {
|
|
17
|
+
computeUnits.push(match[1]);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return computeUnits;
|
|
21
|
+
}
|
package/src/wallet.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {Keypair, PublicKey, Transaction} from
|
|
2
|
-
import {IWallet} from
|
|
1
|
+
import { Keypair, PublicKey, Transaction } from '@solana/web3.js';
|
|
2
|
+
import { IWallet } from './types';
|
|
3
3
|
|
|
4
4
|
export class Wallet implements IWallet {
|
|
5
|
-
|
|
5
|
+
constructor(readonly payer: Keypair) {}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
async signTransaction(tx: Transaction): Promise<Transaction> {
|
|
8
|
+
tx.partialSign(this.payer);
|
|
9
|
+
return tx;
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
async signAllTransactions(txs: Transaction[]): Promise<Transaction[]> {
|
|
13
|
+
return txs.map((t) => {
|
|
14
|
+
t.partialSign(this.payer);
|
|
15
|
+
return t;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
get publicKey(): PublicKey {
|
|
20
|
+
return this.payer.publicKey;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/.eslintrc.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"env": {
|
|
5
|
-
"browser": true
|
|
6
|
-
},
|
|
7
|
-
"ignorePatterns": ["**/lib"],
|
|
8
|
-
"plugins": [],
|
|
9
|
-
"extends": [
|
|
10
|
-
"eslint:recommended",
|
|
11
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
12
|
-
"plugin:@typescript-eslint/recommended"
|
|
13
|
-
],
|
|
14
|
-
"rules": {
|
|
15
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
16
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
|
17
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
18
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
19
|
-
"@typescript-eslint/no-unused-vars": [
|
|
20
|
-
2,
|
|
21
|
-
{
|
|
22
|
-
"argsIgnorePattern": "^_",
|
|
23
|
-
"varsIgnorePattern": "^_"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"@typescript-eslint/no-var-requires": 0,
|
|
27
|
-
"@typescript-eslint/no-empty-function": 0,
|
|
28
|
-
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
|
|
29
|
-
"semi": 2
|
|
30
|
-
},
|
|
31
|
-
"settings": {
|
|
32
|
-
"react": {
|
|
33
|
-
"version": "detect"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
**/node_modules/**
|