@noosphere/contracts 0.1.0-alpha.4 → 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.cjs +336 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +209 -43
- package/dist/index.d.ts +209 -43
- package/dist/index.js +337 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/abis/Coordinator.abi.json +96 -6
- package/src/abis/Router.abi.json +42 -6
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
CoordinatorAbi__factory: () => CoordinatorAbi__factory,
|
|
25
25
|
CoordinatorContract: () => CoordinatorContract,
|
|
26
26
|
FulfillResult: () => FulfillResult,
|
|
27
|
+
InputType: () => InputType,
|
|
27
28
|
RouterAbi__factory: () => RouterAbi__factory,
|
|
28
29
|
RouterContract: () => RouterContract,
|
|
29
30
|
SubscriptionBatchReaderAbi__factory: () => SubscriptionBatchReaderAbi__factory,
|
|
@@ -355,18 +356,54 @@ var _abi = [
|
|
|
355
356
|
},
|
|
356
357
|
{
|
|
357
358
|
name: "input",
|
|
358
|
-
type: "
|
|
359
|
-
internalType: "
|
|
359
|
+
type: "tuple",
|
|
360
|
+
internalType: "struct PayloadData",
|
|
361
|
+
components: [
|
|
362
|
+
{
|
|
363
|
+
name: "contentHash",
|
|
364
|
+
type: "bytes32",
|
|
365
|
+
internalType: "bytes32"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "uri",
|
|
369
|
+
type: "bytes",
|
|
370
|
+
internalType: "bytes"
|
|
371
|
+
}
|
|
372
|
+
]
|
|
360
373
|
},
|
|
361
374
|
{
|
|
362
375
|
name: "output",
|
|
363
|
-
type: "
|
|
364
|
-
internalType: "
|
|
376
|
+
type: "tuple",
|
|
377
|
+
internalType: "struct PayloadData",
|
|
378
|
+
components: [
|
|
379
|
+
{
|
|
380
|
+
name: "contentHash",
|
|
381
|
+
type: "bytes32",
|
|
382
|
+
internalType: "bytes32"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "uri",
|
|
386
|
+
type: "bytes",
|
|
387
|
+
internalType: "bytes"
|
|
388
|
+
}
|
|
389
|
+
]
|
|
365
390
|
},
|
|
366
391
|
{
|
|
367
392
|
name: "proof",
|
|
368
|
-
type: "
|
|
369
|
-
internalType: "
|
|
393
|
+
type: "tuple",
|
|
394
|
+
internalType: "struct PayloadData",
|
|
395
|
+
components: [
|
|
396
|
+
{
|
|
397
|
+
name: "contentHash",
|
|
398
|
+
type: "bytes32",
|
|
399
|
+
internalType: "bytes32"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "uri",
|
|
403
|
+
type: "bytes",
|
|
404
|
+
internalType: "bytes"
|
|
405
|
+
}
|
|
406
|
+
]
|
|
370
407
|
},
|
|
371
408
|
{
|
|
372
409
|
name: "commitmentData",
|
|
@@ -682,6 +719,60 @@ var _abi = [
|
|
|
682
719
|
type: "uint16",
|
|
683
720
|
indexed: false,
|
|
684
721
|
internalType: "uint16"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: "input",
|
|
725
|
+
type: "tuple",
|
|
726
|
+
indexed: false,
|
|
727
|
+
internalType: "struct PayloadData",
|
|
728
|
+
components: [
|
|
729
|
+
{
|
|
730
|
+
name: "contentHash",
|
|
731
|
+
type: "bytes32",
|
|
732
|
+
internalType: "bytes32"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "uri",
|
|
736
|
+
type: "bytes",
|
|
737
|
+
internalType: "bytes"
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
name: "output",
|
|
743
|
+
type: "tuple",
|
|
744
|
+
indexed: false,
|
|
745
|
+
internalType: "struct PayloadData",
|
|
746
|
+
components: [
|
|
747
|
+
{
|
|
748
|
+
name: "contentHash",
|
|
749
|
+
type: "bytes32",
|
|
750
|
+
internalType: "bytes32"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "uri",
|
|
754
|
+
type: "bytes",
|
|
755
|
+
internalType: "bytes"
|
|
756
|
+
}
|
|
757
|
+
]
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "proof",
|
|
761
|
+
type: "tuple",
|
|
762
|
+
indexed: false,
|
|
763
|
+
internalType: "struct PayloadData",
|
|
764
|
+
components: [
|
|
765
|
+
{
|
|
766
|
+
name: "contentHash",
|
|
767
|
+
type: "bytes32",
|
|
768
|
+
internalType: "bytes32"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
name: "uri",
|
|
772
|
+
type: "bytes",
|
|
773
|
+
internalType: "bytes"
|
|
774
|
+
}
|
|
775
|
+
]
|
|
685
776
|
}
|
|
686
777
|
],
|
|
687
778
|
anonymous: false
|
|
@@ -1358,18 +1449,54 @@ var _abi2 = [
|
|
|
1358
1449
|
inputs: [
|
|
1359
1450
|
{
|
|
1360
1451
|
name: "input",
|
|
1361
|
-
type: "
|
|
1362
|
-
internalType: "
|
|
1452
|
+
type: "tuple",
|
|
1453
|
+
internalType: "struct PayloadData",
|
|
1454
|
+
components: [
|
|
1455
|
+
{
|
|
1456
|
+
name: "contentHash",
|
|
1457
|
+
type: "bytes32",
|
|
1458
|
+
internalType: "bytes32"
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
name: "uri",
|
|
1462
|
+
type: "bytes",
|
|
1463
|
+
internalType: "bytes"
|
|
1464
|
+
}
|
|
1465
|
+
]
|
|
1363
1466
|
},
|
|
1364
1467
|
{
|
|
1365
1468
|
name: "output",
|
|
1366
|
-
type: "
|
|
1367
|
-
internalType: "
|
|
1469
|
+
type: "tuple",
|
|
1470
|
+
internalType: "struct PayloadData",
|
|
1471
|
+
components: [
|
|
1472
|
+
{
|
|
1473
|
+
name: "contentHash",
|
|
1474
|
+
type: "bytes32",
|
|
1475
|
+
internalType: "bytes32"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
name: "uri",
|
|
1479
|
+
type: "bytes",
|
|
1480
|
+
internalType: "bytes"
|
|
1481
|
+
}
|
|
1482
|
+
]
|
|
1368
1483
|
},
|
|
1369
1484
|
{
|
|
1370
1485
|
name: "proof",
|
|
1371
|
-
type: "
|
|
1372
|
-
internalType: "
|
|
1486
|
+
type: "tuple",
|
|
1487
|
+
internalType: "struct PayloadData",
|
|
1488
|
+
components: [
|
|
1489
|
+
{
|
|
1490
|
+
name: "contentHash",
|
|
1491
|
+
type: "bytes32",
|
|
1492
|
+
internalType: "bytes32"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
name: "uri",
|
|
1496
|
+
type: "bytes",
|
|
1497
|
+
internalType: "bytes"
|
|
1498
|
+
}
|
|
1499
|
+
]
|
|
1373
1500
|
},
|
|
1374
1501
|
{
|
|
1375
1502
|
name: "numRedundantDeliveries",
|
|
@@ -4328,18 +4455,54 @@ var Router_abi_default = [
|
|
|
4328
4455
|
inputs: [
|
|
4329
4456
|
{
|
|
4330
4457
|
name: "input",
|
|
4331
|
-
type: "
|
|
4332
|
-
internalType: "
|
|
4458
|
+
type: "tuple",
|
|
4459
|
+
internalType: "struct PayloadData",
|
|
4460
|
+
components: [
|
|
4461
|
+
{
|
|
4462
|
+
name: "contentHash",
|
|
4463
|
+
type: "bytes32",
|
|
4464
|
+
internalType: "bytes32"
|
|
4465
|
+
},
|
|
4466
|
+
{
|
|
4467
|
+
name: "uri",
|
|
4468
|
+
type: "bytes",
|
|
4469
|
+
internalType: "bytes"
|
|
4470
|
+
}
|
|
4471
|
+
]
|
|
4333
4472
|
},
|
|
4334
4473
|
{
|
|
4335
4474
|
name: "output",
|
|
4336
|
-
type: "
|
|
4337
|
-
internalType: "
|
|
4475
|
+
type: "tuple",
|
|
4476
|
+
internalType: "struct PayloadData",
|
|
4477
|
+
components: [
|
|
4478
|
+
{
|
|
4479
|
+
name: "contentHash",
|
|
4480
|
+
type: "bytes32",
|
|
4481
|
+
internalType: "bytes32"
|
|
4482
|
+
},
|
|
4483
|
+
{
|
|
4484
|
+
name: "uri",
|
|
4485
|
+
type: "bytes",
|
|
4486
|
+
internalType: "bytes"
|
|
4487
|
+
}
|
|
4488
|
+
]
|
|
4338
4489
|
},
|
|
4339
4490
|
{
|
|
4340
4491
|
name: "proof",
|
|
4341
|
-
type: "
|
|
4342
|
-
internalType: "
|
|
4492
|
+
type: "tuple",
|
|
4493
|
+
internalType: "struct PayloadData",
|
|
4494
|
+
components: [
|
|
4495
|
+
{
|
|
4496
|
+
name: "contentHash",
|
|
4497
|
+
type: "bytes32",
|
|
4498
|
+
internalType: "bytes32"
|
|
4499
|
+
},
|
|
4500
|
+
{
|
|
4501
|
+
name: "uri",
|
|
4502
|
+
type: "bytes",
|
|
4503
|
+
internalType: "bytes"
|
|
4504
|
+
}
|
|
4505
|
+
]
|
|
4343
4506
|
},
|
|
4344
4507
|
{
|
|
4345
4508
|
name: "numRedundantDeliveries",
|
|
@@ -5815,12 +5978,19 @@ var RouterContract = class {
|
|
|
5815
5978
|
//////////////////////////////////////////////////////////////////////////*/
|
|
5816
5979
|
/**
|
|
5817
5980
|
* Accept fulfillment results and attempt on-chain settlement
|
|
5981
|
+
* @param input - PayloadData containing contentHash and uri for input
|
|
5982
|
+
* @param output - PayloadData containing contentHash and uri for output
|
|
5983
|
+
* @param proof - PayloadData containing contentHash and uri for proof
|
|
5984
|
+
* @param numRedundantDeliveries - Number of redundant deliveries
|
|
5985
|
+
* @param nodeWallet - Address of the node's payment wallet
|
|
5986
|
+
* @param payments - Array of payment instructions
|
|
5987
|
+
* @param commitment - The commitment data
|
|
5818
5988
|
*/
|
|
5819
5989
|
async fulfill(input, output, proof, numRedundantDeliveries, nodeWallet, payments, commitment) {
|
|
5820
5990
|
const result = await this.contract.fulfill(
|
|
5821
|
-
input,
|
|
5822
|
-
output,
|
|
5823
|
-
proof,
|
|
5991
|
+
this.encodePayloadData(input),
|
|
5992
|
+
this.encodePayloadData(output),
|
|
5993
|
+
this.encodePayloadData(proof),
|
|
5824
5994
|
numRedundantDeliveries,
|
|
5825
5995
|
nodeWallet,
|
|
5826
5996
|
payments,
|
|
@@ -5828,6 +5998,17 @@ var RouterContract = class {
|
|
|
5828
5998
|
);
|
|
5829
5999
|
return result;
|
|
5830
6000
|
}
|
|
6001
|
+
/**
|
|
6002
|
+
* Encode PayloadData for contract call
|
|
6003
|
+
* @param payload - PayloadData to encode
|
|
6004
|
+
* @returns Tuple format expected by contract
|
|
6005
|
+
*/
|
|
6006
|
+
encodePayloadData(payload) {
|
|
6007
|
+
return [
|
|
6008
|
+
payload.contentHash,
|
|
6009
|
+
import_ethers6.ethers.toUtf8Bytes(payload.uri)
|
|
6010
|
+
];
|
|
6011
|
+
}
|
|
5831
6012
|
/**
|
|
5832
6013
|
* Execute coordinator-driven payouts
|
|
5833
6014
|
*/
|
|
@@ -6324,18 +6505,54 @@ var Coordinator_abi_default = [
|
|
|
6324
6505
|
},
|
|
6325
6506
|
{
|
|
6326
6507
|
name: "input",
|
|
6327
|
-
type: "
|
|
6328
|
-
internalType: "
|
|
6508
|
+
type: "tuple",
|
|
6509
|
+
internalType: "struct PayloadData",
|
|
6510
|
+
components: [
|
|
6511
|
+
{
|
|
6512
|
+
name: "contentHash",
|
|
6513
|
+
type: "bytes32",
|
|
6514
|
+
internalType: "bytes32"
|
|
6515
|
+
},
|
|
6516
|
+
{
|
|
6517
|
+
name: "uri",
|
|
6518
|
+
type: "bytes",
|
|
6519
|
+
internalType: "bytes"
|
|
6520
|
+
}
|
|
6521
|
+
]
|
|
6329
6522
|
},
|
|
6330
6523
|
{
|
|
6331
6524
|
name: "output",
|
|
6332
|
-
type: "
|
|
6333
|
-
internalType: "
|
|
6525
|
+
type: "tuple",
|
|
6526
|
+
internalType: "struct PayloadData",
|
|
6527
|
+
components: [
|
|
6528
|
+
{
|
|
6529
|
+
name: "contentHash",
|
|
6530
|
+
type: "bytes32",
|
|
6531
|
+
internalType: "bytes32"
|
|
6532
|
+
},
|
|
6533
|
+
{
|
|
6534
|
+
name: "uri",
|
|
6535
|
+
type: "bytes",
|
|
6536
|
+
internalType: "bytes"
|
|
6537
|
+
}
|
|
6538
|
+
]
|
|
6334
6539
|
},
|
|
6335
6540
|
{
|
|
6336
6541
|
name: "proof",
|
|
6337
|
-
type: "
|
|
6338
|
-
internalType: "
|
|
6542
|
+
type: "tuple",
|
|
6543
|
+
internalType: "struct PayloadData",
|
|
6544
|
+
components: [
|
|
6545
|
+
{
|
|
6546
|
+
name: "contentHash",
|
|
6547
|
+
type: "bytes32",
|
|
6548
|
+
internalType: "bytes32"
|
|
6549
|
+
},
|
|
6550
|
+
{
|
|
6551
|
+
name: "uri",
|
|
6552
|
+
type: "bytes",
|
|
6553
|
+
internalType: "bytes"
|
|
6554
|
+
}
|
|
6555
|
+
]
|
|
6339
6556
|
},
|
|
6340
6557
|
{
|
|
6341
6558
|
name: "commitmentData",
|
|
@@ -6651,6 +6868,60 @@ var Coordinator_abi_default = [
|
|
|
6651
6868
|
type: "uint16",
|
|
6652
6869
|
indexed: false,
|
|
6653
6870
|
internalType: "uint16"
|
|
6871
|
+
},
|
|
6872
|
+
{
|
|
6873
|
+
name: "input",
|
|
6874
|
+
type: "tuple",
|
|
6875
|
+
indexed: false,
|
|
6876
|
+
internalType: "struct PayloadData",
|
|
6877
|
+
components: [
|
|
6878
|
+
{
|
|
6879
|
+
name: "contentHash",
|
|
6880
|
+
type: "bytes32",
|
|
6881
|
+
internalType: "bytes32"
|
|
6882
|
+
},
|
|
6883
|
+
{
|
|
6884
|
+
name: "uri",
|
|
6885
|
+
type: "bytes",
|
|
6886
|
+
internalType: "bytes"
|
|
6887
|
+
}
|
|
6888
|
+
]
|
|
6889
|
+
},
|
|
6890
|
+
{
|
|
6891
|
+
name: "output",
|
|
6892
|
+
type: "tuple",
|
|
6893
|
+
indexed: false,
|
|
6894
|
+
internalType: "struct PayloadData",
|
|
6895
|
+
components: [
|
|
6896
|
+
{
|
|
6897
|
+
name: "contentHash",
|
|
6898
|
+
type: "bytes32",
|
|
6899
|
+
internalType: "bytes32"
|
|
6900
|
+
},
|
|
6901
|
+
{
|
|
6902
|
+
name: "uri",
|
|
6903
|
+
type: "bytes",
|
|
6904
|
+
internalType: "bytes"
|
|
6905
|
+
}
|
|
6906
|
+
]
|
|
6907
|
+
},
|
|
6908
|
+
{
|
|
6909
|
+
name: "proof",
|
|
6910
|
+
type: "tuple",
|
|
6911
|
+
indexed: false,
|
|
6912
|
+
internalType: "struct PayloadData",
|
|
6913
|
+
components: [
|
|
6914
|
+
{
|
|
6915
|
+
name: "contentHash",
|
|
6916
|
+
type: "bytes32",
|
|
6917
|
+
internalType: "bytes32"
|
|
6918
|
+
},
|
|
6919
|
+
{
|
|
6920
|
+
name: "uri",
|
|
6921
|
+
type: "bytes",
|
|
6922
|
+
internalType: "bytes"
|
|
6923
|
+
}
|
|
6924
|
+
]
|
|
6654
6925
|
}
|
|
6655
6926
|
],
|
|
6656
6927
|
anonymous: false
|
|
@@ -6973,17 +7244,45 @@ var CoordinatorContract = class {
|
|
|
6973
7244
|
//////////////////////////////////////////////////////////////////////////*/
|
|
6974
7245
|
/**
|
|
6975
7246
|
* Report compute result for an interval
|
|
7247
|
+
* @param deliveryInterval - The interval number for this delivery
|
|
7248
|
+
* @param input - PayloadData containing contentHash and uri for input
|
|
7249
|
+
* @param output - PayloadData containing contentHash and uri for output
|
|
7250
|
+
* @param proof - PayloadData containing contentHash and uri for proof
|
|
7251
|
+
* @param commitmentData - ABI-encoded commitment data
|
|
7252
|
+
* @param nodeWallet - Address of the node's payment wallet
|
|
6976
7253
|
*/
|
|
6977
7254
|
async reportComputeResult(deliveryInterval, input, output, proof, commitmentData, nodeWallet) {
|
|
6978
7255
|
return this.contract.reportComputeResult(
|
|
6979
7256
|
deliveryInterval,
|
|
6980
|
-
input,
|
|
6981
|
-
output,
|
|
6982
|
-
proof,
|
|
7257
|
+
this.encodePayloadData(input),
|
|
7258
|
+
this.encodePayloadData(output),
|
|
7259
|
+
this.encodePayloadData(proof),
|
|
6983
7260
|
commitmentData,
|
|
6984
7261
|
nodeWallet
|
|
6985
7262
|
);
|
|
6986
7263
|
}
|
|
7264
|
+
/**
|
|
7265
|
+
* Encode PayloadData for contract call
|
|
7266
|
+
* @param payload - PayloadData to encode
|
|
7267
|
+
* @returns Tuple format expected by contract
|
|
7268
|
+
*/
|
|
7269
|
+
encodePayloadData(payload) {
|
|
7270
|
+
return [
|
|
7271
|
+
payload.contentHash,
|
|
7272
|
+
import_ethers7.ethers.toUtf8Bytes(payload.uri)
|
|
7273
|
+
];
|
|
7274
|
+
}
|
|
7275
|
+
/**
|
|
7276
|
+
* Parse PayloadData from contract response
|
|
7277
|
+
* @param data - Raw tuple from contract
|
|
7278
|
+
* @returns Parsed PayloadData
|
|
7279
|
+
*/
|
|
7280
|
+
parsePayloadData(data) {
|
|
7281
|
+
return {
|
|
7282
|
+
contentHash: data.contentHash || data[0],
|
|
7283
|
+
uri: import_ethers7.ethers.toUtf8String(data.uri || data[1])
|
|
7284
|
+
};
|
|
7285
|
+
}
|
|
6987
7286
|
/*//////////////////////////////////////////////////////////////////////////
|
|
6988
7287
|
VERIFICATION
|
|
6989
7288
|
//////////////////////////////////////////////////////////////////////////*/
|
|
@@ -7307,6 +7606,12 @@ var SubscriptionBatchReaderContract = class {
|
|
|
7307
7606
|
};
|
|
7308
7607
|
|
|
7309
7608
|
// src/types/index.ts
|
|
7609
|
+
var InputType = /* @__PURE__ */ ((InputType2) => {
|
|
7610
|
+
InputType2[InputType2["RAW_DATA"] = 0] = "RAW_DATA";
|
|
7611
|
+
InputType2[InputType2["URI_STRING"] = 1] = "URI_STRING";
|
|
7612
|
+
InputType2[InputType2["PAYLOAD_DATA"] = 2] = "PAYLOAD_DATA";
|
|
7613
|
+
return InputType2;
|
|
7614
|
+
})(InputType || {});
|
|
7310
7615
|
var FulfillResult = /* @__PURE__ */ ((FulfillResult2) => {
|
|
7311
7616
|
FulfillResult2[FulfillResult2["FULFILLED"] = 0] = "FULFILLED";
|
|
7312
7617
|
FulfillResult2[FulfillResult2["INVALID_REQUEST_ID"] = 1] = "INVALID_REQUEST_ID";
|
|
@@ -8282,6 +8587,7 @@ var ABIs = {
|
|
|
8282
8587
|
CoordinatorAbi__factory,
|
|
8283
8588
|
CoordinatorContract,
|
|
8284
8589
|
FulfillResult,
|
|
8590
|
+
InputType,
|
|
8285
8591
|
RouterAbi__factory,
|
|
8286
8592
|
RouterContract,
|
|
8287
8593
|
SubscriptionBatchReaderAbi__factory,
|