@drift-labs/sdk 2.21.0-beta.2 → 2.21.0

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.
@@ -104,6 +104,7 @@ export declare class DriftClient {
104
104
  fetchAllUserAccounts(includeIdle?: boolean): Promise<ProgramAccount<UserAccount>[]>;
105
105
  getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
106
106
  getUserAccountsForAuthority(authority: PublicKey): Promise<UserAccount[]>;
107
+ getReferrerNameAccountsForAuthority(authority: PublicKey): Promise<ReferrerNameAccount[]>;
107
108
  deleteUser(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
108
109
  getUser(subAccountId?: number): User;
109
110
  getUsers(): User[];
@@ -361,7 +361,7 @@ class DriftClient {
361
361
  async initializeReferrerName(name) {
362
362
  const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, 0);
363
363
  const nameBuffer = (0, userName_1.encodeName)(name);
364
- const referrerNameAccountPublicKey = await (0, pda_1.getReferrerNamePublicKeySync)(this.program.programId, nameBuffer);
364
+ const referrerNameAccountPublicKey = (0, pda_1.getReferrerNamePublicKeySync)(this.program.programId, nameBuffer);
365
365
  const tx = await this.program.transaction.initializeReferrerName(nameBuffer, {
366
366
  accounts: {
367
367
  referrerName: referrerNameAccountPublicKey,
@@ -462,6 +462,18 @@ class DriftClient {
462
462
  ]);
463
463
  return programAccounts.map((programAccount) => programAccount.account);
464
464
  }
465
+ async getReferrerNameAccountsForAuthority(authority) {
466
+ const programAccounts = await this.program.account.referrerName.all([
467
+ {
468
+ memcmp: {
469
+ offset: 8,
470
+ /** data to match, as base-58 encoded string and limited to less than 129 bytes */
471
+ bytes: bs58_1.default.encode(authority.toBuffer()),
472
+ },
473
+ },
474
+ ]);
475
+ return programAccounts.map((programAccount) => programAccount.account);
476
+ }
465
477
  async deleteUser(subAccountId = 0, txParams) {
466
478
  var _a;
467
479
  const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.21.0-beta.2",
2
+ "version": "2.21.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.21.0-beta.2",
3
+ "version": "2.21.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -603,7 +603,7 @@ export class DriftClient {
603
603
 
604
604
  const nameBuffer = encodeName(name);
605
605
 
606
- const referrerNameAccountPublicKey = await getReferrerNamePublicKeySync(
606
+ const referrerNameAccountPublicKey = getReferrerNamePublicKeySync(
607
607
  this.program.programId,
608
608
  nameBuffer
609
609
  );
@@ -774,6 +774,24 @@ export class DriftClient {
774
774
  );
775
775
  }
776
776
 
777
+ public async getReferrerNameAccountsForAuthority(
778
+ authority: PublicKey
779
+ ): Promise<ReferrerNameAccount[]> {
780
+ const programAccounts = await this.program.account.referrerName.all([
781
+ {
782
+ memcmp: {
783
+ offset: 8,
784
+ /** data to match, as base-58 encoded string and limited to less than 129 bytes */
785
+ bytes: bs58.encode(authority.toBuffer()),
786
+ },
787
+ },
788
+ ]);
789
+
790
+ return programAccounts.map(
791
+ (programAccount) => programAccount.account as ReferrerNameAccount
792
+ );
793
+ }
794
+
777
795
  public async deleteUser(
778
796
  subAccountId = 0,
779
797
  txParams?: TxParams
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.21.0-beta.2",
2
+ "version": "2.21.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {