@bench.games/opportunity-markets 0.2.3 → 0.2.5
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/dist/browser/index.js +232 -178
- package/dist/index.cjs +129 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -72
- package/dist/index.d.ts +110 -72
- package/dist/index.js +232 -178
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
COMPUTATION_DEFINITION_ACCOUNT_DISCRIMINATOR: () => COMPUTATION_DEFINITION_ACCOUNT_DISCRIMINATOR,
|
|
43
43
|
CREATE_MARKET_DISCRIMINATOR: () => CREATE_MARKET_DISCRIMINATOR,
|
|
44
44
|
DO_UNSTAKE_EARLY_DISCRIMINATOR: () => DO_UNSTAKE_EARLY_DISCRIMINATOR,
|
|
45
|
-
|
|
45
|
+
END_REVEAL_PERIOD_DISCRIMINATOR: () => END_REVEAL_PERIOD_DISCRIMINATOR,
|
|
46
46
|
FEE_POOL_DISCRIMINATOR: () => FEE_POOL_DISCRIMINATOR,
|
|
47
47
|
INCREASE_REWARD_POOL_DISCRIMINATOR: () => INCREASE_REWARD_POOL_DISCRIMINATOR,
|
|
48
48
|
INCREMENT_OPTION_TALLY_DISCRIMINATOR: () => INCREMENT_OPTION_TALLY_DISCRIMINATOR,
|
|
@@ -130,8 +130,8 @@ __export(index_exports, {
|
|
|
130
130
|
deriveSharedSecret: () => deriveSharedSecret,
|
|
131
131
|
deriveX25519KeypairFromSignature: () => deriveX25519KeypairFromSignature,
|
|
132
132
|
doUnstakeEarly: () => doUnstakeEarly,
|
|
133
|
+
endRevealPeriod: () => endRevealPeriod,
|
|
133
134
|
ensureCentralState: () => ensureCentralState,
|
|
134
|
-
extendRevealPeriod: () => extendRevealPeriod,
|
|
135
135
|
fetchAllArciumSignerAccount: () => fetchAllArciumSignerAccount,
|
|
136
136
|
fetchAllCentralState: () => fetchAllCentralState,
|
|
137
137
|
fetchAllClockAccount: () => fetchAllClockAccount,
|
|
@@ -245,14 +245,14 @@ __export(index_exports, {
|
|
|
245
245
|
getDoUnstakeEarlyInstructionDataCodec: () => getDoUnstakeEarlyInstructionDataCodec,
|
|
246
246
|
getDoUnstakeEarlyInstructionDataDecoder: () => getDoUnstakeEarlyInstructionDataDecoder,
|
|
247
247
|
getDoUnstakeEarlyInstructionDataEncoder: () => getDoUnstakeEarlyInstructionDataEncoder,
|
|
248
|
+
getEndRevealPeriodDiscriminatorBytes: () => getEndRevealPeriodDiscriminatorBytes,
|
|
249
|
+
getEndRevealPeriodInstruction: () => getEndRevealPeriodInstruction,
|
|
250
|
+
getEndRevealPeriodInstructionDataCodec: () => getEndRevealPeriodInstructionDataCodec,
|
|
251
|
+
getEndRevealPeriodInstructionDataDecoder: () => getEndRevealPeriodInstructionDataDecoder,
|
|
252
|
+
getEndRevealPeriodInstructionDataEncoder: () => getEndRevealPeriodInstructionDataEncoder,
|
|
248
253
|
getEpochCodec: () => getEpochCodec,
|
|
249
254
|
getEpochDecoder: () => getEpochDecoder,
|
|
250
255
|
getEpochEncoder: () => getEpochEncoder,
|
|
251
|
-
getExtendRevealPeriodDiscriminatorBytes: () => getExtendRevealPeriodDiscriminatorBytes,
|
|
252
|
-
getExtendRevealPeriodInstruction: () => getExtendRevealPeriodInstruction,
|
|
253
|
-
getExtendRevealPeriodInstructionDataCodec: () => getExtendRevealPeriodInstructionDataCodec,
|
|
254
|
-
getExtendRevealPeriodInstructionDataDecoder: () => getExtendRevealPeriodInstructionDataDecoder,
|
|
255
|
-
getExtendRevealPeriodInstructionDataEncoder: () => getExtendRevealPeriodInstructionDataEncoder,
|
|
256
256
|
getFeePoolCodec: () => getFeePoolCodec,
|
|
257
257
|
getFeePoolDecoder: () => getFeePoolDecoder,
|
|
258
258
|
getFeePoolDiscriminatorBytes: () => getFeePoolDiscriminatorBytes,
|
|
@@ -498,7 +498,7 @@ __export(index_exports, {
|
|
|
498
498
|
parseCloseStakeAccountInstruction: () => parseCloseStakeAccountInstruction,
|
|
499
499
|
parseCreateMarketInstruction: () => parseCreateMarketInstruction,
|
|
500
500
|
parseDoUnstakeEarlyInstruction: () => parseDoUnstakeEarlyInstruction,
|
|
501
|
-
|
|
501
|
+
parseEndRevealPeriodInstruction: () => parseEndRevealPeriodInstruction,
|
|
502
502
|
parseIncreaseRewardPoolInstruction: () => parseIncreaseRewardPoolInstruction,
|
|
503
503
|
parseIncrementOptionTallyInstruction: () => parseIncrementOptionTallyInstruction,
|
|
504
504
|
parseInitCentralStateInstruction: () => parseInitCentralStateInstruction,
|
|
@@ -631,7 +631,9 @@ function getCentralStateEncoder() {
|
|
|
631
631
|
["authority", (0, import_kit2.getAddressEncoder)()],
|
|
632
632
|
["minOptionDeposit", (0, import_kit2.getU64Encoder)()],
|
|
633
633
|
["protocolFeeBp", (0, import_kit2.getU16Encoder)()],
|
|
634
|
-
["feeRecipient", (0, import_kit2.getAddressEncoder)()]
|
|
634
|
+
["feeRecipient", (0, import_kit2.getAddressEncoder)()],
|
|
635
|
+
["rewardWithdrawStakedLimit", (0, import_kit2.getU32Encoder)()],
|
|
636
|
+
["minimumInitialRevealPeriod", (0, import_kit2.getU64Encoder)()]
|
|
635
637
|
]),
|
|
636
638
|
(value) => ({ ...value, discriminator: CENTRAL_STATE_DISCRIMINATOR })
|
|
637
639
|
);
|
|
@@ -644,7 +646,9 @@ function getCentralStateDecoder() {
|
|
|
644
646
|
["authority", (0, import_kit2.getAddressDecoder)()],
|
|
645
647
|
["minOptionDeposit", (0, import_kit2.getU64Decoder)()],
|
|
646
648
|
["protocolFeeBp", (0, import_kit2.getU16Decoder)()],
|
|
647
|
-
["feeRecipient", (0, import_kit2.getAddressDecoder)()]
|
|
649
|
+
["feeRecipient", (0, import_kit2.getAddressDecoder)()],
|
|
650
|
+
["rewardWithdrawStakedLimit", (0, import_kit2.getU32Decoder)()],
|
|
651
|
+
["minimumInitialRevealPeriod", (0, import_kit2.getU64Decoder)()]
|
|
648
652
|
]);
|
|
649
653
|
}
|
|
650
654
|
function getCentralStateCodec() {
|
|
@@ -2143,13 +2147,15 @@ function getOpportunityMarketEncoder() {
|
|
|
2143
2147
|
(0, import_kit46.getOptionEncoder)((0, import_kit46.getArrayEncoder)(getWinningOptionEncoder()))
|
|
2144
2148
|
],
|
|
2145
2149
|
["rewardAmount", (0, import_kit46.getU64Encoder)()],
|
|
2146
|
-
["marketAuthority", (0, import_kit46.
|
|
2150
|
+
["marketAuthority", (0, import_kit46.getAddressEncoder)()],
|
|
2151
|
+
["revealPeriodAuthority", (0, import_kit46.getAddressEncoder)()],
|
|
2147
2152
|
["mint", (0, import_kit46.getAddressEncoder)()],
|
|
2148
2153
|
["earlinessCutoffSeconds", (0, import_kit46.getU64Encoder)()],
|
|
2149
2154
|
["unstakeDelaySeconds", (0, import_kit46.getU64Encoder)()],
|
|
2150
2155
|
["authorizedReaderPubkey", (0, import_kit46.getArrayEncoder)((0, import_kit46.getU8Encoder)(), { size: 32 })],
|
|
2151
2156
|
["allowClosingEarly", (0, import_kit46.getBooleanEncoder)()],
|
|
2152
|
-
["rewardWithdrawn", (0, import_kit46.getBooleanEncoder)()]
|
|
2157
|
+
["rewardWithdrawn", (0, import_kit46.getBooleanEncoder)()],
|
|
2158
|
+
["totalStakedCount", (0, import_kit46.getU64Encoder)()]
|
|
2153
2159
|
]),
|
|
2154
2160
|
(value) => ({ ...value, discriminator: OPPORTUNITY_MARKET_DISCRIMINATOR })
|
|
2155
2161
|
);
|
|
@@ -2169,13 +2175,15 @@ function getOpportunityMarketDecoder() {
|
|
|
2169
2175
|
(0, import_kit46.getOptionDecoder)((0, import_kit46.getArrayDecoder)(getWinningOptionDecoder()))
|
|
2170
2176
|
],
|
|
2171
2177
|
["rewardAmount", (0, import_kit46.getU64Decoder)()],
|
|
2172
|
-
["marketAuthority", (0, import_kit46.
|
|
2178
|
+
["marketAuthority", (0, import_kit46.getAddressDecoder)()],
|
|
2179
|
+
["revealPeriodAuthority", (0, import_kit46.getAddressDecoder)()],
|
|
2173
2180
|
["mint", (0, import_kit46.getAddressDecoder)()],
|
|
2174
2181
|
["earlinessCutoffSeconds", (0, import_kit46.getU64Decoder)()],
|
|
2175
2182
|
["unstakeDelaySeconds", (0, import_kit46.getU64Decoder)()],
|
|
2176
2183
|
["authorizedReaderPubkey", (0, import_kit46.getArrayDecoder)((0, import_kit46.getU8Decoder)(), { size: 32 })],
|
|
2177
2184
|
["allowClosingEarly", (0, import_kit46.getBooleanDecoder)()],
|
|
2178
|
-
["rewardWithdrawn", (0, import_kit46.getBooleanDecoder)()]
|
|
2185
|
+
["rewardWithdrawn", (0, import_kit46.getBooleanDecoder)()],
|
|
2186
|
+
["totalStakedCount", (0, import_kit46.getU64Decoder)()]
|
|
2179
2187
|
]);
|
|
2180
2188
|
}
|
|
2181
2189
|
function getOpportunityMarketCodec() {
|
|
@@ -2592,7 +2600,7 @@ var OpportunityMarketInstruction = /* @__PURE__ */ ((OpportunityMarketInstructio
|
|
|
2592
2600
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["CloseStakeAccount"] = 2] = "CloseStakeAccount";
|
|
2593
2601
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["CreateMarket"] = 3] = "CreateMarket";
|
|
2594
2602
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["DoUnstakeEarly"] = 4] = "DoUnstakeEarly";
|
|
2595
|
-
OpportunityMarketInstruction2[OpportunityMarketInstruction2["
|
|
2603
|
+
OpportunityMarketInstruction2[OpportunityMarketInstruction2["EndRevealPeriod"] = 5] = "EndRevealPeriod";
|
|
2596
2604
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["IncreaseRewardPool"] = 6] = "IncreaseRewardPool";
|
|
2597
2605
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["IncrementOptionTally"] = 7] = "IncrementOptionTally";
|
|
2598
2606
|
OpportunityMarketInstruction2[OpportunityMarketInstruction2["InitCentralState"] = 8] = "InitCentralState";
|
|
@@ -2663,11 +2671,11 @@ function identifyOpportunityMarketInstruction(instruction) {
|
|
|
2663
2671
|
if ((0, import_kit50.containsBytes)(
|
|
2664
2672
|
data,
|
|
2665
2673
|
(0, import_kit50.fixEncoderSize)((0, import_kit50.getBytesEncoder)(), 8).encode(
|
|
2666
|
-
new Uint8Array([
|
|
2674
|
+
new Uint8Array([144, 81, 42, 65, 127, 60, 134, 92])
|
|
2667
2675
|
),
|
|
2668
2676
|
0
|
|
2669
2677
|
)) {
|
|
2670
|
-
return 5 /*
|
|
2678
|
+
return 5 /* EndRevealPeriod */;
|
|
2671
2679
|
}
|
|
2672
2680
|
if ((0, import_kit50.containsBytes)(
|
|
2673
2681
|
data,
|
|
@@ -3474,7 +3482,8 @@ function getCreateMarketInstructionDataEncoder() {
|
|
|
3474
3482
|
["marketAuthority", (0, import_kit56.getOptionEncoder)((0, import_kit56.getAddressEncoder)())],
|
|
3475
3483
|
["unstakeDelaySeconds", (0, import_kit56.getU64Encoder)()],
|
|
3476
3484
|
["authorizedReaderPubkey", (0, import_kit56.getArrayEncoder)((0, import_kit56.getU8Encoder)(), { size: 32 })],
|
|
3477
|
-
["allowClosingEarly", (0, import_kit56.getBooleanEncoder)()]
|
|
3485
|
+
["allowClosingEarly", (0, import_kit56.getBooleanEncoder)()],
|
|
3486
|
+
["revealPeriodAuthority", (0, import_kit56.getAddressEncoder)()]
|
|
3478
3487
|
]),
|
|
3479
3488
|
(value) => ({ ...value, discriminator: CREATE_MARKET_DISCRIMINATOR })
|
|
3480
3489
|
);
|
|
@@ -3489,7 +3498,8 @@ function getCreateMarketInstructionDataDecoder() {
|
|
|
3489
3498
|
["marketAuthority", (0, import_kit56.getOptionDecoder)((0, import_kit56.getAddressDecoder)())],
|
|
3490
3499
|
["unstakeDelaySeconds", (0, import_kit56.getU64Decoder)()],
|
|
3491
3500
|
["authorizedReaderPubkey", (0, import_kit56.getArrayDecoder)((0, import_kit56.getU8Decoder)(), { size: 32 })],
|
|
3492
|
-
["allowClosingEarly", (0, import_kit56.getBooleanDecoder)()]
|
|
3501
|
+
["allowClosingEarly", (0, import_kit56.getBooleanDecoder)()],
|
|
3502
|
+
["revealPeriodAuthority", (0, import_kit56.getAddressDecoder)()]
|
|
3493
3503
|
]);
|
|
3494
3504
|
}
|
|
3495
3505
|
function getCreateMarketInstructionDataCodec() {
|
|
@@ -3850,65 +3860,58 @@ function parseDoUnstakeEarlyInstruction(instruction) {
|
|
|
3850
3860
|
};
|
|
3851
3861
|
}
|
|
3852
3862
|
|
|
3853
|
-
// src/generated/instructions/
|
|
3863
|
+
// src/generated/instructions/endRevealPeriod.ts
|
|
3854
3864
|
var import_kit58 = require("@solana/kit");
|
|
3855
|
-
var
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3865
|
+
var END_REVEAL_PERIOD_DISCRIMINATOR = new Uint8Array([
|
|
3866
|
+
144,
|
|
3867
|
+
81,
|
|
3868
|
+
42,
|
|
3869
|
+
65,
|
|
3870
|
+
127,
|
|
3871
|
+
60,
|
|
3872
|
+
134,
|
|
3873
|
+
92
|
|
3864
3874
|
]);
|
|
3865
|
-
function
|
|
3875
|
+
function getEndRevealPeriodDiscriminatorBytes() {
|
|
3866
3876
|
return (0, import_kit58.fixEncoderSize)((0, import_kit58.getBytesEncoder)(), 8).encode(
|
|
3867
|
-
|
|
3877
|
+
END_REVEAL_PERIOD_DISCRIMINATOR
|
|
3868
3878
|
);
|
|
3869
3879
|
}
|
|
3870
|
-
function
|
|
3880
|
+
function getEndRevealPeriodInstructionDataEncoder() {
|
|
3871
3881
|
return (0, import_kit58.transformEncoder)(
|
|
3872
|
-
(0, import_kit58.getStructEncoder)([
|
|
3873
|
-
|
|
3874
|
-
["newTimeToReveal", (0, import_kit58.getU64Encoder)()]
|
|
3875
|
-
]),
|
|
3876
|
-
(value) => ({ ...value, discriminator: EXTEND_REVEAL_PERIOD_DISCRIMINATOR })
|
|
3882
|
+
(0, import_kit58.getStructEncoder)([["discriminator", (0, import_kit58.fixEncoderSize)((0, import_kit58.getBytesEncoder)(), 8)]]),
|
|
3883
|
+
(value) => ({ ...value, discriminator: END_REVEAL_PERIOD_DISCRIMINATOR })
|
|
3877
3884
|
);
|
|
3878
3885
|
}
|
|
3879
|
-
function
|
|
3886
|
+
function getEndRevealPeriodInstructionDataDecoder() {
|
|
3880
3887
|
return (0, import_kit58.getStructDecoder)([
|
|
3881
|
-
["discriminator", (0, import_kit58.fixDecoderSize)((0, import_kit58.getBytesDecoder)(), 8)]
|
|
3882
|
-
["newTimeToReveal", (0, import_kit58.getU64Decoder)()]
|
|
3888
|
+
["discriminator", (0, import_kit58.fixDecoderSize)((0, import_kit58.getBytesDecoder)(), 8)]
|
|
3883
3889
|
]);
|
|
3884
3890
|
}
|
|
3885
|
-
function
|
|
3891
|
+
function getEndRevealPeriodInstructionDataCodec() {
|
|
3886
3892
|
return (0, import_kit58.combineCodec)(
|
|
3887
|
-
|
|
3888
|
-
|
|
3893
|
+
getEndRevealPeriodInstructionDataEncoder(),
|
|
3894
|
+
getEndRevealPeriodInstructionDataDecoder()
|
|
3889
3895
|
);
|
|
3890
3896
|
}
|
|
3891
|
-
function
|
|
3897
|
+
function getEndRevealPeriodInstruction(input, config) {
|
|
3892
3898
|
const programAddress = config?.programAddress ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
3893
3899
|
const originalAccounts = {
|
|
3894
3900
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
3895
3901
|
market: { value: input.market ?? null, isWritable: true }
|
|
3896
3902
|
};
|
|
3897
3903
|
const accounts = originalAccounts;
|
|
3898
|
-
const args = { ...input };
|
|
3899
3904
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3900
3905
|
return Object.freeze({
|
|
3901
3906
|
accounts: [
|
|
3902
3907
|
getAccountMeta(accounts.authority),
|
|
3903
3908
|
getAccountMeta(accounts.market)
|
|
3904
3909
|
],
|
|
3905
|
-
data:
|
|
3906
|
-
args
|
|
3907
|
-
),
|
|
3910
|
+
data: getEndRevealPeriodInstructionDataEncoder().encode({}),
|
|
3908
3911
|
programAddress
|
|
3909
3912
|
});
|
|
3910
3913
|
}
|
|
3911
|
-
function
|
|
3914
|
+
function parseEndRevealPeriodInstruction(instruction) {
|
|
3912
3915
|
if (instruction.accounts.length < 2) {
|
|
3913
3916
|
throw new Error("Not enough accounts");
|
|
3914
3917
|
}
|
|
@@ -3921,9 +3924,7 @@ function parseExtendRevealPeriodInstruction(instruction) {
|
|
|
3921
3924
|
return {
|
|
3922
3925
|
programAddress: instruction.programAddress,
|
|
3923
3926
|
accounts: { authority: getNextAccount(), market: getNextAccount() },
|
|
3924
|
-
data:
|
|
3925
|
-
instruction.data
|
|
3926
|
-
)
|
|
3927
|
+
data: getEndRevealPeriodInstructionDataDecoder().decode(instruction.data)
|
|
3927
3928
|
};
|
|
3928
3929
|
}
|
|
3929
3930
|
|
|
@@ -4246,7 +4247,9 @@ function getInitCentralStateInstructionDataEncoder() {
|
|
|
4246
4247
|
["earlinessCutoffSeconds", (0, import_kit61.getU64Encoder)()],
|
|
4247
4248
|
["minOptionDeposit", (0, import_kit61.getU64Encoder)()],
|
|
4248
4249
|
["protocolFeeBp", (0, import_kit61.getU16Encoder)()],
|
|
4249
|
-
["feeRecipient", (0, import_kit61.getAddressEncoder)()]
|
|
4250
|
+
["feeRecipient", (0, import_kit61.getAddressEncoder)()],
|
|
4251
|
+
["rewardWithdrawStakedLimit", (0, import_kit61.getU32Encoder)()],
|
|
4252
|
+
["minimumInitialRevealPeriod", (0, import_kit61.getU64Encoder)()]
|
|
4250
4253
|
]),
|
|
4251
4254
|
(value) => ({ ...value, discriminator: INIT_CENTRAL_STATE_DISCRIMINATOR })
|
|
4252
4255
|
);
|
|
@@ -4257,7 +4260,9 @@ function getInitCentralStateInstructionDataDecoder() {
|
|
|
4257
4260
|
["earlinessCutoffSeconds", (0, import_kit61.getU64Decoder)()],
|
|
4258
4261
|
["minOptionDeposit", (0, import_kit61.getU64Decoder)()],
|
|
4259
4262
|
["protocolFeeBp", (0, import_kit61.getU16Decoder)()],
|
|
4260
|
-
["feeRecipient", (0, import_kit61.getAddressDecoder)()]
|
|
4263
|
+
["feeRecipient", (0, import_kit61.getAddressDecoder)()],
|
|
4264
|
+
["rewardWithdrawStakedLimit", (0, import_kit61.getU32Decoder)()],
|
|
4265
|
+
["minimumInitialRevealPeriod", (0, import_kit61.getU64Decoder)()]
|
|
4261
4266
|
]);
|
|
4262
4267
|
}
|
|
4263
4268
|
function getInitCentralStateInstructionDataCodec() {
|
|
@@ -5606,7 +5611,8 @@ function getStakeInstructionDataCodec() {
|
|
|
5606
5611
|
async function getStakeInstructionAsync(input, config) {
|
|
5607
5612
|
const programAddress = config?.programAddress ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
5608
5613
|
const originalAccounts = {
|
|
5609
|
-
signer: { value: input.signer ?? null, isWritable:
|
|
5614
|
+
signer: { value: input.signer ?? null, isWritable: false },
|
|
5615
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5610
5616
|
market: { value: input.market ?? null, isWritable: false },
|
|
5611
5617
|
stakeAccount: { value: input.stakeAccount ?? null, isWritable: true },
|
|
5612
5618
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
@@ -5739,6 +5745,7 @@ async function getStakeInstructionAsync(input, config) {
|
|
|
5739
5745
|
return Object.freeze({
|
|
5740
5746
|
accounts: [
|
|
5741
5747
|
getAccountMeta(accounts.signer),
|
|
5748
|
+
getAccountMeta(accounts.payer),
|
|
5742
5749
|
getAccountMeta(accounts.market),
|
|
5743
5750
|
getAccountMeta(accounts.stakeAccount),
|
|
5744
5751
|
getAccountMeta(accounts.tokenMint),
|
|
@@ -5768,7 +5775,8 @@ async function getStakeInstructionAsync(input, config) {
|
|
|
5768
5775
|
function getStakeInstruction(input, config) {
|
|
5769
5776
|
const programAddress = config?.programAddress ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
5770
5777
|
const originalAccounts = {
|
|
5771
|
-
signer: { value: input.signer ?? null, isWritable:
|
|
5778
|
+
signer: { value: input.signer ?? null, isWritable: false },
|
|
5779
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5772
5780
|
market: { value: input.market ?? null, isWritable: false },
|
|
5773
5781
|
stakeAccount: { value: input.stakeAccount ?? null, isWritable: true },
|
|
5774
5782
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
@@ -5813,6 +5821,7 @@ function getStakeInstruction(input, config) {
|
|
|
5813
5821
|
return Object.freeze({
|
|
5814
5822
|
accounts: [
|
|
5815
5823
|
getAccountMeta(accounts.signer),
|
|
5824
|
+
getAccountMeta(accounts.payer),
|
|
5816
5825
|
getAccountMeta(accounts.market),
|
|
5817
5826
|
getAccountMeta(accounts.stakeAccount),
|
|
5818
5827
|
getAccountMeta(accounts.tokenMint),
|
|
@@ -5840,7 +5849,7 @@ function getStakeInstruction(input, config) {
|
|
|
5840
5849
|
});
|
|
5841
5850
|
}
|
|
5842
5851
|
function parseStakeInstruction(instruction) {
|
|
5843
|
-
if (instruction.accounts.length <
|
|
5852
|
+
if (instruction.accounts.length < 21) {
|
|
5844
5853
|
throw new Error("Not enough accounts");
|
|
5845
5854
|
}
|
|
5846
5855
|
let accountIndex = 0;
|
|
@@ -5853,6 +5862,7 @@ function parseStakeInstruction(instruction) {
|
|
|
5853
5862
|
programAddress: instruction.programAddress,
|
|
5854
5863
|
accounts: {
|
|
5855
5864
|
signer: getNextAccount(),
|
|
5865
|
+
payer: getNextAccount(),
|
|
5856
5866
|
market: getNextAccount(),
|
|
5857
5867
|
stakeAccount: getNextAccount(),
|
|
5858
5868
|
tokenMint: getNextAccount(),
|
|
@@ -5976,6 +5986,7 @@ function getStakeCallbackInstruction(input, config) {
|
|
|
5976
5986
|
value: input.instructionsSysvar ?? null,
|
|
5977
5987
|
isWritable: false
|
|
5978
5988
|
},
|
|
5989
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
5979
5990
|
stakeAccount: { value: input.stakeAccount ?? null, isWritable: true }
|
|
5980
5991
|
};
|
|
5981
5992
|
const accounts = originalAccounts;
|
|
@@ -5995,6 +6006,7 @@ function getStakeCallbackInstruction(input, config) {
|
|
|
5995
6006
|
getAccountMeta(accounts.computationAccount),
|
|
5996
6007
|
getAccountMeta(accounts.clusterAccount),
|
|
5997
6008
|
getAccountMeta(accounts.instructionsSysvar),
|
|
6009
|
+
getAccountMeta(accounts.market),
|
|
5998
6010
|
getAccountMeta(accounts.stakeAccount)
|
|
5999
6011
|
],
|
|
6000
6012
|
data: getStakeCallbackInstructionDataEncoder().encode(
|
|
@@ -6004,7 +6016,7 @@ function getStakeCallbackInstruction(input, config) {
|
|
|
6004
6016
|
});
|
|
6005
6017
|
}
|
|
6006
6018
|
function parseStakeCallbackInstruction(instruction) {
|
|
6007
|
-
if (instruction.accounts.length <
|
|
6019
|
+
if (instruction.accounts.length < 8) {
|
|
6008
6020
|
throw new Error("Not enough accounts");
|
|
6009
6021
|
}
|
|
6010
6022
|
let accountIndex = 0;
|
|
@@ -6022,6 +6034,7 @@ function parseStakeCallbackInstruction(instruction) {
|
|
|
6022
6034
|
computationAccount: getNextAccount(),
|
|
6023
6035
|
clusterAccount: getNextAccount(),
|
|
6024
6036
|
instructionsSysvar: getNextAccount(),
|
|
6037
|
+
market: getNextAccount(),
|
|
6025
6038
|
stakeAccount: getNextAccount()
|
|
6026
6039
|
},
|
|
6027
6040
|
data: getStakeCallbackInstructionDataDecoder().decode(instruction.data)
|
|
@@ -6404,7 +6417,9 @@ function getUpdateCentralStateInstructionDataEncoder() {
|
|
|
6404
6417
|
["earlinessCutoffSeconds", (0, import_kit75.getU64Encoder)()],
|
|
6405
6418
|
["minOptionDeposit", (0, import_kit75.getU64Encoder)()],
|
|
6406
6419
|
["protocolFeeBp", (0, import_kit75.getU16Encoder)()],
|
|
6407
|
-
["feeRecipient", (0, import_kit75.getAddressEncoder)()]
|
|
6420
|
+
["feeRecipient", (0, import_kit75.getAddressEncoder)()],
|
|
6421
|
+
["rewardWithdrawStakedLimit", (0, import_kit75.getU32Encoder)()],
|
|
6422
|
+
["minimumInitialRevealPeriod", (0, import_kit75.getU64Encoder)()]
|
|
6408
6423
|
]),
|
|
6409
6424
|
(value) => ({ ...value, discriminator: UPDATE_CENTRAL_STATE_DISCRIMINATOR })
|
|
6410
6425
|
);
|
|
@@ -6415,7 +6430,9 @@ function getUpdateCentralStateInstructionDataDecoder() {
|
|
|
6415
6430
|
["earlinessCutoffSeconds", (0, import_kit75.getU64Decoder)()],
|
|
6416
6431
|
["minOptionDeposit", (0, import_kit75.getU64Decoder)()],
|
|
6417
6432
|
["protocolFeeBp", (0, import_kit75.getU16Decoder)()],
|
|
6418
|
-
["feeRecipient", (0, import_kit75.getAddressDecoder)()]
|
|
6433
|
+
["feeRecipient", (0, import_kit75.getAddressDecoder)()],
|
|
6434
|
+
["rewardWithdrawStakedLimit", (0, import_kit75.getU32Decoder)()],
|
|
6435
|
+
["minimumInitialRevealPeriod", (0, import_kit75.getU64Decoder)()]
|
|
6419
6436
|
]);
|
|
6420
6437
|
}
|
|
6421
6438
|
function getUpdateCentralStateInstructionDataCodec() {
|
|
@@ -6544,7 +6561,7 @@ function getWithdrawRewardInstructionDataCodec() {
|
|
|
6544
6561
|
async function getWithdrawRewardInstructionAsync(input, config) {
|
|
6545
6562
|
const programAddress = config?.programAddress ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
6546
6563
|
const originalAccounts = {
|
|
6547
|
-
|
|
6564
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
6548
6565
|
market: { value: input.market ?? null, isWritable: true },
|
|
6549
6566
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
6550
6567
|
marketTokenAta: { value: input.marketTokenAta ?? null, isWritable: true },
|
|
@@ -6552,6 +6569,7 @@ async function getWithdrawRewardInstructionAsync(input, config) {
|
|
|
6552
6569
|
value: input.refundTokenAccount ?? null,
|
|
6553
6570
|
isWritable: true
|
|
6554
6571
|
},
|
|
6572
|
+
centralState: { value: input.centralState ?? null, isWritable: false },
|
|
6555
6573
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
6556
6574
|
};
|
|
6557
6575
|
const accounts = originalAccounts;
|
|
@@ -6565,14 +6583,39 @@ async function getWithdrawRewardInstructionAsync(input, config) {
|
|
|
6565
6583
|
]
|
|
6566
6584
|
});
|
|
6567
6585
|
}
|
|
6586
|
+
if (!accounts.centralState.value) {
|
|
6587
|
+
accounts.centralState.value = await (0, import_kit76.getProgramDerivedAddress)({
|
|
6588
|
+
programAddress,
|
|
6589
|
+
seeds: [
|
|
6590
|
+
(0, import_kit76.getBytesEncoder)().encode(
|
|
6591
|
+
new Uint8Array([
|
|
6592
|
+
99,
|
|
6593
|
+
101,
|
|
6594
|
+
110,
|
|
6595
|
+
116,
|
|
6596
|
+
114,
|
|
6597
|
+
97,
|
|
6598
|
+
108,
|
|
6599
|
+
95,
|
|
6600
|
+
115,
|
|
6601
|
+
116,
|
|
6602
|
+
97,
|
|
6603
|
+
116,
|
|
6604
|
+
101
|
|
6605
|
+
])
|
|
6606
|
+
)
|
|
6607
|
+
]
|
|
6608
|
+
});
|
|
6609
|
+
}
|
|
6568
6610
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6569
6611
|
return Object.freeze({
|
|
6570
6612
|
accounts: [
|
|
6571
|
-
getAccountMeta(accounts.
|
|
6613
|
+
getAccountMeta(accounts.authority),
|
|
6572
6614
|
getAccountMeta(accounts.market),
|
|
6573
6615
|
getAccountMeta(accounts.tokenMint),
|
|
6574
6616
|
getAccountMeta(accounts.marketTokenAta),
|
|
6575
6617
|
getAccountMeta(accounts.refundTokenAccount),
|
|
6618
|
+
getAccountMeta(accounts.centralState),
|
|
6576
6619
|
getAccountMeta(accounts.tokenProgram)
|
|
6577
6620
|
],
|
|
6578
6621
|
data: getWithdrawRewardInstructionDataEncoder().encode({}),
|
|
@@ -6582,7 +6625,7 @@ async function getWithdrawRewardInstructionAsync(input, config) {
|
|
|
6582
6625
|
function getWithdrawRewardInstruction(input, config) {
|
|
6583
6626
|
const programAddress = config?.programAddress ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
6584
6627
|
const originalAccounts = {
|
|
6585
|
-
|
|
6628
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
6586
6629
|
market: { value: input.market ?? null, isWritable: true },
|
|
6587
6630
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
6588
6631
|
marketTokenAta: { value: input.marketTokenAta ?? null, isWritable: true },
|
|
@@ -6590,17 +6633,19 @@ function getWithdrawRewardInstruction(input, config) {
|
|
|
6590
6633
|
value: input.refundTokenAccount ?? null,
|
|
6591
6634
|
isWritable: true
|
|
6592
6635
|
},
|
|
6636
|
+
centralState: { value: input.centralState ?? null, isWritable: false },
|
|
6593
6637
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
6594
6638
|
};
|
|
6595
6639
|
const accounts = originalAccounts;
|
|
6596
6640
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6597
6641
|
return Object.freeze({
|
|
6598
6642
|
accounts: [
|
|
6599
|
-
getAccountMeta(accounts.
|
|
6643
|
+
getAccountMeta(accounts.authority),
|
|
6600
6644
|
getAccountMeta(accounts.market),
|
|
6601
6645
|
getAccountMeta(accounts.tokenMint),
|
|
6602
6646
|
getAccountMeta(accounts.marketTokenAta),
|
|
6603
6647
|
getAccountMeta(accounts.refundTokenAccount),
|
|
6648
|
+
getAccountMeta(accounts.centralState),
|
|
6604
6649
|
getAccountMeta(accounts.tokenProgram)
|
|
6605
6650
|
],
|
|
6606
6651
|
data: getWithdrawRewardInstructionDataEncoder().encode({}),
|
|
@@ -6608,7 +6653,7 @@ function getWithdrawRewardInstruction(input, config) {
|
|
|
6608
6653
|
});
|
|
6609
6654
|
}
|
|
6610
6655
|
function parseWithdrawRewardInstruction(instruction) {
|
|
6611
|
-
if (instruction.accounts.length <
|
|
6656
|
+
if (instruction.accounts.length < 7) {
|
|
6612
6657
|
throw new Error("Not enough accounts");
|
|
6613
6658
|
}
|
|
6614
6659
|
let accountIndex = 0;
|
|
@@ -6620,11 +6665,12 @@ function parseWithdrawRewardInstruction(instruction) {
|
|
|
6620
6665
|
return {
|
|
6621
6666
|
programAddress: instruction.programAddress,
|
|
6622
6667
|
accounts: {
|
|
6623
|
-
|
|
6668
|
+
authority: getNextAccount(),
|
|
6624
6669
|
market: getNextAccount(),
|
|
6625
6670
|
tokenMint: getNextAccount(),
|
|
6626
6671
|
marketTokenAta: getNextAccount(),
|
|
6627
6672
|
refundTokenAccount: getNextAccount(),
|
|
6673
|
+
centralState: getNextAccount(),
|
|
6628
6674
|
tokenProgram: getNextAccount()
|
|
6629
6675
|
},
|
|
6630
6676
|
data: getWithdrawRewardInstructionDataDecoder().decode(instruction.data)
|
|
@@ -6673,6 +6719,7 @@ async function createMarket(input) {
|
|
|
6673
6719
|
unstakeDelaySeconds,
|
|
6674
6720
|
authorizedReaderPubkey,
|
|
6675
6721
|
allowClosingEarly,
|
|
6722
|
+
revealPeriodAuthority,
|
|
6676
6723
|
programAddress
|
|
6677
6724
|
} = input;
|
|
6678
6725
|
return getCreateMarketInstructionAsync(
|
|
@@ -6687,7 +6734,8 @@ async function createMarket(input) {
|
|
|
6687
6734
|
marketAuthority,
|
|
6688
6735
|
unstakeDelaySeconds,
|
|
6689
6736
|
authorizedReaderPubkey: toNumberArray(authorizedReaderPubkey),
|
|
6690
|
-
allowClosingEarly
|
|
6737
|
+
allowClosingEarly,
|
|
6738
|
+
revealPeriodAuthority
|
|
6691
6739
|
},
|
|
6692
6740
|
programAddress ? { programAddress } : void 0
|
|
6693
6741
|
);
|
|
@@ -6787,6 +6835,7 @@ async function stake(input, config) {
|
|
|
6787
6835
|
const {
|
|
6788
6836
|
programAddress,
|
|
6789
6837
|
signer,
|
|
6838
|
+
payer,
|
|
6790
6839
|
market,
|
|
6791
6840
|
stakeAccountId,
|
|
6792
6841
|
tokenMint,
|
|
@@ -6805,6 +6854,7 @@ async function stake(input, config) {
|
|
|
6805
6854
|
{
|
|
6806
6855
|
...getComputeAccounts("stake", config),
|
|
6807
6856
|
signer,
|
|
6857
|
+
payer,
|
|
6808
6858
|
market,
|
|
6809
6859
|
stakeAccountId,
|
|
6810
6860
|
tokenMint,
|
|
@@ -6865,10 +6915,10 @@ function selectWinningOptions(input) {
|
|
|
6865
6915
|
);
|
|
6866
6916
|
}
|
|
6867
6917
|
|
|
6868
|
-
// src/instructions/
|
|
6869
|
-
function
|
|
6918
|
+
// src/instructions/endRevealPeriod.ts
|
|
6919
|
+
function endRevealPeriod(input) {
|
|
6870
6920
|
const { programAddress, ...params } = input;
|
|
6871
|
-
return
|
|
6921
|
+
return getEndRevealPeriodInstruction(
|
|
6872
6922
|
params,
|
|
6873
6923
|
programAddress ? { programAddress } : void 0
|
|
6874
6924
|
);
|
|
@@ -6955,7 +7005,7 @@ async function ensureCentralState(rpc, params) {
|
|
|
6955
7005
|
const existing = await fetchMaybeCentralState(rpc, centralStateAddress);
|
|
6956
7006
|
if (existing.exists) {
|
|
6957
7007
|
const s = existing.data;
|
|
6958
|
-
if (s.earlinessCutoffSeconds === BigInt(args.earlinessCutoffSeconds) && s.minOptionDeposit === BigInt(args.minOptionDeposit) && s.protocolFeeBp === args.protocolFeeBp && s.feeRecipient === args.feeRecipient) {
|
|
7008
|
+
if (s.earlinessCutoffSeconds === BigInt(args.earlinessCutoffSeconds) && s.minOptionDeposit === BigInt(args.minOptionDeposit) && s.protocolFeeBp === args.protocolFeeBp && s.feeRecipient === args.feeRecipient && s.rewardWithdrawStakedLimit === args.rewardWithdrawStakedLimit && s.minimumInitialRevealPeriod === BigInt(args.minimumInitialRevealPeriod)) {
|
|
6959
7009
|
return null;
|
|
6960
7010
|
}
|
|
6961
7011
|
return getUpdateCentralStateInstructionAsync(
|
|
@@ -7181,7 +7231,7 @@ function nonceToBytes(nonce) {
|
|
|
7181
7231
|
COMPUTATION_DEFINITION_ACCOUNT_DISCRIMINATOR,
|
|
7182
7232
|
CREATE_MARKET_DISCRIMINATOR,
|
|
7183
7233
|
DO_UNSTAKE_EARLY_DISCRIMINATOR,
|
|
7184
|
-
|
|
7234
|
+
END_REVEAL_PERIOD_DISCRIMINATOR,
|
|
7185
7235
|
FEE_POOL_DISCRIMINATOR,
|
|
7186
7236
|
INCREASE_REWARD_POOL_DISCRIMINATOR,
|
|
7187
7237
|
INCREMENT_OPTION_TALLY_DISCRIMINATOR,
|
|
@@ -7269,8 +7319,8 @@ function nonceToBytes(nonce) {
|
|
|
7269
7319
|
deriveSharedSecret,
|
|
7270
7320
|
deriveX25519KeypairFromSignature,
|
|
7271
7321
|
doUnstakeEarly,
|
|
7322
|
+
endRevealPeriod,
|
|
7272
7323
|
ensureCentralState,
|
|
7273
|
-
extendRevealPeriod,
|
|
7274
7324
|
fetchAllArciumSignerAccount,
|
|
7275
7325
|
fetchAllCentralState,
|
|
7276
7326
|
fetchAllClockAccount,
|
|
@@ -7384,14 +7434,14 @@ function nonceToBytes(nonce) {
|
|
|
7384
7434
|
getDoUnstakeEarlyInstructionDataCodec,
|
|
7385
7435
|
getDoUnstakeEarlyInstructionDataDecoder,
|
|
7386
7436
|
getDoUnstakeEarlyInstructionDataEncoder,
|
|
7437
|
+
getEndRevealPeriodDiscriminatorBytes,
|
|
7438
|
+
getEndRevealPeriodInstruction,
|
|
7439
|
+
getEndRevealPeriodInstructionDataCodec,
|
|
7440
|
+
getEndRevealPeriodInstructionDataDecoder,
|
|
7441
|
+
getEndRevealPeriodInstructionDataEncoder,
|
|
7387
7442
|
getEpochCodec,
|
|
7388
7443
|
getEpochDecoder,
|
|
7389
7444
|
getEpochEncoder,
|
|
7390
|
-
getExtendRevealPeriodDiscriminatorBytes,
|
|
7391
|
-
getExtendRevealPeriodInstruction,
|
|
7392
|
-
getExtendRevealPeriodInstructionDataCodec,
|
|
7393
|
-
getExtendRevealPeriodInstructionDataDecoder,
|
|
7394
|
-
getExtendRevealPeriodInstructionDataEncoder,
|
|
7395
7445
|
getFeePoolCodec,
|
|
7396
7446
|
getFeePoolDecoder,
|
|
7397
7447
|
getFeePoolDiscriminatorBytes,
|
|
@@ -7637,7 +7687,7 @@ function nonceToBytes(nonce) {
|
|
|
7637
7687
|
parseCloseStakeAccountInstruction,
|
|
7638
7688
|
parseCreateMarketInstruction,
|
|
7639
7689
|
parseDoUnstakeEarlyInstruction,
|
|
7640
|
-
|
|
7690
|
+
parseEndRevealPeriodInstruction,
|
|
7641
7691
|
parseIncreaseRewardPoolInstruction,
|
|
7642
7692
|
parseIncrementOptionTallyInstruction,
|
|
7643
7693
|
parseInitCentralStateInstruction,
|