@arcium-hq/client 0.2.0 → 0.3.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/README.md CHANGED
@@ -37,7 +37,7 @@ To send private data for computation within Arcium, you need to encrypt it using
37
37
  ```typescript
38
38
  import { x25519 } from "@arcium-hq/client";
39
39
 
40
- const privateKey = x25519.utils.randomPrivateKey();
40
+ const privateKey = x25519.utils.randomSecretKey();
41
41
  const publicKey = x25519.getPublicKey(privateKey);
42
42
  ```
43
43
 
package/build/index.cjs CHANGED
@@ -1271,7 +1271,7 @@ class Aes256Cipher {
1271
1271
  var address = "BKck65TgoKRokMjQM3datB9oRwJ8rAj2jxPXvHXUvcL6";
1272
1272
  var metadata = {
1273
1273
  name: "arcium",
1274
- version: "0.2.0",
1274
+ version: "0.3.0",
1275
1275
  spec: "0.1.0",
1276
1276
  description: "The Arcium program"
1277
1277
  };
@@ -1589,7 +1589,7 @@ var instructions = [
1589
1589
  },
1590
1590
  {
1591
1591
  kind: "account",
1592
- path: "mxe.cluster.ok_or(MXEError :: ClusterNotSet) ? ",
1592
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
1593
1593
  account: "MXEAccount"
1594
1594
  }
1595
1595
  ]
@@ -1877,7 +1877,7 @@ var instructions = [
1877
1877
  },
1878
1878
  {
1879
1879
  kind: "account",
1880
- path: "arx_node_acc.cluster_memberships.get(1).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
1880
+ path: "arx_node_acc.cluster_memberships.get(1).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
1881
1881
  account: "ArxNode"
1882
1882
  }
1883
1883
  ]
@@ -1902,7 +1902,7 @@ var instructions = [
1902
1902
  },
1903
1903
  {
1904
1904
  kind: "account",
1905
- path: "arx_node_acc.cluster_memberships.get(2).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
1905
+ path: "arx_node_acc.cluster_memberships.get(2).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
1906
1906
  account: "ArxNode"
1907
1907
  }
1908
1908
  ]
@@ -1927,7 +1927,7 @@ var instructions = [
1927
1927
  },
1928
1928
  {
1929
1929
  kind: "account",
1930
- path: "arx_node_acc.cluster_memberships.get(3).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
1930
+ path: "arx_node_acc.cluster_memberships.get(3).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
1931
1931
  account: "ArxNode"
1932
1932
  }
1933
1933
  ]
@@ -1952,7 +1952,7 @@ var instructions = [
1952
1952
  },
1953
1953
  {
1954
1954
  kind: "account",
1955
- path: "arx_node_acc.cluster_memberships.get(4).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
1955
+ path: "arx_node_acc.cluster_memberships.get(4).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
1956
1956
  account: "ArxNode"
1957
1957
  }
1958
1958
  ]
@@ -1977,7 +1977,7 @@ var instructions = [
1977
1977
  },
1978
1978
  {
1979
1979
  kind: "account",
1980
- path: "arx_node_acc.cluster_memberships.get(5).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
1980
+ path: "arx_node_acc.cluster_memberships.get(5).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
1981
1981
  account: "ArxNode"
1982
1982
  }
1983
1983
  ]
@@ -2002,7 +2002,7 @@ var instructions = [
2002
2002
  },
2003
2003
  {
2004
2004
  kind: "account",
2005
- path: "arx_node_acc.cluster_memberships.get(6).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
2005
+ path: "arx_node_acc.cluster_memberships.get(6).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
2006
2006
  account: "ArxNode"
2007
2007
  }
2008
2008
  ]
@@ -2027,7 +2027,7 @@ var instructions = [
2027
2027
  },
2028
2028
  {
2029
2029
  kind: "account",
2030
- path: "arx_node_acc.cluster_memberships.get(7).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
2030
+ path: "arx_node_acc.cluster_memberships.get(7).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
2031
2031
  account: "ArxNode"
2032
2032
  }
2033
2033
  ]
@@ -2052,7 +2052,7 @@ var instructions = [
2052
2052
  },
2053
2053
  {
2054
2054
  kind: "account",
2055
- path: "arx_node_acc.cluster_memberships.get(8).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
2055
+ path: "arx_node_acc.cluster_memberships.get(8).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
2056
2056
  account: "ArxNode"
2057
2057
  }
