@arcium-hq/client 0.6.0 → 0.6.2

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.mjs CHANGED
@@ -262,6 +262,28 @@ function encodeAsRescueEncryptable(v) {
262
262
  }
263
263
  throw new Error('Invalid type to convert from number to bigint');
264
264
  }
265
+ /**
266
+ * Decodes a Rescue-decrypted value back to a signed bigint.
267
+ * Handles the conversion from field element representation to signed integer.
268
+ * @param v - The decrypted field element value
269
+ * @returns The decoded signed bigint value
270
+ */
271
+ function decodeRescueDecryptedToBigInt(v) {
272
+ const twoInv = (CURVE25519_BASE_FIELD.ORDER + 1n) / 2n;
273
+ const binSize = getBinSize(CURVE25519_BASE_FIELD.ORDER - 1n);
274
+ const isLtTwoInv = ctLt(v, twoInv, binSize);
275
+ return ctSelect(isLtTwoInv, v, ctSub(v, CURVE25519_BASE_FIELD.ORDER, binSize), binSize);
276
+ }
277
+ /**
278
+ * Decodes a Rescue-decrypted value back to a JavaScript number.
279
+ * Converts from field element representation to a floating-point number.
280
+ * @param v - The decrypted field element value
281
+ * @returns The decoded number value
282
+ */
283
+ function decodeRescueDecryptedToNumber(v) {
284
+ const vSigned = decodeRescueDecryptedToBigInt(v);
285
+ return Number(vSigned) * 2 ** -DOUBLE_PRECISION_MANTISSA;
286
+ }
265
287
  /**
266
288
  * Checks if a computation reference is null (all zeros).
267
289
  * @param ref - The computation reference to check
@@ -1252,22 +1274,22 @@ class Aes256Cipher extends AesCtrCipher {
1252
1274
  }
1253
1275
 
1254
1276
  class DataSize {
1255
- is_full;
1277
+ isFull;
1256
1278
  size;
1257
1279
  index;
1258
1280
  constructor(index, size) {
1259
- const is_undefined = size == undefined;
1260
- this.is_full = is_undefined;
1261
- this.size = is_undefined ? 0 : size;
1281
+ const isUndefined = size === undefined;
1282
+ this.isFull = isUndefined;
1283
+ this.size = isUndefined ? 0 : size;
1262
1284
  this.index = index;
1263
1285
  }
1264
1286
  }
1265
1287
  function sortDataSizes(arr) {
1266
- arr.sort((left, right) => {
1267
- if (left.is_full != right.is_full) {
1268
- return left.is_full ? -1 : 1;
1288
+ return [...arr].sort((left, right) => {
1289
+ if (left.isFull !== right.isFull) {
1290
+ return left.isFull ? -1 : 1;
1269
1291
  }
1270
- if (left.size != right.size) {
1292
+ if (left.size !== right.size) {
1271
1293
  return right.size - left.size;
1272
1294
  }
1273
1295
  return left.index - right.index;
@@ -1290,7 +1312,7 @@ class PackingState {
1290
1312
  this.maxSize = maxSize;
1291
1313
  }
1292
1314
  getCurrentLoad(index) {
1293
- return this.loads[index] == undefined ? 0 : this.loads[index];
1315
+ return this.loads[index] === undefined ? 0 : this.loads[index];
1294
1316
  }
1295
1317
  canFit(index, size) {
1296
1318
  return this.getCurrentLoad(index) + size <= this.maxSize;
@@ -1305,7 +1327,7 @@ class PackingState {
1305
1327
  return this.lastInsert + 1;
1306
1328
  }
1307
1329
  insert(size) {
1308
- if (size.is_full) {
1330
+ if (size.isFull) {
1309
1331
  this.lastInsert = this.nFull;
1310
1332
  this.nFull++;
1311
1333
  return new PackLocation(this.lastInsert, 0);
@@ -1320,23 +1342,27 @@ class PackingState {
1320
1342
  }
1321
1343
  }
1322
1344
  function packing(maxSize, arr) {
1323
- sortDataSizes(arr);
1345
+ const sortedArr = sortDataSizes(arr);
1324
1346
  const inserts = [];
1325
1347
  const state = new PackingState(maxSize);
1326
- arr.forEach((value) => {
1348
+ sortedArr.forEach((value) => {
1327
1349
  const pack = state.insert(value);
1328
1350
  inserts.push([value.index, pack]);
1329
1351
  });
1330
- const n_packs = state.loads.length;
1352
+ const nPacks = state.nFull + state.loads.length;
1331
1353
  inserts.sort((left, right) => left[0] - right[0]);
1332
1354
  const res = inserts.map((arg) => arg[1]);
1333
- return [n_packs, res];
1355
+ return [nPacks, res];
1334
1356
  }
1335
1357
  const ARCIS_PACKING_SIZE = 214;
1336
1358
  function arcisPacking(arr) {
1337
1359
  return packing(ARCIS_PACKING_SIZE, arr);
1338
1360
  }
1339
1361
 
1362
+ /** Length of a Pubkey in bytes (Solana public keys are 32 bytes) */
1363
+ const PUBKEY_BYTE_LENGTH = 32;
1364
+ /** Maximum value a Pubkey bigint can hold (2^256) */
1365
+ const PUBKEY_MAX_VALUE = 1n << 256n;
1340
1366
  var ArcisValueKind;
