@reflectmoney/stable.ts 1.0.4 → 1.0.5

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.
@@ -1,7 +1,7 @@
1
1
  import { AccountMeta, Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
2
  import BN from "bn.js";
3
3
  import { DriftClient } from "@drift-labs/sdk";
4
- import { Action } from "../generated/reflect_main";
4
+ import { Action, Strategy } from "../generated/reflect_main";
5
5
  import { StablecoinMetadata, Collateral } from "../types";
6
6
  /**
7
7
  * Abstract base class for all stablecoin implementations in the Reflect protocol.
@@ -22,6 +22,8 @@ export declare abstract class Stablecoin {
22
22
  connection: Connection;
23
23
  /** Public key of the controller account for this stablecoin */
24
24
  controller: PublicKey;
25
+ /** Public key of the controller account for this stablecoin */
26
+ strategy: Strategy;
25
27
  /** Array of collateral assets backing this stablecoin */
26
28
  collaterals: Collateral[];
27
29
  /** Public key of the stablecoin mint */
@@ -59,8 +59,8 @@ class LstStablecoin extends Stablecoin_1.Stablecoin {
59
59
  */
60
60
  load(connection) {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
- const { lsts, baseStrategy: { mint } } = yield reflect_main_1.DriftLstController.fromAccountAddress(connection, this.controller);
63
- this.stablecoinMint = mint;
62
+ const { lsts, baseStrategy, } = yield reflect_main_1.DriftLstController.fromAccountAddress(connection, this.controller);
63
+ this.stablecoinMint = baseStrategy.mint;
64
64
  this.lstMap = lsts;
65
65
  this.collaterals = lsts.map(({ marketIndex }) => {
66
66
  var _a;
@@ -68,6 +68,7 @@ class LstStablecoin extends Stablecoin_1.Stablecoin {
68
68
  .find(({ marketIndex: index }) => index === marketIndex);
69
69
  return { mint: market === null || market === void 0 ? void 0 : market.mint, oracle: ((_a = market === null || market === void 0 ? void 0 : market.oracle) === null || _a === void 0 ? void 0 : _a.toBase58()) || "" };
70
70
  });
71
+ this.strategy = baseStrategy;
71
72
  });
72
73
  }
73
74
  /**
@@ -14,6 +14,7 @@ export declare class UsdcPlusStablecoin extends Stablecoin {
14
14
  * @param stablecoinMintOverride - Optional override for the stablecoin mint address
15
15
  */
16
16
  constructor(connection: Connection, stablecoinMintOverride?: PublicKey);
17
+ load(): Promise<void>;
17
18
  /**
18
19
  * Initializes the USDC stablecoin with the specified parameters.
19
20
  * Creates receipt tokens, initializes vault, and initializes the stablecoin.
@@ -40,6 +40,13 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
40
40
  if (stablecoinMintOverride)
41
41
  this.stablecoinMint = stablecoinMintOverride;
42
42
  }
43
+ load() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { baseStrategy, } = yield reflect_main_1.DriftUsdcController.fromAccountAddress(this.connection, this.controller);
46
+ this.stablecoinMint = baseStrategy.mint;
47
+ this.strategy = baseStrategy;
48
+ });
49
+ }
43
50
  /**
44
51
  * Initializes the USDC stablecoin with the specified parameters.
45
52
  * Creates receipt tokens, initializes vault, and initializes the stablecoin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reflectmoney/stable.ts",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "author": "stablecoinjesus @ Palindrome Engineering",
6
6
  "repository": {