2058
2058
  ]
@@ -2077,7 +2077,7 @@ var instructions = [
2077
2077
  },
2078
2078
  {
2079
2079
  kind: "account",
2080
- path: "arx_node_acc.cluster_memberships.get(9).ok_or(NodeError ::\nInvalidClusterMembership) ? ",
2080
+ path: "arx_node_acc.cluster_memberships.get(9).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
2081
2081
  account: "ArxNode"
2082
2082
  }
2083
2083
  ]
@@ -2455,7 +2455,7 @@ var instructions = [
2455
2455
  },
2456
2456
  {
2457
2457
  kind: "account",
2458
- path: "mxe.cluster.ok_or(MXEError :: ClusterNotSet) ? ",
2458
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
2459
2459
  account: "MXEAccount"
2460
2460
  }
2461
2461
  ]
@@ -2745,7 +2745,7 @@ var instructions = [
2745
2745
  },
2746
2746
  {
2747
2747
  kind: "account",
2748
- path: "mxe.cluster.ok_or(MXEError :: ClusterNotSet) ? ",
2748
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
2749
2749
  account: "MXEAccount"
2750
2750
  }
2751
2751
  ]
@@ -4116,6 +4116,41 @@ var instructions = [
4116
4116
  writable: true,
4117
4117
  signer: true
4118
4118
  },
4119
+ {
4120
+ name: "sign_seed",
4121
+ docs: [
4122
+ "This is ok-ish though, as we're not reading the account, we just need it to check that the",
4123
+ "CPI invocation is valid. The only downside is it's a bit ugly and wastes some CUs since",
4124
+ "we can't use a potentially stored bump."
4125
+ ],
4126
+ signer: true,
4127
+ pda: {
4128
+ seeds: [
4129
+ {
4130
+ kind: "const",
4131
+ value: [
4132
+ 83,
4133
+ 105,
4134
+ 103,
4135
+ 110,
4136
+ 101,
4137
+ 114,
4138
+ 65,
4139
+ 99,
4140
+ 99,
4141
+ 111,
4142
+ 117,
4143
+ 110,
4144
+ 116
4145
+ ]
4146
+ }
4147
+ ],
4148
+ program: {
4149
+ kind: "arg",
4150
+ path: "_mxe_program"
4151
+ }
4152
+ }
4153
+ },
4119
4154
  {
4120
4155
  name: "comp",
4121
4156
  writable: true,
@@ -4297,7 +4332,7 @@ var instructions = [
4297
4332
  },
4298
4333
  {
4299
4334
  kind: "arg",
4300
- path: "cluster_index.map_or(mxe.cluster.ok_or(MXEError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
4335
+ path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
4301
4336
  }
4302
4337
  ]
4303
4338
  }
@@ -4376,16 +4411,6 @@ var instructions = [
4376
4411
  }
4377
4412
  }
4378
4413
  },
4379
- {
4380
- name: "callback_accs",
4381
- type: {
4382
- vec: {
4383
- defined: {
4384
- name: "CallbackAccount"
4385
- }
4386
- }
4387
- }
4388
- },
4389
4414
  {
4390
4415
  name: "mxe_program",
4391
4416
  type: "pubkey"
@@ -4396,6 +4421,16 @@ var instructions = [
4396
4421
  option: "string"
4397
4422
  }
4398
4423
  },
4424
+ {
4425
+ name: "custom_callback_instructions",
4426
+ type: {
4427
+ vec: {
4428
+ defined: {
4429
+ name: "CallbackInstruction"
4430
+ }
4431
+ }
4432
+ }
4433
+ },
4399
4434
  {
4400
4435
  name: "input_delivery_fee",
4401
4436
  type: "u64"
@@ -4773,7 +4808,7 @@ var instructions = [
4773
4808
  },
4774
4809
  {
4775
4810
  kind: "account",
4776
- path: "mxe.cluster.ok_or(MXEError :: ClusterNotSet) ? ",
4811
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
4777
4812
  account: "MXEAccount"
4778
4813
  }
4779
4814
  ]
