@arcium-hq/client 0.6.5 → 0.7.0

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 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.6.5",
1812
+ version: "0.7.0",
1813
1813
  spec: "0.1.0",
1814
1814
  description: "The Arcium program"
1815
1815
  };
@@ -4065,6 +4065,29 @@ var instructions = [
4065
4065
  ]
4066
4066
  }
4067
4067
  },
4068
+ {
4069
+ name: "cluster_acc",
4070
+ pda: {
4071
+ seeds: [
4072
+ {
4073
+ kind: "const",
4074
+ value: [
4075
+ 67,
4076
+ 108,
4077
+ 117,
4078
+ 115,
4079
+ 116,
4080
+ 101,
4081
+ 114
4082
+ ]
4083
+ },
4084
+ {
4085
+ kind: "arg",
4086
+ path: "cluster_offset"
4087
+ }
4088
+ ]
4089
+ }
4090
+ },
4068
4091
  {
4069
4092
  name: "executing_pool",
4070
4093
  writable: true,
@@ -4153,6 +4176,17 @@ var instructions = [
4153
4176
  {
4154
4177
  name: "callback_transaction_index",
4155
4178
  type: "u8"
4179
+ },
4180
+ {
4181
+ name: "bls_sig",
4182
+ type: {
4183
+ option: {
4184
+ array: [
4185
+ "u8",
4186
+ 64
4187
+ ]
4188
+ }
4189
+ }
4156
4190
  }
4157
4191
  ]
4158
4192
  },
@@ -5244,6 +5278,17 @@ var instructions = [
5244
5278
  ]
5245
5279
  }
5246
5280
  },
5281
+ {
5282
+ name: "address_lookup_table",
5283
+ docs: [
5284
+ "Seeds are checked in the CPI to LUT program, so no need to check them here."
5285
+ ],
5286
+ writable: true
5287
+ },
5288
+ {
5289
+ name: "lut_program",
5290
+ address: "AddressLookupTab1e1111111111111111111111111"
5291
+ },
5247
5292
  {
5248
5293
  name: "comp_def_acc",
5249
5294
  writable: true,
@@ -5358,6 +5403,11 @@ var instructions = [
5358
5403
  224
5359
5404
  ],
5360
5405
  accounts: [
5406
+ {
5407
+ name: "authority",
5408
+ writable: true,
5409
+ signer: true
5410
+ },
5361
5411
  {
5362
5412
  name: "payer",
5363
5413
  writable: true,
@@ -6155,6 +6205,17 @@ var instructions = [
6155
6205
  ]
6156
6206
  }
6157
6207
  },
6208
+ {
6209
+ name: "address_lookup_table",
6210
+ docs: [
6211
+ "Seeds are checked in the CPI to LUT program, so no need to check them here."
6212
+ ],
6213
+ writable: true
6214
+ },
6215
+ {
6216
+ name: "lut_program",
6217
+ address: "AddressLookupTab1e1111111111111111111111111"
6218
+ },
6158
6219
  {
6159
6220
  name: "clock",
6160
6221
  writable: true,
@@ -6210,6 +6271,10 @@ var instructions = [
6210
6271
  {
6211
6272
  name: "key_recovery_init_offset",
6212
6273
  type: "u64"
6274
+ },
6275
+ {
6276
+ name: "recent_offset",
6277
+ type: "u64"
6213
6278
  }
6214
6279
  ]
6215
6280
  },
@@ -6514,91 +6579,6 @@ var instructions = [
6514
6579
  }
6515
6580
  ]
6516
6581
  },
