@arcium-hq/client 0.8.2 → 0.8.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/build/index.cjs +177 -41
- package/build/index.d.ts +161 -25
- package/build/index.mjs +177 -41
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -1809,7 +1809,7 @@ function createPacker(fields, typeName = 'Packer') {
|
|
|
1809
1809
|
var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
1810
1810
|
var metadata = {
|
|
1811
1811
|
name: "arcium",
|
|
1812
|
-
version: "0.8.
|
|
1812
|
+
version: "0.8.4",
|
|
1813
1813
|
spec: "0.1.0",
|
|
1814
1814
|
description: "The Arcium program"
|
|
1815
1815
|
};
|
|
@@ -6468,6 +6468,85 @@ var instructions = [
|
|
|
6468
6468
|
}
|
|
6469
6469
|
]
|
|
6470
6470
|
},
|
|
6471
|
+
{
|
|
6472
|
+
name: "init_recovery_peer_account",
|
|
6473
|
+
discriminator: [
|
|
6474
|
+
116,
|
|
6475
|
+
29,
|
|
6476
|
+
20,
|
|
6477
|
+
126,
|
|
6478
|
+
177,
|
|
6479
|
+
149,
|
|
6480
|
+
50,
|
|
6481
|
+
147
|
|
6482
|
+
],
|
|
6483
|
+
accounts: [
|
|
6484
|
+
{
|
|
6485
|
+
name: "signer",
|
|
6486
|
+
writable: true,
|
|
6487
|
+
signer: true
|
|
6488
|
+
},
|
|
6489
|
+
{
|
|
6490
|
+
name: "recovery_peer_account",
|
|
6491
|
+
writable: true,
|
|
6492
|
+
pda: {
|
|
6493
|
+
seeds: [
|
|
6494
|
+
{
|
|
6495
|
+
kind: "const",
|
|
6496
|
+
value: [
|
|
6497
|
+
82,
|
|
6498
|
+
101,
|
|
6499
|
+
99,
|
|
6500
|
+
111,
|
|
6501
|
+
118,
|
|
6502
|
+
101,
|
|
6503
|
+
114,
|
|
6504
|
+
121,
|
|
6505
|
+
80,
|
|
6506
|
+
101,
|
|
6507
|
+
101,
|
|
6508
|
+
114,
|
|
6509
|
+
65,
|
|
6510
|
+
99,
|
|
6511
|
+
99,
|
|
6512
|
+
111,
|
|
6513
|
+
117,
|
|
6514
|
+
110,
|
|
6515
|
+
116
|
|
6516
|
+
]
|
|
6517
|
+
},
|
|
6518
|
+
{
|
|
6519
|
+
kind: "arg",
|
|
6520
|
+
path: "peer_offset"
|
|
6521
|
+
}
|
|
6522
|
+
]
|
|
6523
|
+
}
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
name: "system_program",
|
|
6527
|
+
address: "11111111111111111111111111111111"
|
|
6528
|
+
}
|
|
6529
|
+
],
|
|
6530
|
+
args: [
|
|
6531
|
+
{
|
|
6532
|
+
name: "peer_offset",
|
|
6533
|
+
type: "u32"
|
|
6534
|
+
},
|
|
6535
|
+
{
|
|
6536
|
+
name: "authority",
|
|
6537
|
+
type: "pubkey"
|
|
6538
|
+
},
|
|
6539
|
+
{
|
|
6540
|
+
name: "x25519_pubkey",
|
|
6541
|
+
type: {
|
|
6542
|
+
array: [
|
|
6543
|
+
"u8",
|
|
6544
|
+
32
|
|
6545
|
+
]
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
]
|
|
6549
|
+
},
|
|
6471
6550
|
{
|
|
6472
6551
|
name: "join_cluster",
|
|
6473
6552
|
discriminator: [
|
|
@@ -8840,29 +8919,41 @@ var instructions = [
|
|
|
8840
8919
|
],
|
|
8841
8920
|
accounts: [
|
|
8842
8921
|
{
|
|
8843
|
-
name: "
|
|
8922
|
+
name: "signer",
|
|
8844
8923
|
writable: true,
|
|
8845
8924
|
signer: true
|
|
8846
8925
|
},
|
|
8847
8926
|
{
|
|
8848
|
-
name: "
|
|
8927
|
+
name: "recovery_peer_account",
|
|
8849
8928
|
pda: {
|
|
8850
8929
|
seeds: [
|
|
8851
8930
|
{
|
|
8852
8931
|
kind: "const",
|
|
8853
8932
|
value: [
|
|
8854
|
-
|
|
8933
|
+
82,
|
|
8934
|
+
101,
|
|
8935
|
+
99,
|
|
8936
|
+
111,
|
|
8937
|
+
118,
|
|
8938
|
+
101,
|
|
8855
8939
|
114,
|
|
8856
|
-
|
|
8857
|
-
|
|
8940
|
+
121,
|
|
8941
|
+
80,
|
|
8942
|
+
101,
|
|
8943
|
+
101,
|
|
8944
|
+
114,
|
|
8945
|
+
65,
|
|
8946
|
+
99,
|
|
8947
|
+
99,
|
|
8858
8948
|
111,
|
|
8859
|
-
|
|
8860
|
-
|
|
8949
|
+
117,
|
|
8950
|
+
110,
|
|
8951
|
+
116
|
|
8861
8952
|
]
|
|
8862
8953
|
},
|
|
8863
8954
|
{
|
|
8864
8955
|
kind: "arg",
|
|
8865
|
-
path: "
|
|
8956
|
+
path: "peer_offset"
|
|
8866
8957
|
}
|
|
8867
8958
|
]
|
|
8868
8959
|
}
|
|
@@ -8987,7 +9078,7 @@ var instructions = [
|
|
|
8987
9078
|
type: "pubkey"
|
|
8988
9079
|
},
|
|
8989
9080
|
{
|
|
8990
|
-
name: "
|
|
9081
|
+
name: "peer_offset",
|
|
8991
9082
|
type: "u32"
|
|
8992
9083
|
},
|
|
8993
9084
|
{
|
|
@@ -9512,6 +9603,19 @@ var accounts = [
|
|
|
9512
9603
|
183
|
|
9513
9604
|
]
|
|
9514
9605
|
},
|
|
9606
|
+
{
|
|
9607
|
+
name: "RecoveryPeerAccount",
|
|
9608
|
+
discriminator: [
|
|
9609
|
+
126,
|
|
9610
|
+
243,
|
|
9611
|
+
17,
|
|
9612
|
+
238,
|
|
9613
|
+
223,
|
|
9614
|
+
222,
|
|
9615
|
+
130,
|
|
9616
|
+
120
|
|
9617
|
+
]
|
|
9618
|
+
},
|
|
9515
9619
|
{
|
|
9516
9620
|
name: "SmallExecPool",
|
|
9517
9621
|
discriminator: [
|
|
@@ -10483,7 +10587,7 @@ var types = [
|
|
|
10483
10587
|
{
|
|
10484
10588
|
name: "x25519_pubkey",
|
|
10485
10589
|
docs: [
|
|
10486
|
-
"X25519 public key
|
|
10590
|
+
"X25519 public key. MUST BE AT byte index 8 - 40"
|
|
10487
10591
|
],
|
|
10488
10592
|
type: {
|
|
10489
10593
|
array: [
|
|
@@ -12090,7 +12194,7 @@ var types = [
|
|
|
12090
12194
|
{
|
|
12091
12195
|
name: "ip",
|
|
12092
12196
|
docs: [
|
|
12093
|
-
"
|
|
12197
|
+
"`Ipv4Addr`, represented by its 4 octets"
|
|
12094
12198
|
],
|
|
12095
12199
|
type: {
|
|
12096
12200
|
array: [
|
|
@@ -12505,6 +12609,38 @@ var types = [
|
|
|
12505
12609
|
]
|
|
12506
12610
|
}
|
|
12507
12611
|
},
|
|
12612
|
+
{
|
|
12613
|
+
name: "RecoveryPeerAccount",
|
|
12614
|
+
serialization: "bytemuck",
|
|
12615
|
+
repr: {
|
|
12616
|
+
kind: "c"
|
|
12617
|
+
},
|
|
12618
|
+
type: {
|
|
12619
|
+
kind: "struct",
|
|
12620
|
+
fields: [
|
|
12621
|
+
{
|
|
12622
|
+
name: "authority",
|
|
12623
|
+
type: "pubkey"
|
|
12624
|
+
},
|
|
12625
|
+
{
|
|
12626
|
+
name: "x25519_pubkey",
|
|
12627
|
+
docs: [
|
|
12628
|
+
"DO NOT PUT ANYTHING ELSE BEFORE THE X25519_PUBKEY FIELD, IT'S EXPECTED TO BE AT OFFSET 40."
|
|
12629
|
+
],
|
|
12630
|
+
type: {
|
|
12631
|
+
array: [
|
|
12632
|
+
"u8",
|
|
12633
|
+
32
|
|
12634
|
+
]
|
|
12635
|
+
}
|
|
12636
|
+
},
|
|
12637
|
+
{
|
|
12638
|
+
name: "bump",
|
|
12639
|
+
type: "u8"
|
|
12640
|
+
}
|
|
12641
|
+
]
|
|
12642
|
+
}
|
|
12643
|
+
},
|
|
12508
12644
|
{
|
|
12509
12645
|
name: "SetUnset",
|
|
12510
12646
|
docs: [
|
|
@@ -13469,19 +13605,19 @@ async function getMXEUtilityKey(provider, mxeProgramId, field) {
|
|
|
13469
13605
|
return null;
|
|
13470
13606
|
}
|
|
13471
13607
|
/**
|
|
13472
|
-
* Fetches and extracts the MXE
|
|
13608
|
+
* Fetches and extracts the MXE X25519 public key from the MXE account.
|
|
13473
13609
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
13474
13610
|
* @param mxeProgramId - The public key of the MXE program.
|
|
13475
|
-
* @returns The MXE's
|
|
13611
|
+
* @returns The MXE's X25519 public key as a Uint8Array, or null if not set.
|
|
13476
13612
|
*/
|
|
13477
13613
|
async function getMXEPublicKey(provider, mxeProgramId) {
|
|
13478
13614
|
return getMXEUtilityKey(provider, mxeProgramId, 'x25519Pubkey');
|
|
13479
13615
|
}
|
|
13480
13616
|
/**
|
|
13481
|
-
* Fetches and extracts the MXE arcis
|
|
13617
|
+
* Fetches and extracts the MXE arcis Ed25519 verifying key from the MXE account.
|
|
13482
13618
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
13483
13619
|
* @param mxeProgramId - The public key of the MXE program.
|
|
13484
|
-
* @returns The MXE's arcis
|
|
13620
|
+
* @returns The MXE's arcis Ed25519 verifying key as a Uint8Array, or null if not set.
|
|
13485
13621
|
*/
|
|
13486
13622
|
async function getMXEArcisEd25519VerifyingKey(provider, mxeProgramId) {
|
|
13487
13623
|
return getMXEUtilityKey(provider, mxeProgramId, 'ed25519VerifyingKey');
|
|
@@ -13511,7 +13647,7 @@ function getCircuitState(circuitSource) {
|
|
|
13511
13647
|
* @param chunkSize - The number of upload transactions to send in parallel (default: 500).
|
|
13512
13648
|
* @returns An array of transaction signatures for all upload and finalize transactions.
|
|
13513
13649
|
*/
|
|
13514
|
-
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500) {
|
|
13650
|
+
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500, confirmOptions) {
|
|
13515
13651
|
const compDefAccInfo = getCompDefAccInfo(circuitName, mxeProgramId);
|
|
13516
13652
|
const program = getArciumProgram(provider);
|
|
13517
13653
|
const compDefAcc = await program.account.computationDefinitionAccount.fetch(compDefAccInfo.pubkey);
|
|
@@ -13526,11 +13662,11 @@ async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, lo
|
|
|
13526
13662
|
const sigs = [];
|
|
13527
13663
|
const uploadPromises = [];
|
|
13528
13664
|
for (let i = 0; i < numAccs; i++) {
|
|
13529
|
-
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo, mxeProgramId, logging, chunkSize));
|
|
13665
|
+
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo, mxeProgramId, logging, chunkSize, confirmOptions));
|
|
13530
13666
|
}
|
|
13531
13667
|
sigs.push(...(await Promise.all(uploadPromises)).flat());
|
|
13532
13668
|
const finalizeCompDefTx = await buildFinalizeCompDefTx(provider, compDefAccInfo.offset, mxeProgramId);
|
|
13533
|
-
sigs.push(await signAndSendWithBlockhash(provider, finalizeCompDefTx, await provider.connection.getLatestBlockhash()));
|
|
13669
|
+
sigs.push(await signAndSendWithBlockhash(provider, finalizeCompDefTx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions));
|
|
13534
13670
|
return sigs;
|
|
13535
13671
|
}
|
|
13536
13672
|
async function queueKeyRecoveryInit(provider, clusterOffset, mxeProgramId, confirmOptions) {
|
|
@@ -13564,7 +13700,7 @@ async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
|
|
|
13564
13700
|
})
|
|
13565
13701
|
.transaction();
|
|
13566
13702
|
}
|
|
13567
|
-
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500) {
|
|
13703
|
+
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500, confirmOptions) {
|
|
13568
13704
|
const rawCircuitPda = getRawCircuitAccAddress(compDefAccInfo.pubkey, rawCircuitIndex);
|
|
13569
13705
|
const existingAcc = await provider.connection.getAccountInfo(rawCircuitPda);
|
|
13570
13706
|
// Skip entirely if account exists with correct size (pre-seeded at genesis or already uploaded)
|
|
@@ -13594,10 +13730,10 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13594
13730
|
const tx = await buildResizeTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, rawCircuitIndex, MAX_REALLOC_PER_IX
|
|
13595
13731
|
+ i * (MAX_REALLOC_PER_IX * MAX_EMBIGGEN_IX_PER_TX), rawCircuitPart.length);
|
|
13596
13732
|
// eslint-disable-next-line no-await-in-loop
|
|
13597
|
-
const blockInfo = await provider.connection.getLatestBlockhash();
|
|
13733
|
+
const blockInfo = await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' });
|
|
13598
13734
|
sigs.push(
|
|
13599
13735
|
// eslint-disable-next-line no-await-in-loop
|
|
13600
|
-
await signAndSendWithBlockhash(provider, tx, blockInfo));
|
|
13736
|
+
await signAndSendWithBlockhash(provider, tx, blockInfo, confirmOptions));
|
|
13601
13737
|
optionalLog(shouldLog, `Sent resize tx ${i} of ${nonAsyncTxCount}`);
|
|
13602
13738
|
}
|
|
13603
13739
|
}
|
|
@@ -13606,7 +13742,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13606
13742
|
const remainingTxCount = Math.ceil(rawCircuitPart.length / MAX_UPLOAD_PER_TX_BYTES);
|
|
13607
13743
|
optionalLog(shouldLog, `Sending ${remainingTxCount} upload txs`);
|
|
13608
13744
|
const remainingTxs = [];
|
|
13609
|
-
const blockInfo = await provider.connection.getLatestBlockhash();
|
|
13745
|
+
const blockInfo = await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' });
|
|
13610
13746
|
for (let i = 0; i < remainingTxCount; i += chunkSize) {
|
|
13611
13747
|
optionalLog(shouldLog, `Sending chunk ${i / chunkSize + 1} of ${Math.ceil(remainingTxCount / chunkSize)}`);
|
|
13612
13748
|
// Array to hold promises for the current chunk
|
|
@@ -13617,7 +13753,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13617
13753
|
const offset = MAX_UPLOAD_PER_TX_BYTES * (i + j);
|
|
13618
13754
|
// eslint-disable-next-line no-await-in-loop
|
|
13619
13755
|
const tx = await buildUploadCircuitTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, Buffer.copyBytesFrom(rawCircuitPart, offset, MAX_UPLOAD_PER_TX_BYTES), offset, rawCircuitIndex);
|
|
13620
|
-
chunkPromises.push(signAndSendWithBlockhash(provider, tx, blockInfo));
|
|
13756
|
+
chunkPromises.push(signAndSendWithBlockhash(provider, tx, blockInfo, confirmOptions));
|
|
13621
13757
|
}
|
|
13622
13758
|
// Wait for the current chunk to complete before proceeding
|
|
13623
13759
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -13720,7 +13856,7 @@ function getCompDefAccPDA(arciumProgramId, mxeProgramId, offset) {
|
|
|
13720
13856
|
* @param mxeProgramId - The public key of the MXE program to recover.
|
|
13721
13857
|
* @returns The transaction signature.
|
|
13722
13858
|
*/
|
|
13723
|
-
async function recoverMxe(provider, mxeProgramId) {
|
|
13859
|
+
async function recoverMxe(provider, mxeProgramId, confirmOptions) {
|
|
13724
13860
|
const program = getArciumProgram(provider);
|
|
13725
13861
|
const tx = await program.methods
|
|
13726
13862
|
.recoverMxe(mxeProgramId)
|
|
@@ -13729,7 +13865,7 @@ async function recoverMxe(provider, mxeProgramId) {
|
|
|
13729
13865
|
mxeProgram: mxeProgramId,
|
|
13730
13866
|
})
|
|
13731
13867
|
.transaction();
|
|
13732
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13868
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13733
13869
|
}
|
|
13734
13870
|
/**
|
|
13735
13871
|
* Initializes key recovery execution by creating the MxeRecoveryAccount and
|
|
@@ -13740,7 +13876,7 @@ async function recoverMxe(provider, mxeProgramId) {
|
|
|
13740
13876
|
* @param backupMxeProgramId - The public key of the backup MXE program that will take over.
|
|
13741
13877
|
* @returns The transaction signature from part2.
|
|
13742
13878
|
*/
|
|
13743
|
-
async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId) {
|
|
13879
|
+
async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, confirmOptions) {
|
|
13744
13880
|
// Part 1: Create MxeRecoveryAccount with partial size
|
|
13745
13881
|
const program = getArciumProgram(provider);
|
|
13746
13882
|
const tx1 = await program.methods
|
|
@@ -13751,7 +13887,7 @@ async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMx
|
|
|
13751
13887
|
backupMxeProgram: backupMxeProgramId,
|
|
13752
13888
|
})
|
|
13753
13889
|
.transaction();
|
|
13754
|
-
await signAndSendWithBlockhash(provider, tx1, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13890
|
+
await signAndSendWithBlockhash(provider, tx1, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13755
13891
|
// Part 2: Reallocate to full size and create computation definition
|
|
13756
13892
|
const tx2 = await program.methods
|
|
13757
13893
|
.initKeyRecoveryExecutionPart2(originalMxeProgramId, backupMxeProgramId)
|
|
@@ -13762,21 +13898,21 @@ async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMx
|
|
|
13762
13898
|
backupMxeProgram: backupMxeProgramId,
|
|
13763
13899
|
})
|
|
13764
13900
|
.transaction();
|
|
13765
|
-
return signAndSendWithBlockhash(provider, tx2, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13901
|
+
return signAndSendWithBlockhash(provider, tx2, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13766
13902
|
}
|
|
13767
13903
|
/**
|
|
13768
13904
|
* Submits a re-encrypted key recovery share from a recovery peer.
|
|
13769
|
-
* Recovery peers must decrypt shares using their
|
|
13905
|
+
* Recovery peers must decrypt shares using their x25519 private key and re-encrypt
|
|
13770
13906
|
* them for the backup MXE before submission.
|
|
13771
13907
|
* @param provider - The Anchor provider to use for transactions.
|
|
13772
13908
|
* @param originalMxeProgramId - The public key of the original MXE program being recovered.
|
|
13773
13909
|
* @param backupMxeProgramId - The public key of the backup MXE program.
|
|
13774
|
-
* @param
|
|
13910
|
+
* @param peerOffset - The offset of the recovery peer.
|
|
13775
13911
|
* @param peerIndex - The index of this peer in the recovery peers list.
|
|
13776
13912
|
* @param share - The re-encrypted share: 5 field elements of 32 bytes each (160 bytes total).
|
|
13777
13913
|
* @returns The transaction signature.
|
|
13778
13914
|
*/
|
|
13779
|
-
async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeProgramId,
|
|
13915
|
+
async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeProgramId, peerOffset, peerIndex, share, confirmOptions) {
|
|
13780
13916
|
const program = getArciumProgram(provider);
|
|
13781
13917
|
// Convert to array of 5 elements, each 32 bytes
|
|
13782
13918
|
const shareArrays = share.map(elem => Array.from(elem));
|
|
@@ -13789,14 +13925,14 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
|
|
|
13789
13925
|
}
|
|
13790
13926
|
}
|
|
13791
13927
|
const tx = await program.methods
|
|
13792
|
-
.submitKeyRecoveryShare(originalMxeProgramId, backupMxeProgramId,
|
|
13928
|
+
.submitKeyRecoveryShare(originalMxeProgramId, backupMxeProgramId, peerOffset, peerIndex, shareArrays)
|
|
13793
13929
|
.accountsPartial({
|
|
13794
|
-
|
|
13930
|
+
signer: provider.publicKey,
|
|
13795
13931
|
originalMxeProgram: originalMxeProgramId,
|
|
13796
13932
|
backupMxeProgram: backupMxeProgramId,
|
|
13797
13933
|
})
|
|
13798
13934
|
.transaction();
|
|
13799
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13935
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13800
13936
|
}
|
|
13801
13937
|
/**
|
|
13802
13938
|
* Finalizes key recovery execution after the submission threshold is met.
|
|
@@ -13808,7 +13944,7 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
|
|
|
13808
13944
|
* @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
|
|
13809
13945
|
* @returns The transaction signature.
|
|
13810
13946
|
*/
|
|
13811
|
-
async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset) {
|
|
13947
|
+
async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset, confirmOptions) {
|
|
13812
13948
|
const program = getArciumProgram(provider);
|
|
13813
13949
|
const tx = await program.methods
|
|
13814
13950
|
.finalizeKeyRecoveryExecution(originalMxeProgramId, backupMxeProgramId, clusterOffset)
|
|
@@ -13822,7 +13958,7 @@ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, back
|
|
|
13822
13958
|
backupMxeProgram: backupMxeProgramId,
|
|
13823
13959
|
})
|
|
13824
13960
|
.transaction();
|
|
13825
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13961
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13826
13962
|
}
|
|
13827
13963
|
/**
|
|
13828
13964
|
* Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
|
|
@@ -13832,7 +13968,7 @@ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, back
|
|
|
13832
13968
|
* @param mxeProgramId - The public key to use as the MXE program ID.
|
|
13833
13969
|
* @returns The transaction signature.
|
|
13834
13970
|
*/
|
|
13835
|
-
async function initMxePart1(provider, mxeProgramId) {
|
|
13971
|
+
async function initMxePart1(provider, mxeProgramId, confirmOptions) {
|
|
13836
13972
|
const program = getArciumProgram(provider);
|
|
13837
13973
|
const tx = await program.methods
|
|
13838
13974
|
.initMxePart1()
|
|
@@ -13841,7 +13977,7 @@ async function initMxePart1(provider, mxeProgramId) {
|
|
|
13841
13977
|
mxeProgram: mxeProgramId,
|
|
13842
13978
|
})
|
|
13843
13979
|
.transaction();
|
|
13844
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13980
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13845
13981
|
}
|
|
13846
13982
|
/**
|
|
13847
13983
|
* Finishes MXE initialization (part 2).
|
|
@@ -13856,7 +13992,7 @@ async function initMxePart1(provider, mxeProgramId) {
|
|
|
13856
13992
|
* @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
|
|
13857
13993
|
* @returns The transaction signature.
|
|
13858
13994
|
*/
|
|
13859
|
-
async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority) {
|
|
13995
|
+
async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority, confirmOptions) {
|
|
13860
13996
|
const program = getArciumProgram(provider);
|
|
13861
13997
|
// Ensure recoveryPeers has exactly 100 elements
|
|
13862
13998
|
const paddedRecoveryPeers = [...recoveryPeers];
|
|
@@ -13876,7 +14012,7 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers
|
|
|
13876
14012
|
addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
|
|
13877
14013
|
})
|
|
13878
14014
|
.transaction();
|
|
13879
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
14015
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13880
14016
|
}
|
|
13881
14017
|
|
|
13882
14018
|
/**
|
package/build/index.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ type Arcium = {
|
|
|
456
456
|
"address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
457
457
|
"metadata": {
|
|
458
458
|
"name": "arcium";
|
|
459
|
-
"version": "0.8.
|
|
459
|
+
"version": "0.8.4";
|
|
460
460
|
"spec": "0.1.0";
|
|
461
461
|
"description": "The Arcium program";
|
|
462
462
|
};
|
|
@@ -5113,6 +5113,85 @@ type Arcium = {
|
|
|
5113
5113
|
}
|
|
5114
5114
|
];
|
|
5115
5115
|
},
|
|
5116
|
+
{
|
|
5117
|
+
"name": "initRecoveryPeerAccount";
|
|
5118
|
+
"discriminator": [
|
|
5119
|
+
116,
|
|
5120
|
+
29,
|
|
5121
|
+
20,
|
|
5122
|
+
126,
|
|
5123
|
+
177,
|
|
5124
|
+
149,
|
|
5125
|
+
50,
|
|
5126
|
+
147
|
|
5127
|
+
];
|
|
5128
|
+
"accounts": [
|
|
5129
|
+
{
|
|
5130
|
+
"name": "signer";
|
|
5131
|
+
"writable": true;
|
|
5132
|
+
"signer": true;
|
|
5133
|
+
},
|
|
5134
|
+
{
|
|
5135
|
+
"name": "recoveryPeerAccount";
|
|
5136
|
+
"writable": true;
|
|
5137
|
+
"pda": {
|
|
5138
|
+
"seeds": [
|
|
5139
|
+
{
|
|
5140
|
+
"kind": "const";
|
|
5141
|
+
"value": [
|
|
5142
|
+
82,
|
|
5143
|
+
101,
|
|
5144
|
+
99,
|
|
5145
|
+
111,
|
|
5146
|
+
118,
|
|
5147
|
+
101,
|
|
5148
|
+
114,
|
|
5149
|
+
121,
|
|
5150
|
+
80,
|
|
5151
|
+
101,
|
|
5152
|
+
101,
|
|
5153
|
+
114,
|
|
5154
|
+
65,
|
|
5155
|
+
99,
|
|
5156
|
+
99,
|
|
5157
|
+
111,
|
|
5158
|
+
117,
|
|
5159
|
+
110,
|
|
5160
|
+
116
|
|
5161
|
+
];
|
|
5162
|
+
},
|
|
5163
|
+
{
|
|
5164
|
+
"kind": "arg";
|
|
5165
|
+
"path": "peerOffset";
|
|
5166
|
+
}
|
|
5167
|
+
];
|
|
5168
|
+
};
|
|
5169
|
+
},
|
|
5170
|
+
{
|
|
5171
|
+
"name": "systemProgram";
|
|
5172
|
+
"address": "11111111111111111111111111111111";
|
|
5173
|
+
}
|
|
5174
|
+
];
|
|
5175
|
+
"args": [
|
|
5176
|
+
{
|
|
5177
|
+
"name": "peerOffset";
|
|
5178
|
+
"type": "u32";
|
|
5179
|
+
},
|
|
5180
|
+
{
|
|
5181
|
+
"name": "authority";
|
|
5182
|
+
"type": "pubkey";
|
|
5183
|
+
},
|
|
5184
|
+
{
|
|
5185
|
+
"name": "x25519Pubkey";
|
|
5186
|
+
"type": {
|
|
5187
|
+
"array": [
|
|
5188
|
+
"u8",
|
|
5189
|
+
32
|
|
5190
|
+
];
|
|
5191
|
+
};
|
|
5192
|
+
}
|
|
5193
|
+
];
|
|
5194
|
+
},
|
|
5116
5195
|
{
|
|
5117
5196
|
"name": "joinCluster";
|
|
5118
5197
|
"discriminator": [
|
|
@@ -7485,29 +7564,41 @@ type Arcium = {
|
|
|
7485
7564
|
];
|
|
7486
7565
|
"accounts": [
|
|
7487
7566
|
{
|
|
7488
|
-
"name": "
|
|
7567
|
+
"name": "signer";
|
|
7489
7568
|
"writable": true;
|
|
7490
7569
|
"signer": true;
|
|
7491
7570
|
},
|
|
7492
7571
|
{
|
|
7493
|
-
"name": "
|
|
7572
|
+
"name": "recoveryPeerAccount";
|
|
7494
7573
|
"pda": {
|
|
7495
7574
|
"seeds": [
|
|
7496
7575
|
{
|
|
7497
7576
|
"kind": "const";
|
|
7498
7577
|
"value": [
|
|
7499
|
-
|
|
7578
|
+
82,
|
|
7579
|
+
101,
|
|
7580
|
+
99,
|
|
7581
|
+
111,
|
|
7582
|
+
118,
|
|
7583
|
+
101,
|
|
7500
7584
|
114,
|
|
7501
|
-
|
|
7502
|
-
|
|
7585
|
+
121,
|
|
7586
|
+
80,
|
|
7587
|
+
101,
|
|
7588
|
+
101,
|
|
7589
|
+
114,
|
|
7590
|
+
65,
|
|
7591
|
+
99,
|
|
7592
|
+
99,
|
|
7503
7593
|
111,
|
|
7504
|
-
|
|
7505
|
-
|
|
7594
|
+
117,
|
|
7595
|
+
110,
|
|
7596
|
+
116
|
|
7506
7597
|
];
|
|
7507
7598
|
},
|
|
7508
7599
|
{
|
|
7509
7600
|
"kind": "arg";
|
|
7510
|
-
"path": "
|
|
7601
|
+
"path": "peerOffset";
|
|
7511
7602
|
}
|
|
7512
7603
|
];
|
|
7513
7604
|
};
|
|
@@ -7632,7 +7723,7 @@ type Arcium = {
|
|
|
7632
7723
|
"type": "pubkey";
|
|
7633
7724
|
},
|
|
7634
7725
|
{
|
|
7635
|
-
"name": "
|
|
7726
|
+
"name": "peerOffset";
|
|
7636
7727
|
"type": "u32";
|
|
7637
7728
|
},
|
|
7638
7729
|
{
|
|
@@ -8156,6 +8247,19 @@ type Arcium = {
|
|
|
8156
8247
|
183
|
|
8157
8248
|
];
|
|
8158
8249
|
},
|
|
8250
|
+
{
|
|
8251
|
+
"name": "recoveryPeerAccount";
|
|
8252
|
+
"discriminator": [
|
|
8253
|
+
126,
|
|
8254
|
+
243,
|
|
8255
|
+
17,
|
|
8256
|
+
238,
|
|
8257
|
+
223,
|
|
8258
|
+
222,
|
|
8259
|
+
130,
|
|
8260
|
+
120
|
|
8261
|
+
];
|
|
8262
|
+
},
|
|
8159
8263
|
{
|
|
8160
8264
|
"name": "smallExecPool";
|
|
8161
8265
|
"discriminator": [
|
|
@@ -9127,7 +9231,7 @@ type Arcium = {
|
|
|
9127
9231
|
{
|
|
9128
9232
|
"name": "x25519Pubkey";
|
|
9129
9233
|
"docs": [
|
|
9130
|
-
"X25519 public key
|
|
9234
|
+
"X25519 public key. MUST BE AT byte index 8 - 40"
|
|
9131
9235
|
];
|
|
9132
9236
|
"type": {
|
|
9133
9237
|
"array": [
|
|
@@ -10734,7 +10838,7 @@ type Arcium = {
|
|
|
10734
10838
|
{
|
|
10735
10839
|
"name": "ip";
|
|
10736
10840
|
"docs": [
|
|
10737
|
-
"
|
|
10841
|
+
"`Ipv4Addr`, represented by its 4 octets"
|
|
10738
10842
|
];
|
|
10739
10843
|
"type": {
|
|
10740
10844
|
"array": [
|
|
@@ -11149,6 +11253,38 @@ type Arcium = {
|
|
|
11149
11253
|
];
|
|
11150
11254
|
};
|
|
11151
11255
|
},
|
|
11256
|
+
{
|
|
11257
|
+
"name": "recoveryPeerAccount";
|
|
11258
|
+
"serialization": "bytemuck";
|
|
11259
|
+
"repr": {
|
|
11260
|
+
"kind": "c";
|
|
11261
|
+
};
|
|
11262
|
+
"type": {
|
|
11263
|
+
"kind": "struct";
|
|
11264
|
+
"fields": [
|
|
11265
|
+
{
|
|
11266
|
+
"name": "authority";
|
|
11267
|
+
"type": "pubkey";
|
|
11268
|
+
},
|
|
11269
|
+
{
|
|
11270
|
+
"name": "x25519Pubkey";
|
|
11271
|
+
"docs": [
|
|
11272
|
+
"DO NOT PUT ANYTHING ELSE BEFORE THE X25519_PUBKEY FIELD, IT'S EXPECTED TO BE AT OFFSET 40."
|
|
11273
|
+
];
|
|
11274
|
+
"type": {
|
|
11275
|
+
"array": [
|
|
11276
|
+
"u8",
|
|
11277
|
+
32
|
|
11278
|
+
];
|
|
11279
|
+
};
|
|
11280
|
+
},
|
|
11281
|
+
{
|
|
11282
|
+
"name": "bump";
|
|
11283
|
+
"type": "u8";
|
|
11284
|
+
}
|
|
11285
|
+
];
|
|
11286
|
+
};
|
|
11287
|
+
},
|
|
11152
11288
|
{
|
|
11153
11289
|
"name": "setUnset";
|
|
11154
11290
|
"docs": [
|
|
@@ -11696,17 +11832,17 @@ interface MempoolPriorityFeeStats {
|
|
|
11696
11832
|
*/
|
|
11697
11833
|
declare function getMempoolPriorityFeeStats(arciumProgram: anchor.Program<Arcium>, mempoolAddress: PublicKey): Promise<MempoolPriorityFeeStats>;
|
|
11698
11834
|
/**
|
|
11699
|
-
* Fetches and extracts the MXE
|
|
11835
|
+
* Fetches and extracts the MXE X25519 public key from the MXE account.
|
|
11700
11836
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
11701
11837
|
* @param mxeProgramId - The public key of the MXE program.
|
|
11702
|
-
* @returns The MXE's
|
|
11838
|
+
* @returns The MXE's X25519 public key as a Uint8Array, or null if not set.
|
|
11703
11839
|
*/
|
|
11704
11840
|
declare function getMXEPublicKey(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<Uint8Array | null>;
|
|
11705
11841
|
/**
|
|
11706
|
-
* Fetches and extracts the MXE arcis
|
|
11842
|
+
* Fetches and extracts the MXE arcis Ed25519 verifying key from the MXE account.
|
|
11707
11843
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
11708
11844
|
* @param mxeProgramId - The public key of the MXE program.
|
|
11709
|
-
* @returns The MXE's arcis
|
|
11845
|
+
* @returns The MXE's arcis Ed25519 verifying key as a Uint8Array, or null if not set.
|
|
11710
11846
|
*/
|
|
11711
11847
|
declare function getMXEArcisEd25519VerifyingKey(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<Uint8Array | null>;
|
|
11712
11848
|
/**
|
|
@@ -11731,7 +11867,7 @@ declare function getCircuitState(circuitSource: CircuitSource): CircuitState;
|
|
|
11731
11867
|
* @param chunkSize - The number of upload transactions to send in parallel (default: 500).
|
|
11732
11868
|
* @returns An array of transaction signatures for all upload and finalize transactions.
|
|
11733
11869
|
*/
|
|
11734
|
-
declare function uploadCircuit(provider: AnchorProvider, circuitName: string, mxeProgramId: anchor.web3.PublicKey, rawCircuit: Uint8Array, logging?: boolean, chunkSize?: number): Promise<string[]>;
|
|
11870
|
+
declare function uploadCircuit(provider: AnchorProvider, circuitName: string, mxeProgramId: anchor.web3.PublicKey, rawCircuit: Uint8Array, logging?: boolean, chunkSize?: number, confirmOptions?: ConfirmOptions): Promise<string[]>;
|
|
11735
11871
|
declare function queueKeyRecoveryInit(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string[]>;
|
|
11736
11872
|
/**
|
|
11737
11873
|
* Builds a transaction to finalize a computation definition.
|
|
@@ -11765,7 +11901,7 @@ declare function getArciumProgram(provider: AnchorProvider): Program<Arcium>;
|
|
|
11765
11901
|
* @param mxeProgramId - The public key of the MXE program to recover.
|
|
11766
11902
|
* @returns The transaction signature.
|
|
11767
11903
|
*/
|
|
11768
|
-
declare function recoverMxe(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<string>;
|
|
11904
|
+
declare function recoverMxe(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11769
11905
|
/**
|
|
11770
11906
|
* Initializes key recovery execution by creating the MxeRecoveryAccount and
|
|
11771
11907
|
* registering the key_recovery_final computation definition on the backup MXE.
|
|
@@ -11775,20 +11911,20 @@ declare function recoverMxe(provider: AnchorProvider, mxeProgramId: anchor.web3.
|
|
|
11775
11911
|
* @param backupMxeProgramId - The public key of the backup MXE program that will take over.
|
|
11776
11912
|
* @returns The transaction signature from part2.
|
|
11777
11913
|
*/
|
|
11778
|
-
declare function initKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey): Promise<string>;
|
|
11914
|
+
declare function initKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11779
11915
|
/**
|
|
11780
11916
|
* Submits a re-encrypted key recovery share from a recovery peer.
|
|
11781
|
-
* Recovery peers must decrypt shares using their
|
|
11917
|
+
* Recovery peers must decrypt shares using their x25519 private key and re-encrypt
|
|
11782
11918
|
* them for the backup MXE before submission.
|
|
11783
11919
|
* @param provider - The Anchor provider to use for transactions.
|
|
11784
11920
|
* @param originalMxeProgramId - The public key of the original MXE program being recovered.
|
|
11785
11921
|
* @param backupMxeProgramId - The public key of the backup MXE program.
|
|
11786
|
-
* @param
|
|
11922
|
+
* @param peerOffset - The offset of the recovery peer.
|
|
11787
11923
|
* @param peerIndex - The index of this peer in the recovery peers list.
|
|
11788
11924
|
* @param share - The re-encrypted share: 5 field elements of 32 bytes each (160 bytes total).
|
|
11789
11925
|
* @returns The transaction signature.
|
|
11790
11926
|
*/
|
|
11791
|
-
declare function submitKeyRecoveryShare(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey,
|
|
11927
|
+
declare function submitKeyRecoveryShare(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, peerOffset: number, peerIndex: number, share: number[][] | Uint8Array[], confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11792
11928
|
/**
|
|
11793
11929
|
* Finalizes key recovery execution after the submission threshold is met.
|
|
11794
11930
|
* This queues the key_recovery_finalize MPC computation on the backup cluster.
|
|
@@ -11799,7 +11935,7 @@ declare function submitKeyRecoveryShare(provider: AnchorProvider, originalMxePro
|
|
|
11799
11935
|
* @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
|
|
11800
11936
|
* @returns The transaction signature.
|
|
11801
11937
|
*/
|
|
11802
|
-
declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, clusterOffset: number, keyRecoveryFinalizeOffset: anchor.BN): Promise<string>;
|
|
11938
|
+
declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, clusterOffset: number, keyRecoveryFinalizeOffset: anchor.BN, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11803
11939
|
/**
|
|
11804
11940
|
* Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
|
|
11805
11941
|
* this only partially allocates recovery_cluster_acc.
|
|
@@ -11808,7 +11944,7 @@ declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, original
|
|
|
11808
11944
|
* @param mxeProgramId - The public key to use as the MXE program ID.
|
|
11809
11945
|
* @returns The transaction signature.
|
|
11810
11946
|
*/
|
|
11811
|
-
declare function initMxePart1(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<string>;
|
|
11947
|
+
declare function initMxePart1(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11812
11948
|
/**
|
|
11813
11949
|
* Finishes MXE initialization (part 2).
|
|
11814
11950
|
* Reallocates recovery_cluster_acc to full size, initializes recovery_peers,
|
|
@@ -11822,7 +11958,7 @@ declare function initMxePart1(provider: AnchorProvider, mxeProgramId: anchor.web
|
|
|
11822
11958
|
* @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
|
|
11823
11959
|
* @returns The transaction signature.
|
|
11824
11960
|
*/
|
|
11825
|
-
declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, recoveryPeers: number[], keygenOffset: anchor.BN, keyRecoveryInitOffset: anchor.BN, lutOffset: anchor.BN, mxeAuthority?: anchor.web3.PublicKey): Promise<string>;
|
|
11961
|
+
declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, recoveryPeers: number[], keygenOffset: anchor.BN, keyRecoveryInitOffset: anchor.BN, lutOffset: anchor.BN, mxeAuthority?: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
11826
11962
|
|
|
11827
11963
|
/**
|
|
11828
11964
|
* Structure representing the local Arcium environment variables required for local development or testing.
|
package/build/index.mjs
CHANGED
|
@@ -1790,7 +1790,7 @@ function createPacker(fields, typeName = 'Packer') {
|
|
|
1790
1790
|
var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
1791
1791
|
var metadata = {
|
|
1792
1792
|
name: "arcium",
|
|
1793
|
-
version: "0.8.
|
|
1793
|
+
version: "0.8.4",
|
|
1794
1794
|
spec: "0.1.0",
|
|
1795
1795
|
description: "The Arcium program"
|
|
1796
1796
|
};
|
|
@@ -6449,6 +6449,85 @@ var instructions = [
|
|
|
6449
6449
|
}
|
|
6450
6450
|
]
|
|
6451
6451
|
},
|
|
6452
|
+
{
|
|
6453
|
+
name: "init_recovery_peer_account",
|
|
6454
|
+
discriminator: [
|
|
6455
|
+
116,
|
|
6456
|
+
29,
|
|
6457
|
+
20,
|
|
6458
|
+
126,
|
|
6459
|
+
177,
|
|
6460
|
+
149,
|
|
6461
|
+
50,
|
|
6462
|
+
147
|
|
6463
|
+
],
|
|
6464
|
+
accounts: [
|
|
6465
|
+
{
|
|
6466
|
+
name: "signer",
|
|
6467
|
+
writable: true,
|
|
6468
|
+
signer: true
|
|
6469
|
+
},
|
|
6470
|
+
{
|
|
6471
|
+
name: "recovery_peer_account",
|
|
6472
|
+
writable: true,
|
|
6473
|
+
pda: {
|
|
6474
|
+
seeds: [
|
|
6475
|
+
{
|
|
6476
|
+
kind: "const",
|
|
6477
|
+
value: [
|
|
6478
|
+
82,
|
|
6479
|
+
101,
|
|
6480
|
+
99,
|
|
6481
|
+
111,
|
|
6482
|
+
118,
|
|
6483
|
+
101,
|
|
6484
|
+
114,
|
|
6485
|
+
121,
|
|
6486
|
+
80,
|
|
6487
|
+
101,
|
|
6488
|
+
101,
|
|
6489
|
+
114,
|
|
6490
|
+
65,
|
|
6491
|
+
99,
|
|
6492
|
+
99,
|
|
6493
|
+
111,
|
|
6494
|
+
117,
|
|
6495
|
+
110,
|
|
6496
|
+
116
|
|
6497
|
+
]
|
|
6498
|
+
},
|
|
6499
|
+
{
|
|
6500
|
+
kind: "arg",
|
|
6501
|
+
path: "peer_offset"
|
|
6502
|
+
}
|
|
6503
|
+
]
|
|
6504
|
+
}
|
|
6505
|
+
},
|
|
6506
|
+
{
|
|
6507
|
+
name: "system_program",
|
|
6508
|
+
address: "11111111111111111111111111111111"
|
|
6509
|
+
}
|
|
6510
|
+
],
|
|
6511
|
+
args: [
|
|
6512
|
+
{
|
|
6513
|
+
name: "peer_offset",
|
|
6514
|
+
type: "u32"
|
|
6515
|
+
},
|
|
6516
|
+
{
|
|
6517
|
+
name: "authority",
|
|
6518
|
+
type: "pubkey"
|
|
6519
|
+
},
|
|
6520
|
+
{
|
|
6521
|
+
name: "x25519_pubkey",
|
|
6522
|
+
type: {
|
|
6523
|
+
array: [
|
|
6524
|
+
"u8",
|
|
6525
|
+
32
|
|
6526
|
+
]
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
]
|
|
6530
|
+
},
|
|
6452
6531
|
{
|
|
6453
6532
|
name: "join_cluster",
|
|
6454
6533
|
discriminator: [
|
|
@@ -8821,29 +8900,41 @@ var instructions = [
|
|
|
8821
8900
|
],
|
|
8822
8901
|
accounts: [
|
|
8823
8902
|
{
|
|
8824
|
-
name: "
|
|
8903
|
+
name: "signer",
|
|
8825
8904
|
writable: true,
|
|
8826
8905
|
signer: true
|
|
8827
8906
|
},
|
|
8828
8907
|
{
|
|
8829
|
-
name: "
|
|
8908
|
+
name: "recovery_peer_account",
|
|
8830
8909
|
pda: {
|
|
8831
8910
|
seeds: [
|
|
8832
8911
|
{
|
|
8833
8912
|
kind: "const",
|
|
8834
8913
|
value: [
|
|
8835
|
-
|
|
8914
|
+
82,
|
|
8915
|
+
101,
|
|
8916
|
+
99,
|
|
8917
|
+
111,
|
|
8918
|
+
118,
|
|
8919
|
+
101,
|
|
8836
8920
|
114,
|
|
8837
|
-
|
|
8838
|
-
|
|
8921
|
+
121,
|
|
8922
|
+
80,
|
|
8923
|
+
101,
|
|
8924
|
+
101,
|
|
8925
|
+
114,
|
|
8926
|
+
65,
|
|
8927
|
+
99,
|
|
8928
|
+
99,
|
|
8839
8929
|
111,
|
|
8840
|
-
|
|
8841
|
-
|
|
8930
|
+
117,
|
|
8931
|
+
110,
|
|
8932
|
+
116
|
|
8842
8933
|
]
|
|
8843
8934
|
},
|
|
8844
8935
|
{
|
|
8845
8936
|
kind: "arg",
|
|
8846
|
-
path: "
|
|
8937
|
+
path: "peer_offset"
|
|
8847
8938
|
}
|
|
8848
8939
|
]
|
|
8849
8940
|
}
|
|
@@ -8968,7 +9059,7 @@ var instructions = [
|
|
|
8968
9059
|
type: "pubkey"
|
|
8969
9060
|
},
|
|
8970
9061
|
{
|
|
8971
|
-
name: "
|
|
9062
|
+
name: "peer_offset",
|
|
8972
9063
|
type: "u32"
|
|
8973
9064
|
},
|
|
8974
9065
|
{
|
|
@@ -9493,6 +9584,19 @@ var accounts = [
|
|
|
9493
9584
|
183
|
|
9494
9585
|
]
|
|
9495
9586
|
},
|
|
9587
|
+
{
|
|
9588
|
+
name: "RecoveryPeerAccount",
|
|
9589
|
+
discriminator: [
|
|
9590
|
+
126,
|
|
9591
|
+
243,
|
|
9592
|
+
17,
|
|
9593
|
+
238,
|
|
9594
|
+
223,
|
|
9595
|
+
222,
|
|
9596
|
+
130,
|
|
9597
|
+
120
|
|
9598
|
+
]
|
|
9599
|
+
},
|
|
9496
9600
|
{
|
|
9497
9601
|
name: "SmallExecPool",
|
|
9498
9602
|
discriminator: [
|
|
@@ -10464,7 +10568,7 @@ var types = [
|
|
|
10464
10568
|
{
|
|
10465
10569
|
name: "x25519_pubkey",
|
|
10466
10570
|
docs: [
|
|
10467
|
-
"X25519 public key
|
|
10571
|
+
"X25519 public key. MUST BE AT byte index 8 - 40"
|
|
10468
10572
|
],
|
|
10469
10573
|
type: {
|
|
10470
10574
|
array: [
|
|
@@ -12071,7 +12175,7 @@ var types = [
|
|
|
12071
12175
|
{
|
|
12072
12176
|
name: "ip",
|
|
12073
12177
|
docs: [
|
|
12074
|
-
"
|
|
12178
|
+
"`Ipv4Addr`, represented by its 4 octets"
|
|
12075
12179
|
],
|
|
12076
12180
|
type: {
|
|
12077
12181
|
array: [
|
|
@@ -12486,6 +12590,38 @@ var types = [
|
|
|
12486
12590
|
]
|
|
12487
12591
|
}
|
|
12488
12592
|
},
|
|
12593
|
+
{
|
|
12594
|
+
name: "RecoveryPeerAccount",
|
|
12595
|
+
serialization: "bytemuck",
|
|
12596
|
+
repr: {
|
|
12597
|
+
kind: "c"
|
|
12598
|
+
},
|
|
12599
|
+
type: {
|
|
12600
|
+
kind: "struct",
|
|
12601
|
+
fields: [
|
|
12602
|
+
{
|
|
12603
|
+
name: "authority",
|
|
12604
|
+
type: "pubkey"
|
|
12605
|
+
},
|
|
12606
|
+
{
|
|
12607
|
+
name: "x25519_pubkey",
|
|
12608
|
+
docs: [
|
|
12609
|
+
"DO NOT PUT ANYTHING ELSE BEFORE THE X25519_PUBKEY FIELD, IT'S EXPECTED TO BE AT OFFSET 40."
|
|
12610
|
+
],
|
|
12611
|
+
type: {
|
|
12612
|
+
array: [
|
|
12613
|
+
"u8",
|
|
12614
|
+
32
|
|
12615
|
+
]
|
|
12616
|
+
}
|
|
12617
|
+
},
|
|
12618
|
+
{
|
|
12619
|
+
name: "bump",
|
|
12620
|
+
type: "u8"
|
|
12621
|
+
}
|
|
12622
|
+
]
|
|
12623
|
+
}
|
|
12624
|
+
},
|
|
12489
12625
|
{
|
|
12490
12626
|
name: "SetUnset",
|
|
12491
12627
|
docs: [
|
|
@@ -13450,19 +13586,19 @@ async function getMXEUtilityKey(provider, mxeProgramId, field) {
|
|
|
13450
13586
|
return null;
|
|
13451
13587
|
}
|
|
13452
13588
|
/**
|
|
13453
|
-
* Fetches and extracts the MXE
|
|
13589
|
+
* Fetches and extracts the MXE X25519 public key from the MXE account.
|
|
13454
13590
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
13455
13591
|
* @param mxeProgramId - The public key of the MXE program.
|
|
13456
|
-
* @returns The MXE's
|
|
13592
|
+
* @returns The MXE's X25519 public key as a Uint8Array, or null if not set.
|
|
13457
13593
|
*/
|
|
13458
13594
|
async function getMXEPublicKey(provider, mxeProgramId) {
|
|
13459
13595
|
return getMXEUtilityKey(provider, mxeProgramId, 'x25519Pubkey');
|
|
13460
13596
|
}
|
|
13461
13597
|
/**
|
|
13462
|
-
* Fetches and extracts the MXE arcis
|
|
13598
|
+
* Fetches and extracts the MXE arcis Ed25519 verifying key from the MXE account.
|
|
13463
13599
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
13464
13600
|
* @param mxeProgramId - The public key of the MXE program.
|
|
13465
|
-
* @returns The MXE's arcis
|
|
13601
|
+
* @returns The MXE's arcis Ed25519 verifying key as a Uint8Array, or null if not set.
|
|
13466
13602
|
*/
|
|
13467
13603
|
async function getMXEArcisEd25519VerifyingKey(provider, mxeProgramId) {
|
|
13468
13604
|
return getMXEUtilityKey(provider, mxeProgramId, 'ed25519VerifyingKey');
|
|
@@ -13492,7 +13628,7 @@ function getCircuitState(circuitSource) {
|
|
|
13492
13628
|
* @param chunkSize - The number of upload transactions to send in parallel (default: 500).
|
|
13493
13629
|
* @returns An array of transaction signatures for all upload and finalize transactions.
|
|
13494
13630
|
*/
|
|
13495
|
-
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500) {
|
|
13631
|
+
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500, confirmOptions) {
|
|
13496
13632
|
const compDefAccInfo = getCompDefAccInfo(circuitName, mxeProgramId);
|
|
13497
13633
|
const program = getArciumProgram(provider);
|
|
13498
13634
|
const compDefAcc = await program.account.computationDefinitionAccount.fetch(compDefAccInfo.pubkey);
|
|
@@ -13507,11 +13643,11 @@ async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, lo
|
|
|
13507
13643
|
const sigs = [];
|
|
13508
13644
|
const uploadPromises = [];
|
|
13509
13645
|
for (let i = 0; i < numAccs; i++) {
|
|
13510
|
-
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo, mxeProgramId, logging, chunkSize));
|
|
13646
|
+
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo, mxeProgramId, logging, chunkSize, confirmOptions));
|
|
13511
13647
|
}
|
|
13512
13648
|
sigs.push(...(await Promise.all(uploadPromises)).flat());
|
|
13513
13649
|
const finalizeCompDefTx = await buildFinalizeCompDefTx(provider, compDefAccInfo.offset, mxeProgramId);
|
|
13514
|
-
sigs.push(await signAndSendWithBlockhash(provider, finalizeCompDefTx, await provider.connection.getLatestBlockhash()));
|
|
13650
|
+
sigs.push(await signAndSendWithBlockhash(provider, finalizeCompDefTx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions));
|
|
13515
13651
|
return sigs;
|
|
13516
13652
|
}
|
|
13517
13653
|
async function queueKeyRecoveryInit(provider, clusterOffset, mxeProgramId, confirmOptions) {
|
|
@@ -13545,7 +13681,7 @@ async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
|
|
|
13545
13681
|
})
|
|
13546
13682
|
.transaction();
|
|
13547
13683
|
}
|
|
13548
|
-
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500) {
|
|
13684
|
+
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500, confirmOptions) {
|
|
13549
13685
|
const rawCircuitPda = getRawCircuitAccAddress(compDefAccInfo.pubkey, rawCircuitIndex);
|
|
13550
13686
|
const existingAcc = await provider.connection.getAccountInfo(rawCircuitPda);
|
|
13551
13687
|
// Skip entirely if account exists with correct size (pre-seeded at genesis or already uploaded)
|
|
@@ -13575,10 +13711,10 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13575
13711
|
const tx = await buildResizeTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, rawCircuitIndex, MAX_REALLOC_PER_IX
|
|
13576
13712
|
+ i * (MAX_REALLOC_PER_IX * MAX_EMBIGGEN_IX_PER_TX), rawCircuitPart.length);
|
|
13577
13713
|
// eslint-disable-next-line no-await-in-loop
|
|
13578
|
-
const blockInfo = await provider.connection.getLatestBlockhash();
|
|
13714
|
+
const blockInfo = await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' });
|
|
13579
13715
|
sigs.push(
|
|
13580
13716
|
// eslint-disable-next-line no-await-in-loop
|
|
13581
|
-
await signAndSendWithBlockhash(provider, tx, blockInfo));
|
|
13717
|
+
await signAndSendWithBlockhash(provider, tx, blockInfo, confirmOptions));
|
|
13582
13718
|
optionalLog(shouldLog, `Sent resize tx ${i} of ${nonAsyncTxCount}`);
|
|
13583
13719
|
}
|
|
13584
13720
|
}
|
|
@@ -13587,7 +13723,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13587
13723
|
const remainingTxCount = Math.ceil(rawCircuitPart.length / MAX_UPLOAD_PER_TX_BYTES);
|
|
13588
13724
|
optionalLog(shouldLog, `Sending ${remainingTxCount} upload txs`);
|
|
13589
13725
|
const remainingTxs = [];
|
|
13590
|
-
const blockInfo = await provider.connection.getLatestBlockhash();
|
|
13726
|
+
const blockInfo = await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' });
|
|
13591
13727
|
for (let i = 0; i < remainingTxCount; i += chunkSize) {
|
|
13592
13728
|
optionalLog(shouldLog, `Sending chunk ${i / chunkSize + 1} of ${Math.ceil(remainingTxCount / chunkSize)}`);
|
|
13593
13729
|
// Array to hold promises for the current chunk
|
|
@@ -13598,7 +13734,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
13598
13734
|
const offset = MAX_UPLOAD_PER_TX_BYTES * (i + j);
|
|
13599
13735
|
// eslint-disable-next-line no-await-in-loop
|
|
13600
13736
|
const tx = await buildUploadCircuitTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, Buffer.copyBytesFrom(rawCircuitPart, offset, MAX_UPLOAD_PER_TX_BYTES), offset, rawCircuitIndex);
|
|
13601
|
-
chunkPromises.push(signAndSendWithBlockhash(provider, tx, blockInfo));
|
|
13737
|
+
chunkPromises.push(signAndSendWithBlockhash(provider, tx, blockInfo, confirmOptions));
|
|
13602
13738
|
}
|
|
13603
13739
|
// Wait for the current chunk to complete before proceeding
|
|
13604
13740
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -13701,7 +13837,7 @@ function getCompDefAccPDA(arciumProgramId, mxeProgramId, offset) {
|
|
|
13701
13837
|
* @param mxeProgramId - The public key of the MXE program to recover.
|
|
13702
13838
|
* @returns The transaction signature.
|
|
13703
13839
|
*/
|
|
13704
|
-
async function recoverMxe(provider, mxeProgramId) {
|
|
13840
|
+
async function recoverMxe(provider, mxeProgramId, confirmOptions) {
|
|
13705
13841
|
const program = getArciumProgram(provider);
|
|
13706
13842
|
const tx = await program.methods
|
|
13707
13843
|
.recoverMxe(mxeProgramId)
|
|
@@ -13710,7 +13846,7 @@ async function recoverMxe(provider, mxeProgramId) {
|
|
|
13710
13846
|
mxeProgram: mxeProgramId,
|
|
13711
13847
|
})
|
|
13712
13848
|
.transaction();
|
|
13713
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13849
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13714
13850
|
}
|
|
13715
13851
|
/**
|
|
13716
13852
|
* Initializes key recovery execution by creating the MxeRecoveryAccount and
|
|
@@ -13721,7 +13857,7 @@ async function recoverMxe(provider, mxeProgramId) {
|
|
|
13721
13857
|
* @param backupMxeProgramId - The public key of the backup MXE program that will take over.
|
|
13722
13858
|
* @returns The transaction signature from part2.
|
|
13723
13859
|
*/
|
|
13724
|
-
async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId) {
|
|
13860
|
+
async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, confirmOptions) {
|
|
13725
13861
|
// Part 1: Create MxeRecoveryAccount with partial size
|
|
13726
13862
|
const program = getArciumProgram(provider);
|
|
13727
13863
|
const tx1 = await program.methods
|
|
@@ -13732,7 +13868,7 @@ async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMx
|
|
|
13732
13868
|
backupMxeProgram: backupMxeProgramId,
|
|
13733
13869
|
})
|
|
13734
13870
|
.transaction();
|
|
13735
|
-
await signAndSendWithBlockhash(provider, tx1, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13871
|
+
await signAndSendWithBlockhash(provider, tx1, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13736
13872
|
// Part 2: Reallocate to full size and create computation definition
|
|
13737
13873
|
const tx2 = await program.methods
|
|
13738
13874
|
.initKeyRecoveryExecutionPart2(originalMxeProgramId, backupMxeProgramId)
|
|
@@ -13743,21 +13879,21 @@ async function initKeyRecoveryExecution(provider, originalMxeProgramId, backupMx
|
|
|
13743
13879
|
backupMxeProgram: backupMxeProgramId,
|
|
13744
13880
|
})
|
|
13745
13881
|
.transaction();
|
|
13746
|
-
return signAndSendWithBlockhash(provider, tx2, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13882
|
+
return signAndSendWithBlockhash(provider, tx2, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13747
13883
|
}
|
|
13748
13884
|
/**
|
|
13749
13885
|
* Submits a re-encrypted key recovery share from a recovery peer.
|
|
13750
|
-
* Recovery peers must decrypt shares using their
|
|
13886
|
+
* Recovery peers must decrypt shares using their x25519 private key and re-encrypt
|
|
13751
13887
|
* them for the backup MXE before submission.
|
|
13752
13888
|
* @param provider - The Anchor provider to use for transactions.
|
|
13753
13889
|
* @param originalMxeProgramId - The public key of the original MXE program being recovered.
|
|
13754
13890
|
* @param backupMxeProgramId - The public key of the backup MXE program.
|
|
13755
|
-
* @param
|
|
13891
|
+
* @param peerOffset - The offset of the recovery peer.
|
|
13756
13892
|
* @param peerIndex - The index of this peer in the recovery peers list.
|
|
13757
13893
|
* @param share - The re-encrypted share: 5 field elements of 32 bytes each (160 bytes total).
|
|
13758
13894
|
* @returns The transaction signature.
|
|
13759
13895
|
*/
|
|
13760
|
-
async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeProgramId,
|
|
13896
|
+
async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeProgramId, peerOffset, peerIndex, share, confirmOptions) {
|
|
13761
13897
|
const program = getArciumProgram(provider);
|
|
13762
13898
|
// Convert to array of 5 elements, each 32 bytes
|
|
13763
13899
|
const shareArrays = share.map(elem => Array.from(elem));
|
|
@@ -13770,14 +13906,14 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
|
|
|
13770
13906
|
}
|
|
13771
13907
|
}
|
|
13772
13908
|
const tx = await program.methods
|
|
13773
|
-
.submitKeyRecoveryShare(originalMxeProgramId, backupMxeProgramId,
|
|
13909
|
+
.submitKeyRecoveryShare(originalMxeProgramId, backupMxeProgramId, peerOffset, peerIndex, shareArrays)
|
|
13774
13910
|
.accountsPartial({
|
|
13775
|
-
|
|
13911
|
+
signer: provider.publicKey,
|
|
13776
13912
|
originalMxeProgram: originalMxeProgramId,
|
|
13777
13913
|
backupMxeProgram: backupMxeProgramId,
|
|
13778
13914
|
})
|
|
13779
13915
|
.transaction();
|
|
13780
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13916
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13781
13917
|
}
|
|
13782
13918
|
/**
|
|
13783
13919
|
* Finalizes key recovery execution after the submission threshold is met.
|
|
@@ -13789,7 +13925,7 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
|
|
|
13789
13925
|
* @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
|
|
13790
13926
|
* @returns The transaction signature.
|
|
13791
13927
|
*/
|
|
13792
|
-
async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset) {
|
|
13928
|
+
async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset, confirmOptions) {
|
|
13793
13929
|
const program = getArciumProgram(provider);
|
|
13794
13930
|
const tx = await program.methods
|
|
13795
13931
|
.finalizeKeyRecoveryExecution(originalMxeProgramId, backupMxeProgramId, clusterOffset)
|
|
@@ -13803,7 +13939,7 @@ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, back
|
|
|
13803
13939
|
backupMxeProgram: backupMxeProgramId,
|
|
13804
13940
|
})
|
|
13805
13941
|
.transaction();
|
|
13806
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13942
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13807
13943
|
}
|
|
13808
13944
|
/**
|
|
13809
13945
|
* Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
|
|
@@ -13813,7 +13949,7 @@ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, back
|
|
|
13813
13949
|
* @param mxeProgramId - The public key to use as the MXE program ID.
|
|
13814
13950
|
* @returns The transaction signature.
|
|
13815
13951
|
*/
|
|
13816
|
-
async function initMxePart1(provider, mxeProgramId) {
|
|
13952
|
+
async function initMxePart1(provider, mxeProgramId, confirmOptions) {
|
|
13817
13953
|
const program = getArciumProgram(provider);
|
|
13818
13954
|
const tx = await program.methods
|
|
13819
13955
|
.initMxePart1()
|
|
@@ -13822,7 +13958,7 @@ async function initMxePart1(provider, mxeProgramId) {
|
|
|
13822
13958
|
mxeProgram: mxeProgramId,
|
|
13823
13959
|
})
|
|
13824
13960
|
.transaction();
|
|
13825
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13961
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13826
13962
|
}
|
|
13827
13963
|
/**
|
|
13828
13964
|
* Finishes MXE initialization (part 2).
|
|
@@ -13837,7 +13973,7 @@ async function initMxePart1(provider, mxeProgramId) {
|
|
|
13837
13973
|
* @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
|
|
13838
13974
|
* @returns The transaction signature.
|
|
13839
13975
|
*/
|
|
13840
|
-
async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority) {
|
|
13976
|
+
async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority, confirmOptions) {
|
|
13841
13977
|
const program = getArciumProgram(provider);
|
|
13842
13978
|
// Ensure recoveryPeers has exactly 100 elements
|
|
13843
13979
|
const paddedRecoveryPeers = [...recoveryPeers];
|
|
@@ -13857,7 +13993,7 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers
|
|
|
13857
13993
|
addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
|
|
13858
13994
|
})
|
|
13859
13995
|
.transaction();
|
|
13860
|
-
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
|
|
13996
|
+
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
13861
13997
|
}
|
|
13862
13998
|
|
|
13863
13999
|
/**
|