@bench.games/opportunity-markets 0.1.19 → 0.1.21
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 +36 -16
- package/dist/index.cjs +34 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +36 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -3389,7 +3389,7 @@ import {
|
|
|
3389
3389
|
fixEncoderSize as fixEncoderSize13,
|
|
3390
3390
|
getBytesEncoder as getBytesEncoder13
|
|
3391
3391
|
} from "@solana/kit";
|
|
3392
|
-
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "
|
|
3392
|
+
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "bncZ1gDqgqhSWFzcxjeMoCtqN7odS8wYn1nS5tXZ9jA";
|
|
3393
3393
|
var OpportunityMarketAccount = /* @__PURE__ */ ((OpportunityMarketAccount2) => {
|
|
3394
3394
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ArciumSignerAccount"] = 0] = "ArciumSignerAccount";
|
|
3395
3395
|
OpportunityMarketAccount2[OpportunityMarketAccount2["CentralState"] = 1] = "CentralState";
|
|
@@ -11401,23 +11401,20 @@ async function getEphemeralEncryptedTokenAccountAddress(tokenMint, owner, index,
|
|
|
11401
11401
|
return getEncryptedTokenAccountAddressWithIndex(tokenMint, owner, index, programId);
|
|
11402
11402
|
}
|
|
11403
11403
|
|
|
11404
|
-
// src/accounts/
|
|
11404
|
+
// src/accounts/opportunityMarket.ts
|
|
11405
11405
|
import {
|
|
11406
11406
|
getAddressEncoder as getAddressEncoder58,
|
|
11407
|
+
getU64Encoder as getU64Encoder41,
|
|
11407
11408
|
getProgramDerivedAddress as getProgramDerivedAddress25
|
|
11408
11409
|
} from "@solana/kit";
|
|
11409
|
-
var
|
|
11410
|
-
async function
|
|
11411
|
-
const addressEncoder = getAddressEncoder58();
|
|
11412
|
-
const idBytes = new Uint8Array(4);
|
|
11413
|
-
new DataView(idBytes.buffer).setUint32(0, shareAccountId, true);
|
|
11410
|
+
var OPPORTUNITY_MARKET_SEED = "opportunity_market";
|
|
11411
|
+
async function getOpportunityMarketAddress(creator, marketIndex, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
11414
11412
|
return getProgramDerivedAddress25({
|
|
11415
11413
|
programAddress: programId,
|
|
11416
11414
|
seeds: [
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
idBytes
|
|
11415
|
+
OPPORTUNITY_MARKET_SEED,
|
|
11416
|
+
getAddressEncoder58().encode(creator),
|
|
11417
|
+
getU64Encoder41().encode(BigInt(marketIndex))
|
|
11421
11418
|
]
|
|
11422
11419
|
});
|
|
11423
11420
|
}
|
|
@@ -11440,21 +11437,42 @@ async function getOpportunityMarketOptionAddress(market, optionIndex, programId
|
|
|
11440
11437
|
});
|
|
11441
11438
|
}
|
|
11442
11439
|
|
|
11443
|
-
// src/accounts/
|
|
11440
|
+
// src/accounts/shareAccount.ts
|
|
11444
11441
|
import {
|
|
11445
11442
|
getAddressEncoder as getAddressEncoder60,
|
|
11446
11443
|
getProgramDerivedAddress as getProgramDerivedAddress27
|
|
11447
11444
|
} from "@solana/kit";
|
|
11445
|
+
var SHARE_ACCOUNT_SEED = "share_account";
|
|
11446
|
+
async function getShareAccountAddress(owner, market, shareAccountId, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
11447
|
+
const addressEncoder = getAddressEncoder60();
|
|
11448
|
+
const idBytes = new Uint8Array(4);
|
|
11449
|
+
new DataView(idBytes.buffer).setUint32(0, shareAccountId, true);
|
|
11450
|
+
return getProgramDerivedAddress27({
|
|
11451
|
+
programAddress: programId,
|
|
11452
|
+
seeds: [
|
|
11453
|
+
SHARE_ACCOUNT_SEED,
|
|
11454
|
+
addressEncoder.encode(owner),
|
|
11455
|
+
addressEncoder.encode(market),
|
|
11456
|
+
idBytes
|
|
11457
|
+
]
|
|
11458
|
+
});
|
|
11459
|
+
}
|
|
11460
|
+
|
|
11461
|
+
// src/accounts/tokenVault.ts
|
|
11462
|
+
import {
|
|
11463
|
+
getAddressEncoder as getAddressEncoder61,
|
|
11464
|
+
getProgramDerivedAddress as getProgramDerivedAddress28
|
|
11465
|
+
} from "@solana/kit";
|
|
11448
11466
|
var TOKEN_VAULT_SEED = "token_vault";
|
|
11449
11467
|
async function getTokenVaultAddress(mint, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
11450
|
-
return
|
|
11468
|
+
return getProgramDerivedAddress28({
|
|
11451
11469
|
programAddress: programId,
|
|
11452
|
-
seeds: [TOKEN_VAULT_SEED,
|
|
11470
|
+
seeds: [TOKEN_VAULT_SEED, getAddressEncoder61().encode(mint)]
|
|
11453
11471
|
});
|
|
11454
11472
|
}
|
|
11455
11473
|
|
|
11456
11474
|
// src/arcium/awaitFinalizeComputation.ts
|
|
11457
|
-
import { getAddressEncoder as
|
|
11475
|
+
import { getAddressEncoder as getAddressEncoder62 } from "@solana/kit";
|
|
11458
11476
|
|
|
11459
11477
|
// src/arcium/constants.ts
|
|
11460
11478
|
var ARCIUM_PROGRAM_ID = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
@@ -11483,7 +11501,7 @@ var awaitBatchComputationFinalization = async (rpc, computationOffsets, options)
|
|
|
11483
11501
|
}
|
|
11484
11502
|
const mxeProgramId = options?.mxeProgramId ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
11485
11503
|
const commitment = options?.commitment ?? "confirmed";
|
|
11486
|
-
const mxeProgramIdBytes =
|
|
11504
|
+
const mxeProgramIdBytes = getAddressEncoder62().encode(mxeProgramId);
|
|
11487
11505
|
const transactionCountLimit = options?.transactionCountLimit ?? 100;
|
|
11488
11506
|
const pollInterval = options?.pollInterval ?? 1e3;
|
|
11489
11507
|
const maxAttempts = options?.maxAttempts ?? 120;
|
|
@@ -11655,6 +11673,7 @@ export {
|
|
|
11655
11673
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
11656
11674
|
OPPORTUNITY_MARKET_OPTION_SEED,
|
|
11657
11675
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|
|
11676
|
+
OPPORTUNITY_MARKET_SEED,
|
|
11658
11677
|
OpportunityMarketAccount,
|
|
11659
11678
|
OpportunityMarketInstruction,
|
|
11660
11679
|
Output,
|
|
@@ -12003,6 +12022,7 @@ export {
|
|
|
12003
12022
|
getOpenMarketInstructionDataCodec,
|
|
12004
12023
|
getOpenMarketInstructionDataDecoder,
|
|
12005
12024
|
getOpenMarketInstructionDataEncoder,
|
|
12025
|
+
getOpportunityMarketAddress,
|
|
12006
12026
|
getOpportunityMarketCodec,
|
|
12007
12027
|
getOpportunityMarketDecoder,
|
|
12008
12028
|
getOpportunityMarketDiscriminatorBytes,
|
package/dist/index.cjs
CHANGED
|
@@ -98,6 +98,7 @@ __export(index_exports, {
|
|
|
98
98
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR: () => OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
99
99
|
OPPORTUNITY_MARKET_OPTION_SEED: () => OPPORTUNITY_MARKET_OPTION_SEED,
|
|
100
100
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS: () => OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|
|
101
|
+
OPPORTUNITY_MARKET_SEED: () => OPPORTUNITY_MARKET_SEED,
|
|
101
102
|
OpportunityMarketAccount: () => OpportunityMarketAccount,
|
|
102
103
|
OpportunityMarketInstruction: () => OpportunityMarketInstruction,
|
|
103
104
|
Output: () => Output,
|
|
@@ -446,6 +447,7 @@ __export(index_exports, {
|
|
|
446
447
|
getOpenMarketInstructionDataCodec: () => getOpenMarketInstructionDataCodec,
|
|
447
448
|
getOpenMarketInstructionDataDecoder: () => getOpenMarketInstructionDataDecoder,
|
|
448
449
|
getOpenMarketInstructionDataEncoder: () => getOpenMarketInstructionDataEncoder,
|
|
450
|
+
getOpportunityMarketAddress: () => getOpportunityMarketAddress,
|
|
449
451
|
getOpportunityMarketCodec: () => getOpportunityMarketCodec,
|
|
450
452
|
getOpportunityMarketDecoder: () => getOpportunityMarketDecoder,
|
|
451
453
|
getOpportunityMarketDiscriminatorBytes: () => getOpportunityMarketDiscriminatorBytes,
|
|
@@ -3293,7 +3295,7 @@ var import_kit66 = require("@solana/kit");
|
|
|
3293
3295
|
|
|
3294
3296
|
// src/generated/programs/opportunityMarket.ts
|
|
3295
3297
|
var import_kit65 = require("@solana/kit");
|
|
3296
|
-
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "
|
|
3298
|
+
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "bncZ1gDqgqhSWFzcxjeMoCtqN7odS8wYn1nS5tXZ9jA";
|
|
3297
3299
|
var OpportunityMarketAccount = /* @__PURE__ */ ((OpportunityMarketAccount2) => {
|
|
3298
3300
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ArciumSignerAccount"] = 0] = "ArciumSignerAccount";
|
|
3299
3301
|
OpportunityMarketAccount2[OpportunityMarketAccount2["CentralState"] = 1] = "CentralState";
|
|
@@ -10721,20 +10723,16 @@ async function getEphemeralEncryptedTokenAccountAddress(tokenMint, owner, index,
|
|
|
10721
10723
|
return getEncryptedTokenAccountAddressWithIndex(tokenMint, owner, index, programId);
|
|
10722
10724
|
}
|
|
10723
10725
|
|
|
10724
|
-
// src/accounts/
|
|
10726
|
+
// src/accounts/opportunityMarket.ts
|
|
10725
10727
|
var import_kit110 = require("@solana/kit");
|
|
10726
|
-
var
|
|
10727
|
-
async function
|
|
10728
|
-
const addressEncoder = (0, import_kit110.getAddressEncoder)();
|
|
10729
|
-
const idBytes = new Uint8Array(4);
|
|
10730
|
-
new DataView(idBytes.buffer).setUint32(0, shareAccountId, true);
|
|
10728
|
+
var OPPORTUNITY_MARKET_SEED = "opportunity_market";
|
|
10729
|
+
async function getOpportunityMarketAddress(creator, marketIndex, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
10731
10730
|
return (0, import_kit110.getProgramDerivedAddress)({
|
|
10732
10731
|
programAddress: programId,
|
|
10733
10732
|
seeds: [
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
idBytes
|
|
10733
|
+
OPPORTUNITY_MARKET_SEED,
|
|
10734
|
+
(0, import_kit110.getAddressEncoder)().encode(creator),
|
|
10735
|
+
(0, import_kit110.getU64Encoder)().encode(BigInt(marketIndex))
|
|
10738
10736
|
]
|
|
10739
10737
|
});
|
|
10740
10738
|
}
|
|
@@ -10753,18 +10751,36 @@ async function getOpportunityMarketOptionAddress(market, optionIndex, programId
|
|
|
10753
10751
|
});
|
|
10754
10752
|
}
|
|
10755
10753
|
|
|
10756
|
-
// src/accounts/
|
|
10754
|
+
// src/accounts/shareAccount.ts
|
|
10757
10755
|
var import_kit112 = require("@solana/kit");
|
|
10756
|
+
var SHARE_ACCOUNT_SEED = "share_account";
|
|
10757
|
+
async function getShareAccountAddress(owner, market, shareAccountId, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
10758
|
+
const addressEncoder = (0, import_kit112.getAddressEncoder)();
|
|
10759
|
+
const idBytes = new Uint8Array(4);
|
|
10760
|
+
new DataView(idBytes.buffer).setUint32(0, shareAccountId, true);
|
|
10761
|
+
return (0, import_kit112.getProgramDerivedAddress)({
|
|
10762
|
+
programAddress: programId,
|
|
10763
|
+
seeds: [
|
|
10764
|
+
SHARE_ACCOUNT_SEED,
|
|
10765
|
+
addressEncoder.encode(owner),
|
|
10766
|
+
addressEncoder.encode(market),
|
|
10767
|
+
idBytes
|
|
10768
|
+
]
|
|
10769
|
+
});
|
|
10770
|
+
}
|
|
10771
|
+
|
|
10772
|
+
// src/accounts/tokenVault.ts
|
|
10773
|
+
var import_kit113 = require("@solana/kit");
|
|
10758
10774
|
var TOKEN_VAULT_SEED = "token_vault";
|
|
10759
10775
|
async function getTokenVaultAddress(mint, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
10760
|
-
return (0,
|
|
10776
|
+
return (0, import_kit113.getProgramDerivedAddress)({
|
|
10761
10777
|
programAddress: programId,
|
|
10762
|
-
seeds: [TOKEN_VAULT_SEED, (0,
|
|
10778
|
+
seeds: [TOKEN_VAULT_SEED, (0, import_kit113.getAddressEncoder)().encode(mint)]
|
|
10763
10779
|
});
|
|
10764
10780
|
}
|
|
10765
10781
|
|
|
10766
10782
|
// src/arcium/awaitFinalizeComputation.ts
|
|
10767
|
-
var
|
|
10783
|
+
var import_kit114 = require("@solana/kit");
|
|
10768
10784
|
|
|
10769
10785
|
// src/arcium/constants.ts
|
|
10770
10786
|
var ARCIUM_PROGRAM_ID = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
@@ -10793,7 +10809,7 @@ var awaitBatchComputationFinalization = async (rpc, computationOffsets, options)
|
|
|
10793
10809
|
}
|
|
10794
10810
|
const mxeProgramId = options?.mxeProgramId ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
10795
10811
|
const commitment = options?.commitment ?? "confirmed";
|
|
10796
|
-
const mxeProgramIdBytes = (0,
|
|
10812
|
+
const mxeProgramIdBytes = (0, import_kit114.getAddressEncoder)().encode(mxeProgramId);
|
|
10797
10813
|
const transactionCountLimit = options?.transactionCountLimit ?? 100;
|
|
10798
10814
|
const pollInterval = options?.pollInterval ?? 1e3;
|
|
10799
10815
|
const maxAttempts = options?.maxAttempts ?? 120;
|
|
@@ -10966,6 +10982,7 @@ function nonceToBytes(nonce) {
|
|
|
10966
10982
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
10967
10983
|
OPPORTUNITY_MARKET_OPTION_SEED,
|
|
10968
10984
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|
|
10985
|
+
OPPORTUNITY_MARKET_SEED,
|
|
10969
10986
|
OpportunityMarketAccount,
|
|
10970
10987
|
OpportunityMarketInstruction,
|
|
10971
10988
|
Output,
|
|
@@ -11314,6 +11331,7 @@ function nonceToBytes(nonce) {
|
|
|
11314
11331
|
getOpenMarketInstructionDataCodec,
|
|
11315
11332
|
getOpenMarketInstructionDataDecoder,
|
|
11316
11333
|
getOpenMarketInstructionDataEncoder,
|
|
11334
|
+
getOpportunityMarketAddress,
|
|
11317
11335
|
getOpportunityMarketCodec,
|
|
11318
11336
|
getOpportunityMarketDecoder,
|
|
11319
11337
|
getOpportunityMarketDiscriminatorBytes,
|