6517
- {
6518
- name: "leave_mxe",
6519
- discriminator: [
6520
- 225,
6521
- 222,
6522
- 68,
6523
- 9,
6524
- 96,
6525
- 160,
6526
- 126,
6527
- 211
6528
- ],
6529
- accounts: [
6530
- {
6531
- name: "authority",
6532
- writable: true,
6533
- signer: true
6534
- },
6535
- {
6536
- name: "cluster_acc",
6537
- writable: true,
6538
- pda: {
6539
- seeds: [
6540
- {
6541
- kind: "const",
6542
- value: [
6543
- 67,
6544
- 108,
6545
- 117,
6546
- 115,
6547
- 116,
6548
- 101,
6549
- 114
6550
- ]
6551
- },
6552
- {
6553
- kind: "arg",
6554
- path: "_id"
6555
- }
6556
- ]
6557
- }
6558
- },
6559
- {
6560
- name: "mxe",
6561
- writable: true,
6562
- pda: {
6563
- seeds: [
6564
- {
6565
- kind: "const",
6566
- value: [
6567
- 77,
6568
- 88,
6569
- 69,
6570
- 65,
6571
- 99,
6572
- 99,
6573
- 111,
6574
- 117,
6575
- 110,
6576
- 116
6577
- ]
6578
- },
6579
- {
6580
- kind: "arg",
6581
- path: "_mxe_program"
6582
- }
6583
- ]
6584
- }
6585
- },
6586
- {
6587
- name: "system_program",
6588
- address: "11111111111111111111111111111111"
6589
- }
6590
- ],
6591
- args: [
6592
- {
6593
- name: "cluster_offset",
6594
- type: "u32"
6595
- },
6596
- {
6597
- name: "mxe_program",
6598
- type: "pubkey"
6599
- }
6600
- ]
6601
- },
6602
6582
  {
6603
6583
  name: "propose_fee",
6604
6584
  discriminator: [
@@ -6903,8 +6883,9 @@ var instructions = [
6903
6883
  ]
6904
6884
  },
6905
6885
  {
6906
- kind: "arg",
6907
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6886
+ kind: "account",
6887
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6888
+ account: "MXEAccount"
6908
6889
  },
6909
6890
  {
6910
6891
  kind: "arg",
@@ -6958,8 +6939,9 @@ var instructions = [
6958
6939
  ]
6959
6940
  },
6960
6941
  {
6961
- kind: "arg",
6962
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6942
+ kind: "account",
6943
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6944
+ account: "MXEAccount"
6963
6945
  }
6964
6946
  ]
6965
6947
  }
@@ -6982,8 +6964,9 @@ var instructions = [
6982
6964
  ]
6983
6965
  },
6984
6966
  {
6985
- kind: "arg",
6986
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6967
+ kind: "account",
6968
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6969
+ account: "MXEAccount"
6987
6970
  }
6988
6971
  ]
6989
6972
  }
@@ -7054,8 +7037,9 @@ var instructions = [
7054
7037
  ]
7055
7038
  },
7056
7039
  {
7057
- kind: "arg",
7058
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
7040
+ kind: "account",
7041
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
7042
+ account: "MXEAccount"
7059
7043
  }
7060
7044
  ]
7061
7045
  }
@@ -7119,12 +7103,6 @@ var instructions = [
7119
7103
  name: "computation_definition_offset",
7120
7104
  type: "u32"
7121
7105
  },
