@campnetwork/origin 0.0.5 → 0.0.7

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.
@@ -164,8 +164,8 @@ var constants = {
164
164
  TIKTOK_LINKED: "4a2ffdd3-f0e9-4784-8b49-ff76ec1c0a6a",
165
165
  TELEGRAM_LINKED: "9006bc5d-bcc9-4d01-a860-4f1a201e8e47",
166
166
  },
167
- DATANFT_CONTRACT_ADDRESS: "0xd064817Dc0Af032c3fb5dd4671fd10E0a5F0515D",
168
- MARKETPLACE_CONTRACT_ADDRESS: "0x3B782d053de8910cC0EF3DC09EEA055229a70c6b",
167
+ DATANFT_CONTRACT_ADDRESS: "0xb55066f2793773B3784f8c57c415a8b5932B33Cd",
168
+ MARKETPLACE_CONTRACT_ADDRESS: "0x977fdEF62CE095Ae8750Fd3496730F24F60dea7a",
169
169
  };
170
170
 
171
171
  let providers = [];
@@ -263,11 +263,6 @@ var abi$1 = [
263
263
  internalType: "string",
264
264
  name: "_symbol",
265
265
  type: "string"
266
- },
267
- {
268
- internalType: "string",
269
- name: "_baseURI",
270
- type: "string"
271
266
  }
272
267
  ],
273
268
  stateMutability: "nonpayable",
@@ -282,28 +277,93 @@ var abi$1 = [
282
277
  {
283
278
  inputs: [
284
279
  {
285
- internalType: "uint16",
286
- name: "royaltyBps",
287
- type: "uint16"
280
+ internalType: "address",
281
+ name: "sender",
282
+ type: "address"
283
+ },
284
+ {
285
+ internalType: "uint256",
286
+ name: "tokenId",
287
+ type: "uint256"
288
+ },
289
+ {
290
+ internalType: "address",
291
+ name: "owner",
292
+ type: "address"
288
293
  }
289
294
  ],
290
- name: "InvalidRoyalty",
295
+ name: "ERC721IncorrectOwner",
291
296
  type: "error"
292
297
  },
293
298
  {
294
299
  inputs: [
300
+ {
301
+ internalType: "address",
302
+ name: "operator",
303
+ type: "address"
304
+ },
295
305
  {
296
306
  internalType: "uint256",
297
307
  name: "tokenId",
298
308
  type: "uint256"
299
- },
309
+ }
310
+ ],
311
+ name: "ERC721InsufficientApproval",
312
+ type: "error"
313
+ },
314
+ {
315
+ inputs: [
300
316
  {
301
317
  internalType: "address",
302
- name: "caller",
318
+ name: "approver",
303
319
  type: "address"
304
320
  }
305
321
  ],
306
- name: "NotTokenOwner",
322
+ name: "ERC721InvalidApprover",
323
+ type: "error"
324
+ },
325
+ {
326
+ inputs: [
327
+ {
328
+ internalType: "address",
329
+ name: "operator",
330
+ type: "address"
331
+ }
332
+ ],
333
+ name: "ERC721InvalidOperator",
334
+ type: "error"
335
+ },
336
+ {
337
+ inputs: [
338
+ {
339
+ internalType: "address",
340
+ name: "owner",
341
+ type: "address"
342
+ }
343
+ ],
344
+ name: "ERC721InvalidOwner",
345
+ type: "error"
346
+ },
347
+ {
348
+ inputs: [
349
+ {
350
+ internalType: "address",
351
+ name: "receiver",
352
+ type: "address"
353
+ }
354
+ ],
355
+ name: "ERC721InvalidReceiver",
356
+ type: "error"
357
+ },
358
+ {
359
+ inputs: [
360
+ {
361
+ internalType: "address",
362
+ name: "sender",
363
+ type: "address"
364
+ }
365
+ ],
366
+ name: "ERC721InvalidSender",
307
367
  type: "error"
308
368
  },
309
369
  {
@@ -314,37 +374,103 @@ var abi$1 = [
314
374
  type: "uint256"
315
375
  }
316
376
  ],
317
- name: "TokenAlreadyExists",
377
+ name: "ERC721NonexistentToken",
318
378
  type: "error"
319
379
  },
320
380
  {
321
381
  inputs: [
322
382
  ],
323
- name: "URIQueryForNonexistentToken",
383
+ name: "EnforcedPause",
324
384
  type: "error"
325
385
  },
326
386
  {
327
387
  inputs: [
328
388
  ],
329
- name: "Unauthorized",
389
+ name: "ExpectedPause",
330
390
  type: "error"
331
391
  },
332
392
  {
333
393
  inputs: [
334
394
  ],
335
- name: "Verifier_InvalidDeadline",
395
+ name: "InvalidDeadline",
336
396
  type: "error"
337
397
  },
338
398
  {
339
399
  inputs: [
400
+ {
401
+ internalType: "uint16",
402
+ name: "royaltyBps",
403
+ type: "uint16"
404
+ }
340
405
  ],
341
- name: "Verifier_InvalidSignature",
406
+ name: "InvalidRoyalty",
342
407
  type: "error"
343
408
  },
344
409
  {
345
410
  inputs: [
346
411
  ],
347
- name: "ZeroAddress",
412
+ name: "InvalidSignature",
413
+ type: "error"
414
+ },
415
+ {
416
+ inputs: [
417
+ {
418
+ internalType: "uint256",
419
+ name: "tokenId",
420
+ type: "uint256"
421
+ },
422
+ {
423
+ internalType: "address",
424
+ name: "caller",
425
+ type: "address"
426
+ }
427
+ ],
428
+ name: "NotTokenOwner",
429
+ type: "error"
430
+ },
431
+ {
432
+ inputs: [
433
+ {
434
+ internalType: "address",
435
+ name: "owner",
436
+ type: "address"
437
+ }
438
+ ],
439
+ name: "OwnableInvalidOwner",
440
+ type: "error"
441
+ },
442
+ {
443
+ inputs: [
444
+ {
445
+ internalType: "address",
446
+ name: "account",
447
+ type: "address"
448
+ }
449
+ ],
450
+ name: "OwnableUnauthorizedAccount",
451
+ type: "error"
452
+ },
453
+ {
454
+ inputs: [
455
+ ],
456
+ name: "SignatureAlreadyUsed",
457
+ type: "error"
458
+ },
459
+ {
460
+ inputs: [
461
+ {
462
+ internalType: "uint256",
463
+ name: "tokenId",
464
+ type: "uint256"
465
+ }
466
+ ],
467
+ name: "TokenAlreadyExists",
468
+ type: "error"
469
+ },
470
+ {
471
+ inputs: [
472
+ ],
473
+ name: "Unauthorized",
348
474
  type: "error"
349
475
  },
