@bench.games/conviction-markets 0.1.2 → 0.1.4
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/utils/arcium.d.ts +62 -1
- package/dist/utils/arcium.d.ts.map +1 -1
- package/dist/utils/arcium.js +92 -2
- package/dist/utils/arcium.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/arcium.d.ts
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import type { BN } from "@coral-xyz/anchor";
|
|
3
|
+
/**
|
|
4
|
+
* Arcium cluster offset for devnet
|
|
5
|
+
*/
|
|
1
6
|
export declare const ARCIUM_CLUSTER_OFFSET = 456;
|
|
2
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Pre-computed Arcium addresses for the cluster
|
|
9
|
+
* These are constant for ARCIUM_CLUSTER_OFFSET = 456
|
|
10
|
+
*/
|
|
11
|
+
export declare const CLUSTER_ADDRESS: PublicKey;
|
|
12
|
+
export declare const MEMPOOL_ADDRESS: PublicKey;
|
|
13
|
+
export declare const EXECUTING_POOL_ADDRESS: PublicKey;
|
|
14
|
+
/**
|
|
15
|
+
* Pre-computed MXE address for the program
|
|
16
|
+
*/
|
|
17
|
+
export declare const MXE_ADDRESS: PublicKey;
|
|
18
|
+
/**
|
|
19
|
+
* Pre-computed MXE X25519 public key for encryption
|
|
20
|
+
* This is the encryption key used for MPC computations
|
|
21
|
+
*/
|
|
22
|
+
export declare const MXE_X25519_PUBKEY: Uint8Array<ArrayBuffer>;
|
|
23
|
+
/**
|
|
24
|
+
* Pre-computed computation definition addresses
|
|
25
|
+
* These are constant for the program and computation definition names
|
|
26
|
+
*/
|
|
27
|
+
export declare const COMP_DEF_ADDRESSES: {
|
|
28
|
+
readonly INIT_VOTE_TOKEN_ACCOUNT: PublicKey;
|
|
29
|
+
readonly BUY_VOTE_TOKENS: PublicKey;
|
|
30
|
+
readonly CLAIM_VOTE_TOKENS: PublicKey;
|
|
31
|
+
readonly BUY_CONVICTION_MARKET_SHARES: PublicKey;
|
|
32
|
+
readonly INIT_MARKET_SHARES: PublicKey;
|
|
33
|
+
readonly REVEAL_SHARES: PublicKey;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Returns the cluster address
|
|
37
|
+
* @deprecated Use CLUSTER_ADDRESS constant instead
|
|
38
|
+
*/
|
|
39
|
+
export declare function getClusterAddress(): PublicKey;
|
|
40
|
+
/**
|
|
41
|
+
* Derives the computation account address for a given offset
|
|
42
|
+
* This replicates the PDA derivation from Arcium's getComputationAccAddress
|
|
43
|
+
*
|
|
44
|
+
* @param clusterOffset - The cluster offset (should be ARCIUM_CLUSTER_OFFSET)
|
|
45
|
+
* @param computationOffset - The unique computation offset
|
|
46
|
+
* @returns The computation account public key
|
|
47
|
+
*/
|
|
48
|
+
export declare function getComputationAccAddress(clusterOffset: number, computationOffset: BN): PublicKey;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the MXE address for the program
|
|
51
|
+
* @deprecated Use MXE_ADDRESS constant instead
|
|
52
|
+
*/
|
|
53
|
+
export declare function getMXEAccAddress(): PublicKey;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the mempool address
|
|
56
|
+
* @deprecated Use MEMPOOL_ADDRESS constant instead
|
|
57
|
+
*/
|
|
58
|
+
export declare function getMempoolAccAddress(): PublicKey;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the executing pool address
|
|
61
|
+
* @deprecated Use EXECUTING_POOL_ADDRESS constant instead
|
|
62
|
+
*/
|
|
63
|
+
export declare function getExecutingPoolAccAddress(): PublicKey;
|
|
3
64
|
//# sourceMappingURL=arcium.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcium.d.ts","sourceRoot":"","sources":["../../src/utils/arcium.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arcium.d.ts","sourceRoot":"","sources":["../../src/utils/arcium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,WAE3B,CAAC;AACF,eAAO,MAAM,eAAe,WAE3B,CAAC;AACF,eAAO,MAAM,sBAAsB,WAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,WAEvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,yBAG5B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;CAmBrB,CAAC;AAEX;;;GAGG;AACH,wBAAgB,iBAAiB,cAEhC;AAcD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,EAAE,GACpB,SAAS,CAwBX;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,CAE5C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,CAEhD;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,SAAS,CAEtD"}
|
package/dist/utils/arcium.js
CHANGED
|
@@ -1,6 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Arcium cluster offset for devnet
|
|
4
|
+
*/
|
|
2
5
|
export const ARCIUM_CLUSTER_OFFSET = 456;
|
|
6
|
+
/**
|
|
7
|
+
* Pre-computed Arcium addresses for the cluster
|
|
8
|
+
* These are constant for ARCIUM_CLUSTER_OFFSET = 456
|
|
9
|
+
*/
|
|
10
|
+
export const CLUSTER_ADDRESS = new PublicKey("DzaQCyfybroycrNqE5Gk7LhSbWD2qfCics6qptBFbr95");
|
|
11
|
+
export const MEMPOOL_ADDRESS = new PublicKey("Ex7BD8o8PK1y2eXDd38Jgujj93uHygrZeWXDeGAHmHtN");
|
|
12
|
+
export const EXECUTING_POOL_ADDRESS = new PublicKey("4mcrgNZzJwwKrE3wXMHfepT8htSBmGqBzDYPJijWooog");
|
|
13
|
+
/**
|
|
14
|
+
* Pre-computed MXE address for the program
|
|
15
|
+
*/
|
|
16
|
+
export const MXE_ADDRESS = new PublicKey("9ZtprvNpFCzxuKewDRpmByWLXrxFfGZcrfY6TZTdpvGu");
|
|
17
|
+
/**
|
|
18
|
+
* Pre-computed MXE X25519 public key for encryption
|
|
19
|
+
* This is the encryption key used for MPC computations
|
|
20
|
+
*/
|
|
21
|
+
export const MXE_X25519_PUBKEY = new Uint8Array([
|
|
22
|
+
86, 128, 27, 68, 105, 225, 151, 107, 234, 191, 106, 144, 73, 64, 231, 222,
|
|
23
|
+
106, 54, 63, 75, 115, 210, 248, 234, 23, 107, 255, 189, 49, 228, 35, 32,
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Pre-computed computation definition addresses
|
|
27
|
+
* These are constant for the program and computation definition names
|
|
28
|
+
*/
|
|
29
|
+
export const COMP_DEF_ADDRESSES = {
|
|
30
|
+
INIT_VOTE_TOKEN_ACCOUNT: new PublicKey("8cJL5BUsL8RtZfZ221M787Vm5kYptFUY65HEZRnX8J6U"),
|
|
31
|
+
BUY_VOTE_TOKENS: new PublicKey("6tqXdWgxnLVn9iVgaMR5rHezWBWJNAEHYq9TLcM9Qu1B"),
|
|
32
|
+
CLAIM_VOTE_TOKENS: new PublicKey("BMbKGJUuSEf198ZNWrFfihBG5PhC6fbLeVRheYpyyzW9"),
|
|
33
|
+
BUY_CONVICTION_MARKET_SHARES: new PublicKey("7DZfQXSRViCZUyzdCxbJnTPgVJJZ4H7a2PZyLfcmp8Np"),
|
|
34
|
+
INIT_MARKET_SHARES: new PublicKey("3PoitQnNeBTDUvPBm8NRDn8tgfvK2rTBFHS2xzZv72tb"),
|
|
35
|
+
REVEAL_SHARES: new PublicKey("DUDK7NEvBXta65uqSX12TNEcNSJYoterhVB9nfkfhA8f"),
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Returns the cluster address
|
|
39
|
+
* @deprecated Use CLUSTER_ADDRESS constant instead
|
|
40
|
+
*/
|
|
3
41
|
export function getClusterAddress() {
|
|
4
|
-
return
|
|
42
|
+
return CLUSTER_ADDRESS;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Arcium program ID for PDA derivation
|
|
46
|
+
*/
|
|
47
|
+
const ARCIUM_PROGRAM_ID = new PublicKey("ARCGL1vmM2YKqmxjVV8LaD9Qi98N2CvT6jjzk6QmqLM");
|
|
48
|
+
/**
|
|
49
|
+
* Computation account seed constant
|
|
50
|
+
*/
|
|
51
|
+
const COMPUTATION_ACC_SEED = "ComputationAccount";
|
|
52
|
+
/**
|
|
53
|
+
* Derives the computation account address for a given offset
|
|
54
|
+
* This replicates the PDA derivation from Arcium's getComputationAccAddress
|
|
55
|
+
*
|
|
56
|
+
* @param clusterOffset - The cluster offset (should be ARCIUM_CLUSTER_OFFSET)
|
|
57
|
+
* @param computationOffset - The unique computation offset
|
|
58
|
+
* @returns The computation account public key
|
|
59
|
+
*/
|
|
60
|
+
export function getComputationAccAddress(clusterOffset, computationOffset) {
|
|
61
|
+
// Convert cluster offset to buffer (u32 LE)
|
|
62
|
+
const clusterOffsetBuffer = Buffer.alloc(4);
|
|
63
|
+
clusterOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
64
|
+
// Convert computation offset to buffer (u64 LE) using BN's toArrayLike
|
|
65
|
+
const computationOffsetBuffer = computationOffset.toArrayLike(Buffer, "le", 8);
|
|
66
|
+
// The computation account PDA is derived with seeds:
|
|
67
|
+
// ["ComputationAccount", cluster_offset_bytes, computation_offset_bytes]
|
|
68
|
+
const [computationAddress] = PublicKey.findProgramAddressSync([
|
|
69
|
+
Buffer.from(COMPUTATION_ACC_SEED),
|
|
70
|
+
clusterOffsetBuffer,
|
|
71
|
+
computationOffsetBuffer,
|
|
72
|
+
], ARCIUM_PROGRAM_ID);
|
|
73
|
+
return computationAddress;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns the MXE address for the program
|
|
77
|
+
* @deprecated Use MXE_ADDRESS constant instead
|
|
78
|
+
*/
|
|
79
|
+
export function getMXEAccAddress() {
|
|
80
|
+
return MXE_ADDRESS;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Returns the mempool address
|
|
84
|
+
* @deprecated Use MEMPOOL_ADDRESS constant instead
|
|
85
|
+
*/
|
|
86
|
+
export function getMempoolAccAddress() {
|
|
87
|
+
return MEMPOOL_ADDRESS;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns the executing pool address
|
|
91
|
+
* @deprecated Use EXECUTING_POOL_ADDRESS constant instead
|
|
92
|
+
*/
|
|
93
|
+
export function getExecutingPoolAccAddress() {
|
|
94
|
+
return EXECUTING_POOL_ADDRESS;
|
|
5
95
|
}
|
|
6
96
|
//# sourceMappingURL=arcium.js.map
|
package/dist/utils/arcium.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcium.js","sourceRoot":"","sources":["../../src/utils/arcium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"arcium.js","sourceRoot":"","sources":["../../src/utils/arcium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,SAAS,CAC1C,8CAA8C,CAC/C,CAAC;AACF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,SAAS,CAC1C,8CAA8C,CAC/C,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,SAAS,CACjD,8CA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