7122
- {
7123
- name: "cluster_index",
7124
- type: {
7125
- option: "u16"
7126
- }
7127
- },
7128
7106
  {
7129
7107
  name: "args",
7130
7108
  type: {
@@ -7137,12 +7115,6 @@ var instructions = [
7137
7115
  name: "mxe_program",
7138
7116
  type: "pubkey"
7139
7117
  },
7140
- {
7141
- name: "callback_url",
7142
- type: {
7143
- option: "string"
7144
- }
7145
- },
7146
7118
  {
7147
7119
  name: "custom_callback_instructions",
7148
7120
  type: {
@@ -7533,16 +7505,16 @@ var instructions = [
7533
7505
  ]
7534
7506
  },
7535
7507
  {
7536
- name: "reclaim_failure_rent",
7508
+ name: "reclaim_failure_rent_idempotent",
7537
7509
  discriminator: [
7538
- 159,
7539
- 99,
7540
- 116,
7541
- 180,
7542
- 42,
7543
- 9,
7544
- 202,
7545
- 219
7510
+ 138,
7511
+ 13,
7512
+ 253,
7513
+ 191,
7514
+ 226,
7515
+ 239,
7516
+ 246,
7517
+ 10
7546
7518
  ],
7547
7519
  accounts: [
7548
7520
  {
@@ -7550,51 +7522,19 @@ var instructions = [
7550
7522
  writable: true,
7551
7523
  signer: true
7552
7524
  },
7525
+ {
7526
+ name: "recipient",
7527
+ docs: [
7528
+ "failure PDA"
7529
+ ],
7530
+ writable: true
7531
+ },
7553
7532
  {
7554
7533
  name: "failure_acc",
7555
- writable: true,
7556
- pda: {
7557
- seeds: [
7558
- {
7559
- kind: "const",
7560
- value: [
7561
- 70,
7562
- 97,
7563
- 105,
7564
- 108,
7565
- 117,
7566
- 114,
7567
- 101,
7568
- 67,
7569
- 108,
7570
- 97,
7571
- 105,
7572
- 109,
7573
- 65,
7574
- 99,
7575
- 99,
7576
- 111,
7577
- 117,
7578
- 110,
7579
- 116,
7580
- 72,
7581
- 101,
7582
- 97,
7583
- 100,
7584
- 101,
7585
- 114
7586
- ]
7587
- },
7588
- {
7589
- kind: "arg",
7590
- path: "mxe_program"
7591
- },
7592
- {
7593
- kind: "arg",
7594
- path: "comp_offset"
7595
- }
7596
- ]
7597
- }
7534
+ docs: [
7535
+ "the checks and close by hand in the instruction handler."
7536
+ ],
7537
+ writable: true
7598
7538
  }
7599
7539
  ],
7600
7540
  args: [
@@ -9691,6 +9631,19 @@ var events = [
9691
9631
  186
9692
9632
  ]
9693
9633
  },
9634
+ {
9635
+ name: "KeyRecoveryEvent",
9636
+ discriminator: [
9637
+ 83,
9638
+ 147,
9639
+ 226,
9640
+ 153,
9641
+ 39,
9642
+ 242,
9643
+ 109,
9644
+ 254
9645
+ ]
9646
+ },
9694
9647
  {
9695
9648
  name: "QueueComputationEvent",
9696
9649
  discriminator: [
@@ -9831,6 +9784,11 @@ var errors = [
9831
9784
  name: "InvalidCallbackIndex",
9832
9785
  msg: "Invalid callback transaction index"
9833
9786
  },
9787
+ {
9788
+ code: 6212,
9789
+ name: "MultiTxCallbacksDisabled",
9790
+ msg: "Multi-transaction callbacks disabled"
9791
+ },
9834
9792
  {
9835
9793
  code: 6300,
9836
9794
  name: "ComputationDefinitionNotCompleted",
@@ -10150,6 +10108,11 @@ var errors = [
10150
10108
  code: 6715,
10151
10109
  name: "ArithmeticOverflow",
10152
10110
  msg: "Arithmetic overflow"
10111
+ },
10112
+ {
10113
+ code: 6716,
10114
+ name: "MxeInRecoveryState",
10115
+ msg: "MXE is in recovery state, cannot queue new computations"
10153
10116
  }
10154
10117
  ];
10155
10118
  var types = [
@@ -10970,20 +10933,6 @@ var types = [
10970
10933
  }
10971
10934
  }
10972
10935
  },
10973
- {
10974
- name: "cluster_index",
10975
- docs: [
10976
- "The MXE's cluster to be used for execution.",
10977
- "",
10978
- "# Notes",
10979
- "",
10980
- "- [None] represents the default cluster,",
10981
- "- [Some] specifies the index of the fallback cluster."
10982
- ],
10983
- type: {
10984
- option: "u16"
10985
- }
10986
- },
10987
10936
  {
10988
10937
  name: "arguments",
10989
10938
  type: {
@@ -10992,12 +10941,6 @@ var types = [
10992
10941
  }
10993
10942
  }
10994
10943
  },
10995
- {
10996
- name: "callback_url",
10997
- type: {
10998
- option: "string"
10999
- }
11000
- },
11001
10944
  {
11002
10945
  name: "custom_callback_instructions",
11003
10946
  type: {
@@ -11320,6 +11263,16 @@ var types = [
11320
11263
  }
11321
11264
  }
11322
11265
  ]
11266
+ },
11267
+ {
11268
+ name: "KeyRecoveryFailure",
11269
+ fields: [
11270
+ {
11271
+ defined: {
11272
+ name: "KeyRecoveryFailureReason"
11273
+ }
11274
+ }
11275
+ ]
11323
11276
  }
11324
11277
  ]
11325
11278
  }
@@ -11477,6 +11430,58 @@ var types = [
11477
11430
  ]
11478
11431
  }
11479
11432
  },
11433
+ {
11434
+ name: "KeyRecoveryEvent",
11435
+ type: {
11436
+ kind: "struct",
11437
+ fields: [
11438
+ {
11439
+ name: "computation_offset",
11440
+ type: "u64"
11441
+ },
11442
+ {
11443
+ name: "mxe_program_id",
11444
+ type: "pubkey"
11445
+ },
11446
+ {
11447
+ name: "backup_mxe_program_id",
11448
+ type: "pubkey"
11449
+ }
11450
+ ]
11451
+ }
11452
+ },
11453
+ {
11454
+ name: "KeyRecoveryFailureReason",
11455
+ type: {
11456
+ kind: "enum",
11457
+ variants: [
11458
+ {
11459
+ name: "KeysDigestMismatch"
11460
+ },
11461
+ {
11462
+ name: "X25519PubkeyMismatch"
11463
+ },
11464
+ {
11465
+ name: "Ed25519VerifyingKeyMismatch"
11466
+ },
11467
+ {
11468
+ name: "ElGamalPubkeyMismatch"
11469
+ },
11470
+ {
11471
+ name: "TooManyCorruptPeers"
11472
+ },
11473
+ {
11474
+ name: "Serialization"
11475
+ },
11476
+ {
11477
+ name: "NoPubkeysSet"
11478
+ },
11479
+ {
11480
+ name: "AccountNotFound"
11481
+ }
11482
+ ]
11483
+ }
11484
+ },
11480
11485
  {
11481
11486
  name: "LargeExecPool",
11482
11487
  serialization: "bytemuckunsafe",
@@ -11750,24 +11755,8 @@ var types = [
11750
11755
  }
11751
11756
  },
11752
11757
  {
11753
- name: "fallback_clusters",
11754
- docs: [
11755
- "Fallback clusters that can execute this MXE as an alternative to the",
11756
- "[MXEAccount::cluster]. There can be a maximum of [MAX_FALLBACK_CLUSTERS]",
11757
- "fallback clusters."
11758
- ],
11759
- type: {
11760
- vec: "u32"
11761
- }
11762
- },
11763
- {
11764
- name: "rejected_clusters",
11765
- docs: [
11766
- "The clusters that have rejected this MXE."
11767
- ],
11768
- type: {
11769
- vec: "u32"
11770
- }
11758
+ name: "lut_offset_slot",
11759
+ type: "u64"
11771
11760
  },
11772
11761
  {
11773
11762
  name: "computation_definitions",
@@ -13055,6 +13044,11 @@ const RECOVERY_CLUSTER_ACC_SEED = 'RecoveryClusterAccount';
13055
13044
  * @constant {string}
13056
13045
  */
13057
13046
  const MXE_RECOVERY_ACC_SEED = 'MxeRecoveryAccount';
13047
+ /**
13048
+ * Seed for ComputationDefinitionRaw PDA
13049
+ * @constant {string}
13050
+ */
13051
+ const RAW_CIRCUIT_ACC_SEED = 'ComputationDefinitionRaw';
13058
13052
  /**
13059
13053
  * Maximum number of bytes that can be reallocated per instruction.
13060
13054
  * @constant {number}
@@ -13214,6 +13208,32 @@ function getMxeRecoveryAccAddress(backupMxeProgramId, originalMxeProgramId) {
13214
13208
  ];
13215
13209
  return generateArciumPDAFrom(seeds)[0];
13216
13210
  }
13211
+ /**
13212
+ * Derives the raw circuit account address for a given computation definition and index.
13213
+ * @param compDefPubkey - The public key of the computation definition account.
13214
+ * @param rawCircuitIndex - The index of the raw circuit account (0-based).
13215
+ * @returns The derived raw circuit account public key.
13216
+ */
13217
+ function getRawCircuitAccAddress(compDefPubkey, rawCircuitIndex) {
13218
+ const seeds = [
13219
+ Buffer.from(RAW_CIRCUIT_ACC_SEED),
13220
+ compDefPubkey.toBuffer(),
13221
+ Buffer.from([rawCircuitIndex]),
13222
+ ];
13223
+ return generateArciumPDAFrom(seeds)[0];
13224
+ }
13225
+ /**
13226
+ * Derives the address lookup table address for an MXE program.
13227
+ * @param mxeProgramId - The public key of the MXE program.
13228
+ * @param lutOffset - The index of the lookup table, to be fetched from the mxe account.
13229
+ * @returns The derived address lookup table public key.
13230
+ */
13231
+ function getLookupTableAddress(mxeProgramId, lutOffset) {
13232
+ const mxeAccount = getMXEAccAddress(mxeProgramId);
13233
+ const lutIndexBuffer = lutOffset.toArrayLike(Buffer, 'le', 8);
13234
+ const seeds = [mxeAccount.toBuffer(), lutIndexBuffer];
13235
+ return web3_js.PublicKey.findProgramAddressSync(seeds, web3_js.AddressLookupTableProgram.programId)[0];
13236
+ }
13217
13237
  /**
13218
13238
  * Generates a program-derived address (PDA) from the provided seeds and the Arcium program ID.
13219
13239
  * @param seeds - An array of Buffer seeds used for PDA derivation.
@@ -13466,6 +13486,21 @@ async function getMXEPublicKey(provider, mxeProgramId) {
13466
13486
  async function getMXEArcisEd25519VerifyingKey(provider, mxeProgramId) {
13467
13487
  return getMXEUtilityKey(provider, mxeProgramId, 'ed25519VerifyingKey');
13468
13488
  }
13489
+ /**
13490
+ * Determines the current state of a circuit based on its on-chain configuration.
13491
+ * @internal Called internally by `uploadCircuit` - most users don't need this directly.
13492
+ * @param circuitSource - The circuitSource field from ComputationDefinitionAccount.
13493
+ * @returns The current state of the circuit.
13494
+ */
13495
+ function getCircuitState(circuitSource) {
13496
+ if (!('onChain' in circuitSource) || !circuitSource.onChain) {
13497
+ return 'Offchain';
13498
+ }
13499
+ if (circuitSource.onChain[0].isCompleted) {
13500
+ return 'OnchainFinalized';
13501
+ }
13502
+ return 'OnchainPending';
13503
+ }
13469
13504
  /**
13470
13505
  * Uploads a circuit to the blockchain, splitting it into multiple accounts if necessary.
13471
13506
  * @param provider - The Anchor provider to use for transactions.
@@ -13477,10 +13512,17 @@ async function getMXEArcisEd25519VerifyingKey(provider, mxeProgramId) {
13477
13512
  * @returns An array of transaction signatures for all upload and finalize transactions.
13478
13513
  */
13479
13514
  async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500) {
13480
- // 9 = 8-byte discriminator + 1-byte bump for ComputationDefinitionRaw account
13481
- const numAccs = Math.ceil(rawCircuit.length / (MAX_ACCOUNT_SIZE - 9));
13482
13515
  const compDefAccInfo = getCompDefAccInfo(circuitName, mxeProgramId);
13483
13516
  const program = getArciumProgram(provider);
13517
+ const compDefAcc = await program.account.computationDefinitionAccount.fetch(compDefAccInfo.pubkey);
13518
+ // Type assertion at boundary where Anchor's fetch() returns the account data
13519
+ const state = getCircuitState(compDefAcc.circuitSource);
13520
+ if (state !== 'OnchainPending') {
13521
+ optionalLog(logging, `Circuit ${circuitName} skipped: ${state}`);
13522
+ return [];
13523
+ }
13524
+ // 9 = 8-byte discriminator + 1-byte bump for ComputationDefinitionRaw account
13525
+ const numAccs = Math.ceil(rawCircuit.length / (MAX_ACCOUNT_SIZE - 9));
13484
13526
  const sigs = [];
13485
13527
  const uploadPromises = [];
13486
13528
  for (let i = 0; i < numAccs; i++) {
@@ -13523,15 +13565,26 @@ async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
13523
13565
  .transaction();
13524
13566
  }
13525
13567
  async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500) {
13568
+ const rawCircuitPda = getRawCircuitAccAddress(compDefAccInfo.pubkey, rawCircuitIndex);
13569
+ const existingAcc = await provider.connection.getAccountInfo(rawCircuitPda);
13570
+ // Skip entirely if account exists with correct size (pre-seeded at genesis or already uploaded)
13571
+ // Account layout: 8-byte discriminator + 1-byte bump + circuit data
13572
+ const requiredAccountSize = rawCircuitPart.length + 9;
13573
+ if (existingAcc !== null && existingAcc.data.length >= requiredAccountSize) {
13574
+ optionalLog(shouldLog, `Raw circuit acc ${rawCircuitIndex} already exists with sufficient size, skipping`);
13575
+ return [];
13576
+ }
13526
13577
  const sigs = [];
13527
- const initTx = await program.methods
13528
- .initRawCircuitAcc(compDefAccInfo.offset, mxeProgramId, rawCircuitIndex)
13529
- .accounts({
13530
- signer: provider.publicKey,
13531
- })
13532
- .rpc();
13533
- optionalLog(shouldLog, `Initiated raw circuit acc with raw circuit index ${rawCircuitIndex}`);
13534
- sigs.push(initTx);
13578
+ if (existingAcc === null) {
13579
+ const initTx = await program.methods
13580
+ .initRawCircuitAcc(compDefAccInfo.offset, mxeProgramId, rawCircuitIndex)
13581
+ .accounts({
13582
+ signer: provider.publicKey,
13583
+ })
13584
+ .rpc();
13585
+ optionalLog(shouldLog, `Initiated raw circuit acc with raw circuit index ${rawCircuitIndex}`);
13586
+ sigs.push(initTx);
13587
+ }
13535
13588
  if (rawCircuitPart.length > MAX_REALLOC_PER_IX) {
13536
13589
  // We only need to add size if the init didn't already make us big enough
13537
13590
  const nonAsyncTxCount = Math.ceil(rawCircuitPart.length / (MAX_REALLOC_PER_IX * MAX_EMBIGGEN_IX_PER_TX));
@@ -13556,8 +13609,10 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
13556
13609
  const blockInfo = await provider.connection.getLatestBlockhash();
13557
13610
  for (let i = 0; i < remainingTxCount; i += chunkSize) {
13558
13611
  optionalLog(shouldLog, `Sending chunk ${i / chunkSize + 1} of ${Math.ceil(remainingTxCount / chunkSize)}`);
13559
- const chunkPromises = []; // Array to hold promises for the current chunk
13560
- const currentChunkSize = Math.min(chunkSize, remainingTxCount - i); // Handle the last chunk
13612
+ // Array to hold promises for the current chunk
13613
+ const chunkPromises = [];
13614
+ // Handle the last chunk
13615
+ const currentChunkSize = Math.min(chunkSize, remainingTxCount - i);
13561
13616
  for (let j = 0; j < currentChunkSize; j++) {
13562
13617
  const offset = MAX_UPLOAD_PER_TX_BYTES * (i + j);
13563
13618
  // eslint-disable-next-line no-await-in-loop
@@ -13567,7 +13622,8 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
13567
13622
  // Wait for the current chunk to complete before proceeding
13568
13623
  // eslint-disable-next-line no-await-in-loop
13569
13624
  const chunkResults = await Promise.all(chunkPromises);
13570
- remainingTxs.push(...chunkResults); // Add the results of the current chunk to the main array
13625
+ // Add the results of the current chunk to the main array
13626
+ remainingTxs.push(...chunkResults);
13571
13627
  optionalLog(shouldLog, `Done sending chunk ${i / chunkSize + 1} of ${Math.ceil(remainingTxCount / chunkSize)}`);
13572
13628
  }
13573
13629
  return sigs.concat(remainingTxs);
@@ -13744,22 +13800,22 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
13744
13800
  }
13745
13801
  /**
13746
13802
  * Finalizes key recovery execution after the submission threshold is met.
13747
- * This queues the key_recovery_final MPC computation on the backup cluster.
13803
+ * This queues the key_recovery_finalize MPC computation on the backup cluster.
13748
13804
  * @param provider - The Anchor provider to use for transactions.
13749
13805
  * @param originalMxeProgramId - The public key of the original MXE program being recovered.
13750
13806
  * @param backupMxeProgramId - The public key of the backup MXE program.
13751
13807
  * @param clusterOffset - The cluster offset where the backup MXE is deployed.
13752
- * @param keyRecoveryFinalOffset - The computation offset for the key_recovery_final computation.
13808
+ * @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
13753
13809
  * @returns The transaction signature.
13754
13810
  */
13755
- async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalOffset) {
13811
+ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset) {
13756
13812
  const program = getArciumProgram(provider);
13757
13813
  const tx = await program.methods
13758
13814
  .finalizeKeyRecoveryExecution(originalMxeProgramId, backupMxeProgramId, clusterOffset)
13759
13815
  .accountsPartial({
13760
13816
  authority: provider.publicKey,
13761
13817
  payer: provider.publicKey,
13762
- keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalOffset),
13818
+ keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalizeOffset),
13763
13819
  executingPool: getExecutingPoolAccAddress(clusterOffset),
13764
13820
  mempool: getMempoolAccAddress(clusterOffset),
13765
13821
  originalMxeProgram: originalMxeProgramId,
@@ -13800,7 +13856,7 @@ async function initMxePart1(provider, mxeProgramId) {
13800
13856
  * @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
13801
13857
  * @returns The transaction signature.
13802
13858
  */
13803
- async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, mxeAuthority) {
13859
+ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority) {
13804
13860
  const program = getArciumProgram(provider);
13805
13861
  // Ensure recoveryPeers has exactly 100 elements
13806
13862
  const paddedRecoveryPeers = [...recoveryPeers];
@@ -13811,12 +13867,13 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers
13811
13867
  throw new Error('recoveryPeers must have at most 100 elements');
13812
13868
  }
13813
13869
  const tx = await program.methods
13814
- .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset)
13870
+ .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset)
13815
13871
  .accountsPartial({
13816
13872
  signer: provider.publicKey,
13817
13873
  mxeProgram: mxeProgramId,
13818
13874
  poolAccount: getFeePoolAccAddress(),
13819
13875
  mxeAuthority: mxeAuthority ?? provider.publicKey,
13876
+ addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
13820
13877
  })
13821
13878
  .transaction();
13822
13879
  return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
@@ -13913,6 +13970,7 @@ exports.getArciumEnv = getArciumEnv;
13913
13970
  exports.getArciumProgram = getArciumProgram;
13914
13971
  exports.getArciumProgramId = getArciumProgramId;
13915
13972
  exports.getArxNodeAccAddress = getArxNodeAccAddress;
13973
+ exports.getCircuitState = getCircuitState;
13916
13974
  exports.getClockAccAddress = getClockAccAddress;
13917
13975
  exports.getClusterAccAddress = getClusterAccAddress;
13918
13976
  exports.getCompDefAccAddress = getCompDefAccAddress;
@@ -13922,6 +13980,7 @@ exports.getComputationsInMempool = getComputationsInMempool;
13922
13980
  exports.getExecutingPoolAccAddress = getExecutingPoolAccAddress;
13923
13981
  exports.getExecutingPoolAccInfo = getExecutingPoolAccInfo;
13924
13982
  exports.getFeePoolAccAddress = getFeePoolAccAddress;
13983
+ exports.getLookupTableAddress = getLookupTableAddress;
13925
13984
  exports.getMXEAccAddress = getMXEAccAddress;
13926
13985
  exports.getMXEArcisEd25519VerifyingKey = getMXEArcisEd25519VerifyingKey;
13927
13986
  exports.getMXEPublicKey = getMXEPublicKey;
@@ -13929,6 +13988,7 @@ exports.getMempoolAccAddress = getMempoolAccAddress;
13929
13988
  exports.getMempoolAccInfo = getMempoolAccInfo;
13930
13989
  exports.getMempoolPriorityFeeStats = getMempoolPriorityFeeStats;
13931
13990
  exports.getMxeRecoveryAccAddress = getMxeRecoveryAccAddress;
13991
+ exports.getRawCircuitAccAddress = getRawCircuitAccAddress;
13932
13992
  exports.getRecoveryClusterAccAddress = getRecoveryClusterAccAddress;
13933
13993
  exports.initKeyRecoveryExecution = initKeyRecoveryExecution;
13934
13994
  exports.initMxePart1 = initMxePart1;