350
476
  {
@@ -370,9 +496,9 @@ var abi$1 = [
370
496
  },
371
497
  {
372
498
  indexed: false,
373
- internalType: "uint64",
499
+ internalType: "uint256",
374
500
  name: "newExpiry",
375
- type: "uint64"
501
+ type: "uint256"
376
502
  },
377
503
  {
378
504
  indexed: false,
@@ -442,6 +568,12 @@ var abi$1 = [
442
568
  internalType: "uint256",
443
569
  name: "tokenId",
444
570
  type: "uint256"
571
+ },
572
+ {
573
+ indexed: true,
574
+ internalType: "address",
575
+ name: "creator",
576
+ type: "address"
445
577
  }
446
578
  ],
447
579
  name: "DataDeleted",
@@ -461,9 +593,15 @@ var abi$1 = [
461
593
  internalType: "address",
462
594
  name: "creator",
463
595
  type: "address"
596
+ },
597
+ {
598
+ indexed: false,
599
+ internalType: "bytes32",
600
+ name: "contentHash",
601
+ type: "bytes32"
464
602
  }
465
603
  ],
466
- name: "DataDeletionRequested",
604
+ name: "DataMinted",
467
605
  type: "event"
468
606
  },
469
607
  {
@@ -471,24 +609,31 @@ var abi$1 = [
471
609
  inputs: [
472
610
  {
473
611
  indexed: true,
474
- internalType: "uint256",
475
- name: "tokenId",
476
- type: "uint256"
612
+ internalType: "address",
613
+ name: "previousOwner",
614
+ type: "address"
477
615
  },
478
616
  {
479
617
  indexed: true,
480
618
  internalType: "address",
481
- name: "creator",
619
+ name: "newOwner",
482
620
  type: "address"
483
- },
621
+ }
622
+ ],
623
+ name: "OwnershipTransferred",
624
+ type: "event"
625
+ },
626
+ {
627
+ anonymous: false,
628
+ inputs: [
484
629
  {
485
630
  indexed: false,
486
- internalType: "bytes32",
487
- name: "contentHash",
488
- type: "bytes32"
631
+ internalType: "address",
632
+ name: "account",
633
+ type: "address"
489
634
  }
490
635
  ],
491
- name: "DataMinted",
636
+ name: "Paused",
492
637
  type: "event"
493
638
  },
