@noosphere/contracts 0.1.0-alpha.5 → 0.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -325,18 +325,54 @@ var _abi = [
325
325
  },
326
326
  {
327
327
  name: "input",
328
- type: "bytes",
329
- internalType: "bytes"
328
+ type: "tuple",
329
+ internalType: "struct PayloadData",
330
+ components: [
331
+ {
332
+ name: "contentHash",
333
+ type: "bytes32",
334
+ internalType: "bytes32"
335
+ },
336
+ {
337
+ name: "uri",
338
+ type: "bytes",
339
+ internalType: "bytes"
340
+ }
341
+ ]
330
342
  },
331
343
  {
332
344
  name: "output",
333
- type: "bytes",
334
- internalType: "bytes"
345
+ type: "tuple",
346
+ internalType: "struct PayloadData",
347
+ components: [
348
+ {
349
+ name: "contentHash",
350
+ type: "bytes32",
351
+ internalType: "bytes32"
352
+ },
353
+ {
354
+ name: "uri",
355
+ type: "bytes",
356
+ internalType: "bytes"
357
+ }
358
+ ]
335
359
  },
336
360
  {
337
361
  name: "proof",
338
- type: "bytes",
339
- internalType: "bytes"
362
+ type: "tuple",
363
+ internalType: "struct PayloadData",
364
+ components: [
365
+ {
366
+ name: "contentHash",
367
+ type: "bytes32",
368
+ internalType: "bytes32"
369
+ },
370
+ {
371
+ name: "uri",
372
+ type: "bytes",
373
+ internalType: "bytes"
374
+ }
375
+ ]
340
376
  },
341
377
  {
342
378
  name: "commitmentData",
@@ -652,6 +688,60 @@ var _abi = [
652
688
  type: "uint16",
653
689
  indexed: false,
654
690
  internalType: "uint16"
691
+ },
692
+ {
693
+ name: "input",
694
+ type: "tuple",
695
+ indexed: false,
696
+ internalType: "struct PayloadData",
697
+ components: [
698
+ {
699
+ name: "contentHash",
700
+ type: "bytes32",
701
+ internalType: "bytes32"
702
+ },
703
+ {
704
+ name: "uri",
705
+ type: "bytes",
706
+ internalType: "bytes"
707
+ }
708
+ ]
709
+ },
710
+ {
711
+ name: "output",
712
+ type: "tuple",
713
+ indexed: false,
714
+ internalType: "struct PayloadData",
715
+ components: [
716
+ {
717
+ name: "contentHash",
718
+ type: "bytes32",
719
+ internalType: "bytes32"
720
+ },
721
+ {
722
+ name: "uri",
723
+ type: "bytes",
724
+ internalType: "bytes"
725
+ }
726
+ ]
727
+ },
728
+ {
729
+ name: "proof",
730
+ type: "tuple",
731
+ indexed: false,
732
+ internalType: "struct PayloadData",
733
+ components: [
734
+ {
735
+ name: "contentHash",
736
+ type: "bytes32",
737
+ internalType: "bytes32"
738
+ },
739
+ {
740
+ name: "uri",
741
+ type: "bytes",
742
+ internalType: "bytes"
743
+ }
744
+ ]
655
745
  }
656
746
  ],
657
747
  anonymous: false
