@drift-labs/sdk 2.74.0-beta.11 → 2.74.0-beta.12
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 +1 -1
- package/lib/adminClient.d.ts +3 -1
- package/lib/adminClient.js +15 -9
- package/package.json +1 -1
- package/src/adminClient.ts +63 -34
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.74.0-beta.
|
|
1
|
+
2.74.0-beta.12
|
package/lib/adminClient.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ 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
|
-
|
|
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>;
|
|
95
97
|
}
|
package/lib/adminClient.js
CHANGED
|
@@ -1061,42 +1061,48 @@ 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
|
-
|
|
1075
|
+
return await this.program.instruction.initializePrelaunchOracle(params, {
|
|
1070
1076
|
accounts: {
|
|
1071
|
-
admin
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1098
|
+
return await this.program.instruction.updatePrelaunchOracleParams(params, {
|
|
1090
1099
|
accounts: {
|
|
1091
|
-
admin
|
|
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);
|
|
1098
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1099
|
-
return txSig;
|
|
1100
1106
|
}
|
|
1101
1107
|
async deletePrelaunchOracle(perpMarketIndex) {
|
|
1102
1108
|
const deletePrelaunchOracleIx = await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
|
package/package.json
CHANGED
package/src/adminClient.ts
CHANGED
|
@@ -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
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
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
|
-
|
|
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
|
|
2359
|
+
public async getUpdatePrelaunchOracleParamsIx(
|
|
2360
|
+
admin: PublicKey,
|
|
2325
2361
|
perpMarketIndex: number,
|
|
2326
2362
|
price?: BN,
|
|
2327
2363
|
maxPrice?: BN
|
|
2328
|
-
): Promise<
|
|
2364
|
+
): Promise<TransactionInstruction> {
|
|
2329
2365
|
const params = {
|
|
2330
2366
|
perpMarketIndex,
|
|
2331
2367
|
price: price || null,
|
|
@@ -2337,24 +2373,17 @@ export class AdminClient extends DriftClient {
|
|
|
2337
2373
|
perpMarketIndex
|
|
2338
2374
|
);
|
|
2339
2375
|
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
});
|
|
2352
|
-
|
|
2353
|
-
const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
|
|
2354
|
-
|
|
2355
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
2356
|
-
|
|
2357
|
-
return txSig;
|
|
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
|
+
});
|
|
2358
2387
|
}
|
|
2359
2388
|
|
|
2360
2389
|
public async deletePrelaunchOracle(
|