1341
1367
  (function (ArcisValueKind) {
1342
1368
  ArcisValueKind[ArcisValueKind["Integer"] = 0] = "Integer";
@@ -1358,10 +1384,10 @@ class IntegerInfo {
1358
1384
  minValue() {
1359
1385
  return this.signed ? -1n << (this.width - 1n) : 0n;
1360
1386
  }
1361
- is_within_bounds(b) {
1362
- const min_value = this.minValue();
1363
- const min_bigger_value = this.signed ? 1n << (this.width - 1n) : 1n << this.width;
1364
- return min_value <= b && b < min_bigger_value;
1387
+ isWithinBounds(b) {
1388
+ const minVal = this.minValue();
1389
+ const maxVal = this.signed ? 1n << (this.width - 1n) : 1n << this.width;
1390
+ return minVal <= b && b < maxVal;
1365
1391
  }
1366
1392
  name() {
1367
1393
  return (this.signed ? "i" : "u") + this.width;
@@ -1395,9 +1421,9 @@ class ArcisValueField {
1395
1421
  kind = ArcisValueKind.Pubkey;
1396
1422
  break;
1397
1423
  }
1398
- if (kind == ArcisValueKind.Integer) {
1399
- if (typeof rawType == "string") {
1400
- throw TypeError("Weird thfflkmk");
1424
+ if (kind === ArcisValueKind.Integer) {
1425
+ if (typeof rawType === "string") {
1426
+ throw new TypeError("Expected Integer type object with signed/width properties");
1401
1427
  }
1402
1428
  const info = IntegerInfo.fromJson(rawType.Integer);
1403
1429
  return new ArcisValueField(name, kind, info);
@@ -1407,38 +1433,63 @@ class ArcisValueField {
1407
1433
  }
1408
1434
  }
1409
1435
  toBigInt(arg) {
1436
+ if (this.kind === ArcisValueKind.Float) {
1437
+ if (typeof arg !== 'number') {
1438
+ throw new TypeError(`Field ${this.name} expected a number, got ${typeof arg}`);
1439
+ }
1440
+ return encodeAsRescueEncryptable(arg);
1441
+ }
1442
+ let value = arg;
1443
+ if (typeof value === 'number') {
1444
+ if (!Number.isInteger(value)) {
1445
+ throw new TypeError(`Field ${this.name}: expected integer, got float ${value}`);
1446
+ }
1447
+ if (!Number.isSafeInteger(value)) {
1448
+ throw new RangeError(`Field ${this.name}: ${value} exceeds safe integer range, use BigInt`);
1449
+ }
1450
+ value = BigInt(value);
1451
+ }
1410
1452
  switch (this.kind) {
1411
1453
  case ArcisValueKind.Bool:
1412
- if (typeof arg != "boolean") {
1413
- throw new TypeError("Field " + this.name + " expected a `boolean`, got `" + typeof arg + "`.");
1414
- }
1415
- return BigInt(arg);
1416
- case ArcisValueKind.Float:
1417
- if (typeof arg != "number") {
1418
- throw new TypeError("Field " + this.name + " expected a `number`, got `" + typeof arg + "`.");
1454
+ if (typeof value !== 'boolean') {
1455
+ throw new TypeError(`Field ${this.name} expected a boolean, got ${typeof value}`);
1419
1456
  }
1420
- return encodeAsRescueEncryptable(arg);
1457
+ return BigInt(value);
1421
1458
  case ArcisValueKind.FullInteger:
1422
- if (typeof arg != "bigint") {
1423
- throw new TypeError("Field " + this.name + " expected a `bigint`, got `" + typeof arg + "`.");
1459
+ if (typeof value !== 'bigint') {
1460
+ throw new TypeError(`Field ${this.name} expected a bigint, got ${typeof value}`);
1424
1461
  }
1425
- return arg;
1462
+ return value;
1426
1463
  case ArcisValueKind.Integer:
1427
- if (typeof arg != "bigint") {
1428
- throw new TypeError("Field " + this.name + " expected a `bigint`, got `" + typeof arg + "`.");
1464
+ if (typeof value !== 'bigint') {
1465
+ throw new TypeError(`Field ${this.name} expected a bigint, got ${typeof value}`);
1429
1466
  }
1430
- if (typeof this.info == "undefined") {
1431
- throw new TypeError("Field " + this.name + " is an integer, but signedness and width are unknown.");
1467
+ if (this.info === undefined) {
1468
+ throw new TypeError(`Field ${this.name} is an integer, but signedness and width are unknown`);
1432
1469
  }
1433
- if (!this.info.is_within_bounds(arg)) {
1434
- throw new TypeError("Field " + this.name + " is a " + this.info.name() + ", and " + arg + " is not.");
1470
+ if (!this.info.isWithinBounds(value)) {
1471
+ const min = this.info.minValue();
1472
+ const max = this.info.signed ? (1n << (this.info.width - 1n)) - 1n : (1n << this.info.width) - 1n;
1473
+ throw new RangeError(`Field "${this.name}" (${this.info.name()}): value ${value} out of range [${min}, ${max}]`);
1435
1474
  }
1436
- return arg - this.info.minValue();
1437
- case ArcisValueKind.Pubkey:
1438
- if (!(arg instanceof Uint8Array)) {
1439
- throw new TypeError("Field " + this.name + " expected a `Uint8Array`, got `" + typeof arg + "`.");
1475
+ return value - this.info.minValue();
1476
+ case ArcisValueKind.Pubkey: {
1477
+ if (!(value instanceof Uint8Array)) {
1478
+ throw new TypeError(`Field ${this.name} expected a Uint8Array, got ${typeof value}`);
1440
1479
  }
1441
- throw new TypeError("unimplemented pubkey ");
1480
+ if (value.length !== PUBKEY_BYTE_LENGTH) {
1481
+ throw new RangeError(`Field ${this.name} expected ${PUBKEY_BYTE_LENGTH}-byte Uint8Array, got ${value.length} bytes`);
1482
+ }
1483
+ let pubkeyResult = 0n;
1484
+ for (let i = 0; i < PUBKEY_BYTE_LENGTH; i++) {
1485
+ pubkeyResult |= BigInt(value[i]) << BigInt(i * 8);
1486
+ }
1487
+ return pubkeyResult;
1488
+ }
1489
+ default: {
1490
+ const _exhaustive = this.kind;
1491
+ throw new Error(`Unhandled ArcisValueKind: ${_exhaustive}`);
1492
+ }
1442
1493
  }
1443
1494
  }
1444
1495
  fromBigInt(arg) {
@@ -1450,20 +1501,57 @@ class ArcisValueField {
1450
1501
  case 1n:
1451
1502
  return true;
1452
1503
  default:
1453
- throw new Error("Bool was neither 0 nor 1, it was " + arg);
1504
+ throw new RangeError(`Field ${this.name}: Bool must be 0 or 1, got ${arg}`);
1454
1505
  }
1455
1506
  case ArcisValueKind.Float:
1456
- return Number(arg - (1n << 127n)) / (2 ** 52);
1507
+ return decodeRescueDecryptedToNumber(arg);
1457
1508
  case ArcisValueKind.FullInteger:
1458
1509
  return arg;
1459
1510
  case ArcisValueKind.Integer:
1460
- if (this.info == undefined) {
1461
- throw TypeError("Integer type without integer info");
1511
+ if (this.info === undefined) {
1512
+ throw new TypeError("Integer type without integer info");
1462
1513
  }
1463
1514
  return arg + this.info.minValue();
1464
- case ArcisValueKind.Pubkey:
1465
- throw new Error("unimplemented yet");
1515
+ case ArcisValueKind.Pubkey: {
1516
+ if (arg < 0n) {
1517
+ throw new RangeError(`Field ${this.name}: Pubkey cannot be negative`);
1518
+ }
1519
+ if (arg >= PUBKEY_MAX_VALUE) {
1520
+ throw new RangeError(`Field ${this.name}: Pubkey exceeds 256 bits`);
1521
+ }
1522
+ const pubkeyBytes = new Uint8Array(PUBKEY_BYTE_LENGTH);
1523
+ let remaining = arg;
1524
+ for (let i = 0; i < PUBKEY_BYTE_LENGTH; i++) {
1525
+ pubkeyBytes[i] = Number(remaining & 0xffn);
1526
+ remaining >>= 8n;
1527
+ }
1528
+ return pubkeyBytes;
1529
+ }
1530
+ default: {
1531
+ const _exhaustive = this.kind;
1532
+ throw new Error(`Unhandled ArcisValueKind: ${_exhaustive}`);
1533
+ }
1534
+ }
1535
+ }
1536
+ static fromFieldInfo(info) {
1537
+ const name = info.name;
1538
+ if (info.type === 'Bool') {
1539
+ return new ArcisValueField(name, ArcisValueKind.Bool);
1540
+ }
1541
+ if (info.type === 'FullInteger') {
1542
+ return new ArcisValueField(name, ArcisValueKind.FullInteger);
1466
1543
  }
1544
+ if (info.type === 'Float') {
1545
+ return new ArcisValueField(name, ArcisValueKind.Float);
1546
+ }
1547
+ if (info.type === 'Pubkey') {
1548
+ return new ArcisValueField(name, ArcisValueKind.Pubkey);
1549
+ }
1550
+ if (typeof info.type === 'object' && 'Integer' in info.type) {
1551
+ const intInfo = new IntegerInfo(info.type.Integer.signed, BigInt(info.type.Integer.width));
1552
+ return new ArcisValueField(name, ArcisValueKind.Integer, intInfo);
1553
+ }
1554
+ throw new TypeError(`Unknown field type for ${name}`);
1467
1555
  }
1468
1556
  toDataSize(index) {
1469
1557
  switch (this.kind) {
@@ -1488,6 +1576,9 @@ class ArcisType {
1488
1576
  this.fields = fields;
1489
1577
  }
1490
1578
  pack(rawData) {
1579
+ if (rawData.length !== this.fields.length) {
1580
+ throw new RangeError(`Expected ${this.fields.length} fields, got ${rawData.length}`);
1581
+ }
1491
1582
  const data = rawData.map((val, index) => this.fields[index].toBigInt(val));
1492
1583
  const dataSizes = this.fields.map((field, index) => field.toDataSize(index));
1493
1584
  const packing = arcisPacking(dataSizes);
@@ -1502,11 +1593,14 @@ class ArcisType {
1502
1593
  unpack(packed) {
1503
1594
  const dataSizes = this.fields.map((field, index) => field.toDataSize(index));
1504
1595
  const packing = arcisPacking(dataSizes);
1596
+ if (packed.length < packing[0]) {
1597
+ throw new RangeError(`Expected at least ${packing[0]} packed elements, got ${packed.length}`);
1598
+ }
1505
1599
  const res = [];
1506
1600
  for (let idx = 0; idx < dataSizes.length; idx++) {
1507
1601
  const packLocation = packing[1][idx];
1508
1602
  const dataSize = dataSizes[idx];
1509
- const val = dataSize.is_full ? packed[packLocation.index] : (packed[packLocation.index] >> BigInt(packLocation.offset)) % (1n << BigInt(dataSize.size));
1603
+ const val = dataSize.isFull ? packed[packLocation.index] : (packed[packLocation.index] >> BigInt(packLocation.offset)) % (1n << BigInt(dataSize.size));
1510
1604
  res.push(this.fields[idx].fromBigInt(val));
1511
1605
  }
1512
1606
  return res;
@@ -1538,10 +1632,76 @@ class ArcisModule {
1538
1632
  }
1539
1633
  }
1540
1634
 
1541
- var address = "BpaW2ZmCJnDwizWY8eM34JtVqp2kRgnmQcedSVc9USdP";
1635
+ function parseFieldName(name) {
1636
+ const match = name.match(/^(.+)\[(\d+)\]$/);
1637
+ if (match) {
1638
+ return { base: match[1], index: parseInt(match[2], 10) };
1639
+ }
1640
+ return { base: name, index: null };
1641
+ }
1642
+ function extractValue(data, fieldName) {
1643
+ const { base, index } = parseFieldName(fieldName);
1644
+ const value = data[base];
1645
+ if (index !== null) {
1646
+ if (!Array.isArray(value)) {
1647
+ throw new TypeError(`Field "${base}" should be an array`);
1648
+ }
1649
+ if (index >= value.length) {
1650
+ throw new RangeError(`Field "${base}[${index}]" out of bounds (array length: ${value.length})`);
1651
+ }
1652
+ return value[index];
1653
+ }
1654
+ return value;
1655
+ }
1656
+ function groupUnpackedValues(values, fieldNames) {
1657
+ const result = {};
1658
+ for (let i = 0; i < fieldNames.length; i++) {
1659
+ const { base, index } = parseFieldName(fieldNames[i]);
1660
+ const value = values[i];
1661
+ if (index !== null) {
1662
+ if (!result[base]) {
1663
+ result[base] = [];
1664
+ }
1665
+ result[base][index] = value;
1666
+ }
1667
+ else {
1668
+ result[base] = value;
1669
+ }
1670
+ }
1671
+ return result;
1672
+ }
1673
+ /**
1674
+ * Creates a type-safe packer from field definitions.
1675
+ * Use `as const` on the fields array for compile-time field name validation.
1676
+ * @param fields - Field definitions from generated code.
1677
+ * @param typeName - Type name for debugging.
1678
+ */
1679
+ function createPacker(fields, typeName = 'Packer') {
1680
+ const arcisFields = fields.map(f => ArcisValueField.fromFieldInfo(f));
1681
+ const arcisType = new ArcisType(typeName, arcisFields);
1682
+ const fieldNames = fields.map(f => f.name);
1683
+ return {
1684
+ pack(data) {
1685
+ const arr = fieldNames.map(name => {
1686
+ const value = extractValue(data, name);
1687
+ if (value === undefined) {
1688
+ throw new Error(`Missing required field: "${name}"`);
1689
+ }
1690
+ return value;
1691
+ });
1692
+ return arcisType.pack(arr);
1693
+ },
1694
+ unpack(packed) {
1695
+ const arr = arcisType.unpack(packed);
1696
+ return groupUnpackedValues(arr, fieldNames);
1697
+ }
1698
+ };
1699
+ }
1700
+
1701
+ var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
1542
1702
  var metadata = {
1543
1703
  name: "arcium",
1544
- version: "0.6.0",
1704
+ version: "0.6.2",
1545
1705
  spec: "0.1.0",
1546
1706
  description: "The Arcium program"
1547
1707
  };
@@ -2714,18 +2874,24 @@ var instructions = [
2714
2874
  {
2715
2875
  kind: "const",
2716
2876
  value: [
2717
- 109,
2877
+ 77,
2718
2878
  120,
2719
2879
  101,
2720
- 95,
2721
- 114,
2880
+ 82,
2722
2881
  101,
2723
2882
  99,
2724
2883
  111,
2725
2884
  118,
2726
2885
  101,
2727
2886
  114,
2728
- 121
2887
+ 121,
2888
+ 65,
2889
+ 99,
2890
+ 99,
2891
+ 111,
2892
+ 117,
2893
+ 110,
2894
+ 116
2729
2895
  ]
2730
2896
  },
2731
2897
  {
@@ -3491,18 +3657,24 @@ var instructions = [
3491
3657
  {
3492
3658
  kind: "const",
3493
3659
  value: [
3494
- 109,
3660
+ 77,
3495
3661
  120,
3496
3662
  101,
3497
- 95,
3498
- 114,
3663
+ 82,
3499
3664
  101,
3500
3665
  99,
3501
3666
  111,
3502
3667
  118,
3503
3668
  101,
3504
3669
  114,
3505
- 121
3670
+ 121,
3671
+ 65,
3672
+ 99,
3673
+ 99,
3674
+ 111,
3675
+ 117,
3676
+ 110,
3677
+ 116
3506
3678
  ]
3507
3679
  },
3508
3680
  {
@@ -3846,18 +4018,24 @@ var instructions = [
3846
4018
  {
3847
4019
  kind: "const",
3848
4020
  value: [
3849
- 109,
4021
+ 77,
3850
4022
  120,
3851
4023
  101,
3852
- 95,
3853
- 114,
4024
+ 82,
3854
4025
  101,
3855
4026
  99,
3856
4027
  111,
3857
4028
  118,
3858
4029
  101,
3859
4030
  114,
3860
- 121
4031
+ 121,
4032
+ 65,
4033
+ 99,
4034
+ 99,
4035
+ 111,
4036
+ 117,
4037
+ 110,
4038
+ 116
3861
4039
  ]
3862
4040
  },
3863
4041
  {
@@ -4960,18 +5138,24 @@ var instructions = [
4960
5138
  {
4961
5139
  kind: "const",
4962
5140
  value: [
4963
- 109,
5141
+ 77,
4964
5142
  120,
4965
5143
  101,
4966
- 95,
4967
- 114,
5144
+ 82,
4968
5145
  101,
4969
5146
  99,
4970
5147
  111,
4971
5148
  118,
4972
5149
  101,
4973
5150
  114,
4974
- 121
5151
+ 121,
5152
+ 65,
5153
+ 99,
5154
+ 99,
5155
+ 111,
5156
+ 117,
5157
+ 110,
5158
+ 116
4975
5159
  ]
4976
5160
  },
4977
5161
  {
@@ -5133,18 +5317,24 @@ var instructions = [
5133
5317
  {
5134
5318
  kind: "const",
5135
5319
  value: [
5136
- 109,
5320
+ 77,
5137
5321
  120,
5138
5322
  101,
5139
- 95,
5140
- 114,
5323
+ 82,
5141
5324
  101,
5142
5325
  99,
5143
5326
  111,
5144
5327
  118,
5145
5328
  101,
5146
5329
  114,
5147
- 121
5330
+ 121,
5331
+ 65,
5332
+ 99,
5333
+ 99,
5334
+ 111,
5335
+ 117,
5336
+ 110,
5337
+ 116
5148
5338
  ]
5149
5339
  },
5150
5340
  {
@@ -7301,18 +7491,24 @@ var instructions = [
7301
7491
  {
7302
7492
  kind: "const",
7303
7493
  value: [
7304
- 109,
7494
+ 77,
7305
7495
  120,
7306
7496
  101,
7307
- 95,
7308
- 114,
7497
+ 82,
7309
7498
  101,
7310
7499
  99,
7311
7500
  111,
7312
7501
  118,
7313
7502
  101,
7314
7503
  114,
7315
- 121
7504
+ 121,
7505
+ 65,
7506
+ 99,
7507
+ 99,
7508
+ 111,
7509
+ 117,
7510
+ 110,
7511
+ 116
7316
7512
  ]
7317
7513
  },
7318
7514
  {
@@ -8541,18 +8737,24 @@ var instructions = [
8541
8737
  {
8542
8738
  kind: "const",
8543
8739
  value: [
8544
- 109,
8740
+ 77,
8545
8741
  120,
8546
8742
  101,
8547
- 95,
8548
- 114,
8743
+ 82,
8549
8744
  101,
8550
8745
  99,
8551
8746
  111,
8552
8747
  118,
8553
8748
  101,
8554
8749
  114,
8555
- 121
8750
+ 121,
8751
+ 65,
8752
+ 99,
8753
+ 99,
8754
+ 111,
8755
+ 117,
8756
+ 110,
8757
+ 116
8556
8758
  ]
8557
8759
  },
8558
8760
  {
@@ -9666,6 +9868,11 @@ var errors = [
9666
9868
  code: 6713,
9667
9869
  name: "BackupClusterNotSet",
9668
9870
  msg: "Backup MXE cluster is not set"
9871
+ },
9872
+ {
9873
+ code: 6714,
9874
+ name: "ShareAlreadySubmitted",
9875
+ msg: "Share already submitted"
9669
9876
  }
9670
9877
  ];
9671
9878
  var types = [
@@ -11526,17 +11733,11 @@ var types = [
11526
11733
  kind: "struct",
11527
11734
  fields: [
11528
11735
  {
11529
- name: "bitmap",
11736
+ name: "key_recovery_finalize_offset",
11530
11737
  docs: [
11531
- "Bitmap tracking which peers have uploaded their shares.",
11532
- "Bit index corresponds to the index in the original MXE's recovery_peers array."
11738
+ "The computation offset for the queued key_recovery_finalize circuit."
11533
11739
  ],
11534
- type: {
11535
- array: [
11536
- "u8",
11537
- 13
11538
- ]
11539
- }
11740
+ type: "u64"
11540
11741
  },
11541
11742
  {
11542
11743
  name: "shares",
@@ -11562,52 +11763,32 @@ var types = [
11562
11763
  }
11563
11764
  },
11564
11765
  {
11565
- name: "is_finalized",
11566
- docs: [
11567
- "Whether the recovery has been finalized (threshold met and marked ready)."
11568
- ],
11569
- type: "u8"
11766
+ name: "original_mxe_pubkey",
11767
+ type: "pubkey"
11570
11768
  },
11571
11769
  {
11572
- name: "_padding1",
11573
- docs: [
11574
- "Padding for u64 alignment (need 5 bytes to align key_recovery_final_offset at 8-byte",
11575
- "boundary)"
11576
- ],
11577
- type: {
11578
- array: [
11579
- "u8",
11580
- 2
11581
- ]
11582
- }
11770
+ name: "backup_mxe_pubkey",
11771
+ type: "pubkey"
11583
11772
  },
11584
11773
  {
11585
- name: "key_recovery_finalize_offset",
11774
+ name: "is_finalized",
11586
11775
  docs: [
11587
- "The computation offset for the queued key_recovery_finalize circuit."
11776
+ "Whether the recovery has been finalized (threshold met and marked ready)."
11588
11777
  ],
11589
- type: "u64"
11778
+ type: "u8"
11590
11779
  },
11591
11780
  {
11592
11781
  name: "_padding2",
11593
11782
  docs: [
11594
- "Padding to ensure struct size is multiple of 8 (for zero_copy alignment after bump field)"
11783
+ "Padding to ensure struct size is u64 aligned (6 bytes)"
11595
11784
  ],
11596
11785
  type: {
11597
11786
  array: [
11598
11787
  "u8",
11599
- 7
11788
+ 6
11600
11789
  ]
11601
11790
  }
11602
11791
  },
11603
- {
11604
- name: "original_mxe_pubkey",
11605
- type: "pubkey"
11606
- },
11607
- {
11608
- name: "backup_mxe_pubkey",
11609
- type: "pubkey"
11610
- },
11611
11792
  {
11612
11793
  name: "bump",
11613
11794
  type: "u8"
@@ -12596,7 +12777,7 @@ const RECOVERY_CLUSTER_ACC_SEED = 'RecoveryClusterAccount';
12596
12777
  * Seed for MxeRecoveryAccount PDA
12597
12778
  * @constant {string}
12598
12779
  */
12599
- const MXE_RECOVERY_ACC_SEED = 'mxe_recovery';
12780
+ const MXE_RECOVERY_ACC_SEED = 'MxeRecoveryAccount';
12600
12781
  /**
12601
12782
  * Maximum number of bytes that can be reallocated per instruction.
12602
12783
  * @constant {number}
@@ -13422,4 +13603,4 @@ async function awaitEvent(eventListener, eventName, eventCheck, commitment = 'co
13422
13603
  return { event: foundEvent[0], sig: foundEvent[1] };
13423
13604
  }
13424
13605
 
13425
- export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, deserializeLE, finalizeKeyRecoveryExecution, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRecoveryClusterAccAddress, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };
13606
+ export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, ArcisValueField, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, IntegerInfo, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, createPacker, deserializeLE, finalizeKeyRecoveryExecution, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRecoveryClusterAccAddress, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };