@drift-labs/sdk 2.31.0-beta.6 → 2.31.0-beta.7
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/lib/constants/perpMarkets.js +20 -0
- package/lib/driftClient.js +1 -1
- package/lib/idl/drift.json +1 -1
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/retryTxSender.js +6 -3
- package/lib/tx/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/constants/perpMarkets.ts +20 -0
- package/src/driftClient.ts +2 -1
- package/src/idl/drift.json +1 -1
- package/src/tx/retryTxSender.ts +6 -3
- package/src/tx/types.ts +2 -1
|
@@ -114,6 +114,16 @@ exports.DevnetPerpMarkets = [
|
|
|
114
114
|
launchTs: 1683125906000,
|
|
115
115
|
oracleSource: __1.OracleSource.PYTH_1M,
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
fullName: 'OP',
|
|
119
|
+
category: ['L2', 'Infra'],
|
|
120
|
+
symbol: 'OP-PERP',
|
|
121
|
+
baseAssetSymbol: 'OP',
|
|
122
|
+
marketIndex: 11,
|
|
123
|
+
oracle: new web3_js_1.PublicKey('8ctSiDhA7eJoii4TkKV8Rx4KFdz3ycsA1FXy9wq56quG'),
|
|
124
|
+
launchTs: 1683125906000,
|
|
125
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
126
|
+
},
|
|
117
127
|
];
|
|
118
128
|
exports.MainnetPerpMarkets = [
|
|
119
129
|
{
|
|
@@ -226,6 +236,16 @@ exports.MainnetPerpMarkets = [
|
|
|
226
236
|
launchTs: 1683125906000,
|
|
227
237
|
oracleSource: __1.OracleSource.PYTH_1M,
|
|
228
238
|
},
|
|
239
|
+
{
|
|
240
|
+
fullName: 'OP',
|
|
241
|
+
category: ['L2', 'Infra'],
|
|
242
|
+
symbol: 'OP-PERP',
|
|
243
|
+
baseAssetSymbol: 'OP',
|
|
244
|
+
marketIndex: 11,
|
|
245
|
+
oracle: new web3_js_1.PublicKey('4o4CUwzFwLqCvmA5x1G4VzoZkAhAcbiuiYyjWX1CVbY2'),
|
|
246
|
+
launchTs: 1683125906000,
|
|
247
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
248
|
+
},
|
|
229
249
|
];
|
|
230
250
|
exports.PerpMarkets = {
|
|
231
251
|
devnet: exports.DevnetPerpMarkets,
|
package/lib/driftClient.js
CHANGED
|
@@ -3040,7 +3040,7 @@ class DriftClient {
|
|
|
3040
3040
|
return this.txSender.send(tx, additionalSigners, opts, preSigned);
|
|
3041
3041
|
}
|
|
3042
3042
|
else {
|
|
3043
|
-
return this.txSender.sendVersionedTransaction(tx, additionalSigners, opts);
|
|
3043
|
+
return this.txSender.sendVersionedTransaction(tx, additionalSigners, opts, preSigned);
|
|
3044
3044
|
}
|
|
3045
3045
|
}
|
|
3046
3046
|
async buildTransaction(instructions, txParams, txVersion, lookupTables) {
|
package/lib/idl/drift.json
CHANGED
|
@@ -14,7 +14,7 @@ export declare class RetryTxSender implements TxSender {
|
|
|
14
14
|
send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
15
15
|
prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions): Promise<Transaction>;
|
|
16
16
|
getVersionedTransaction(ixs: TransactionInstruction[], lookupTableAccounts: AddressLookupTableAccount[], additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<VersionedTransaction>;
|
|
17
|
-
sendVersionedTransaction(tx: VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
17
|
+
sendVersionedTransaction(tx: VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
18
18
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
19
19
|
confirmTransaction(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
20
20
|
getTimestamp(): number;
|
package/lib/tx/retryTxSender.js
CHANGED
|
@@ -54,10 +54,13 @@ class RetryTxSender {
|
|
|
54
54
|
const tx = new web3_js_1.VersionedTransaction(message);
|
|
55
55
|
return tx;
|
|
56
56
|
}
|
|
57
|
-
async sendVersionedTransaction(tx, additionalSigners, opts) {
|
|
57
|
+
async sendVersionedTransaction(tx, additionalSigners, opts, preSigned) {
|
|
58
58
|
let signedTx;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (preSigned) {
|
|
60
|
+
signedTx = tx;
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
}
|
|
63
|
+
else if (this.provider.wallet.payer) {
|
|
61
64
|
// @ts-ignore
|
|
62
65
|
tx.sign((additionalSigners !== null && additionalSigners !== void 0 ? additionalSigners : []).concat(this.provider.wallet.payer));
|
|
63
66
|
signedTx = tx;
|
package/lib/tx/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type TxSigAndSlot = {
|
|
|
8
8
|
export interface TxSender {
|
|
9
9
|
provider: Provider;
|
|
10
10
|
send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
11
|
-
sendVersionedTransaction(tx: VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
11
|
+
sendVersionedTransaction(tx: VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
12
12
|
getVersionedTransaction(ixs: TransactionInstruction[], lookupTableAccounts: AddressLookupTableAccount[], additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<VersionedTransaction>;
|
|
13
13
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -124,6 +124,16 @@ export const DevnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
124
124
|
launchTs: 1683125906000,
|
|
125
125
|
oracleSource: OracleSource.PYTH_1M,
|
|
126
126
|
},
|
|
127
|
+
{
|
|
128
|
+
fullName: 'OP',
|
|
129
|
+
category: ['L2', 'Infra'],
|
|
130
|
+
symbol: 'OP-PERP',
|
|
131
|
+
baseAssetSymbol: 'OP',
|
|
132
|
+
marketIndex: 11,
|
|
133
|
+
oracle: new PublicKey('8ctSiDhA7eJoii4TkKV8Rx4KFdz3ycsA1FXy9wq56quG'),
|
|
134
|
+
launchTs: 1683125906000,
|
|
135
|
+
oracleSource: OracleSource.PYTH,
|
|
136
|
+
},
|
|
127
137
|
];
|
|
128
138
|
|
|
129
139
|
export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
@@ -237,6 +247,16 @@ export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
237
247
|
launchTs: 1683125906000,
|
|
238
248
|
oracleSource: OracleSource.PYTH_1M,
|
|
239
249
|
},
|
|
250
|
+
{
|
|
251
|
+
fullName: 'OP',
|
|
252
|
+
category: ['L2', 'Infra'],
|
|
253
|
+
symbol: 'OP-PERP',
|
|
254
|
+
baseAssetSymbol: 'OP',
|
|
255
|
+
marketIndex: 11,
|
|
256
|
+
oracle: new PublicKey('4o4CUwzFwLqCvmA5x1G4VzoZkAhAcbiuiYyjWX1CVbY2'),
|
|
257
|
+
launchTs: 1683125906000,
|
|
258
|
+
oracleSource: OracleSource.PYTH,
|
|
259
|
+
},
|
|
240
260
|
];
|
|
241
261
|
|
|
242
262
|
export const PerpMarkets: { [key in DriftEnv]: PerpMarketConfig[] } = {
|
package/src/driftClient.ts
CHANGED
package/src/idl/drift.json
CHANGED
package/src/tx/retryTxSender.ts
CHANGED
|
@@ -117,11 +117,14 @@ export class RetryTxSender implements TxSender {
|
|
|
117
117
|
async sendVersionedTransaction(
|
|
118
118
|
tx: VersionedTransaction,
|
|
119
119
|
additionalSigners?: Array<Signer>,
|
|
120
|
-
opts?: ConfirmOptions
|
|
120
|
+
opts?: ConfirmOptions,
|
|
121
|
+
preSigned?: boolean
|
|
121
122
|
): Promise<TxSigAndSlot> {
|
|
122
123
|
let signedTx;
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
if (preSigned) {
|
|
125
|
+
signedTx = tx;
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
} else if (this.provider.wallet.payer) {
|
|
125
128
|
// @ts-ignore
|
|
126
129
|
tx.sign((additionalSigners ?? []).concat(this.provider.wallet.payer));
|
|
127
130
|
signedTx = tx;
|
package/src/tx/types.ts
CHANGED