@@ -5352,48 +5387,258 @@ var events = [
5352
5387
  var errors = [
5353
5388
  {
5354
5389
  code: 6000,
5390
+ name: "InvalidAuthority",
5391
+ msg: "The given authority is invalid"
5392
+ },
5393
+ {
5394
+ code: 6001,
5395
+ name: "MxeKeysAlreadySet",
5396
+ msg: "The MXE keys are already set, i.e. all the nodes of the MXE cluster already agreed on the MXE keys"
5397
+ },
5398
+ {
5399
+ code: 6002,
5400
+ name: "MxeKeysNotSet",
5401
+ msg: "The MXE keys are not set, i.e. not all the nodes of the MXE cluster agreed on the MXE keys"
5402
+ },
5403
+ {
5404
+ code: 6003,
5405
+ name: "InvalidMXE",
5406
+ msg: "An invalid MXE account has been supplied"
5407
+ },
5408
+ {
5409
+ code: 6004,
5410
+ name: "ClusterAlreadySet",
5411
+ msg: "The cluster is already set"
5412
+ },
5413
+ {
5414
+ code: 6005,
5415
+ name: "ClusterNotSet",
5416
+ msg: "The cluster is not set"
5417
+ },
5418
+ {
5419
+ code: 6006,
5420
+ name: "InvalidCluster",
5421
+ msg: "An invalid cluster account has been supplied"
5422
+ },
5423
+ {
5424
+ code: 6007,
5425
+ name: "InvalidComputationDefinition",
5426
+ msg: "An invalid computation definition account has been supplied"
5427
+ },
5428
+ {
5429
+ code: 6008,
5430
+ name: "CantFindMempoolID",
5431
+ msg: "Couldn't find a mempool ID for the computation"
5432
+ },
5433
+ {
5434
+ code: 6100,
5435
+ name: "InvalidMempoolDiscriminator",
5436
+ msg: "Mempool discriminator is invalid"
5437
+ },
5438
+ {
5439
+ code: 6101,
5440
+ name: "InvalidMempoolSize",
5441
+ msg: "Mempool size is invalid"
5442
+ },
5443
+ {
5444
+ code: 6102,
5445
+ name: "InvalidExecpoolDiscriminator",
5446
+ msg: "Execpool discriminator is invalid"
5447
+ },
5448
+ {
5449
+ code: 6103,
5450
+ name: "MaxParallelismReached",
5451
+ msg: "Max parallelism reached"
5452
+ },
5453
+ {
5454
+ code: 6200,
5455
+ name: "InvalidComputationOffset",
5456
+ msg: "Computation offset is invalid"
5457
+ },
5458
+ {
5459
+ code: 6201,
5460
+ name: "InvalidCallbackAccs",
5461
+ msg: "Callback accounts are invalid"
5462
+ },
5463
+ {
5464
+ code: 6202,
5465
+ name: "InvalidCallbackAccsLen",
5466
+ msg: "Callback accounts length is invalid"
5467
+ },
5468
+ {
5469
+ code: 6203,
5470
+ name: "AlreadyInitializedComputation",
5471
+ msg: "The computation is already initialized"
5472
+ },
5473
+ {
5474
+ code: 6204,
5475
+ name: "AlreadyCallbackedComputation",
5476
+ msg: "Callback computation already called"
5477
+ },
5478
+ {
5479
+ code: 6205,
5480
+ name: "InvalidFinalizeTx",
5481
+ msg: "Finalize tx is invalid"
5482
+ },
5483
+ {
5484
+ code: 6206,
5485
+ name: "InvalidComputationStatus",
5486
+ msg: "Computation status is invalid"
5487
+ },
5488
+ {
5489
+ code: 6207,
5490
+ name: "InvalidComputation",
5491
+ msg: "Computation is invalid"
5492
+ },
5493
+ {
5494
+ code: 6208,
5495
+ name: "InvalidComputationAuthority",
5496
+ msg: "Computation authority is invalid"
5497
+ },
5498
+ {
5499
+ code: 6209,
5500
+ name: "InvalidCallbackInstructions",
5501
+ msg: "Callback instructions are invalid"
5502
+ },
5503
+ {
5504
+ code: 6300,
5505
+ name: "ComputationDefinitionNotCompleted",
5506
+ msg: "Computation definition is not completed"
5507
+ },
5508
+ {
5509
+ code: 6301,
5510
+ name: "InvalidArguments",
5511
+ msg: "Arguments supplied are invalid"
5512
+ },
5513
+ {
5514
+ code: 6302,
5515
+ name: "InvalidCircuitSource",
5516
+ msg: "Circuit source is invalid"
5517
+ },
5518
+ {
5519
+ code: 6303,
5520
+ name: "ComputationDefinitionAlreadyCompleted",
5521
+ msg: "Computation definition already completed"
5522
+ },
5523
+ {
5524
+ code: 6400,
5355
5525
  name: "InvalidNode",
5356
5526
  msg: "Node is invalid"
5357
5527
  },
5358
5528
  {
5359
- code: 6001,
5529
+ code: 6401,
5360
5530
  name: "MaxClusterMembershipReached",
5361
5531
  msg: "Maximum number of nodes in the cluster has been reached"
5362
5532
  },
5363
5533
  {
5364
- code: 6002,
5534
+ code: 6402,
5365
5535
  name: "NodeAlreadyExists",
5366
5536
  msg: "The node already exists in the cluster"
5367
5537
  },
5368
5538
  {
5369
- code: 6003,
5370
- name: "InvalidAuthority",
5539
+ code: 6403,
5540
+ name: "InvalidNodeAuthority",
5371
5541
  msg: "Node authority is invalid"
5372
5542
  },
5373
5543
  {
5374
- code: 6004,
5544
+ code: 6404,
5375
5545
  name: "NodeNotInactive",
5376
5546
  msg: "Node is not inactive"
5377
5547
  },
5378
5548
  {
5379
- code: 6005,
5549
+ code: 6405,
5380
5550
  name: "NodeNotActive",
5381
5551
  msg: "Node is not active"
5382
5552
  },
5383
5553
  {
5384
- code: 6006,
5554
+ code: 6406,
5385
5555
  name: "InvalidClusterMembership",
5386
5556
  msg: "Cluster membership is invalid"
5387
5557
  },
5388
5558
  {
5389
- code: 6007,
5559
+ code: 6407,
5390
5560
  name: "NodeInActiveCluster",
5391
5561
  msg: "Node is in an active cluster"
5392
5562
  },
5393
5563
  {
5394
- code: 6008,
5395
- name: "InvalidConfig",
5564
+ code: 6408,
5565
+ name: "InvalidNodeConfig",
5396
5566
  msg: "Node config is invalid"
5567
+ },
5568
+ {
5569
+ code: 6500,
5570
+ name: "ClusterFull",
5571
+ msg: "Cluster is full"
5572
+ },
5573
+ {
5574
+ code: 6501,
5575
+ name: "InvalidDeactivationEpoch",
5576
+ msg: "Cluster deactivation epoch is invalid"
5577
+ },
5578
+ {
5579
+ code: 6502,
5580
+ name: "InvalidMaxSize",
5581
+ msg: "Cluster maximum size is invalid"
5582
+ },
5583
+ {
5584
+ code: 6503,
5585
+ name: "InvalidClusterAuthority",
5586
+ msg: "Cluster authority is invalid"
5587
+ },
5588
+ {
5589
+ code: 6504,
5590
+ name: "InvalidFeeProposal",
5591
+ msg: "Cluster fee proposal is invalid"
5592
+ },
5593
+ {
5594
+ code: 6505,
5595
+ name: "InvalidClusterState",
5596
+ msg: "Cluster state is invalid"
5597
+ },
5598
+ {
5599
+ code: 6506,
5600
+ name: "InvalidVote",
5601
+ msg: "Cluster vote is invalid"
5602
+ },
5603
+ {
5604
+ code: 6600,
5605
+ name: "SerializationFailed",
5606
+ msg: "Borsh serialization failed"
5607
+ },
5608
+ {
5609
+ code: 6601,
5610
+ name: "DeserializationFailed",
5611
+ msg: "Borsh deserialization failed"
5612
+ },
5613
+ {
5614
+ code: 6602,
5615
+ name: "HeapFull",
5616
+ msg: "Heap is full"
5617
+ },
5618
+ {
5619
+ code: 6603,
5620
+ name: "InvalidSlot",
5621
+ msg: "Current slot is before the last updated slot"
5622
+ },
5623
+ {
5624
+ code: 6604,
5625
+ name: "EpochIsInfinity",
5626
+ msg: "Epoch is infinity"
5627
+ },
5628
+ {
5629
+ code: 6605,
5630
+ name: "InvalidTimestamp",
5631
+ msg: "Timestamp is invalid"
5632
+ },
5633
+ {
5634
+ code: 6606,
5635
+ name: "InvalidEpoch",
5636
+ msg: "Epoch is invalid"
5637
+ },
5638
+ {
5639
+ code: 6607,
5640
+ name: "EpochOverflow",
5641
+ msg: "Epoch overflowed"
5397
5642
  }
5398
5643
  ];
5399
5644
  var types = [
@@ -5740,20 +5985,18 @@ var types = [
5740
5985
  type: "u32"
5741
5986
  },
5742
5987
  {
5743
- name: "allowed_authorities",
5744
- type: {
5745
- vec: "pubkey"
5746
- }
5988
+ name: "authority",
5989
+ docs: [
5990
+ "Admin key for node management operations"
5991
+ ],
5992
+ type: "pubkey"
5747
5993
  },
5748
5994
  {
5749
- name: "supported_protocols",
5750
- type: {
5751
- vec: {
5752
- defined: {
5753
- name: "MPCProtocol"
5754
- }
5755
- }
5756
- }
5995
+ name: "callback_authority",
5996
+ docs: [
5997
+ "Key used to sign computation callbacks - separated for operational security"
5998
+ ],
5999
+ type: "pubkey"
5757
6000
  }
5758
6001
  ]
5759
6002
  }