@@ -1328,18 +1418,54 @@ var _abi2 = [
1328
1418
  inputs: [
1329
1419
  {
1330
1420
  name: "input",
1331
- type: "bytes",
1332
- internalType: "bytes"
1421
+ type: "tuple",
1422
+ internalType: "struct PayloadData",
1423
+ components: [
1424
+ {
1425
+ name: "contentHash",
1426
+ type: "bytes32",
1427
+ internalType: "bytes32"
1428
+ },
1429
+ {
1430
+ name: "uri",
1431
+ type: "bytes",
1432
+ internalType: "bytes"
1433
+ }
1434
+ ]
1333
1435
  },
1334
1436
  {
1335
1437
  name: "output",
1336
- type: "bytes",
1337
- internalType: "bytes"
1438
+ type: "tuple",
1439
+ internalType: "struct PayloadData",
1440
+ components: [
1441
+ {
1442
+ name: "contentHash",
1443
+ type: "bytes32",
1444
+ internalType: "bytes32"
1445
+ },
1446
+ {
1447
+ name: "uri",
1448
+ type: "bytes",
1449
+ internalType: "bytes"
1450
+ }
1451
+ ]
1338
1452
  },
1339
1453
  {
1340
1454
  name: "proof",
1341
- type: "bytes",
1342
- internalType: "bytes"
1455
+ type: "tuple",
1456
+ internalType: "struct PayloadData",
1457
+ components: [
1458
+ {
1459
+ name: "contentHash",
1460
+ type: "bytes32",
1461
+ internalType: "bytes32"
1462
+ },
1463
+ {
1464
+ name: "uri",
1465
+ type: "bytes",
1466
+ internalType: "bytes"
1467
+ }
1468
+ ]
1343
1469
  },
1344
1470
  {
1345
1471
  name: "numRedundantDeliveries",
@@ -3915,7 +4041,7 @@ var WalletFactoryAbi__factory = class {
3915
4041
  WalletFactoryAbi__factory.abi = _abi5;
3916
4042
 
3917
4043
  // src/Router.ts
3918
- import { Contract as Contract6 } from "ethers";
4044
+ import { Contract as Contract6, ethers } from "ethers";
3919
4045
 
3920
4046
  // src/abis/Router.abi.json
3921
4047
  var Router_abi_default = [
@@ -4298,18 +4424,54 @@ var Router_abi_default = [
4298
4424
  inputs: [
4299
4425
  {
4300
4426
  name: "input",
4301
- type: "bytes",
4302
- internalType: "bytes"
4427
+ type: "tuple",
4428
+ internalType: "struct PayloadData",
4429
+ components: [
4430
+ {
4431
+ name: "contentHash",
4432
+ type: "bytes32",
4433
+ internalType: "bytes32"
4434
+ },
4435
+ {
4436
+ name: "uri",
4437
+ type: "bytes",
4438
+ internalType: "bytes"
4439
+ }
4440
+ ]
4303
4441
  },
4304
4442
  {
4305
4443
  name: "output",
4306
- type: "bytes",
4307
- internalType: "bytes"
4444
+ type: "tuple",
4445
+ internalType: "struct PayloadData",
4446
+ components: [
4447
+ {
4448
+ name: "contentHash",
4449
+ type: "bytes32",
4450
+ internalType: "bytes32"
4451
+ },
4452
+ {
4453
+ name: "uri",
4454
+ type: "bytes",
4455
+ internalType: "bytes"
4456
+ }
4457
+ ]
4308
4458
  },
4309
4459
  {
4310
4460
  name: "proof",
4311
- type: "bytes",
4312
- internalType: "bytes"
4461
+ type: "tuple",
4462
+ internalType: "struct PayloadData",
4463
+ components: [
4464
+ {
4465
+ name: "contentHash",
4466
+ type: "bytes32",
4467
+ internalType: "bytes32"
4468
+ },
4469
+ {
4470
+ name: "uri",
4471
+ type: "bytes",
4472
+ internalType: "bytes"
4473
+ }
4474
+ ]
4313
4475
  },
4314
4476
  {
4315
4477
  name: "numRedundantDeliveries",
@@ -5785,12 +5947,19 @@ var RouterContract = class {
5785
5947
  //////////////////////////////////////////////////////////////////////////*/
5786
5948
  /**
5787
5949
  * Accept fulfillment results and attempt on-chain settlement
5950
+ * @param input - PayloadData containing contentHash and uri for input
5951
+ * @param output - PayloadData containing contentHash and uri for output
5952
+ * @param proof - PayloadData containing contentHash and uri for proof
5953
+ * @param numRedundantDeliveries - Number of redundant deliveries
5954
+ * @param nodeWallet - Address of the node's payment wallet
5955
+ * @param payments - Array of payment instructions
5956
+ * @param commitment - The commitment data
5788
5957
  */
5789
5958
  async fulfill(input, output, proof, numRedundantDeliveries, nodeWallet, payments, commitment) {
5790
5959
  const result = await this.contract.fulfill(
5791
- input,
5792
- output,
5793
- proof,
5960
+ this.encodePayloadData(input),
5961
+ this.encodePayloadData(output),
5962
+ this.encodePayloadData(proof),
5794
5963
  numRedundantDeliveries,
5795
5964
  nodeWallet,
5796
5965
  payments,
@@ -5798,6 +5967,17 @@ var RouterContract = class {
5798
5967
  );
5799
5968
  return result;
5800
5969
  }
5970
+ /**
5971
+ * Encode PayloadData for contract call
5972
+ * @param payload - PayloadData to encode
5973
+ * @returns Tuple format expected by contract
5974
+ */
5975
+ encodePayloadData(payload) {
5976
+ return [
5977
+ payload.contentHash,
5978
+ ethers.toUtf8Bytes(payload.uri)
5979
+ ];
5980
+ }
5801
5981
  /**
5802
5982
  * Execute coordinator-driven payouts
5803
5983
  */
@@ -5982,7 +6162,7 @@ var RouterContract = class {
5982
6162
  };
5983
6163
 
5984
6164
  // src/Coordinator.ts
5985
- import { Contract as Contract7 } from "ethers";
6165
+ import { Contract as Contract7, ethers as ethers2 } from "ethers";
5986
6166
 
5987
6167
  // src/abis/Coordinator.abi.json
5988
6168
  var Coordinator_abi_default = [
@@ -6294,18 +6474,54 @@ var Coordinator_abi_default = [
6294
6474
  },
6295
6475
  {
6296
6476
  name: "input",
6297
- type: "bytes",
6298
- internalType: "bytes"
6477
+ type: "tuple",
6478
+ internalType: "struct PayloadData",
6479
+ components: [
6480
+ {
6481
+ name: "contentHash",
6482
+ type: "bytes32",
6483
+ internalType: "bytes32"
6484
+ },
6485
+ {
6486
+ name: "uri",
6487
+ type: "bytes",
6488
+ internalType: "bytes"
6489
+ }
6490
+ ]
6299
6491
  },
6300
6492
  {
6301
6493
  name: "output",
6302
- type: "bytes",
6303
- internalType: "bytes"
6494
+ type: "tuple",
6495
+ internalType: "struct PayloadData",
6496
+ components: [
6497
+ {
6498
+ name: "contentHash",
6499
+ type: "bytes32",
6500
+ internalType: "bytes32"
6501
+ },
6502
+ {
6503
+ name: "uri",
6504
+ type: "bytes",
6505
+ internalType: "bytes"
6506
+ }
6507
+ ]
6304
6508
  },
6305
6509
  {
6306
6510
  name: "proof",
6307
- type: "bytes",
6308
- internalType: "bytes"
6511
+ type: "tuple",
6512
+ internalType: "struct PayloadData",
6513
+ components: [
6514
+ {
6515
+ name: "contentHash",
6516
+ type: "bytes32",
6517
+ internalType: "bytes32"
6518
+ },
6519
+ {
6520
+ name: "uri",
6521
+ type: "bytes",
6522
+ internalType: "bytes"
6523
+ }
6524
+ ]
6309
6525
  },
6310
6526
  {
6311
6527
  name: "commitmentData",
@@ -6621,6 +6837,60 @@ var Coordinator_abi_default = [
6621
6837
  type: "uint16",
6622
6838
  indexed: false,
6623
6839
  internalType: "uint16"
6840
+ },
6841
+ {
6842
+ name: "input",
6843
+ type: "tuple",
6844
+ indexed: false,
6845
+ internalType: "struct PayloadData",
6846
+ components: [
6847
+ {
6848
+ name: "contentHash",
6849
+ type: "bytes32",
6850
+ internalType: "bytes32"
6851
+ },
6852
+ {
6853
+ name: "uri",
6854
+ type: "bytes",
6855
+ internalType: "bytes"
6856
+ }
6857
+ ]
6858
+ },
6859
+ {
6860
+ name: "output",
6861
+ type: "tuple",
6862
+ indexed: false,
6863
+ internalType: "struct PayloadData",
6864
+ components: [
6865
+ {
6866
+ name: "contentHash",
6867
+ type: "bytes32",
6868
+ internalType: "bytes32"
6869
+ },
6870
+ {
6871
+ name: "uri",
6872
+ type: "bytes",
6873
+ internalType: "bytes"
6874
+ }
6875
+ ]
6876
+ },
6877
+ {
6878
+ name: "proof",
6879
+ type: "tuple",
6880
+ indexed: false,
6881
+ internalType: "struct PayloadData",
6882
+ components: [
6883
+ {
6884
+ name: "contentHash",
6885
+ type: "bytes32",
6886
+ internalType: "bytes32"
6887
+ },
6888
+ {
6889
+ name: "uri",
6890
+ type: "bytes",
6891
+ internalType: "bytes"
6892
+ }
6893
+ ]
6624
6894
  }
6625
6895
  ],
6626
6896
  anonymous: false
@@ -6943,17 +7213,45 @@ var CoordinatorContract = class {
6943
7213
  //////////////////////////////////////////////////////////////////////////*/
6944
7214
  /**
6945
7215
  * Report compute result for an interval
7216
+ * @param deliveryInterval - The interval number for this delivery
7217
+ * @param input - PayloadData containing contentHash and uri for input
7218
+ * @param output - PayloadData containing contentHash and uri for output
7219
+ * @param proof - PayloadData containing contentHash and uri for proof
7220
+ * @param commitmentData - ABI-encoded commitment data
7221
+ * @param nodeWallet - Address of the node's payment wallet
6946
7222
  */
6947
7223
  async reportComputeResult(deliveryInterval, input, output, proof, commitmentData, nodeWallet) {
6948
7224
  return this.contract.reportComputeResult(
6949
7225
  deliveryInterval,
6950
- input,
6951
- output,
6952
- proof,
7226
+ this.encodePayloadData(input),
7227
+ this.encodePayloadData(output),
7228
+ this.encodePayloadData(proof),
6953
7229
  commitmentData,
6954
7230
  nodeWallet
6955
7231
  );
6956
7232
  }
7233
+ /**
7234
+ * Encode PayloadData for contract call
7235
+ * @param payload - PayloadData to encode
7236
+ * @returns Tuple format expected by contract
7237
+ */
7238
+ encodePayloadData(payload) {
7239
+ return [
7240
+ payload.contentHash,
7241
+ ethers2.toUtf8Bytes(payload.uri)
7242
+ ];
7243
+ }
7244
+ /**
7245
+ * Parse PayloadData from contract response
7246
+ * @param data - Raw tuple from contract
7247
+ * @returns Parsed PayloadData
7248
+ */
7249
+ parsePayloadData(data) {
7250
+ return {
7251
+ contentHash: data.contentHash || data[0],
7252
+ uri: ethers2.toUtf8String(data.uri || data[1])
7253
+ };
7254
+ }
6957
7255
  /*//////////////////////////////////////////////////////////////////////////
6958
7256
  VERIFICATION
6959
7257
  //////////////////////////////////////////////////////////////////////////*/
@@ -7277,6 +7575,12 @@ var SubscriptionBatchReaderContract = class {
7277
7575
  };
7278
7576
 
7279
7577
  // src/types/index.ts
7578
+ var InputType = /* @__PURE__ */ ((InputType2) => {
7579
+ InputType2[InputType2["RAW_DATA"] = 0] = "RAW_DATA";
7580
+ InputType2[InputType2["URI_STRING"] = 1] = "URI_STRING";
7581
+ InputType2[InputType2["PAYLOAD_DATA"] = 2] = "PAYLOAD_DATA";
7582
+ return InputType2;
7583
+ })(InputType || {});
7280
7584
  var FulfillResult = /* @__PURE__ */ ((FulfillResult2) => {
7281
7585
  FulfillResult2[FulfillResult2["FULFILLED"] = 0] = "FULFILLED";
7282
7586
  FulfillResult2[FulfillResult2["INVALID_REQUEST_ID"] = 1] = "INVALID_REQUEST_ID";
@@ -8251,6 +8555,7 @@ export {
8251
8555
  CoordinatorAbi__factory,
8252
8556
  CoordinatorContract,
8253
8557
  FulfillResult,
8558
+ InputType,
8254
8559
  RouterAbi__factory,
8255
8560
  RouterContract,
8256
8561
  SubscriptionBatchReaderAbi__factory,