@haven-fi/solauto-sdk 1.0.223 → 1.0.225

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,9 +14,9 @@ export declare class ReferralStateManager extends TxHandler {
14
14
  localTest?: boolean | undefined;
15
15
  umi: Umi;
16
16
  signer: Signer;
17
- authority: PublicKey;
18
17
  referralState: PublicKey;
19
18
  referralStateData: ReferralState | null;
19
+ authority: PublicKey;
20
20
  referredBy?: PublicKey;
21
21
  referredByState?: PublicKey;
22
22
  constructor(rpcUrl: string, localTest?: boolean | undefined);
@@ -24,7 +24,7 @@ export declare class ReferralStateManager extends TxHandler {
24
24
  defaultLookupTables(): string[];
25
25
  setReferredBy(referredBy?: PublicKey): void;
26
26
  updateReferralStatesIx(destFeesMint?: PublicKey, lookupTable?: PublicKey): TransactionBuilder;
27
- claimReferralFeesIx(destFeesMint?: PublicKey): TransactionBuilder;
27
+ claimReferralFeesIx(): TransactionBuilder;
28
28
  resetLiveTxUpdates(success?: boolean): Promise<void>;
29
29
  }
30
30
  //# sourceMappingURL=referralStateManager.d.ts.map
@@ -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,EAGL,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;A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EAAE,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAaxC,SAAS,CAAC,EAAE,OAAO;IAZrB,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;gBAGjC,MAAM,EAAE,MAAM,EACP,SAAS,CAAC,EAAE,OAAO,YAAA;IAUtB,UAAU,CAAC,IAAI,EAAE,wBAAwB;IA4B/C,mBAAmB,IAAI,MAAM,EAAE;IAS/B,aAAa,CAAC,UAAU,CAAC,EAAE,SAAS;IAmBpC,sBAAsB,CACpB,YAAY,CAAC,EAAE,SAAS,EACxB,WAAW,CAAC,EAAE,SAAS,GACtB,kBAAkB;IAerB,mBAAmB,IAAI,kBAAkB;IA+BnC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
@@ -28,11 +28,13 @@ class ReferralStateManager extends txHandler_1.TxHandler {
28
28
  ? (0, umi_1.signerIdentity)(args.signer)
29
29
  : (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
30
30
  this.signer = this.umi.identity;
31
- this.authority = args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
32
31
  this.referralState = args.referralState
33
32
  ? args.referralState
34
33
  : (0, utils_1.getReferralState)(args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey));
35
34
  this.referralStateData = await (0, generated_1.safeFetchReferralState)(this.umi, (0, umi_1.publicKey)(this.referralState), { commitment: "confirmed" });
35
+ this.authority = this.referralStateData
36
+ ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.authority)
37
+ : (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
36
38
  this.setReferredBy(args.referredByAuthority);
37
39
  }
38
40
  defaultLookupTables() {
@@ -70,11 +72,11 @@ class ReferralStateManager extends txHandler_1.TxHandler {
70
72
  addressLookupTable: lookupTable ? (0, umi_1.publicKey)(lookupTable) : null,
71
73
  });
72
74
  }
73
- claimReferralFeesIx(destFeesMint) {
74
- const referralFeesDestMint = destFeesMint ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.destFeesMint);
75
+ claimReferralFeesIx() {
76
+ const referralFeesDestMint = (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.destFeesMint);
75
77
  const referralDestTa = (0, utils_1.getTokenAccount)(this.referralState, referralFeesDestMint);
76
78
  const feesDestinationTa = referralFeesDestMint !== spl_token_1.NATIVE_MINT
77
- ? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), referralFeesDestMint))
79
+ ? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, referralFeesDestMint))
78
80
  : undefined;
