@drift-labs/sdk 2.74.0-beta.11 → 2.74.0-beta.13

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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.74.0-beta.11
1
+ 2.74.0-beta.13
@@ -90,6 +90,9 @@ export declare class AdminClient extends DriftClient {
90
90
  initializeProtocolIfSharesTransferConfig(): Promise<TransactionSignature>;
91
91
  updateProtocolIfSharesTransferConfig(whitelistedSigners?: PublicKey[], maxTransferPerEpoch?: BN): Promise<TransactionSignature>;
92
92
  initializePrelaunchOracle(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
93
- updatePrelaunchOracleParams(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
93
+ getInitializePrelaunchOracleIx(admin: PublicKey, perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionInstruction>;
94
+ updatePrelaunchOracleParams(admin: PublicKey, perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
95
+ getUpdatePrelaunchOracleParamsIx(admin: PublicKey, perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionInstruction>;
94
96
  deletePrelaunchOracle(perpMarketIndex: number): Promise<TransactionSignature>;
97
+ getDeletePrelaunchOracleIx(admin: PublicKey, perpMarketIndex: number): Promise<TransactionInstruction>;
95
98
  }
@@ -1061,55 +1061,64 @@ class AdminClient extends driftClient_1.DriftClient {
1061
1061
  return txSig;
1062
1062
  }
1063
1063
  async initializePrelaunchOracle(perpMarketIndex, price, maxPrice) {
1064
+ const initializePrelaunchOracleIx = await this.getInitializePrelaunchOracleIx(this.wallet.publicKey, perpMarketIndex, price, maxPrice);
1065
+ const tx = await this.buildTransaction(initializePrelaunchOracleIx);
1066
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1067
+ return txSig;
1068
+ }
1069
+ async getInitializePrelaunchOracleIx(admin, perpMarketIndex, price, maxPrice) {
1064
1070
  const params = {
1065
1071
  perpMarketIndex,
1066
1072
  price: price || null,
1067
1073
  maxPrice: maxPrice || null,
1068
1074
  };
1069
- const initializePrelaunchOracleIx = await this.program.instruction.initializePrelaunchOracle(params, {
1075
+ return await this.program.instruction.initializePrelaunchOracle(params, {
1070
1076
  accounts: {
1071
- admin: this.wallet.publicKey,
1077
+ admin,
1072
1078
  state: await this.getStatePublicKey(),
1073
1079
  prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
1074
1080
  rent: web3_js_1.SYSVAR_RENT_PUBKEY,
1075
1081
  systemProgram: anchor.web3.SystemProgram.programId,
1076
1082
  },
1077
1083
  });
1078
- const tx = await this.buildTransaction(initializePrelaunchOracleIx);
1084
+ }
1085
+ async updatePrelaunchOracleParams(admin, perpMarketIndex, price, maxPrice) {
1086
+ const updatePrelaunchOracleParamsIx = await this.getUpdatePrelaunchOracleParamsIx(this.wallet.publicKey, perpMarketIndex, price, maxPrice);
1087
+ const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
1079
1088
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1080
1089
  return txSig;
1081
1090
  }
1082
- async updatePrelaunchOracleParams(perpMarketIndex, price, maxPrice) {
1091
+ async getUpdatePrelaunchOracleParamsIx(admin, perpMarketIndex, price, maxPrice) {
1083
1092
  const params = {
1084
1093
  perpMarketIndex,
1085
1094
  price: price || null,
1086
1095
  maxPrice: maxPrice || null,
1087
1096
  };
1088
1097
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
1089
- const updatePrelaunchOracleParamsIx = await this.program.instruction.updatePrelaunchOracleParams(params, {
1098
+ return await this.program.instruction.updatePrelaunchOracleParams(params, {
1090
1099
  accounts: {
1091
- admin: this.wallet.publicKey,
1100
+ admin,
1092
1101
  state: await this.getStatePublicKey(),
1093
1102
  perpMarket: perpMarketPublicKey,
1094
1103
  prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
1095
1104
  },
1096
1105
  });
1097
- const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
1106
+ }
1107
+ async deletePrelaunchOracle(perpMarketIndex) {
1108
+ const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(this.wallet.publicKey, perpMarketIndex);
1109
+ const tx = await this.buildTransaction(deletePrelaunchOracleIx);
1098
1110
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1099
1111
  return txSig;
1100
1112
  }
1101
- async deletePrelaunchOracle(perpMarketIndex) {
1102
- const deletePrelaunchOracleIx = await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
1113
+ async getDeletePrelaunchOracleIx(admin, perpMarketIndex) {
1114
+ return await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
1103
1115
  accounts: {
1104
- admin: this.wallet.publicKey,
1116
+ admin,
1105
1117
  state: await this.getStatePublicKey(),
1106
1118
  prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
1107
1119
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1108
1120
  },
1109
1121
  });
1110
- const tx = await this.buildTransaction(deletePrelaunchOracleIx);
1111
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
1112
- return txSig;
1113
1122
  }
1114
1123
  }
1115
1124
  exports.AdminClient = AdminClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.74.0-beta.11",
3
+ "version": "2.74.0-beta.13",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -2294,38 +2294,74 @@ export class AdminClient extends DriftClient {
2294
2294
  price?: BN,
2295
2295
  maxPrice?: BN
2296
2296
  ): Promise<TransactionSignature> {
2297
+ const initializePrelaunchOracleIx =
2298
+ await this.getInitializePrelaunchOracleIx(
2299
+ this.wallet.publicKey,
2300
+ perpMarketIndex,
2301
+ price,
2302
+ maxPrice
2303
+ );
2304
+
2305
+ const tx = await this.buildTransaction(initializePrelaunchOracleIx);
2306
+
2307
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
2308
+
2309
+ return txSig;
2310
+ }
2311
+
2312
+ public async getInitializePrelaunchOracleIx(
2313
+ admin: PublicKey,
2314
+ perpMarketIndex: number,
2315
+ price?: BN,
2316
+ maxPrice?: BN
2317
+ ): Promise<TransactionInstruction> {
2297
2318
  const params = {
2298
2319
  perpMarketIndex,
2299
2320
  price: price || null,
2300
2321
  maxPrice: maxPrice || null,
2301
2322
  };
2302
2323
 
2303
- const initializePrelaunchOracleIx =
2304
- await this.program.instruction.initializePrelaunchOracle(params, {
2305
- accounts: {
2306
- admin: this.wallet.publicKey,
2307
- state: await this.getStatePublicKey(),
2308
- prelaunchOracle: await getPrelaunchOraclePublicKey(
2309
- this.program.programId,
2310
- perpMarketIndex
2311
- ),
2312
- rent: SYSVAR_RENT_PUBKEY,
2313
- systemProgram: anchor.web3.SystemProgram.programId,
2314
- },
2315
- });
2324
+ return await this.program.instruction.initializePrelaunchOracle(params, {
2325
+ accounts: {
2326
+ admin,
2327
+ state: await this.getStatePublicKey(),
2328
+ prelaunchOracle: await getPrelaunchOraclePublicKey(
2329
+ this.program.programId,
2330
+ perpMarketIndex
2331
+ ),
2332
+ rent: SYSVAR_RENT_PUBKEY,
2333
+ systemProgram: anchor.web3.SystemProgram.programId,
2334
+ },
2335
+ });
2336
+ }
2316
2337
 
2317
- const tx = await this.buildTransaction(initializePrelaunchOracleIx);
2338
+ public async updatePrelaunchOracleParams(
2339
+ admin: PublicKey,
2340
+ perpMarketIndex: number,
2341
+ price?: BN,
2342
+ maxPrice?: BN
2343
+ ): Promise<TransactionSignature> {
2344
+ const updatePrelaunchOracleParamsIx =
2345
+ await this.getUpdatePrelaunchOracleParamsIx(
2346
+ this.wallet.publicKey,
2347
+ perpMarketIndex,
2348
+ price,
2349
+ maxPrice
2350
+ );
2351
+
2352
+ const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
2318
2353
 
2319
2354
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
2320
2355
 
2321
2356
  return txSig;
2322
2357
  }
2323
2358
 
2324
- public async updatePrelaunchOracleParams(
2359
+ public async getUpdatePrelaunchOracleParamsIx(
2360
+ admin: PublicKey,
2325
2361
  perpMarketIndex: number,
2326
2362
  price?: BN,
2327
2363
  maxPrice?: BN
2328
- ): Promise<TransactionSignature> {
2364
+ ): Promise<TransactionInstruction> {
2329
2365
  const params = {
2330
2366
  perpMarketIndex,
2331
2367
  price: price || null,
@@ -2337,33 +2373,43 @@ export class AdminClient extends DriftClient {
2337
2373
  perpMarketIndex
2338
2374
  );
2339
2375
 
2340
- const updatePrelaunchOracleParamsIx =
2341
- await this.program.instruction.updatePrelaunchOracleParams(params, {
2342
- accounts: {
2343
- admin: this.wallet.publicKey,
2344
- state: await this.getStatePublicKey(),
2345
- perpMarket: perpMarketPublicKey,
2346
- prelaunchOracle: await getPrelaunchOraclePublicKey(
2347
- this.program.programId,
2348
- perpMarketIndex
2349
- ),
2350
- },
2351
- });
2376
+ return await this.program.instruction.updatePrelaunchOracleParams(params, {
2377
+ accounts: {
2378
+ admin,
2379
+ state: await this.getStatePublicKey(),
2380
+ perpMarket: perpMarketPublicKey,
2381
+ prelaunchOracle: await getPrelaunchOraclePublicKey(
2382
+ this.program.programId,
2383
+ perpMarketIndex
2384
+ ),
2385
+ },
2386
+ });
2387
+ }
2352
2388
 
2353
- const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
2389
+ public async deletePrelaunchOracle(
2390
+ perpMarketIndex: number
2391
+ ): Promise<TransactionSignature> {
2392
+ const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(
2393
+ this.wallet.publicKey,
2394
+ perpMarketIndex
2395
+ );
2396
+
2397
+ const tx = await this.buildTransaction(deletePrelaunchOracleIx);
2354
2398
 
2355
2399
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
2356
2400
 
2357
2401
  return txSig;
2358
2402
  }
2359
2403
 
2360
- public async deletePrelaunchOracle(
2404
+ public async getDeletePrelaunchOracleIx(
2405
+ admin: PublicKey,
2361
2406
  perpMarketIndex: number
2362
- ): Promise<TransactionSignature> {
2363
- const deletePrelaunchOracleIx =
2364
- await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
2407
+ ): Promise<TransactionInstruction> {
2408
+ return await this.program.instruction.deletePrelaunchOracle(
2409
+ perpMarketIndex,
2410
+ {
2365
2411
  accounts: {
2366
- admin: this.wallet.publicKey,
2412
+ admin,
2367
2413
  state: await this.getStatePublicKey(),
2368
2414
  prelaunchOracle: await getPrelaunchOraclePublicKey(
2369
2415
  this.program.programId,
@@ -2374,12 +2420,7 @@ export class AdminClient extends DriftClient {
2374
2420
  perpMarketIndex
2375
2421
  ),
2376
2422
  },
2377
- });
2378
-
2379
- const tx = await this.buildTransaction(deletePrelaunchOracleIx);
2380
-
2381
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
2382
-
2383
- return txSig;
2423
+ }
2424
+ );
2384
2425
  }
2385
2426
  }