@@ -5794,6 +6037,35 @@ var types = [
5794
6037
  ]
5795
6038
  }
5796
6039
  },
6040
+ {
6041
+ name: "CallbackInstruction",
6042
+ docs: [
6043
+ "A custom callback instruction with its own program ID and discriminator."
6044
+ ],
6045
+ type: {
6046
+ kind: "struct",
6047
+ fields: [
6048
+ {
6049
+ name: "program_id",
6050
+ type: "pubkey"
6051
+ },
6052
+ {
6053
+ name: "discriminator",
6054
+ type: "bytes"
6055
+ },
6056
+ {
6057
+ name: "accounts",
6058
+ type: {
6059
+ vec: {
6060
+ defined: {
6061
+ name: "CallbackAccount"
6062
+ }
6063
+ }
6064
+ }
6065
+ }
6066
+ ]
6067
+ }
6068
+ },
5797
6069
  {
5798
6070
  name: "CircuitSource",
5799
6071
  type: {
@@ -6041,19 +6313,19 @@ var types = [
6041
6313
  }
6042
6314
  },
6043
6315
  {
6044
- name: "callback_accs",
6316
+ name: "callback_url",
6045
6317
  type: {
6046
- vec: {
6047
- defined: {
6048
- name: "CallbackAccount"
6049
- }
6050
- }
6318
+ option: "string"
6051
6319
  }
6052
6320
  },
6053
6321
  {
6054
- name: "callback_url",
6322
+ name: "custom_callback_instructions",
6055
6323
  type: {
6056
- option: "string"
6324
+ vec: {
6325
+ defined: {
6326
+ name: "CallbackInstruction"
6327
+ }
6328
+ }
6057
6329
  }
6058
6330
  },
6059
6331
  {
@@ -6142,15 +6414,6 @@ var types = [
6142
6414
  name: "ComputationSignature"
6143
6415
  }
6144
6416
  }
6145
- },
6146
- {
6147
- name: "callback_discriminator",
6148
- type: {
6149
- array: [
6150
- "u8",
6151
- 8
6152
- ]
6153
- }
6154
6417
  }
6155
6418
  ]
6156
6419
  }
@@ -6324,6 +6587,21 @@ var types = [
6324
6587
  ]
6325
6588
  }
6326
6589
  },
6590
+ {
6591
+ name: "counter",
6592
+ type: "u64"
6593
+ },
6594
+ {
6595
+ name: "execpool_index",
6596
+ type: {
6597
+ array: [
6598
+ "u64",
6599
+ {
6600
+ generic: "MAX_PARRALLEL_COMPUTATIONS"
6601
+ }
6602
+ ]
6603
+ }
6604
+ },
6327
6605
  {
6328
6606
  name: "currently_executing",
6329
6607
  type: {
@@ -6677,20 +6955,6 @@ var types = [
6677
6955
  ]
6678
6956
  }
6679
6957
  },
6680
- {
6681
- name: "MPCProtocol",
6682
- type: {
6683
- kind: "enum",
6684
- variants: [
6685
- {
6686
- name: "CERBERUS"
6687
- },
6688
- {
6689
- name: "MANTICORE"
6690
- }
6691
- ]
6692
- }
6693
- },
6694
6958
  {
6695
6959
  name: "MXEAccount",
6696
6960
  docs: [