79
81
  return (0, generated_1.claimReferralFees)(this.umi, {
80
82
  signer: this.signer,
@@ -21,7 +21,7 @@ class LookupTables {
21
21
  const currentCacheAddresses = this.cache.map((x) => x.publicKey.toString());
22
22
  const missingAddresses = addresses.filter((x) => !currentCacheAddresses.includes(x));
23
23
  if (missingAddresses) {
24
- const additionalInputs = await (0, solanaUtils_1.getAdressLookupInputs)(this.umi, missingAddresses);
24
+ const additionalInputs = await (0, solanaUtils_1.getAddressLookupInputs)(this.umi, missingAddresses);
25
25
  this.cache.push(...additionalInputs);
26
26
  }
27
27
  return this.cache;
@@ -11,7 +11,7 @@ export declare function createAssociatedTokenAccountUmiIx(signer: Signer, wallet
11
11
  export declare function systemTransferUmiIx(signer: Signer, destination: PublicKey, lamports: bigint): WrappedInstruction;
12
12
  export declare function closeTokenAccountUmiIx(signer: Signer, tokenAccount: PublicKey, authority: PublicKey): WrappedInstruction;
13
13
  export declare function splTokenTransferUmiIx(signer: Signer, fromTa: PublicKey, toTa: PublicKey, authority: PublicKey, amount: bigint): WrappedInstruction;
14
- export declare function getAdressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
14
+ export declare function getAddressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
15
15
  export declare function assembleFinalTransaction(signer: Signer, tx: TransactionBuilder, computeUnitPrice: number, computeUnitLimit?: number): TransactionBuilder;
16
16
  export declare function getComputeUnitPriceEstimate(umi: Umi, tx: TransactionBuilder, prioritySetting: PriorityFeeSetting): Promise<number | undefined>;
17
17
  export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, txType?: TransactionRunType, attemptNum?: number, prioritySetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<Uint8Array | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,UAAU,EACV,SAAS,EAIT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,UAE3D;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,GACb,CAAC,UAAU,EAAE,GAAG,CAAC,CAInB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EA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AAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAKpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAKpB;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,kBAAkB,EACtB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,sBA4D1B;AAmBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAED,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,GAAE,kBAA+C,EAChE,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAmEjC"}
@@ -13,7 +13,7 @@ exports.createAssociatedTokenAccountUmiIx = createAssociatedTokenAccountUmiIx;
13
13
  exports.systemTransferUmiIx = systemTransferUmiIx;
14
14
  exports.closeTokenAccountUmiIx = closeTokenAccountUmiIx;
15
15
  exports.splTokenTransferUmiIx = splTokenTransferUmiIx;
16
- exports.getAdressLookupInputs = getAdressLookupInputs;
16
+ exports.getAddressLookupInputs = getAddressLookupInputs;
17
17
  exports.assembleFinalTransaction = assembleFinalTransaction;
18
18
  exports.getComputeUnitPriceEstimate = getComputeUnitPriceEstimate;
19
19
  exports.sendSingleOptimizedTransaction = sendSingleOptimizedTransaction;
@@ -71,7 +71,7 @@ function closeTokenAccountUmiIx(signer, tokenAccount, authority) {
71
71
  function splTokenTransferUmiIx(signer, fromTa, toTa, authority, amount) {
72
72
  return getWrappedInstruction(signer, (0, spl_token_1.createTransferInstruction)(fromTa, toTa, authority, amount));
73
73
  }
74
- async function getAdressLookupInputs(umi, lookupTableAddresses) {
74
+ async function getAddressLookupInputs(umi, lookupTableAddresses) {
75
75
  const addressLookupTableAccountInfos = await umi.rpc.getAccounts(lookupTableAddresses.map((key) => (0, umi_1.publicKey)(key)));
76
76
  return addressLookupTableAccountInfos.reduce((acc, accountInfo, index) => {
77
77
  const addressLookupTableAddress = lookupTableAddresses[index];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.223",
3
+ "version": "1.0.225",
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",
@@ -35,9 +35,9 @@ export class ReferralStateManager extends TxHandler {
35
35
  public umi!: Umi;
36
36
  public signer!: Signer;
37
37
 
38
- public authority!: PublicKey;
39
38
  public referralState!: PublicKey;
40
39
  public referralStateData!: ReferralState | null;
40
+ public authority!: PublicKey;
41
41
 
42
42
  public referredBy?: PublicKey;
43
43
  public referredByState?: PublicKey;
@@ -64,7 +64,6 @@ export class ReferralStateManager extends TxHandler {
64
64
  : walletAdapterIdentity(args.wallet!, true)
65
65
  );
66
66
  this.signer = this.umi.identity;
67
- this.authority = args.authority ?? toWeb3JsPublicKey(this.signer.publicKey);
68
67
 
69
68
  this.referralState = args.referralState
70
69
  ? args.referralState
@@ -76,6 +75,9 @@ export class ReferralStateManager extends TxHandler {
76
75
  publicKey(this.referralState),
77
76
  { commitment: "confirmed" }
78
77
  );
78
+ this.authority = this.referralStateData
79
+ ? toWeb3JsPublicKey(this.referralStateData.authority)
80
+ : toWeb3JsPublicKey(this.signer.publicKey);
79
81
 
80
82
  this.setReferredBy(args.referredByAuthority);
81
83
  }
@@ -126,9 +128,10 @@ export class ReferralStateManager extends TxHandler {
126
128
  });
127
129
  }
128
130
 
129
- claimReferralFeesIx(destFeesMint?: PublicKey): TransactionBuilder {
130
- const referralFeesDestMint =
131
- destFeesMint ?? toWeb3JsPublicKey(this.referralStateData!.destFeesMint);
131
+ claimReferralFeesIx(): TransactionBuilder {
132
+ const referralFeesDestMint = toWeb3JsPublicKey(
133
+ this.referralStateData!.destFeesMint
134
+ );
132
135
  const referralDestTa = getTokenAccount(
133
136
  this.referralState,
134
137
  referralFeesDestMint
@@ -137,7 +140,7 @@ export class ReferralStateManager extends TxHandler {
137
140
  referralFeesDestMint !== NATIVE_MINT
138
141
  ? publicKey(
139
142
  getTokenAccount(
140
- toWeb3JsPublicKey(this.signer.publicKey),
143
+ this.authority,
141
144
  referralFeesDestMint
142
145
  )
143
146
  )
@@ -7,7 +7,7 @@ import {
7
7
  } from "@metaplex-foundation/umi";
8
8
  import { SolautoClient } from "../clients/solautoClient";
9
9
  import {
10
- getAdressLookupInputs,
10
+ getAddressLookupInputs,
11
11
  sendSingleOptimizedTransaction,
12
12
  } from "../utils/solanaUtils";
13
13
  import {
@@ -37,7 +37,7 @@ class LookupTables {
37
37
  (x) => !currentCacheAddresses.includes(x)
38
38
  );
39
39
  if (missingAddresses) {
40
- const additionalInputs = await getAdressLookupInputs(
40
+ const additionalInputs = await getAddressLookupInputs(
41
41
  this.umi,
42
42
  missingAddresses
43
43
  );
@@ -144,7 +144,7 @@ export function splTokenTransferUmiIx(
144
144
  );
145
145
  }
146
146
 
147
- export async function getAdressLookupInputs(
147
+ export async function getAddressLookupInputs(
148
148
  umi: Umi,
149
149
  lookupTableAddresses: string[]
150
150
  ): Promise<AddressLookupTableInput[]> {