@drift-labs/sdk 0.1.36-master.7 → 0.2.0-master.10
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/bulkAccountLoader.d.ts +6 -6
- package/lib/accounts/bulkAccountLoader.js +81 -95
- package/lib/accounts/bulkUserSubscription.js +13 -57
- package/lib/accounts/fetch.d.ts +4 -0
- package/lib/accounts/fetch.js +18 -0
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +34 -38
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +224 -224
- package/lib/accounts/pollingOracleSubscriber.d.ts +3 -3
- package/lib/accounts/pollingOracleSubscriber.js +37 -49
- package/lib/accounts/pollingTokenAccountSubscriber.d.ts +3 -3
- package/lib/accounts/pollingTokenAccountSubscriber.js +35 -50
- package/lib/accounts/pollingUserAccountSubscriber.d.ts +7 -13
- package/lib/accounts/pollingUserAccountSubscriber.js +71 -134
- package/lib/accounts/types.d.ts +34 -41
- package/lib/accounts/webSocketAccountSubscriber.d.ts +6 -4
- package/lib/accounts/webSocketAccountSubscriber.js +39 -35
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +33 -28
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +153 -185
- package/lib/accounts/webSocketUserAccountSubscriber.d.ts +5 -11
- package/lib/accounts/webSocketUserAccountSubscriber.js +22 -67
- package/lib/addresses/marketAddresses.d.ts +4 -0
- package/lib/addresses/marketAddresses.js +15 -0
- package/lib/addresses/pda.d.ts +12 -0
- package/lib/addresses/pda.js +83 -0
- package/lib/admin.d.ts +12 -18
- package/lib/admin.js +398 -558
- package/lib/clearingHouse.d.ts +83 -109
- package/lib/clearingHouse.js +832 -893
- package/lib/clearingHouseConfig.d.ts +34 -0
- package/lib/clearingHouseConfig.js +2 -0
- package/lib/clearingHouseUser.d.ts +19 -22
- package/lib/clearingHouseUser.js +155 -141
- package/lib/clearingHouseUserConfig.d.ts +14 -0
- package/lib/clearingHouseUserConfig.js +2 -0
- package/lib/config.d.ts +12 -0
- package/lib/config.js +35 -4
- package/lib/constants/banks.d.ts +16 -0
- package/lib/constants/banks.js +41 -0
- package/lib/constants/markets.d.ts +8 -3
- package/lib/constants/markets.js +13 -206
- package/lib/constants/numericConstants.d.ts +17 -0
- package/lib/constants/numericConstants.js +23 -6
- package/lib/events/eventList.d.ts +22 -0
- package/lib/events/eventList.js +77 -0
- package/lib/events/eventSubscriber.d.ts +34 -0
- package/lib/events/eventSubscriber.js +126 -0
- package/lib/events/fetchLogs.d.ts +13 -0
- package/lib/events/fetchLogs.js +39 -0
- package/lib/events/pollingLogProvider.d.ts +15 -0
- package/lib/events/pollingLogProvider.js +53 -0
- package/lib/events/sort.d.ts +2 -0
- package/lib/events/sort.js +44 -0
- package/lib/events/txEventCache.d.ts +24 -0
- package/lib/events/txEventCache.js +71 -0
- package/lib/events/types.d.ts +49 -0
- package/lib/events/types.js +20 -0
- package/lib/events/webSocketLogProvider.d.ts +12 -0
- package/lib/events/webSocketLogProvider.js +30 -0
- package/lib/examples/makeTradeExample.js +26 -27
- package/lib/factory/bigNum.d.ts +118 -0
- package/lib/factory/bigNum.js +364 -0
- package/lib/factory/oracleClient.d.ts +1 -2
- package/lib/factory/oracleClient.js +6 -2
- package/lib/idl/clearing_house.json +2258 -2774
- package/lib/index.d.ts +14 -5
- package/lib/index.js +18 -5
- package/lib/math/amm.d.ts +24 -29
- package/lib/math/amm.js +209 -176
- package/lib/math/auction.d.ts +5 -0
- package/lib/math/auction.js +42 -0
- package/lib/math/bankBalance.d.ts +9 -0
- package/lib/math/bankBalance.js +75 -0
- package/lib/math/conversion.d.ts +0 -1
- package/lib/math/conversion.js +1 -5
- package/lib/math/funding.d.ts +6 -6
- package/lib/math/funding.js +158 -175
- package/lib/math/market.d.ts +6 -6
- package/lib/math/market.js +10 -9
- package/lib/math/orders.d.ts +6 -1
- package/lib/math/orders.js +38 -1
- package/lib/math/position.d.ts +7 -5
- package/lib/math/position.js +29 -27
- package/lib/math/repeg.d.ts +22 -0
- package/lib/math/repeg.js +128 -0
- package/lib/math/trade.d.ts +5 -4
- package/lib/math/trade.js +29 -24
- package/lib/mockUSDCFaucet.js +87 -116
- package/lib/oracles/oracleClientCache.d.ts +8 -0
- package/lib/oracles/oracleClientCache.js +19 -0
- package/lib/oracles/pythClient.d.ts +3 -5
- package/lib/oracles/pythClient.js +12 -31
- package/lib/oracles/quoteAssetOracleClient.d.ts +9 -0
- package/lib/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/oracles/switchboardClient.d.ts +3 -5
- package/lib/oracles/switchboardClient.js +29 -50
- package/lib/oracles/types.d.ts +6 -1
- package/lib/orderParams.d.ts +14 -5
- package/lib/orderParams.js +8 -96
- package/lib/orders.d.ts +6 -7
- package/lib/orders.js +11 -89
- package/lib/slot/SlotSubscriber.d.ts +19 -0
- package/lib/slot/SlotSubscriber.js +26 -0
- package/lib/tx/retryTxSender.d.ts +2 -2
- package/lib/tx/retryTxSender.js +108 -123
- package/lib/tx/types.d.ts +5 -1
- package/lib/tx/utils.d.ts +1 -1
- package/lib/tx/utils.js +11 -2
- package/lib/types.d.ts +180 -110
- package/lib/types.js +54 -1
- package/lib/userName.d.ts +4 -0
- package/lib/userName.js +20 -0
- package/lib/util/computeUnits.js +10 -21
- package/lib/util/tps.js +11 -22
- package/lib/wallet.js +7 -20
- package/package.json +11 -4
- package/src/accounts/bulkAccountLoader.js +197 -0
- package/src/accounts/bulkAccountLoader.ts +21 -15
- package/src/accounts/bulkUserSubscription.js +33 -0
- package/src/accounts/bulkUserSubscription.ts +1 -45
- package/src/accounts/fetch.js +29 -0
- package/src/accounts/fetch.ts +33 -0
- package/src/accounts/pollingClearingHouseAccountSubscriber.js +311 -0
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +249 -214
- package/src/accounts/pollingOracleSubscriber.js +93 -0
- package/src/accounts/pollingOracleSubscriber.ts +16 -8
- package/src/accounts/pollingTokenAccountSubscriber.js +90 -0
- package/src/accounts/pollingTokenAccountSubscriber.ts +11 -8
- package/src/accounts/pollingUserAccountSubscriber.js +132 -0
- package/src/accounts/pollingUserAccountSubscriber.ts +21 -86
- package/src/accounts/types.js +10 -0
- package/src/accounts/types.ts +41 -70
- package/src/accounts/utils.js +7 -0
- package/src/accounts/webSocketAccountSubscriber.js +93 -0
- package/src/accounts/webSocketAccountSubscriber.ts +33 -16
- package/src/accounts/webSocketClearingHouseAccountSubscriber.js +233 -0
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +190 -240
- package/src/accounts/webSocketUserAccountSubscriber.js +62 -0
- package/src/accounts/webSocketUserAccountSubscriber.ts +11 -71
- package/src/addresses/marketAddresses.js +26 -0
- package/src/addresses/marketAddresses.ts +18 -0
- package/{lib/addresses.js → src/addresses/pda.js} +45 -34
- package/src/addresses/pda.ts +118 -0
- package/src/admin.ts +247 -336
- package/src/assert/assert.js +9 -0
- package/src/clearingHouse.ts +1023 -1026
- package/src/clearingHouseConfig.ts +37 -0
- package/src/clearingHouseUser.ts +275 -185
- package/src/clearingHouseUserConfig.ts +18 -0
- package/src/config.ts +54 -1
- package/src/constants/banks.ts +50 -0
- package/src/constants/markets.ts +16 -207
- package/src/constants/numericConstants.ts +34 -5
- package/src/events/eventList.js +77 -0
- package/src/events/eventList.ts +94 -0
- package/src/events/eventSubscriber.js +139 -0
- package/src/events/eventSubscriber.ts +194 -0
- package/src/events/fetchLogs.js +50 -0
- package/src/events/fetchLogs.ts +80 -0
- package/src/events/pollingLogProvider.js +64 -0
- package/src/events/pollingLogProvider.ts +79 -0
- package/src/events/sort.js +44 -0
- package/src/events/sort.ts +65 -0
- package/src/events/txEventCache.js +71 -0
- package/src/events/txEventCache.ts +74 -0
- package/src/events/types.js +20 -0
- package/src/events/types.ts +98 -0
- package/src/events/webSocketLogProvider.js +41 -0
- package/src/events/webSocketLogProvider.ts +38 -0
- package/src/examples/makeTradeExample.js +80 -0
- package/src/examples/makeTradeExample.ts +20 -11
- package/src/factory/bigNum.js +364 -0
- package/src/factory/bigNum.ts +524 -0
- package/src/factory/oracleClient.js +20 -0
- package/src/factory/oracleClient.ts +7 -4
- package/src/idl/clearing_house.json +2258 -2774
- package/src/index.js +69 -0
- package/src/index.ts +14 -5
- package/src/math/amm.js +369 -0
- package/src/math/amm.ts +382 -243
- package/src/math/auction.js +42 -0
- package/src/math/auction.ts +43 -0
- package/src/math/bankBalance.js +75 -0
- package/src/math/bankBalance.ts +112 -0
- package/src/math/conversion.js +11 -0
- package/src/math/conversion.ts +1 -11
- package/src/math/funding.js +248 -0
- package/src/math/funding.ts +12 -9
- package/src/math/market.js +57 -0
- package/src/math/market.ts +37 -30
- package/src/math/oracles.js +26 -0
- package/src/math/orders.js +110 -0
- package/src/math/orders.ts +43 -1
- package/src/math/position.js +140 -0
- package/src/math/position.ts +52 -35
- package/src/math/repeg.js +128 -0
- package/src/math/repeg.ts +176 -0
- package/src/math/state.js +15 -0
- package/src/math/trade.js +253 -0
- package/src/math/trade.ts +55 -47
- package/src/math/utils.js +26 -0
- package/src/math/utils.js.map +1 -0
- package/src/mockUSDCFaucet.js +171 -0
- package/src/oracles/oracleClientCache.js +19 -0
- package/src/oracles/oracleClientCache.ts +20 -0
- package/src/oracles/pythClient.js +46 -0
- package/src/oracles/pythClient.ts +4 -11
- package/src/oracles/quoteAssetOracleClient.js +32 -0
- package/src/oracles/quoteAssetOracleClient.ts +25 -0
- package/src/oracles/switchboardClient.js +69 -0
- package/src/oracles/switchboardClient.ts +11 -24
- package/src/oracles/types.js +2 -0
- package/src/oracles/types.ts +7 -1
- package/src/orderParams.js +20 -0
- package/src/orderParams.ts +20 -141
- package/src/orders.js +134 -0
- package/src/orders.ts +25 -134
- package/src/slot/SlotSubscriber.js +39 -0
- package/src/slot/SlotSubscriber.ts +42 -0
- package/src/token/index.js +38 -0
- package/src/tx/retryTxSender.js +188 -0
- package/src/tx/retryTxSender.ts +6 -4
- package/src/tx/types.js +2 -0
- package/src/tx/types.ts +6 -1
- package/src/tx/utils.js +17 -0
- package/src/tx/utils.ts +22 -3
- package/src/types.js +114 -0
- package/src/types.ts +176 -124
- package/src/userName.js +20 -0
- package/src/userName.ts +20 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/src/wallet.js +35 -0
- package/tests/bn/test.ts +255 -0
- package/tsconfig.json +12 -12
- package/lib/addresses.d.ts +0 -10
- package/lib/constants/accounts.d.ts +0 -15
- package/lib/constants/accounts.js +0 -18
- package/lib/factory/clearingHouse.d.ts +0 -35
- package/lib/factory/clearingHouse.js +0 -81
- package/lib/factory/clearingHouseUser.d.ts +0 -19
- package/lib/factory/clearingHouseUser.js +0 -34
- package/lib/math/insuranceFund.d.ts +0 -15
- package/lib/math/insuranceFund.js +0 -33
- package/lib/settlement.d.ts +0 -4
- package/lib/settlement.js +0 -10
- package/lib/tx/defaultTxSender.d.ts +0 -8
- package/lib/tx/defaultTxSender.js +0 -12
- package/src/addresses.ts +0 -82
- package/src/constants/accounts.ts +0 -26
- package/src/factory/clearingHouse.ts +0 -173
- package/src/factory/clearingHouseUser.ts +0 -73
- package/src/math/insuranceFund.ts +0 -29
- package/src/settlement.ts +0 -9
- package/src/tx/defaultTxSender.ts +0 -24
|
@@ -0,0 +1,93 @@
|
|
|
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.PollingOracleSubscriber = void 0;
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
const events_1 = require("events");
|
|
15
|
+
class PollingOracleSubscriber {
|
|
16
|
+
constructor(publicKey, oracleClient, accountLoader) {
|
|
17
|
+
this.isSubscribed = false;
|
|
18
|
+
this.publicKey = publicKey;
|
|
19
|
+
this.oracleClient = oracleClient;
|
|
20
|
+
this.accountLoader = accountLoader;
|
|
21
|
+
this.eventEmitter = new events_1.EventEmitter();
|
|
22
|
+
}
|
|
23
|
+
subscribe() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (this.isSubscribed) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
this.addToAccountLoader();
|
|
29
|
+
let subscriptionSucceeded = false;
|
|
30
|
+
let retries = 0;
|
|
31
|
+
while (!subscriptionSucceeded && retries < 5) {
|
|
32
|
+
yield this.fetch();
|
|
33
|
+
subscriptionSucceeded = this.didSubscriptionSucceed();
|
|
34
|
+
retries++;
|
|
35
|
+
}
|
|
36
|
+
if (subscriptionSucceeded) {
|
|
37
|
+
this.eventEmitter.emit('update');
|
|
38
|
+
}
|
|
39
|
+
this.isSubscribed = subscriptionSucceeded;
|
|
40
|
+
return subscriptionSucceeded;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
addToAccountLoader() {
|
|
44
|
+
if (this.callbackId) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.callbackId = this.accountLoader.addAccount(this.publicKey, (buffer, slot) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const oraclePriceData = yield this.oracleClient.getOraclePriceDataFromBuffer(buffer);
|
|
49
|
+
this.oraclePriceData = { data: oraclePriceData, slot };
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.eventEmitter.emit('oracleUpdate', oraclePriceData);
|
|
52
|
+
this.eventEmitter.emit('update');
|
|
53
|
+
}));
|
|
54
|
+
this.errorCallbackId = this.accountLoader.addErrorCallbacks((error) => {
|
|
55
|
+
this.eventEmitter.emit('error', error);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
fetch() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
yield this.accountLoader.load();
|
|
61
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(this.publicKey);
|
|
62
|
+
this.oraclePriceData = {
|
|
63
|
+
data: yield this.oracleClient.getOraclePriceDataFromBuffer(buffer),
|
|
64
|
+
slot,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
unsubscribe() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
if (!this.isSubscribed) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.accountLoader.removeAccount(this.publicKey, this.callbackId);
|
|
74
|
+
this.callbackId = undefined;
|
|
75
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
76
|
+
this.errorCallbackId = undefined;
|
|
77
|
+
this.isSubscribed = false;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
assertIsSubscribed() {
|
|
81
|
+
if (!this.isSubscribed) {
|
|
82
|
+
throw new types_1.NotSubscribedError('You must call `subscribe` before using this function');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
getOraclePriceData() {
|
|
86
|
+
this.assertIsSubscribed();
|
|
87
|
+
return this.oraclePriceData;
|
|
88
|
+
}
|
|
89
|
+
didSubscriptionSucceed() {
|
|
90
|
+
return !!this.oraclePriceData;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.PollingOracleSubscriber = PollingOracleSubscriber;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DataAndSlot,
|
|
3
|
+
NotSubscribedError,
|
|
4
|
+
OracleEvents,
|
|
5
|
+
OracleSubscriber,
|
|
6
|
+
} from './types';
|
|
2
7
|
import { Program } from '@project-serum/anchor';
|
|
3
8
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
4
9
|
import { EventEmitter } from 'events';
|
|
@@ -17,7 +22,7 @@ export class PollingOracleSubscriber implements OracleSubscriber {
|
|
|
17
22
|
callbackId?: string;
|
|
18
23
|
errorCallbackId?: string;
|
|
19
24
|
|
|
20
|
-
oraclePriceData?: OraclePriceData
|
|
25
|
+
oraclePriceData?: DataAndSlot<OraclePriceData>;
|
|
21
26
|
|
|
22
27
|
public constructor(
|
|
23
28
|
publicKey: PublicKey,
|
|
@@ -61,10 +66,10 @@ export class PollingOracleSubscriber implements OracleSubscriber {
|
|
|
61
66
|
|
|
62
67
|
this.callbackId = this.accountLoader.addAccount(
|
|
63
68
|
this.publicKey,
|
|
64
|
-
async (buffer) => {
|
|
69
|
+
async (buffer, slot) => {
|
|
65
70
|
const oraclePriceData =
|
|
66
71
|
await this.oracleClient.getOraclePriceDataFromBuffer(buffer);
|
|
67
|
-
this.oraclePriceData = oraclePriceData;
|
|
72
|
+
this.oraclePriceData = { data: oraclePriceData, slot };
|
|
68
73
|
// @ts-ignore
|
|
69
74
|
this.eventEmitter.emit('oracleUpdate', oraclePriceData);
|
|
70
75
|
this.eventEmitter.emit('update');
|
|
@@ -78,10 +83,13 @@ export class PollingOracleSubscriber implements OracleSubscriber {
|
|
|
78
83
|
|
|
79
84
|
async fetch(): Promise<void> {
|
|
80
85
|
await this.accountLoader.load();
|
|
81
|
-
const buffer = this.accountLoader.
|
|
82
|
-
|
|
83
|
-
buffer
|
|
86
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(
|
|
87
|
+
this.publicKey
|
|
84
88
|
);
|
|
89
|
+
this.oraclePriceData = {
|
|
90
|
+
data: await this.oracleClient.getOraclePriceDataFromBuffer(buffer),
|
|
91
|
+
slot,
|
|
92
|
+
};
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
async unsubscribe(): Promise<void> {
|
|
@@ -106,7 +114,7 @@ export class PollingOracleSubscriber implements OracleSubscriber {
|
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
|
|
109
|
-
public getOraclePriceData(): OraclePriceData {
|
|
117
|
+
public getOraclePriceData(): DataAndSlot<OraclePriceData> {
|
|
110
118
|
this.assertIsSubscribed();
|
|
111
119
|
return this.oraclePriceData;
|
|
112
120
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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.PollingTokenAccountSubscriber = void 0;
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
const events_1 = require("events");
|
|
15
|
+
const token_1 = require("../token");
|
|
16
|
+
class PollingTokenAccountSubscriber {
|
|
17
|
+
constructor(publicKey, accountLoader) {
|
|
18
|
+
this.isSubscribed = false;
|
|
19
|
+
this.publicKey = publicKey;
|
|
20
|
+
this.accountLoader = accountLoader;
|
|
21
|
+
this.eventEmitter = new events_1.EventEmitter();
|
|
22
|
+
}
|
|
23
|
+
subscribe() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (this.isSubscribed) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
this.addToAccountLoader();
|
|
29
|
+
let subscriptionSucceeded = false;
|
|
30
|
+
let retries = 0;
|
|
31
|
+
while (!subscriptionSucceeded && retries < 5) {
|
|
32
|
+
yield this.fetch();
|
|
33
|
+
subscriptionSucceeded = this.didSubscriptionSucceed();
|
|
34
|
+
retries++;
|
|
35
|
+
}
|
|
36
|
+
if (subscriptionSucceeded) {
|
|
37
|
+
this.eventEmitter.emit('update');
|
|
38
|
+
}
|
|
39
|
+
this.isSubscribed = subscriptionSucceeded;
|
|
40
|
+
return subscriptionSucceeded;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
addToAccountLoader() {
|
|
44
|
+
if (this.callbackId) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.callbackId = this.accountLoader.addAccount(this.publicKey, (buffer, slot) => {
|
|
48
|
+
const tokenAccount = token_1.parseTokenAccount(buffer);
|
|
49
|
+
this.tokenAccountAndSlot = { data: tokenAccount, slot };
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.eventEmitter.emit('tokenAccountUpdate', tokenAccount);
|
|
52
|
+
this.eventEmitter.emit('update');
|
|
53
|
+
});
|
|
54
|
+
this.errorCallbackId = this.accountLoader.addErrorCallbacks((error) => {
|
|
55
|
+
this.eventEmitter.emit('error', error);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
fetch() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
yield this.accountLoader.load();
|
|
61
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(this.publicKey);
|
|
62
|
+
this.tokenAccountAndSlot = { data: token_1.parseTokenAccount(buffer), slot };
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
unsubscribe() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (!this.isSubscribed) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.accountLoader.removeAccount(this.publicKey, this.callbackId);
|
|
71
|
+
this.callbackId = undefined;
|
|
72
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
73
|
+
this.errorCallbackId = undefined;
|
|
74
|
+
this.isSubscribed = false;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
assertIsSubscribed() {
|
|
78
|
+
if (!this.isSubscribed) {
|
|
79
|
+
throw new types_1.NotSubscribedError('You must call `subscribe` before using this function');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
getTokenAccountAndSlot() {
|
|
83
|
+
this.assertIsSubscribed();
|
|
84
|
+
return this.tokenAccountAndSlot;
|
|
85
|
+
}
|
|
86
|
+
didSubscriptionSucceed() {
|
|
87
|
+
return !!this.tokenAccountAndSlot;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.PollingTokenAccountSubscriber = PollingTokenAccountSubscriber;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DataAndSlot,
|
|
2
3
|
NotSubscribedError,
|
|
3
4
|
TokenAccountEvents,
|
|
4
5
|
TokenAccountSubscriber,
|
|
@@ -21,7 +22,7 @@ export class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
|
21
22
|
callbackId?: string;
|
|
22
23
|
errorCallbackId?: string;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
tokenAccountAndSlot?: DataAndSlot<AccountInfo>;
|
|
25
26
|
|
|
26
27
|
public constructor(publicKey: PublicKey, accountLoader: BulkAccountLoader) {
|
|
27
28
|
this.isSubscribed = false;
|
|
@@ -59,9 +60,9 @@ export class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
|
59
60
|
|
|
60
61
|
this.callbackId = this.accountLoader.addAccount(
|
|
61
62
|
this.publicKey,
|
|
62
|
-
(buffer) => {
|
|
63
|
+
(buffer, slot: number) => {
|
|
63
64
|
const tokenAccount = parseTokenAccount(buffer);
|
|
64
|
-
this.
|
|
65
|
+
this.tokenAccountAndSlot = { data: tokenAccount, slot };
|
|
65
66
|
// @ts-ignore
|
|
66
67
|
this.eventEmitter.emit('tokenAccountUpdate', tokenAccount);
|
|
67
68
|
this.eventEmitter.emit('update');
|
|
@@ -75,8 +76,10 @@ export class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
|
75
76
|
|
|
76
77
|
async fetch(): Promise<void> {
|
|
77
78
|
await this.accountLoader.load();
|
|
78
|
-
const buffer = this.accountLoader.
|
|
79
|
-
|
|
79
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(
|
|
80
|
+
this.publicKey
|
|
81
|
+
);
|
|
82
|
+
this.tokenAccountAndSlot = { data: parseTokenAccount(buffer), slot };
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
async unsubscribe(): Promise<void> {
|
|
@@ -101,12 +104,12 @@ export class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
public
|
|
107
|
+
public getTokenAccountAndSlot(): DataAndSlot<AccountInfo> {
|
|
105
108
|
this.assertIsSubscribed();
|
|
106
|
-
return this.
|
|
109
|
+
return this.tokenAccountAndSlot;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
didSubscriptionSucceed(): boolean {
|
|
110
|
-
return !!this.
|
|
113
|
+
return !!this.tokenAccountAndSlot;
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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.PollingUserAccountSubscriber = void 0;
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
const events_1 = require("events");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
class PollingUserAccountSubscriber {
|
|
17
|
+
constructor(program, userAccountPublicKey, accountLoader) {
|
|
18
|
+
this.accountsToPoll = new Map();
|
|
19
|
+
this.isSubscribed = false;
|
|
20
|
+
this.program = program;
|
|
21
|
+
this.accountLoader = accountLoader;
|
|
22
|
+
this.eventEmitter = new events_1.EventEmitter();
|
|
23
|
+
this.userAccountPublicKey = userAccountPublicKey;
|
|
24
|
+
}
|
|
25
|
+
subscribe() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (this.isSubscribed) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
yield this.addToAccountLoader();
|
|
31
|
+
let subscriptionSucceeded = false;
|
|
32
|
+
let retries = 0;
|
|
33
|
+
while (!subscriptionSucceeded && retries < 5) {
|
|
34
|
+
yield this.fetchIfUnloaded();
|
|
35
|
+
subscriptionSucceeded = this.didSubscriptionSucceed();
|
|
36
|
+
retries++;
|
|
37
|
+
}
|
|
38
|
+
if (subscriptionSucceeded) {
|
|
39
|
+
this.eventEmitter.emit('update');
|
|
40
|
+
}
|
|
41
|
+
this.isSubscribed = subscriptionSucceeded;
|
|
42
|
+
return subscriptionSucceeded;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
addToAccountLoader() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
if (this.accountsToPoll.size > 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.accountsToPoll.set(this.userAccountPublicKey.toString(), {
|
|
51
|
+
key: 'user',
|
|
52
|
+
publicKey: this.userAccountPublicKey,
|
|
53
|
+
eventType: 'userAccountUpdate',
|
|
54
|
+
});
|
|
55
|
+
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
56
|
+
accountToPoll.callbackId = this.accountLoader.addAccount(accountToPoll.publicKey, (buffer, slot) => {
|
|
57
|
+
if (!buffer) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const account = this.program.account[accountToPoll.key].coder.accounts.decode(utils_1.capitalize(accountToPoll.key), buffer);
|
|
61
|
+
this[accountToPoll.key] = { data: account, slot };
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
this.eventEmitter.emit(accountToPoll.eventType, account);
|
|
64
|
+
this.eventEmitter.emit('update');
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
this.errorCallbackId = this.accountLoader.addErrorCallbacks((error) => {
|
|
68
|
+
this.eventEmitter.emit('error', error);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
fetchIfUnloaded() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
let shouldFetch = false;
|
|
75
|
+
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
76
|
+
if (this[accountToPoll.key] === undefined) {
|
|
77
|
+
shouldFetch = true;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (shouldFetch) {
|
|
82
|
+
yield this.fetch();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
fetch() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
yield this.accountLoader.load();
|
|
89
|
+
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
90
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(accountToPoll.publicKey);
|
|
91
|
+
if (buffer) {
|
|
92
|
+
const account = this.program.account[accountToPoll.key].coder.accounts.decode(utils_1.capitalize(accountToPoll.key), buffer);
|
|
93
|
+
this[accountToPoll.key] = { data: account, slot };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
didSubscriptionSucceed() {
|
|
99
|
+
let success = true;
|
|
100
|
+
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
101
|
+
if (!this[accountToPoll.key]) {
|
|
102
|
+
success = false;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return success;
|
|
107
|
+
}
|
|
108
|
+
unsubscribe() {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
if (!this.isSubscribed) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
114
|
+
this.accountLoader.removeAccount(accountToPoll.publicKey, accountToPoll.callbackId);
|
|
115
|
+
}
|
|
116
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
117
|
+
this.errorCallbackId = undefined;
|
|
118
|
+
this.accountsToPoll.clear();
|
|
119
|
+
this.isSubscribed = false;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
assertIsSubscribed() {
|
|
123
|
+
if (!this.isSubscribed) {
|
|
124
|
+
throw new types_1.NotSubscribedError('You must call `subscribe` before using this function');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
getUserAccountAndSlot() {
|
|
128
|
+
this.assertIsSubscribed();
|
|
129
|
+
return this.user;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.PollingUserAccountSubscriber = PollingUserAccountSubscriber;
|
|
@@ -1,49 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DataAndSlot,
|
|
2
3
|
AccountToPoll,
|
|
3
4
|
NotSubscribedError,
|
|
4
5
|
UserAccountEvents,
|
|
5
6
|
UserAccountSubscriber,
|
|
6
|
-
UserPublicKeys,
|
|
7
7
|
} from './types';
|
|
8
8
|
import { Program } from '@project-serum/anchor';
|
|
9
9
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
10
10
|
import { EventEmitter } from 'events';
|
|
11
11
|
import { PublicKey } from '@solana/web3.js';
|
|
12
|
-
import {
|
|
13
|
-
getUserAccountPublicKey,
|
|
14
|
-
getUserOrdersAccountPublicKey,
|
|
15
|
-
} from '../addresses';
|
|
16
|
-
import { UserAccount, UserOrdersAccount, UserPositionsAccount } from '../types';
|
|
12
|
+
import { UserAccount } from '../types';
|
|
17
13
|
import { BulkAccountLoader } from './bulkAccountLoader';
|
|
18
14
|
import { capitalize } from './utils';
|
|
19
|
-
import { ClearingHouseConfigType } from '../factory/clearingHouse';
|
|
20
15
|
|
|
21
16
|
export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
22
17
|
isSubscribed: boolean;
|
|
23
18
|
program: Program;
|
|
24
19
|
eventEmitter: StrictEventEmitter<EventEmitter, UserAccountEvents>;
|
|
25
|
-
|
|
20
|
+
userAccountPublicKey: PublicKey;
|
|
26
21
|
|
|
27
22
|
accountLoader: BulkAccountLoader;
|
|
28
23
|
accountsToPoll = new Map<string, AccountToPoll>();
|
|
29
24
|
errorCallbackId?: string;
|
|
30
25
|
|
|
31
|
-
user?: UserAccount
|
|
32
|
-
userPositions?: UserPositionsAccount;
|
|
33
|
-
userOrders?: UserOrdersAccount;
|
|
34
|
-
|
|
35
|
-
type: ClearingHouseConfigType = 'polling';
|
|
26
|
+
user?: DataAndSlot<UserAccount>;
|
|
36
27
|
|
|
37
28
|
public constructor(
|
|
38
29
|
program: Program,
|
|
39
|
-
|
|
30
|
+
userAccountPublicKey: PublicKey,
|
|
40
31
|
accountLoader: BulkAccountLoader
|
|
41
32
|
) {
|
|
42
33
|
this.isSubscribed = false;
|
|
43
34
|
this.program = program;
|
|
44
|
-
this.authority = authority;
|
|
45
35
|
this.accountLoader = accountLoader;
|
|
46
36
|
this.eventEmitter = new EventEmitter();
|
|
37
|
+
this.userAccountPublicKey = userAccountPublicKey;
|
|
47
38
|
}
|
|
48
39
|
|
|
49
40
|
async subscribe(): Promise<boolean> {
|
|
@@ -69,69 +60,21 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
69
60
|
return subscriptionSucceeded;
|
|
70
61
|
}
|
|
71
62
|
|
|
72
|
-
async addToAccountLoader(
|
|
63
|
+
async addToAccountLoader(): Promise<void> {
|
|
73
64
|
if (this.accountsToPoll.size > 0) {
|
|
74
65
|
return;
|
|
75
66
|
}
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const userAccount = (await this.program.account.user.fetch(
|
|
84
|
-
userPublicKey
|
|
85
|
-
)) as UserAccount;
|
|
86
|
-
|
|
87
|
-
this.accountsToPoll.set(userPublicKey.toString(), {
|
|
88
|
-
key: 'user',
|
|
89
|
-
publicKey: userPublicKey,
|
|
90
|
-
eventType: 'userAccountData',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this.accountsToPoll.set(userAccount.positions.toString(), {
|
|
94
|
-
key: 'userPositions',
|
|
95
|
-
publicKey: userAccount.positions,
|
|
96
|
-
eventType: 'userPositionsData',
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const userOrdersPublicKey = await getUserOrdersAccountPublicKey(
|
|
100
|
-
this.program.programId,
|
|
101
|
-
userPublicKey
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
this.accountsToPoll.set(userOrdersPublicKey.toString(), {
|
|
105
|
-
key: 'userOrders',
|
|
106
|
-
publicKey: userOrdersPublicKey,
|
|
107
|
-
eventType: 'userOrdersData',
|
|
108
|
-
});
|
|
109
|
-
} else {
|
|
110
|
-
this.accountsToPoll.set(userPublicKeys.user.toString(), {
|
|
111
|
-
key: 'user',
|
|
112
|
-
publicKey: userPublicKeys.user,
|
|
113
|
-
eventType: 'userAccountData',
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this.accountsToPoll.set(userPublicKeys.userPositions.toString(), {
|
|
117
|
-
key: 'userPositions',
|
|
118
|
-
publicKey: userPublicKeys.userPositions,
|
|
119
|
-
eventType: 'userPositionsData',
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
if (userPublicKeys.userOrders) {
|
|
123
|
-
this.accountsToPoll.set(userPublicKeys.userOrders.toString(), {
|
|
124
|
-
key: 'userOrders',
|
|
125
|
-
publicKey: userPublicKeys.userOrders,
|
|
126
|
-
eventType: 'userOrdersData',
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
68
|
+
this.accountsToPoll.set(this.userAccountPublicKey.toString(), {
|
|
69
|
+
key: 'user',
|
|
70
|
+
publicKey: this.userAccountPublicKey,
|
|
71
|
+
eventType: 'userAccountUpdate',
|
|
72
|
+
});
|
|
130
73
|
|
|
131
74
|
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
132
75
|
accountToPoll.callbackId = this.accountLoader.addAccount(
|
|
133
76
|
accountToPoll.publicKey,
|
|
134
|
-
(buffer) => {
|
|
77
|
+
(buffer, slot) => {
|
|
135
78
|
if (!buffer) {
|
|
136
79
|
return;
|
|
137
80
|
}
|
|
@@ -139,7 +82,7 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
139
82
|
const account = this.program.account[
|
|
140
83
|
accountToPoll.key
|
|
141
84
|
].coder.accounts.decode(capitalize(accountToPoll.key), buffer);
|
|
142
|
-
this[accountToPoll.key] = account;
|
|
85
|
+
this[accountToPoll.key] = { data: account, slot };
|
|
143
86
|
// @ts-ignore
|
|
144
87
|
this.eventEmitter.emit(accountToPoll.eventType, account);
|
|
145
88
|
this.eventEmitter.emit('update');
|
|
@@ -169,11 +112,14 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
169
112
|
async fetch(): Promise<void> {
|
|
170
113
|
await this.accountLoader.load();
|
|
171
114
|
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
172
|
-
const buffer = this.accountLoader.
|
|
115
|
+
const { buffer, slot } = this.accountLoader.getBufferAndSlot(
|
|
116
|
+
accountToPoll.publicKey
|
|
117
|
+
);
|
|
173
118
|
if (buffer) {
|
|
174
|
-
|
|
119
|
+
const account = this.program.account[
|
|
175
120
|
accountToPoll.key
|
|
176
121
|
].coder.accounts.decode(capitalize(accountToPoll.key), buffer);
|
|
122
|
+
this[accountToPoll.key] = { data: account, slot };
|
|
177
123
|
}
|
|
178
124
|
}
|
|
179
125
|
}
|
|
@@ -181,8 +127,7 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
181
127
|
didSubscriptionSucceed(): boolean {
|
|
182
128
|
let success = true;
|
|
183
129
|
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
184
|
-
|
|
185
|
-
if (accountToPoll.key !== 'userOrders' && !this[accountToPoll.key]) {
|
|
130
|
+
if (!this[accountToPoll.key]) {
|
|
186
131
|
success = false;
|
|
187
132
|
break;
|
|
188
133
|
}
|
|
@@ -218,18 +163,8 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
218
163
|
}
|
|
219
164
|
}
|
|
220
165
|
|
|
221
|
-
public
|
|
166
|
+
public getUserAccountAndSlot(): DataAndSlot<UserAccount> {
|
|
222
167
|
this.assertIsSubscribed();
|
|
223
168
|
return this.user;
|
|
224
169
|
}
|
|
225
|
-
|
|
226
|
-
public getUserPositionsAccount(): UserPositionsAccount {
|
|
227
|
-
this.assertIsSubscribed();
|
|
228
|
-
return this.userPositions;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
public getUserOrdersAccount(): UserOrdersAccount {
|
|
232
|
-
this.assertIsSubscribed();
|
|
233
|
-
return this.userOrders;
|
|
234
|
-
}
|
|
235
170
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotSubscribedError = void 0;
|
|
4
|
+
class NotSubscribedError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.name = 'NotSubscribedError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.NotSubscribedError = NotSubscribedError;
|