@reflectmoney/stable.ts 2.8.2 → 2.8.3

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.
@@ -32,7 +32,8 @@ export declare class UsdcPlusStablecoin extends Stablecoin<DriftUsdcController>
32
32
  * @returns Promise resolving to an array of TransactionInstruction objects
33
33
  */
34
34
  initialize(signer: PublicKey, mint: PublicKey, cap: BN, recipientAddresses: PublicKey[], recipientCuts: number[]): Promise<TransactionInstruction[]>;
35
- initializeDriftClient(): void;
35
+ initializePollingDriftClient(): void;
36
+ initializeWebsocketDriftClient(): void;
36
37
  /**
37
38
  * Initializes the stablecoin drift account for the USDC+ controller.
38
39
  *
@@ -51,8 +51,10 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
51
51
  // Otherwise has to be loaded first.
52
52
  if (stablecoinMintOverride)
53
53
  this.stablecoinMint = stablecoinMintOverride;
54
+ // Unless explicitly told to skip, default to polling Drift client.
55
+ // This may be skipped, and custom drift client initialization may be handled with `initializePollingDriftClient` or `initializeWebsocketDriftClient`.
54
56
  if (!skipInitializeDriftClient) {
55
- this.initializeDriftClient();
57
+ this.initializePollingDriftClient();
56
58
  }
57
59
  }
58
60
  /**
@@ -110,7 +112,7 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
110
112
  return [ix];
111
113
  });
112
114
  }
113
- initializeDriftClient() {
115
+ initializePollingDriftClient() {
114
116
  this.driftClient = new sdk_2.DriftClient({
115
117
  connection: this.connection,
116
118
  env: this.devnet ? "devnet" : "mainnet-beta",
@@ -122,6 +124,17 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
122
124
  },
123
125
  });
124
126
  }
127
+ initializeWebsocketDriftClient() {
128
+ this.driftClient = new sdk_2.DriftClient({
129
+ connection: this.connection,
130
+ env: this.devnet ? "devnet" : "mainnet-beta",
131
+ wallet: new nodewallet_1.default(web3_js_1.Keypair.generate()),
132
+ authority: this.controllerKey,
133
+ accountSubscription: {
134
+ type: "websocket",
135
+ },
136
+ });
137
+ }
125
138
  /**
126
139
  * Initializes the stablecoin drift account for the USDC+ controller.
127
140
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reflectmoney/stable.ts",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "type": "commonjs",
5
5
  "author": "stablecoinjesus @ Palindrome Engineering",
6
6
  "repository": {