494
639
  {
@@ -585,32 +730,17 @@ var abi$1 = [
585
730
  type: "event"
586
731
  },
587
732
  {
733
+ anonymous: false,
588
734
  inputs: [
589
735
  {
736
+ indexed: false,
590
737
  internalType: "address",
591
- name: "creator",
592
- type: "address"
593
- }
594
- ],
595
- name: "addCreator",
596
- outputs: [
597
- ],
598
- stateMutability: "nonpayable",
599
- type: "function"
600
- },
601
- {
602
- inputs: [
603
- {
604
- internalType: "address",
605
- name: "pauser",
738
+ name: "account",
606
739
  type: "address"
607
740
  }
608
741
  ],
609
- name: "addPauser",
610
- outputs: [
611
- ],
612
- stateMutability: "nonpayable",
613
- type: "function"
742
+ name: "Unpaused",
743
+ type: "event"
614
744
  },
615
745
  {
616
746
  inputs: [
@@ -635,7 +765,7 @@ var abi$1 = [
635
765
  inputs: [
636
766
  {
637
767
  internalType: "address",
638
- name: "owner_",
768
+ name: "owner",
639
769
  type: "address"
640
770
  }
641
771
  ],
@@ -650,20 +780,6 @@ var abi$1 = [
650
780
  stateMutability: "view",
651
781
  type: "function"
652
782
  },
653
- {
654
- inputs: [
655
- ],
656
- name: "baseURI",
657
- outputs: [
658
- {
659
- internalType: "string",
660
- name: "",
661
- type: "string"
662
- }
663
- ],
664
- stateMutability: "view",
665
- type: "function"
666
- },
667
783
  {
668
784
  inputs: [
669
785
  {
@@ -683,25 +799,6 @@ var abi$1 = [
683
799
  stateMutability: "view",
684
800
  type: "function"
685
801
  },
686
- {
687
- inputs: [
688
- {
689
- internalType: "address",
690
- name: "",
691
- type: "address"
692
- }
693
- ],
694
- name: "creators",
695
- outputs: [
696
- {
697
- internalType: "bool",
698
- name: "",
699
- type: "bool"
700
- }
701
- ],
702
- stateMutability: "view",
703
- type: "function"
704
- },
705
802
  {
706
803
  inputs: [
707
804
  {
@@ -713,7 +810,7 @@ var abi$1 = [
713
810
  name: "dataStatus",
714
811
  outputs: [
715
812
  {
716
- internalType: "enum DataNFT.DataStatus",
813
+ internalType: "enum IpNFT.DataStatus",
717
814
  name: "",
718
815
  type: "uint8"
719
816
  }
@@ -787,7 +884,7 @@ var abi$1 = [
787
884
  type: "address"
788
885
  }
789
886
  ],
790
- internalType: "struct DataNFT.LicenseTerms",
887
+ internalType: "struct IpNFT.LicenseTerms",
791
888
  name: "",
792
889
  type: "tuple"
793
890
  }
@@ -799,7 +896,7 @@ var abi$1 = [
799
896
  inputs: [
800
897
  {
801
898
  internalType: "address",
802
- name: "owner_",
899
+ name: "owner",
803
900
  type: "address"
804
901
  },
805
902
  {
@@ -833,7 +930,7 @@ var abi$1 = [
833
930
  },
834
931
  {
835
932
  internalType: "bytes32",
836
- name: "hash",
933
+ name: "creatorContentHash",
837
934
  type: "bytes32"
838
935
  },
839
936
  {
@@ -864,7 +961,7 @@ var abi$1 = [
864
961
  type: "address"
865
962
  }
866
963
  ],
867
- internalType: "struct DataNFT.LicenseTerms",
964
+ internalType: "struct IpNFT.LicenseTerms",
868
965
  name: "licenseTerms",
869
966
  type: "tuple"
870
967
  },
@@ -874,19 +971,9 @@ var abi$1 = [
874
971
  type: "uint256"
875
972
  },
876
973
  {
877
- internalType: "uint8",
878
- name: "v",
879
- type: "uint8"
880
- },
881
- {
882
- internalType: "bytes32",
883
- name: "r",
884
- type: "bytes32"
885
- },
886
- {
887
- internalType: "bytes32",
888
- name: "s",
889
- type: "bytes32"
974
+ internalType: "bytes",
975
+ name: "signature",
976
+ type: "bytes"
890
977
  }
891
978
  ],
892
979
  name: "mintWithSignature",
@@ -967,63 +1054,11 @@ var abi$1 = [
967
1054
  },
968
1055
  {
969
1056
  inputs: [
970
- {
971
- internalType: "address",
972
- name: "",
973
- type: "address"
974
- }
975
1057
  ],
976
- name: "pausers",
1058
+ name: "renounceOwnership",
977
1059
  outputs: [
978
- {
979
- internalType: "bool",
980
- name: "",
981
- type: "bool"
982
- }
983
1060
  ],
984
- stateMutability: "view",
985
- type: "function"
986
- },
987
- {
988
- inputs: [
989
- {
990
- internalType: "address",
991
- name: "creator",
992
- type: "address"
993
- }
994
- ],
995
- name: "removeCreator",
996
- outputs: [
997
- ],
998
- stateMutability: "nonpayable",
999
- type: "function"
1000
- },
1001
- {
1002
- inputs: [
1003
- {
1004
- internalType: "address",
1005
- name: "pauser",
1006
- type: "address"
1007
- }
1008
- ],
1009
- name: "removePauser",
1010
- outputs: [
1011
- ],
1012
- stateMutability: "nonpayable",
1013
- type: "function"
1014
- },
1015
- {
1016
- inputs: [
1017
- {
1018
- internalType: "uint256",
1019
- name: "tokenId",
1020
- type: "uint256"
1021
- }
1022
- ],
1023
- name: "requestDelete",
1024
- outputs: [
1025
- ],
1026
- stateMutability: "nonpayable",
1061
+ stateMutability: "nonpayable",
1027
1062
  type: "function"
1028
1063
  },
1029
1064
  {
@@ -1165,6 +1200,25 @@ var abi$1 = [
1165
1200
  stateMutability: "nonpayable",
1166
1201
  type: "function"
1167
1202
  },
1203
+ {
1204
+ inputs: [
1205
+ {
1206
+ internalType: "bytes4",
1207
+ name: "interfaceId",
1208
+ type: "bytes4"
1209
+ }
1210
+ ],
1211
+ name: "supportsInterface",
1212
+ outputs: [
1213
+ {
1214
+ internalType: "bool",
1215
+ name: "",
1216
+ type: "bool"
1217
+ }
1218
+ ],
1219
+ stateMutability: "view",
1220
+ type: "function"
1221
+ },
1168
1222
  {
1169
1223
  inputs: [
1170
1224
  ],
@@ -1217,7 +1271,7 @@ var abi$1 = [
1217
1271
  inputs: [
1218
1272
  {
1219
1273
  internalType: "uint256",
1220
- name: "",
1274
+ name: "_tokenId",
1221
1275
  type: "uint256"
1222
1276
  }
1223
1277
  ],
@@ -1256,6 +1310,20 @@ var abi$1 = [
1256
1310
  stateMutability: "nonpayable",
1257
1311
  type: "function"
1258
1312
  },
1313
+ {
1314
+ inputs: [
1315
+ {
1316
+ internalType: "address",
1317
+ name: "newOwner",
1318
+ type: "address"
1319
+ }
1320
+ ],
1321
+ name: "transferOwnership",
1322
+ outputs: [
1323
+ ],
1324
+ stateMutability: "nonpayable",
1325
+ type: "function"
1326
+ },
1259
1327
  {
1260
1328
  inputs: [
1261
1329
  ],
@@ -1272,6 +1340,11 @@ var abi$1 = [
1272
1340
  name: "tokenId",
1273
1341
  type: "uint256"
1274
1342
  },
1343
+ {
1344
+ internalType: "address",
1345
+ name: "_royaltyReceiver",
1346
+ type: "address"
1347
+ },
1275
1348
  {
1276
1349
  components: [
1277
1350
  {
@@ -1295,7 +1368,7 @@ var abi$1 = [
1295
1368
  type: "address"
1296
1369
  }
1297
1370
  ],
1298
- internalType: "struct DataNFT.LicenseTerms",
1371
+ internalType: "struct IpNFT.LicenseTerms",
1299
1372
  name: "newTerms",
1300
1373
  type: "tuple"
1301
1374
  }
@@ -1305,6 +1378,25 @@ var abi$1 = [
1305
1378
  ],
1306
1379
  stateMutability: "nonpayable",
1307
1380
  type: "function"
1381
+ },
1382
+ {
1383
+ inputs: [
1384
+ {
1385
+ internalType: "bytes32",
1386
+ name: "",
1387
+ type: "bytes32"
1388
+ }
1389
+ ],
1390
+ name: "usedNonces",
1391
+ outputs: [
1392
+ {
1393
+ internalType: "bool",
1394
+ name: "",
1395
+ type: "bool"
1396
+ }
1397
+ ],
1398
+ stateMutability: "view",
1399
+ type: "function"
1308
1400
  }
1309
1401
  ];
1310
1402
 
@@ -1321,17 +1413,7 @@ var abi$1 = [
1321
1413
  */
1322
1414
  function mintWithSignature(to, tokenId, hash, uri, licenseTerms, deadline, signature) {
1323
1415
  return __awaiter(this, void 0, void 0, function* () {
1324
- return yield this.callContractMethod(constants.DATANFT_CONTRACT_ADDRESS, abi$1, "mintWithSignature", [
1325
- to,
1326
- tokenId,
1327
- hash,
1328
- uri,
1329
- licenseTerms,
1330
- deadline,
1331
- signature.v,
1332
- signature.r,
1333
- signature.s,
1334
- ], { waitForReceipt: true });
1416
+ return yield this.callContractMethod(constants.DATANFT_CONTRACT_ADDRESS, abi$1, "mintWithSignature", [to, tokenId, hash, uri, licenseTerms, deadline, signature], { waitForReceipt: true });
1335
1417
  });
1336
1418
  }
1337
1419
  /**
@@ -1341,11 +1423,17 @@ function mintWithSignature(to, tokenId, hash, uri, licenseTerms, deadline, signa
1341
1423
  * @param fileKey Optional file key for file uploads.
1342
1424
  * @return A promise that resolves with the registration data.
1343
1425
  */
1344
- function registerDataNFT(source, deadline, fileKey) {
1426
+ function registerIpNFT(source, deadline, licenseTerms, fileKey) {
1345
1427
  return __awaiter(this, void 0, void 0, function* () {
1346
1428
  const body = {
1347
1429
  source,
1348
- deadline: deadline.toString(),
1430
+ deadline: Number(deadline),
1431
+ licenseTerms: {
1432
+ price: licenseTerms.price.toString(),
1433
+ duration: licenseTerms.duration,
1434
+ royaltyBps: licenseTerms.royaltyBps,
1435
+ paymentToken: licenseTerms.paymentToken,
1436
+ },
1349
1437
  };
1350
1438
  if (fileKey !== undefined) {
1351
1439
  body.fileKey = fileKey;
@@ -1433,530 +1521,571 @@ function setApprovalForAll(operator, approved) {
1433
1521
 
1434
1522
  var abi = [
1435
1523
  {
1436
- type: "constructor",
1437
1524
  inputs: [
1438
1525
  {
1526
+ internalType: "address",
1439
1527
  name: "dataNFT_",
1440
- type: "address",
1441
- internalType: "address"
1528
+ type: "address"
1442
1529
  },
1443
1530
  {
1444
- name: "router_",
1445
- type: "address",
1446
- internalType: "address"
1531
+ internalType: "uint16",
1532
+ name: "protocolFeeBps_",
1533
+ type: "uint16"
1447
1534
  },
1448
1535
  {
1449
- name: "protocolFeeBps_",
1450
- type: "uint16",
1451
- internalType: "uint16"
1536
+ internalType: "address",
1537
+ name: "treasury_",
1538
+ type: "address"
1452
1539
  }
1453
1540
  ],
1454
- stateMutability: "nonpayable"
1541
+ stateMutability: "nonpayable",
1542
+ type: "constructor"
1455
1543
  },
1456
1544
  {
1457
- type: "function",
1458
- name: "addFeeManager",
1459
1545
  inputs: [
1460
- {
1461
- name: "feeManager",
1462
- type: "address",
1463
- internalType: "address"
1464
- }
1465
- ],
1466
- outputs: [
1467
1546
  ],
1468
- stateMutability: "nonpayable"
1547
+ name: "EnforcedPause",
1548
+ type: "error"
1469
1549
  },
1470
1550
  {
1471
- type: "function",
1472
- name: "addPauser",
1473
1551
  inputs: [
1474
- {
1475
- name: "pauser",
1476
- type: "address",
1477
- internalType: "address"
1478
- }
1479
- ],
1480
- outputs: [
1481
1552
  ],
1482
- stateMutability: "nonpayable"
1553
+ name: "ExpectedPause",
1554
+ type: "error"
1483
1555
  },
1484
1556
  {
1485
- type: "function",
1486
- name: "buyAccess",
1487
1557
  inputs: [
1488
1558
  {
1489
- name: "tokenId",
1490
- type: "uint256",
1491
- internalType: "uint256"
1559
+ internalType: "uint256",
1560
+ name: "expected",
1561
+ type: "uint256"
1492
1562
  },
1493
1563
  {
1494
- name: "periods",
1495
- type: "uint32",
1496
- internalType: "uint32"
1564
+ internalType: "uint256",
1565
+ name: "actual",
1566
+ type: "uint256"
1497
1567
  }
1498
1568
  ],
1499
- outputs: [
1500
- ],
1501
- stateMutability: "payable"
1569
+ name: "InvalidPayment",
1570
+ type: "error"
1502
1571
  },
1503
1572
  {
1504
- type: "function",
1505
- name: "dataNFT",
1506
1573
  inputs: [
1507
- ],
1508
- outputs: [
1509
1574
  {
1510
- name: "",
1511
- type: "address",
1512
- internalType: "contract DataNFT"
1575
+ internalType: "uint32",
1576
+ name: "periods",
1577
+ type: "uint32"
1513
1578
  }
1514
1579
  ],
1515
- stateMutability: "view"
1580
+ name: "InvalidPeriods",
1581
+ type: "error"
1516
1582
  },
1517
1583
  {
1518
- type: "function",
1519
- name: "feeManagers",
1520
1584
  inputs: [
1521
1585
  {
1522
- name: "",
1523
- type: "address",
1524
- internalType: "address"
1525
- }
1526
- ],
1527
- outputs: [
1528
- {
1529
- name: "",
1530
- type: "bool",
1531
- internalType: "bool"
1586
+ internalType: "uint16",
1587
+ name: "royaltyBps",
1588
+ type: "uint16"
1532
1589
  }
1533
1590
  ],
1534
- stateMutability: "view"
1591
+ name: "InvalidRoyalty",
1592
+ type: "error"
1535
1593
  },
1536
1594
  {
1537
- type: "function",
1538
- name: "hasAccess",
1539
1595
  inputs: [
1540
1596
  {
1541
- name: "user",
1542
- type: "address",
1543
- internalType: "address"
1544
- },
1545
- {
1546
- name: "tokenId",
1547
- type: "uint256",
1548
- internalType: "uint256"
1549
- }
1550
- ],
1551
- outputs: [
1552
- {
1553
- name: "",
1554
- type: "bool",
1555
- internalType: "bool"
1597
+ internalType: "address",
1598
+ name: "owner",
1599
+ type: "address"
1556
1600
  }
1557
1601
  ],
1558
- stateMutability: "view"
1602
+ name: "OwnableInvalidOwner",
1603
+ type: "error"
1559
1604
  },
1560
1605
  {
1561
- type: "function",
1562
- name: "owner",
1563
1606
  inputs: [
1564
- ],
1565
- outputs: [
1566
1607
  {
1567
- name: "",
1568
- type: "address",
1569
- internalType: "address"
1608
+ internalType: "address",
1609
+ name: "account",
1610
+ type: "address"
1570
1611
  }
1571
1612
  ],
1572
- stateMutability: "view"
1613
+ name: "OwnableUnauthorizedAccount",
1614
+ type: "error"
1573
1615
  },
1574
1616
  {
1575
- type: "function",
1576
- name: "pause",
1577
1617
  inputs: [
1578
1618
  ],
1579
- outputs: [
1580
- ],
1581
- stateMutability: "nonpayable"
1619
+ name: "TransferFailed",
1620
+ type: "error"
1582
1621
  },
1583
1622
  {
1584
- type: "function",
1585
- name: "paused",
1586
1623
  inputs: [
1587
1624
  ],
1588
- outputs: [
1589
- {
1590
- name: "",
1591
- type: "bool",
1592
- internalType: "bool"
1593
- }
1594
- ],
1595
- stateMutability: "view"
1625
+ name: "Unauthorized",
1626
+ type: "error"
1596
1627
  },
1597
1628
  {
1598
- type: "function",
1599
- name: "pausers",
1600
1629
  inputs: [
1601
- {
1602
- name: "",
1603
- type: "address",
1604
- internalType: "address"
1605
- }
1606
- ],
1607
- outputs: [
1608
- {
1609
- name: "",
1610
- type: "bool",
1611
- internalType: "bool"
1612
- }
1613
1630
  ],
1614
- stateMutability: "view"
1631
+ name: "ZeroAddress",
1632
+ type: "error"
1615
1633
  },
1616
1634
  {
1617
- type: "function",
1618
- name: "protocolFeeBps",
1635
+ anonymous: false,
1619
1636
  inputs: [
1620
- ],
1621
- outputs: [
1622
1637
  {
1623
- name: "",
1624
- type: "uint16",
1625
- internalType: "uint16"
1626
- }
1627
- ],
1628
- stateMutability: "view"
1629
- },
1630
- {
1631
- type: "function",
1632
- name: "removeFeeManager",
1633
- inputs: [
1638
+ indexed: true,
1639
+ internalType: "uint256",
1640
+ name: "tokenId",
1641
+ type: "uint256"
1642
+ },
1634
1643
  {
1635
- name: "feeManager",
1636
- type: "address",
1637
- internalType: "address"
1644
+ indexed: true,
1645
+ internalType: "address",
1646
+ name: "buyer",
1647
+ type: "address"
1648
+ },
1649
+ {
1650
+ indexed: false,
1651
+ internalType: "uint32",
1652
+ name: "periods",
1653
+ type: "uint32"
1654
+ },
1655
+ {
1656
+ indexed: false,
1657
+ internalType: "uint256",
1658
+ name: "newExpiry",
1659
+ type: "uint256"
1660
+ },
1661
+ {
1662
+ indexed: false,
1663
+ internalType: "uint256",
1664
+ name: "amountPaid",
1665
+ type: "uint256"
1638
1666
  }
1639
1667
  ],
1640
- outputs: [
1641
- ],
1642
- stateMutability: "nonpayable"
1668
+ name: "AccessPurchased",
1669
+ type: "event"
1643
1670
  },
1644
1671
  {
1645
- type: "function",
1646
- name: "removePauser",
1672
+ anonymous: false,
1647
1673
  inputs: [
1648
1674
  {
1649
- name: "pauser",
1650
- type: "address",
1651
- internalType: "address"
1675
+ indexed: true,
1676
+ internalType: "uint256",
1677
+ name: "tokenId",
1678
+ type: "uint256"
1679
+ },
1680
+ {
1681
+ indexed: true,
1682
+ internalType: "address",
1683
+ name: "creator",
1684
+ type: "address"
1652
1685
  }
1653
1686
  ],
1654
- outputs: [
1655
- ],
1656
- stateMutability: "nonpayable"
1687
+ name: "DataDeleted",
1688
+ type: "event"
1657
1689
  },
1658
1690
  {
1659
- type: "function",
1660
- name: "renewAccess",
1691
+ anonymous: false,
1661
1692
  inputs: [
1662
1693
  {
1694
+ indexed: true,
1695
+ internalType: "uint256",
1663
1696
  name: "tokenId",
1664
- type: "uint256",
1665
- internalType: "uint256"
1697
+ type: "uint256"
1666
1698
  },
1667
1699
  {
1668
- name: "buyer",
1669
- type: "address",
1670
- internalType: "address"
1700
+ indexed: true,
1701
+ internalType: "address",
1702
+ name: "creator",
1703
+ type: "address"
1671
1704
  },
1672
1705
  {
1673
- name: "periods",
1674
- type: "uint32",
1675
- internalType: "uint32"
1706
+ indexed: false,
1707
+ internalType: "bytes32",
1708
+ name: "contentHash",
1709
+ type: "bytes32"
1676
1710
  }
1677
1711
  ],
1678
- outputs: [
1679
- ],
1680
- stateMutability: "payable"
1681
- },
1682
- {
1683
- type: "function",
1684
- name: "router",
1685
- inputs: [
1686
- ],
1687
- outputs: [
1688
- {
1689
- name: "",
1690
- type: "address",
1691
- internalType: "contract RoyaltyRouter"
1692
- }
1693
- ],
1694
- stateMutability: "view"
1712
+ name: "DataMinted",
1713
+ type: "event"
1695
1714
  },
1696
1715
  {
1697
- type: "function",
1698
- name: "subscriptionExpiry",
1716
+ anonymous: false,
1699
1717
  inputs: [
1700
1718
  {
1701
- name: "",
1702
- type: "uint256",
1703
- internalType: "uint256"
1719
+ indexed: true,
1720
+ internalType: "address",
1721
+ name: "previousOwner",
1722
+ type: "address"
1704
1723
  },
1705
1724
  {
1706
- name: "",
1707
- type: "address",
1708
- internalType: "address"
1709
- }
1710
- ],
1711
- outputs: [
1712
- {
1713
- name: "",
1714
- type: "uint64",
1715
- internalType: "uint64"
1725
+ indexed: true,
1726
+ internalType: "address",
1727
+ name: "newOwner",
1728
+ type: "address"
1716
1729
  }
1717
1730
  ],
1718
- stateMutability: "view"
1731
+ name: "OwnershipTransferred",
1732
+ type: "event"
1719
1733
  },
1720
1734
  {
1721
- type: "function",
1722
- name: "unpause",
1735
+ anonymous: false,
1723
1736
  inputs: [
1737
+ {
1738
+ indexed: false,
1739
+ internalType: "address",
1740
+ name: "account",
1741
+ type: "address"
1742
+ }
1724
1743
  ],
1725
- outputs: [
1726
- ],
1727
- stateMutability: "nonpayable"
1744
+ name: "Paused",
1745
+ type: "event"
1728
1746
  },
1729
1747
  {
1730
- type: "function",
1731
- name: "updateProtocolFee",
1748
+ anonymous: false,
1732
1749
  inputs: [
1733
1750
  {
1734
- name: "newFeeBps",
1735
- type: "uint16",
1736
- internalType: "uint16"
1751
+ indexed: true,
1752
+ internalType: "uint256",
1753
+ name: "tokenId",
1754
+ type: "uint256"
1755
+ },
1756
+ {
1757
+ indexed: false,
1758
+ internalType: "uint256",
1759
+ name: "royaltyAmount",
1760
+ type: "uint256"
1761
+ },
1762
+ {
1763
+ indexed: false,
1764
+ internalType: "address",
1765
+ name: "creator",
1766
+ type: "address"
1767
+ },
1768
+ {
1769
+ indexed: false,
1770
+ internalType: "uint256",
1771
+ name: "protocolAmount",
1772
+ type: "uint256"
1737
1773
  }
1738
1774
  ],
1739
- outputs: [
1740
- ],
1741
- stateMutability: "nonpayable"
1775
+ name: "RoyaltyPaid",
1776
+ type: "event"
1742
1777
  },
1743
1778
  {
1744
- type: "event",
1745
- name: "AccessPurchased",
1779
+ anonymous: false,
1746
1780
  inputs: [
1747
1781
  {
1748
- name: "tokenId",
1749
- type: "uint256",
1750
1782
  indexed: true,
1751
- internalType: "uint256"
1783
+ internalType: "uint256",
1784
+ name: "tokenId",
1785
+ type: "uint256"
1752
1786
  },
1753
1787
  {
1754
- name: "buyer",
1755
- type: "address",
1756
- indexed: true,
1757
- internalType: "address"
1788
+ indexed: false,
1789
+ internalType: "uint128",
1790
+ name: "newPrice",
1791
+ type: "uint128"
1758
1792
  },
1759
1793
  {
1760
- name: "periods",
1761
- type: "uint32",
1762
1794
  indexed: false,
1763
- internalType: "uint32"
1795
+ internalType: "uint32",
1796
+ name: "newDuration",
1797
+ type: "uint32"
1764
1798
  },
1765
1799
  {
1766
- name: "newExpiry",
1767
- type: "uint64",
1768
1800
  indexed: false,
1769
- internalType: "uint64"
1801
+ internalType: "uint16",
1802
+ name: "newRoyaltyBps",
1803
+ type: "uint16"
1770
1804
  },
1771
1805
  {
1772
- name: "amountPaid",
1773
- type: "uint256",
1774
1806
  indexed: false,
1775
- internalType: "uint256"
1807
+ internalType: "address",
1808
+ name: "paymentToken",
1809
+ type: "address"
1776
1810
  }
1777
1811
  ],
1778
- anonymous: false
1812
+ name: "TermsUpdated",
1813
+ type: "event"
1779
1814
  },
1780
1815
  {
1781
- type: "event",
1782
- name: "DataDeleted",
1816
+ anonymous: false,
1783
1817
  inputs: [
1784
1818
  {
1785
- name: "tokenId",
1786
- type: "uint256",
1787
- indexed: true,
1788
- internalType: "uint256"
1819
+ indexed: false,
1820
+ internalType: "address",
1821
+ name: "account",
1822
+ type: "address"
1789
1823
  }
1790
1824
  ],
1791
- anonymous: false
1825
+ name: "Unpaused",
1826
+ type: "event"
1792
1827
  },
1793
1828
  {
1794
- type: "event",
1795
- name: "DataDeletionRequested",
1796
1829
  inputs: [
1797
1830
  {
1798
- name: "tokenId",
1799
- type: "uint256",
1800
- indexed: true,
1801
- internalType: "uint256"
1802
- },
1803
- {
1804
- name: "creator",
1805
- type: "address",
1806
- indexed: true,
1807
- internalType: "address"
1831
+ internalType: "address",
1832
+ name: "feeManager",
1833
+ type: "address"
1808
1834
  }
1809
1835
  ],
1810
- anonymous: false
1836
+ name: "addFeeManager",
1837
+ outputs: [
1838
+ ],
1839
+ stateMutability: "nonpayable",
1840
+ type: "function"
1811
1841
  },
1812
1842
  {
1813
- type: "event",
1814
- name: "DataMinted",
1815
1843
  inputs: [
1816
1844
  {
1817
- name: "tokenId",
1818
- type: "uint256",
1819
- indexed: true,
1820
- internalType: "uint256"
1845
+ internalType: "address",
1846
+ name: "buyer",
1847
+ type: "address"
1821
1848
  },
1822
1849
  {
1823
- name: "creator",
1824
- type: "address",
1825
- indexed: true,
1826
- internalType: "address"
1850
+ internalType: "uint256",
1851
+ name: "tokenId",
1852
+ type: "uint256"
1827
1853
  },
1828
1854
  {
1829
- name: "contentHash",
1830
- type: "bytes32",
1831
- indexed: false,
1832
- internalType: "bytes32"
1855
+ internalType: "uint32",
1856
+ name: "periods",
1857
+ type: "uint32"
1833
1858
  }
1834
1859
  ],
1835
- anonymous: false
1860
+ name: "buyAccess",
1861
+ outputs: [
1862
+ ],
1863
+ stateMutability: "payable",
1864
+ type: "function"
1836
1865
  },
1837
1866
  {
1838
- type: "event",
1839
- name: "RoyaltyPaid",
1840
1867
  inputs: [
1868
+ ],
1869
+ name: "dataNFT",
1870
+ outputs: [
1841
1871
  {
1842
- name: "tokenId",
1843
- type: "uint256",
1844
- indexed: true,
1845
- internalType: "uint256"
1846
- },
1847
- {
1848
- name: "royaltyAmount",
1849
- type: "uint256",
1850
- indexed: false,
1851
- internalType: "uint256"
1852
- },
1872
+ internalType: "contract IpNFT",
1873
+ name: "",
1874
+ type: "address"
1875
+ }
1876
+ ],
1877
+ stateMutability: "view",
1878
+ type: "function"
1879
+ },
1880
+ {
1881
+ inputs: [
1853
1882
  {
1854
- name: "creator",
1855
- type: "address",
1856
- indexed: false,
1857
- internalType: "address"
1858
- },
1883
+ internalType: "address",
1884
+ name: "",
1885
+ type: "address"
1886
+ }
1887
+ ],
1888
+ name: "feeManagers",
1889
+ outputs: [
1859
1890
  {
1860
- name: "protocolAmount",
1861
- type: "uint256",
1862
- indexed: false,
1863
- internalType: "uint256"
1891
+ internalType: "bool",
1892
+ name: "",
1893
+ type: "bool"
1864
1894
  }
1865
1895
  ],
1866
- anonymous: false
1896
+ stateMutability: "view",
1897
+ type: "function"
1867
1898
  },
1868
1899
  {
1869
- type: "event",
1870
- name: "TermsUpdated",
1871
1900
  inputs: [
1872
1901
  {
1873
- name: "tokenId",
1874
- type: "uint256",
1875
- indexed: true,
1876
- internalType: "uint256"
1902
+ internalType: "address",
1903
+ name: "user",
1904
+ type: "address"
1877
1905
  },
1878
1906
  {
1879
- name: "newPrice",
1880
- type: "uint128",
1881
- indexed: false,
1882
- internalType: "uint128"
1883
- },
1907
+ internalType: "uint256",
1908
+ name: "tokenId",
1909
+ type: "uint256"
1910
+ }
1911
+ ],
1912
+ name: "hasAccess",
1913
+ outputs: [
1884
1914
  {
1885
- name: "newDuration",
1886
- type: "uint32",
1887
- indexed: false,
1888
- internalType: "uint32"
1889
- },
1915
+ internalType: "bool",
1916
+ name: "",
1917
+ type: "bool"
1918
+ }
1919
+ ],
1920
+ stateMutability: "view",
1921
+ type: "function"
1922
+ },
1923
+ {
1924
+ inputs: [
1925
+ ],
1926
+ name: "owner",
1927
+ outputs: [
1890
1928
  {
1891
- name: "newRoyaltyBps",
1892
- type: "uint16",
1893
- indexed: false,
1894
- internalType: "uint16"
1895
- },
1929
+ internalType: "address",
1930
+ name: "",
1931
+ type: "address"
1932
+ }
1933
+ ],
1934
+ stateMutability: "view",
1935
+ type: "function"
1936
+ },
1937
+ {
1938
+ inputs: [
1939
+ ],
1940
+ name: "pause",
1941
+ outputs: [
1942
+ ],
1943
+ stateMutability: "nonpayable",
1944
+ type: "function"
1945
+ },
1946
+ {
1947
+ inputs: [
1948
+ ],
1949
+ name: "paused",
1950
+ outputs: [
1896
1951
  {
1897
- name: "paymentToken",
1898
- type: "address",
1899
- indexed: false,
1900
- internalType: "address"
1952
+ internalType: "bool",
1953
+ name: "",
1954
+ type: "bool"
1901
1955
  }
1902
1956
  ],
1903
- anonymous: false
1957
+ stateMutability: "view",
1958
+ type: "function"
1904
1959
  },
1905
1960
  {
1906
- type: "error",
1907
- name: "DurationZero",
1908
1961
  inputs: [
1909
- ]
1962
+ ],
1963
+ name: "protocolFeeBps",
1964
+ outputs: [
1965
+ {
1966
+ internalType: "uint16",
1967
+ name: "",
1968
+ type: "uint16"
1969
+ }
1970
+ ],
1971
+ stateMutability: "view",
1972
+ type: "function"
1910
1973
  },
1911
1974
  {
1912
- type: "error",
1913
- name: "InvalidPayment",
1914
1975
  inputs: [
1915
1976
  {
1916
- name: "expected",
1917
- type: "uint256",
1918
- internalType: "uint256"
1977
+ internalType: "address",
1978
+ name: "feeManager",
1979
+ type: "address"
1980
+ }
1981
+ ],
1982
+ name: "removeFeeManager",
1983
+ outputs: [
1984
+ ],
1985
+ stateMutability: "nonpayable",
1986
+ type: "function"
1987
+ },
1988
+ {
1989
+ inputs: [
1990
+ ],
1991
+ name: "renounceOwnership",
1992
+ outputs: [
1993
+ ],
1994
+ stateMutability: "nonpayable",
1995
+ type: "function"
1996
+ },
1997
+ {
1998
+ inputs: [
1999
+ {
2000
+ internalType: "uint256",
2001
+ name: "",
2002
+ type: "uint256"
1919
2003
  },
1920
2004
  {
1921
- name: "actual",
1922
- type: "uint256",
1923
- internalType: "uint256"
2005
+ internalType: "address",
2006
+ name: "",
2007
+ type: "address"
1924
2008
  }
1925
- ]
2009
+ ],
2010
+ name: "subscriptionExpiry",
2011
+ outputs: [
2012
+ {
2013
+ internalType: "uint256",
2014
+ name: "",
2015
+ type: "uint256"
2016
+ }
2017
+ ],
2018
+ stateMutability: "view",
2019
+ type: "function"
1926
2020
  },
1927
2021
  {
1928
- type: "error",
1929
- name: "InvalidPeriods",
1930
2022
  inputs: [
1931
2023
  {
1932
- name: "periods",
1933
- type: "uint32",
1934
- internalType: "uint32"
2024
+ internalType: "address",
2025
+ name: "newOwner",
2026
+ type: "address"
1935
2027
  }
1936
- ]
2028
+ ],
2029
+ name: "transferOwnership",
2030
+ outputs: [
2031
+ ],
2032
+ stateMutability: "nonpayable",
2033
+ type: "function"
1937
2034
  },
1938
2035
  {
1939
- type: "error",
1940
- name: "InvalidRoyalty",
1941
2036
  inputs: [
2037
+ ],
2038
+ name: "treasury",
2039
+ outputs: [
1942
2040
  {
1943
- name: "royaltyBps",
1944
- type: "uint16",
1945
- internalType: "uint16"
2041
+ internalType: "address",
2042
+ name: "",
2043
+ type: "address"
1946
2044
  }
1947
- ]
2045
+ ],
2046
+ stateMutability: "view",
2047
+ type: "function"
1948
2048
  },
1949
2049
  {
1950
- type: "error",
1951
- name: "Unauthorized",
1952
2050
  inputs: [
1953
- ]
2051
+ ],
2052
+ name: "unpause",
2053
+ outputs: [
2054
+ ],
2055
+ stateMutability: "nonpayable",
2056
+ type: "function"
2057
+ },
2058
+ {
2059
+ inputs: [
2060
+ {
2061
+ internalType: "uint16",
2062
+ name: "newFeeBps",
2063
+ type: "uint16"
2064
+ }
2065
+ ],
2066
+ name: "updateProtocolFee",
2067
+ outputs: [
2068
+ ],
2069
+ stateMutability: "nonpayable",
2070
+ type: "function"
1954
2071
  },
1955
2072
  {
1956
- type: "error",
1957
- name: "ZeroAddress",
1958
2073
  inputs: [
1959
- ]
2074
+ {
2075
+ internalType: "address",
2076
+ name: "newTreasury",
2077
+ type: "address"
2078
+ }
2079
+ ],
2080
+ name: "updateTreasury",
2081
+ outputs: [
2082
+ ],
2083
+ stateMutability: "nonpayable",
2084
+ type: "function"
2085
+ },
2086
+ {
2087
+ stateMutability: "payable",
2088
+ type: "receive"
1960
2089
  }
1961
2090
  ];
1962
2091
 
@@ -2062,51 +2191,44 @@ class Origin {
2062
2191
  if (!this.viemClient) {
2063
2192
  throw new Error("WalletClient not connected.");
2064
2193
  }
2065
- try {
2066
- const info = yield this.uploadFile(file, options);
2067
- if (!info || !info.key) {
2068
- console.error("Invalid upload info:", info);
2069
- return null;
2070
- }
2071
- const deadline = BigInt(Math.floor(Date.now() / 1000) + 600); // 10 minutes from now
2072
- const registration = yield this.registerDataNFT("file", deadline, info.key);
2073
- const { tokenId, signerAddress, hash, v, r, s } = registration;
2074
- if (!tokenId ||
2075
- !signerAddress ||
2076
- !hash ||
2077
- v === undefined ||
2078
- r === undefined ||
2079
- s === undefined) {
2080
- console.error("Invalid registration data:", registration);
2081
- return null;
2082
- }
2083
- const [account] = yield this.viemClient.request({
2084
- method: "eth_requestAccounts",
2085
- params: [],
2086
- });
2087
- const signature = { v, r, s };
2088
- const mintResult = yield this.mintWithSignature(account, tokenId, hash, info.url, license, deadline, signature);
2089
- return tokenId.toString();
2194
+ const info = yield this.uploadFile(file, options);
2195
+ if (!info || !info.key) {
2196
+ throw new Error("Failed to upload file or get upload info.");
2090
2197
  }
2091
- catch (error) {
2092
- console.error("Failed to upload file:", error);
2093
- return null;
2198
+ const deadline = BigInt(Math.floor(Date.now()) + 600); // 10 minutes from now
2199
+ const registration = yield this.registerIpNFT("file", deadline, license, info.key);
2200
+ const { tokenId, signerAddress, creatorContentHash, signature, uri } = registration;
2201
+ if (!tokenId ||
2202
+ !signerAddress ||
2203
+ !creatorContentHash ||
2204
+ signature === undefined ||
2205
+ !uri) {
2206
+ throw new Error("Failed to register IpNFT: Missing required fields in registration response.");
2094
2207
  }
2095
- });
2096
- this.mintSocial = (source) => __awaiter(this, void 0, void 0, function* () {
2097
- try {
2098
- const deadline = BigInt(Math.floor(Date.now() / 1000) + 600); // 10 minutes from now (temp)
2099
- const registration = yield this.registerDataNFT(source, deadline);
2100
- if (!registration) {
2101
- console.error("Failed to register DataNFT");
2102
- return null;
2103
- }
2104
- return registration.tokenId.toString();
2208
+ const [account] = yield this.viemClient.request({
2209
+ method: "eth_requestAccounts",
2210
+ params: [],
2211
+ });
2212
+ const mintResult = yield this.mintWithSignature(account, tokenId, creatorContentHash, uri, license, deadline, signature);
2213
+ if (mintResult.status !== "0x1") {
2214
+ throw new Error(`Minting failed with status: ${mintResult.status}`);
2105
2215
  }
2106
- catch (error) {
2107
- console.error("Failed to mint social DataNFT:", error);
2108
- return null;
2216
+ return tokenId.toString();
2217
+ });
2218
+ this.mintSocial = (source, license) => __awaiter(this, void 0, void 0, function* () {
2219
+ // try {
2220
+ const deadline = BigInt(Math.floor(Date.now()) + 600); // 10 minutes from now (temp)
2221
+ const registration = yield this.registerIpNFT(source, deadline, license);
2222
+ if (!registration) {
2223
+ // console.error("Failed to register IpNFT");
2224
+ // return null;
2225
+ throw new Error("Failed to register Social IpNFT");
2109
2226
  }
2227
+ return registration.tokenId.toString();
2228
+ // } catch (error) {
2229
+ // console.error("Failed to mint social IpNFT:", error);
2230
+ // return null;
2231
+ // }
2110
2232
  });
2111
2233
  this.getOriginUploads = () => __awaiter(this, void 0, void 0, function* () {
2112
2234
  const res = yield fetch(`${constants.AUTH_HUB_BASE_API}/auth/origin/files`, {
@@ -2126,7 +2248,7 @@ class Origin {
2126
2248
  this.viemClient = viemClient;
2127
2249
  // DataNFT methods
2128
2250
  this.mintWithSignature = mintWithSignature.bind(this);
2129
- this.registerDataNFT = registerDataNFT.bind(this);
2251
+ this.registerIpNFT = registerIpNFT.bind(this);
2130
2252
  this.updateTerms = updateTerms.bind(this);
2131
2253
  this.requestDelete = requestDelete.bind(this);
2132
2254
  this.getTerms = getTerms.bind(this);
@@ -2277,21 +2399,27 @@ class Origin {
2277
2399
  args: params,
2278
2400
  });
2279
2401
  yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_ensureChainId).call(this, testnet);
2280
- const txHash = yield this.viemClient.sendTransaction({
2281
- to: contractAddress,
2282
- data,
2283
- account,
2284
- value: options.value,
2285
- gas: options.gas,
2286
- });
2287
- if (typeof txHash !== "string") {
2288
- throw new Error("Transaction failed to send.");
2402
+ try {
2403
+ const txHash = yield this.viemClient.sendTransaction({
2404
+ to: contractAddress,
2405
+ data,
2406
+ account,
2407
+ value: options.value,
2408
+ gas: options.gas,
2409
+ });
2410
+ if (typeof txHash !== "string") {
2411
+ throw new Error("Transaction failed to send.");
2412
+ }
2413
+ if (!options.waitForReceipt) {
2414
+ return txHash;
2415
+ }
2416
+ const receipt = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_waitForTxReceipt).call(this, txHash);
2417
+ return receipt;
2289
2418
  }
2290
- if (!options.waitForReceipt) {
2291
- return txHash;
2419
+ catch (error) {
2420
+ console.error("Transaction failed:", error);
2421
+ throw new Error("Transaction failed: " + error);
2292
2422
  }
2293
- const receipt = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_waitForTxReceipt).call(this, txHash);
2294
- return receipt;
2295
2423
  }
2296
2424
  });
2297
2425
  }