@haven-fi/solauto-sdk 1.0.354 → 1.0.355

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.
@@ -7,7 +7,6 @@ export interface ReferralStateManagerArgs {
7
7
  signer?: Signer;
8
8
  wallet?: WalletAdapter;
9
9
  authority?: PublicKey;
10
- referralState?: PublicKey;
11
10
  referredByAuthority?: PublicKey;
12
11
  }
13
12
  export declare class ReferralStateManager extends TxHandler {
@@ -1 +1 @@
1
- {"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAC1C,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,MAAM,CAAC;IAEhB,aAAa,EAAG,SAAS,CAAC;IAC1B,iBAAiB,EAAG,aAAa,GAAG,IAAI,CAAC;IACzC,SAAS,EAAG,SAAS,CAAC;IAEtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,eAAe,CAAC,EAAE,SAAS,CAAC;IAE7B,UAAU,CAAC,IAAI,EAAE,wBAAwB;IA6B/C,mBAAmB,IAAI,MAAM,E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EACxB,WAAW,CAAC,EAAE,SAAS,GACtB,kBAAkB;IAerB,mBAAmB,IAAI,kBAAkB;IA0BnC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
@@ -19,14 +19,11 @@ class ReferralStateManager extends txHandler_1.TxHandler {
19
19
  ? (0, umi_1.signerIdentity)(args.signer, true)
20
20
  : (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
21
21
  this.signer = this.umi.identity;
22
- this.referralState = args.referralState
23
- ? args.referralState
24
- : (0, utils_1.getReferralState)(args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.programId);
22
+ this.authority = args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
23
+ this.referralState = (0, utils_1.getReferralState)(this.authority, this.programId);
25
24
  this.referralStateData = await (0, generated_1.safeFetchReferralState)(this.umi, (0, umi_1.publicKey)(this.referralState), { commitment: "confirmed" });
26
- this.authority = this.referralStateData
27
- ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.authority)
28
- : (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
29
25
  this.setReferredBy(args.referredByAuthority);
26
+ this.log("Referral state:", this.referralState);
30
27
  }
31
28
  defaultLookupTables() {
32
29
  return this.referralStateData?.lookupTable &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.354",
3
+ "version": "1.0.355",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -26,7 +26,6 @@ export interface ReferralStateManagerArgs {
26
26
  signer?: Signer;
27
27
  wallet?: WalletAdapter;
28
28
  authority?: PublicKey;
29
- referralState?: PublicKey;
30
29
  referredByAuthority?: PublicKey;
31
30
  }
32
31
 
@@ -51,23 +50,18 @@ export class ReferralStateManager extends TxHandler {
51
50
  : walletAdapterIdentity(args.wallet!, true)
52
51
  );
53
52
  this.signer = this.umi.identity;
53
+ this.authority = args.authority ?? toWeb3JsPublicKey(this.signer.publicKey);
54
+
55
+ this.referralState = getReferralState(this.authority, this.programId);
54
56
 
55
- this.referralState = args.referralState
56
- ? args.referralState
57
- : getReferralState(
58
- args.authority ?? toWeb3JsPublicKey(this.signer.publicKey),
59
- this.programId
60
- );
61
57
  this.referralStateData = await safeFetchReferralState(
62
58
  this.umi,
63
59
  publicKey(this.referralState),
64
60
  { commitment: "confirmed" }
65
61
  );
66
- this.authority = this.referralStateData
67
- ? toWeb3JsPublicKey(this.referralStateData.authority)
68
- : toWeb3JsPublicKey(this.signer.publicKey);
69
62
 
70
63
  this.setReferredBy(args.referredByAuthority);
64
+ this.log("Referral state:", this.referralState);
71
65
  }
72
66
 
73
67
  defaultLookupTables(): string[] {