@drift-labs/vaults-sdk 0.1.0 → 0.1.2
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/README.md +44 -8
- package/cli/cli.ts +45 -9
- package/cli/commands/applyProfitShare.ts +3 -6
- package/cli/commands/deposit.ts +0 -1
- package/cli/commands/deriveVaultAddress.ts +15 -0
- package/cli/commands/index.ts +4 -1
- package/cli/commands/initVault.ts +104 -23
- package/cli/commands/initVaultDepositor.ts +0 -1
- package/cli/commands/listDepositorsForVault.ts +0 -1
- package/cli/commands/managerCancelWithdraw.ts +0 -1
- package/cli/commands/managerDeposit.ts +0 -1
- package/cli/commands/managerRequestWithdraw.ts +0 -1
- package/cli/commands/managerUpdateMarginTradingEnabled.ts +26 -0
- package/cli/commands/managerUpdateVault.ts +91 -9
- package/cli/commands/managerUpdateVaultDelegate.ts +35 -0
- package/cli/commands/managerWithdraw.ts +0 -1
- package/cli/commands/requestWithdraw.ts +0 -1
- package/cli/commands/vaultDeposit.ts +0 -1
- package/cli/commands/vaultWithdraw.ts +0 -1
- package/cli/commands/viewVault.ts +4 -4
- package/cli/commands/viewVaultDepositor.ts +0 -1
- package/cli/commands/withdraw.ts +0 -1
- package/cli/utils.ts +15 -8
- package/lib/accountSubscribers/index.js +5 -1
- package/lib/accounts/index.js +5 -1
- package/lib/accounts/vaultAccount.js +1 -1
- package/lib/accounts/vaultDepositorAccount.js +1 -1
- package/lib/addresses.js +5 -1
- package/lib/index.js +5 -1
- package/lib/parsers/index.js +5 -1
- package/lib/parsers/logParser.d.ts +1 -1
- package/lib/types/drift_vaults.d.ts +113 -1
- package/lib/types/drift_vaults.js +112 -0
- package/lib/types/types.d.ts +13 -13
- package/lib/utils.js +6 -2
- package/lib/vaultClient.d.ts +22 -0
- package/lib/vaultClient.js +85 -24
- package/package.json +2 -4
- package/src/idl/drift_vaults.json +112 -0
- package/src/types/drift_vaults.ts +224 -0
- package/src/vaultClient.ts +97 -0
package/lib/vaultClient.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VaultClient = void 0;
|
|
4
4
|
const sdk_1 = require("@drift-labs/sdk");
|
|
5
5
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
|
-
const addresses_1 = require("
|
|
6
|
+
const addresses_1 = require("@drift-labs/competitions-sdk/lib/addresses");
|
|
7
|
+
const addresses_2 = require("./addresses");
|
|
7
8
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
9
|
const spl_token_1 = require("@solana/spl-token");
|
|
9
10
|
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
@@ -72,12 +73,12 @@ class VaultClient {
|
|
|
72
73
|
return netSpotValue.add(unrealizedPnl);
|
|
73
74
|
}
|
|
74
75
|
async initializeVault(params) {
|
|
75
|
-
const vault =
|
|
76
|
-
const tokenAccount =
|
|
76
|
+
const vault = (0, addresses_2.getVaultAddressSync)(this.program.programId, params.name);
|
|
77
|
+
const tokenAccount = (0, addresses_2.getTokenVaultAddressSync)(this.program.programId, vault);
|
|
77
78
|
const driftState = await this.driftClient.getStatePublicKey();
|
|
78
79
|
const spotMarket = this.driftClient.getSpotMarketAccount(params.spotMarketIndex);
|
|
79
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault);
|
|
80
|
-
const userKey = sdk_1.getUserAccountPublicKeySync(this.driftClient.program.programId, vault);
|
|
80
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault);
|
|
81
|
+
const userKey = (0, sdk_1.getUserAccountPublicKeySync)(this.driftClient.program.programId, vault);
|
|
81
82
|
const accounts = {
|
|
82
83
|
driftSpotMarket: spotMarket.pubkey,
|
|
83
84
|
driftSpotMarketMint: spotMarket.mint,
|
|
@@ -111,6 +112,23 @@ class VaultClient {
|
|
|
111
112
|
})
|
|
112
113
|
.rpc();
|
|
113
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Updates the vault margin trading status.
|
|
117
|
+
* @param vault vault address to update
|
|
118
|
+
* @param enabeld whether to enable margin trading
|
|
119
|
+
* @returns
|
|
120
|
+
*/
|
|
121
|
+
async updateMarginTradingEnabled(vault, enabled) {
|
|
122
|
+
const vaultAccount = await this.program.account.vault.fetch(vault);
|
|
123
|
+
return await this.program.methods
|
|
124
|
+
.updateMarginTradingEnabled(enabled)
|
|
125
|
+
.accounts({
|
|
126
|
+
vault: vault,
|
|
127
|
+
driftUser: vaultAccount.user,
|
|
128
|
+
driftProgram: this.driftClient.program.programId,
|
|
129
|
+
})
|
|
130
|
+
.rpc();
|
|
131
|
+
}
|
|
114
132
|
/**
|
|
115
133
|
*
|
|
116
134
|
* @param vault vault address to deposit to
|
|
@@ -134,12 +152,12 @@ class VaultClient {
|
|
|
134
152
|
.accounts({
|
|
135
153
|
vault,
|
|
136
154
|
vaultTokenAccount: vaultAccount.tokenAccount,
|
|
137
|
-
driftUser: await sdk_1.getUserAccountPublicKey(this.driftClient.program.programId, vault),
|
|
155
|
+
driftUser: await (0, sdk_1.getUserAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
138
156
|
driftProgram: this.driftClient.program.programId,
|
|
139
|
-
driftUserStats: sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault),
|
|
157
|
+
driftUserStats: (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
140
158
|
driftState: await this.driftClient.getStatePublicKey(),
|
|
141
159
|
driftSpotMarketVault: driftSpotMarket.vault,
|
|
142
|
-
userTokenAccount: spl_token_1.getAssociatedTokenAddressSync(driftSpotMarket.mint, this.driftClient.wallet.publicKey),
|
|
160
|
+
userTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(driftSpotMarket.mint, this.driftClient.wallet.publicKey),
|
|
143
161
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
144
162
|
})
|
|
145
163
|
.remainingAccounts(remainingAccounts)
|
|
@@ -159,7 +177,7 @@ class VaultClient {
|
|
|
159
177
|
userAccounts: [user.getUserAccount()],
|
|
160
178
|
writableSpotMarketIndexes: [vaultAccount.spotMarketIndex],
|
|
161
179
|
});
|
|
162
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault);
|
|
180
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault);
|
|
163
181
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
164
182
|
const accounts = {
|
|
165
183
|
vault,
|
|
@@ -187,7 +205,7 @@ class VaultClient {
|
|
|
187
205
|
}
|
|
188
206
|
async managerCancelWithdrawRequest(vault) {
|
|
189
207
|
const vaultAccount = await this.program.account.vault.fetch(vault);
|
|
190
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault);
|
|
208
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault);
|
|
191
209
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
192
210
|
const accounts = {
|
|
193
211
|
manager: this.driftClient.wallet.publicKey,
|
|
@@ -245,12 +263,12 @@ class VaultClient {
|
|
|
245
263
|
vault,
|
|
246
264
|
manager: this.driftClient.wallet.publicKey,
|
|
247
265
|
vaultTokenAccount: vaultAccount.tokenAccount,
|
|
248
|
-
driftUser: await sdk_1.getUserAccountPublicKey(this.driftClient.program.programId, vault),
|
|
266
|
+
driftUser: await (0, sdk_1.getUserAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
249
267
|
driftProgram: this.driftClient.program.programId,
|
|
250
|
-
driftUserStats: sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault),
|
|
268
|
+
driftUserStats: (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
251
269
|
driftState: await this.driftClient.getStatePublicKey(),
|
|
252
270
|
driftSpotMarketVault: spotMarket.vault,
|
|
253
|
-
userTokenAccount: spl_token_1.getAssociatedTokenAddressSync(spotMarket.mint, this.driftClient.wallet.publicKey),
|
|
271
|
+
userTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(spotMarket.mint, this.driftClient.wallet.publicKey),
|
|
254
272
|
driftSigner: this.driftClient.getStateAccount().signer,
|
|
255
273
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
256
274
|
},
|
|
@@ -288,8 +306,8 @@ class VaultClient {
|
|
|
288
306
|
vault,
|
|
289
307
|
vaultDepositor,
|
|
290
308
|
manager: this.driftClient.wallet.publicKey,
|
|
291
|
-
driftUserStats: sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vault),
|
|
292
|
-
driftUser: await sdk_1.getUserAccountPublicKey(this.driftClient.program.programId, vault),
|
|
309
|
+
driftUserStats: (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
310
|
+
driftUser: await (0, sdk_1.getUserAccountPublicKey)(this.driftClient.program.programId, vault),
|
|
293
311
|
driftState: await this.driftClient.getStatePublicKey(),
|
|
294
312
|
driftSigner: this.driftClient.getStateAccount().signer,
|
|
295
313
|
driftProgram: this.driftClient.program.programId,
|
|
@@ -302,7 +320,7 @@ class VaultClient {
|
|
|
302
320
|
});
|
|
303
321
|
}
|
|
304
322
|
createInitVaultDepositorIx(vault, authority) {
|
|
305
|
-
const vaultDepositor =
|
|
323
|
+
const vaultDepositor = (0, addresses_2.getVaultDepositorAddressSync)(this.program.programId, vault, authority);
|
|
306
324
|
const accounts = {
|
|
307
325
|
vaultDepositor,
|
|
308
326
|
vault,
|
|
@@ -325,7 +343,7 @@ class VaultClient {
|
|
|
325
343
|
* @returns
|
|
326
344
|
*/
|
|
327
345
|
async initializeVaultDepositor(vault, authority) {
|
|
328
|
-
const vaultDepositor =
|
|
346
|
+
const vaultDepositor = (0, addresses_2.getVaultDepositorAddressSync)(this.program.programId, vault, authority);
|
|
329
347
|
const accounts = {
|
|
330
348
|
vaultDepositor,
|
|
331
349
|
vault,
|
|
@@ -368,7 +386,7 @@ class VaultClient {
|
|
|
368
386
|
userAccounts: [user.getUserAccount()],
|
|
369
387
|
writableSpotMarketIndexes: [vaultAccount.spotMarketIndex],
|
|
370
388
|
});
|
|
371
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vaultPubKey);
|
|
389
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vaultPubKey);
|
|
372
390
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
373
391
|
const spotMarket = this.driftClient.getSpotMarketAccount(vaultAccount.spotMarketIndex);
|
|
374
392
|
const accounts = {
|
|
@@ -379,7 +397,7 @@ class VaultClient {
|
|
|
379
397
|
driftUser: vaultAccount.user,
|
|
380
398
|
driftState: driftStateKey,
|
|
381
399
|
driftSpotMarketVault: spotMarket.vault,
|
|
382
|
-
userTokenAccount: spl_token_1.getAssociatedTokenAddressSync(spotMarket.mint, this.driftClient.wallet.publicKey, true),
|
|
400
|
+
userTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(spotMarket.mint, this.driftClient.wallet.publicKey, true),
|
|
383
401
|
driftProgram: this.driftClient.program.programId,
|
|
384
402
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
385
403
|
};
|
|
@@ -421,7 +439,7 @@ class VaultClient {
|
|
|
421
439
|
const remainingAccounts = this.driftClient.getRemainingAccounts({
|
|
422
440
|
userAccounts: [user.getUserAccount()],
|
|
423
441
|
});
|
|
424
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
442
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
425
443
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
426
444
|
const accounts = {
|
|
427
445
|
vault: vaultDepositorAccount.vault,
|
|
@@ -460,7 +478,7 @@ class VaultClient {
|
|
|
460
478
|
userAccounts: [user.getUserAccount()],
|
|
461
479
|
writableSpotMarketIndexes: [vaultAccount.spotMarketIndex],
|
|
462
480
|
});
|
|
463
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
481
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
464
482
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
465
483
|
const spotMarket = this.driftClient.getSpotMarketAccount(vaultAccount.spotMarketIndex);
|
|
466
484
|
const accounts = {
|
|
@@ -472,7 +490,7 @@ class VaultClient {
|
|
|
472
490
|
driftState: driftStateKey,
|
|
473
491
|
driftSpotMarketVault: spotMarket.vault,
|
|
474
492
|
driftSigner: this.driftClient.getStateAccount().signer,
|
|
475
|
-
userTokenAccount: spl_token_1.getAssociatedTokenAddressSync(spotMarket.mint, this.driftClient.wallet.publicKey, true),
|
|
493
|
+
userTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(spotMarket.mint, this.driftClient.wallet.publicKey, true),
|
|
476
494
|
driftProgram: this.driftClient.program.programId,
|
|
477
495
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
478
496
|
};
|
|
@@ -497,7 +515,7 @@ class VaultClient {
|
|
|
497
515
|
async cancelRequestWithdraw(vaultDepositor) {
|
|
498
516
|
const vaultDepositorAccount = await this.program.account.vaultDepositor.fetch(vaultDepositor);
|
|
499
517
|
const vaultAccount = await this.program.account.vault.fetch(vaultDepositorAccount.vault);
|
|
500
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
518
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vaultDepositorAccount.vault);
|
|
501
519
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
502
520
|
const accounts = {
|
|
503
521
|
vault: vaultDepositorAccount.vault,
|
|
@@ -551,7 +569,7 @@ class VaultClient {
|
|
|
551
569
|
userAccounts: [user.getUserAccount()],
|
|
552
570
|
writableSpotMarketIndexes: [vaultAccount.spotMarketIndex],
|
|
553
571
|
});
|
|
554
|
-
const userStatsKey = sdk_1.getUserStatsAccountPublicKey(this.driftClient.program.programId, vaultPubKey);
|
|
572
|
+
const userStatsKey = (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, vaultPubKey);
|
|
555
573
|
const driftStateKey = await this.driftClient.getStatePublicKey();
|
|
556
574
|
const accounts = {
|
|
557
575
|
vault: vaultPubKey,
|
|
@@ -592,5 +610,48 @@ class VaultClient {
|
|
|
592
610
|
const { txSig } = await this.driftClient.sendTransaction(tx, [], this.driftClient.opts);
|
|
593
611
|
return txSig;
|
|
594
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Initializes an insurance fund stake for the vault.
|
|
615
|
+
* @param vault vault address to update
|
|
616
|
+
* @param spotMarketIndex spot market index of the insurance fund stake
|
|
617
|
+
* @returns
|
|
618
|
+
*/
|
|
619
|
+
async initializeInsuranceFundStake(vault, spotMarketIndex) {
|
|
620
|
+
const vaultAccount = await this.program.account.vault.fetch(vault);
|
|
621
|
+
const ifStakeAccountPublicKey = (0, sdk_1.getInsuranceFundStakeAccountPublicKey)(this.driftClient.program.programId, vault, spotMarketIndex);
|
|
622
|
+
return await this.program.methods
|
|
623
|
+
.initializeInsuranceFundStake(spotMarketIndex)
|
|
624
|
+
.accounts({
|
|
625
|
+
vault: vault,
|
|
626
|
+
driftSpotMarket: this.driftClient.getSpotMarketAccount(spotMarketIndex).pubkey,
|
|
627
|
+
insuranceFundStake: ifStakeAccountPublicKey,
|
|
628
|
+
driftUserStats: vaultAccount.userStats,
|
|
629
|
+
driftState: await this.driftClient.getStatePublicKey(),
|
|
630
|
+
driftProgram: this.driftClient.program.programId,
|
|
631
|
+
})
|
|
632
|
+
.rpc();
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Initializes a DriftCompetitions Competitor account for the vault.
|
|
636
|
+
* @param vault vault address to initialize Competitor for
|
|
637
|
+
* @param competitionName name of the competition to initialize for
|
|
638
|
+
* @returns
|
|
639
|
+
*/
|
|
640
|
+
async initializeCompetitor(vault, competitionsClient, competitionName) {
|
|
641
|
+
const vaultAccount = await this.program.account.vault.fetch(vault);
|
|
642
|
+
const encodedName = (0, sdk_1.encodeName)(competitionName);
|
|
643
|
+
const competitionAddress = (0, addresses_1.getCompetitionAddressSync)(competitionsClient.program.programId, encodedName);
|
|
644
|
+
const competitorAddress = (0, addresses_1.getCompetitorAddressSync)(competitionsClient.program.programId, competitionAddress, vault);
|
|
645
|
+
return await this.program.methods
|
|
646
|
+
.initializeCompetitor()
|
|
647
|
+
.accounts({
|
|
648
|
+
vault: vault,
|
|
649
|
+
competitor: competitorAddress,
|
|
650
|
+
driftCompetitions: competitionAddress,
|
|
651
|
+
driftUserStats: vaultAccount.userStats,
|
|
652
|
+
driftCompetitionsProgram: competitionsClient.program.programId,
|
|
653
|
+
})
|
|
654
|
+
.rpc();
|
|
655
|
+
}
|
|
595
656
|
}
|
|
596
657
|
exports.VaultClient = VaultClient;
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/vaults-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"directories": {
|
|
7
7
|
"lib": "lib"
|
|
8
8
|
},
|
|
9
|
-
"peerDependencies": {
|
|
10
|
-
"@drift-labs/sdk": "2.40.0-beta.1"
|
|
11
|
-
},
|
|
12
9
|
"dependencies": {
|
|
13
10
|
"@coral-xyz/anchor": "^0.26.0",
|
|
11
|
+
"@drift-labs/sdk": "2.43.0-beta.5",
|
|
14
12
|
"@solana/web3.js": "1.73.2",
|
|
15
13
|
"commander": "^11.0.0",
|
|
16
14
|
"dotenv": "^16.3.1",
|
|
@@ -789,6 +789,118 @@
|
|
|
789
789
|
}
|
|
790
790
|
],
|
|
791
791
|
"args": []
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"name": "initializeInsuranceFundStake",
|
|
795
|
+
"accounts": [
|
|
796
|
+
{
|
|
797
|
+
"name": "vault",
|
|
798
|
+
"isMut": true,
|
|
799
|
+
"isSigner": false
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
"name": "manager",
|
|
803
|
+
"isMut": false,
|
|
804
|
+
"isSigner": true
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"name": "payer",
|
|
808
|
+
"isMut": true,
|
|
809
|
+
"isSigner": true
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"name": "rent",
|
|
813
|
+
"isMut": false,
|
|
814
|
+
"isSigner": false
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"name": "systemProgram",
|
|
818
|
+
"isMut": false,
|
|
819
|
+
"isSigner": false
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"name": "driftSpotMarket",
|
|
823
|
+
"isMut": false,
|
|
824
|
+
"isSigner": false
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
"name": "insuranceFundStake",
|
|
828
|
+
"isMut": true,
|
|
829
|
+
"isSigner": false
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"name": "driftUserStats",
|
|
833
|
+
"isMut": true,
|
|
834
|
+
"isSigner": false
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
"name": "driftState",
|
|
838
|
+
"isMut": false,
|
|
839
|
+
"isSigner": false
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"name": "driftProgram",
|
|
843
|
+
"isMut": false,
|
|
844
|
+
"isSigner": false
|
|
845
|
+
}
|
|
846
|
+
],
|
|
847
|
+
"args": [
|
|
848
|
+
{
|
|
849
|
+
"name": "marketIndex",
|
|
850
|
+
"type": "u16"
|
|
851
|
+
}
|
|
852
|
+
]
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"name": "initializeCompetitor",
|
|
856
|
+
"accounts": [
|
|
857
|
+
{
|
|
858
|
+
"name": "vault",
|
|
859
|
+
"isMut": true,
|
|
860
|
+
"isSigner": false
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"name": "manager",
|
|
864
|
+
"isMut": false,
|
|
865
|
+
"isSigner": true
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"name": "payer",
|
|
869
|
+
"isMut": true,
|
|
870
|
+
"isSigner": true
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"name": "rent",
|
|
874
|
+
"isMut": false,
|
|
875
|
+
"isSigner": false
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"name": "systemProgram",
|
|
879
|
+
"isMut": false,
|
|
880
|
+
"isSigner": false
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
"name": "competitor",
|
|
884
|
+
"isMut": true,
|
|
885
|
+
"isSigner": false
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"name": "driftCompetitions",
|
|
889
|
+
"isMut": true,
|
|
890
|
+
"isSigner": false
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
"name": "driftUserStats",
|
|
894
|
+
"isMut": true,
|
|
895
|
+
"isSigner": false
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"name": "driftCompetitionsProgram",
|
|
899
|
+
"isMut": false,
|
|
900
|
+
"isSigner": false
|
|
901
|
+
}
|
|
902
|
+
],
|
|
903
|
+
"args": []
|
|
792
904
|
}
|
|
793
905
|
],
|
|
794
906
|
"accounts": [
|
|
@@ -789,6 +789,118 @@ export type DriftVaults = {
|
|
|
789
789
|
}
|
|
790
790
|
];
|
|
791
791
|
args: [];
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
name: 'initializeInsuranceFundStake';
|
|
795
|
+
accounts: [
|
|
796
|
+
{
|
|
797
|
+
name: 'vault';
|
|
798
|
+
isMut: true;
|
|
799
|
+
isSigner: false;
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: 'manager';
|
|
803
|
+
isMut: false;
|
|
804
|
+
isSigner: true;
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: 'payer';
|
|
808
|
+
isMut: true;
|
|
809
|
+
isSigner: true;
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
name: 'rent';
|
|
813
|
+
isMut: false;
|
|
814
|
+
isSigner: false;
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
name: 'systemProgram';
|
|
818
|
+
isMut: false;
|
|
819
|
+
isSigner: false;
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
name: 'driftSpotMarket';
|
|
823
|
+
isMut: false;
|
|
824
|
+
isSigner: false;
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
name: 'insuranceFundStake';
|
|
828
|
+
isMut: true;
|
|
829
|
+
isSigner: false;
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: 'driftUserStats';
|
|
833
|
+
isMut: true;
|
|
834
|
+
isSigner: false;
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
name: 'driftState';
|
|
838
|
+
isMut: false;
|
|
839
|
+
isSigner: false;
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
name: 'driftProgram';
|
|
843
|
+
isMut: false;
|
|
844
|
+
isSigner: false;
|
|
845
|
+
}
|
|
846
|
+
];
|
|
847
|
+
args: [
|
|
848
|
+
{
|
|
849
|
+
name: 'marketIndex';
|
|
850
|
+
type: 'u16';
|
|
851
|
+
}
|
|
852
|
+
];
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: 'initializeCompetitor';
|
|
856
|
+
accounts: [
|
|
857
|
+
{
|
|
858
|
+
name: 'vault';
|
|
859
|
+
isMut: true;
|
|
860
|
+
isSigner: false;
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: 'manager';
|
|
864
|
+
isMut: false;
|
|
865
|
+
isSigner: true;
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
name: 'payer';
|
|
869
|
+
isMut: true;
|
|
870
|
+
isSigner: true;
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
name: 'rent';
|
|
874
|
+
isMut: false;
|
|
875
|
+
isSigner: false;
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: 'systemProgram';
|
|
879
|
+
isMut: false;
|
|
880
|
+
isSigner: false;
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: 'competitor';
|
|
884
|
+
isMut: true;
|
|
885
|
+
isSigner: false;
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
name: 'driftCompetitions';
|
|
889
|
+
isMut: true;
|
|
890
|
+
isSigner: false;
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: 'driftUserStats';
|
|
894
|
+
isMut: true;
|
|
895
|
+
isSigner: false;
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: 'driftCompetitionsProgram';
|
|
899
|
+
isMut: false;
|
|
900
|
+
isSigner: false;
|
|
901
|
+
}
|
|
902
|
+
];
|
|
903
|
+
args: [];
|
|
792
904
|
}
|
|
793
905
|
];
|
|
794
906
|
accounts: [
|
|
@@ -2265,6 +2377,118 @@ export const IDL: DriftVaults = {
|
|
|
2265
2377
|
],
|
|
2266
2378
|
args: [],
|
|
2267
2379
|
},
|
|
2380
|
+
{
|
|
2381
|
+
name: 'initializeInsuranceFundStake',
|
|
2382
|
+
accounts: [
|
|
2383
|
+
{
|
|
2384
|
+
name: 'vault',
|
|
2385
|
+
isMut: true,
|
|
2386
|
+
isSigner: false,
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
name: 'manager',
|
|
2390
|
+
isMut: false,
|
|
2391
|
+
isSigner: true,
|
|
2392
|
+
},
|
|
2393
|
+
{
|
|
2394
|
+
name: 'payer',
|
|
2395
|
+
isMut: true,
|
|
2396
|
+
isSigner: true,
|
|
2397
|
+
},
|
|
2398
|
+
{
|
|
2399
|
+
name: 'rent',
|
|
2400
|
+
isMut: false,
|
|
2401
|
+
isSigner: false,
|
|
2402
|
+
},
|
|
2403
|
+
{
|
|
2404
|
+
name: 'systemProgram',
|
|
2405
|
+
isMut: false,
|
|
2406
|
+
isSigner: false,
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
name: 'driftSpotMarket',
|
|
2410
|
+
isMut: false,
|
|
2411
|
+
isSigner: false,
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
name: 'insuranceFundStake',
|
|
2415
|
+
isMut: true,
|
|
2416
|
+
isSigner: false,
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
name: 'driftUserStats',
|
|
2420
|
+
isMut: true,
|
|
2421
|
+
isSigner: false,
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
name: 'driftState',
|
|
2425
|
+
isMut: false,
|
|
2426
|
+
isSigner: false,
|
|
2427
|
+
},
|
|
2428
|
+
{
|
|
2429
|
+
name: 'driftProgram',
|
|
2430
|
+
isMut: false,
|
|
2431
|
+
isSigner: false,
|
|
2432
|
+
},
|
|
2433
|
+
],
|
|
2434
|
+
args: [
|
|
2435
|
+
{
|
|
2436
|
+
name: 'marketIndex',
|
|
2437
|
+
type: 'u16',
|
|
2438
|
+
},
|
|
2439
|
+
],
|
|
2440
|
+
},
|
|
2441
|
+
{
|
|
2442
|
+
name: 'initializeCompetitor',
|
|
2443
|
+
accounts: [
|
|
2444
|
+
{
|
|
2445
|
+
name: 'vault',
|
|
2446
|
+
isMut: true,
|
|
2447
|
+
isSigner: false,
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
name: 'manager',
|
|
2451
|
+
isMut: false,
|
|
2452
|
+
isSigner: true,
|
|
2453
|
+
},
|
|
2454
|
+
{
|
|
2455
|
+
name: 'payer',
|
|
2456
|
+
isMut: true,
|
|
2457
|
+
isSigner: true,
|
|
2458
|
+
},
|
|
2459
|
+
{
|
|
2460
|
+
name: 'rent',
|
|
2461
|
+
isMut: false,
|
|
2462
|
+
isSigner: false,
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
name: 'systemProgram',
|
|
2466
|
+
isMut: false,
|
|
2467
|
+
isSigner: false,
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
name: 'competitor',
|
|
2471
|
+
isMut: true,
|
|
2472
|
+
isSigner: false,
|
|
2473
|
+
},
|
|
2474
|
+
{
|
|
2475
|
+
name: 'driftCompetitions',
|
|
2476
|
+
isMut: true,
|
|
2477
|
+
isSigner: false,
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
name: 'driftUserStats',
|
|
2481
|
+
isMut: true,
|
|
2482
|
+
isSigner: false,
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
name: 'driftCompetitionsProgram',
|
|
2486
|
+
isMut: false,
|
|
2487
|
+
isSigner: false,
|
|
2488
|
+
},
|
|
2489
|
+
],
|
|
2490
|
+
args: [],
|
|
2491
|
+
},
|
|
2268
2492
|
],
|
|
2269
2493
|
accounts: [
|
|
2270
2494
|
{
|