@gitmyabi/kernel 1.0.16 → 1.0.18

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.
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Kernel_json = exports.Kernel_jsonAbi = void 0;
3
+ exports.Kernel = exports.KernelAbi = void 0;
4
4
  const viem_1 = require("viem");
5
5
  /**
6
- * Kernel_json ABI
6
+ * Kernel ABI
7
7
  *
8
8
  * This ABI is typed using viem's type system for full type safety.
9
9
  */
10
- exports.Kernel_jsonAbi = [
10
+ exports.KernelAbi = [
11
11
  {
12
12
  "inputs": [
13
13
  {
@@ -19,6 +19,11 @@ exports.Kernel_jsonAbi = [
19
19
  "stateMutability": "nonpayable",
20
20
  "type": "constructor"
21
21
  },
22
+ {
23
+ "inputs": [],
24
+ "name": "AlreadyInitialized",
25
+ "type": "error"
26
+ },
22
27
  {
23
28
  "inputs": [],
24
29
  "name": "EnableNotApproved",
@@ -29,6 +34,17 @@ exports.Kernel_jsonAbi = [
29
34
  "name": "ExecutionReverted",
30
35
  "type": "error"
31
36
  },
37
+ {
38
+ "inputs": [
39
+ {
40
+ "internalType": "uint256",
41
+ "name": "idx",
42
+ "type": "uint256"
43
+ }
44
+ ],
45
+ "name": "InitConfigError",
46
+ "type": "error"
47
+ },
32
48
  {
33
49
  "inputs": [],
34
50
  "name": "InvalidCallType",
@@ -69,6 +85,11 @@ exports.Kernel_jsonAbi = [
69
85
  "name": "InvalidSelector",
70
86
  "type": "error"
71
87
  },
88
+ {
89
+ "inputs": [],
90
+ "name": "InvalidSelectorData",
91
+ "type": "error"
92
+ },
72
93
  {
73
94
  "inputs": [],
74
95
  "name": "InvalidSignature",
@@ -385,6 +406,34 @@ exports.Kernel_jsonAbi = [
385
406
  "stateMutability": "pure",
386
407
  "type": "function"
387
408
  },
409
+ {
410
+ "inputs": [
411
+ {
412
+ "internalType": "ValidationId",
413
+ "name": "_rootValidator",
414
+ "type": "bytes21"
415
+ },
416
+ {
417
+ "internalType": "contract IHook",
418
+ "name": "hook",
419
+ "type": "address"
420
+ },
421
+ {
422
+ "internalType": "bytes",
423
+ "name": "validatorData",
424
+ "type": "bytes"
425
+ },
426
+ {
427
+ "internalType": "bytes",
428
+ "name": "hookData",
429
+ "type": "bytes"
430
+ }
431
+ ],
432
+ "name": "changeRootValidator",
433
+ "outputs": [],
434
+ "stateMutability": "payable",
435
+ "type": "function"
436
+ },
388
437
  {
389
438
  "inputs": [],
390
439
  "name": "currentNonce",
@@ -587,6 +636,29 @@ exports.Kernel_jsonAbi = [
587
636
  "stateMutability": "view",
588
637
  "type": "function"
589
638
  },
639
+ {
640
+ "inputs": [
641
+ {
642
+ "internalType": "ValidationId",
643
+ "name": "vId",
644
+ "type": "bytes21"
645
+ },
646
+ {
647
+ "internalType": "bytes4",
648
+ "name": "selector",
649
+ "type": "bytes4"
650
+ },
651
+ {
652
+ "internalType": "bool",
653
+ "name": "allow",
654
+ "type": "bool"
655
+ }
656
+ ],
657
+ "name": "grantAccess",
658
+ "outputs": [],
659
+ "stateMutability": "payable",
660
+ "type": "function"
661
+ },
590
662
  {
591
663
  "inputs": [
592
664
  {
@@ -608,6 +680,11 @@ exports.Kernel_jsonAbi = [
608
680
  "internalType": "bytes",
609
681
  "name": "hookData",
610
682
  "type": "bytes"
683
+ },
684
+ {
685
+ "internalType": "bytes[]",
686
+ "name": "initConfig",
687
+ "type": "bytes[]"
611
688
  }
612
689
  ],
613
690
  "name": "initialize",
@@ -753,7 +830,7 @@ exports.Kernel_jsonAbi = [
753
830
  },
754
831
  {
755
832
  "internalType": "bytes",
756
- "name": "signature",
833
+ "name": "data",
757
834
  "type": "bytes"
758
835
  }
759
836
  ],
@@ -768,6 +845,118 @@ exports.Kernel_jsonAbi = [
768
845
  "stateMutability": "view",
769
846
  "type": "function"
770
847
  },
848
+ {
849
+ "inputs": [
850
+ {
851
+ "internalType": "address",
852
+ "name": "",
853
+ "type": "address"
854
+ },
855
+ {
856
+ "internalType": "address",
857
+ "name": "",
858
+ "type": "address"
859
+ },
860
+ {
861
+ "internalType": "uint256[]",
862
+ "name": "",
863
+ "type": "uint256[]"
864
+ },
865
+ {
866
+ "internalType": "uint256[]",
867
+ "name": "",
868
+ "type": "uint256[]"
869
+ },
870
+ {
871
+ "internalType": "bytes",
872
+ "name": "",
873
+ "type": "bytes"
874
+ }
875
+ ],
876
+ "name": "onERC1155BatchReceived",
877
+ "outputs": [
878
+ {
879
+ "internalType": "bytes4",
880
+ "name": "",
881
+ "type": "bytes4"
882
+ }
883
+ ],
884
+ "stateMutability": "pure",
885
+ "type": "function"
886
+ },
887
+ {
888
+ "inputs": [
889
+ {
890
+ "internalType": "address",
891
+ "name": "",
892
+ "type": "address"
893
+ },
894
+ {
895
+ "internalType": "address",
896
+ "name": "",
897
+ "type": "address"
898
+ },
899
+ {
900
+ "internalType": "uint256",
901
+ "name": "",
902
+ "type": "uint256"
903
+ },
904
+ {
905
+ "internalType": "uint256",
906
+ "name": "",
907
+ "type": "uint256"
908
+ },
909
+ {
910
+ "internalType": "bytes",
911
+ "name": "",
912
+ "type": "bytes"
913
+ }
914
+ ],
915
+ "name": "onERC1155Received",
916
+ "outputs": [
917
+ {
918
+ "internalType": "bytes4",
919
+ "name": "",
920
+ "type": "bytes4"
921
+ }
922
+ ],
923
+ "stateMutability": "pure",
924
+ "type": "function"
925
+ },
926
+ {
927
+ "inputs": [
928
+ {
929
+ "internalType": "address",
930
+ "name": "",
931
+ "type": "address"
932
+ },
933
+ {
934
+ "internalType": "address",
935
+ "name": "",
936
+ "type": "address"
937
+ },
938
+ {
939
+ "internalType": "uint256",
940
+ "name": "",
941
+ "type": "uint256"
942
+ },
943
+ {
944
+ "internalType": "bytes",
945
+ "name": "",
946
+ "type": "bytes"
947
+ }
948
+ ],
949
+ "name": "onERC721Received",
950
+ "outputs": [
951
+ {
952
+ "internalType": "bytes4",
953
+ "name": "",
954
+ "type": "bytes4"
955
+ }
956
+ ],
957
+ "stateMutability": "pure",
958
+ "type": "function"
959
+ },
771
960
  {
772
961
  "inputs": [
773
962
  {
@@ -804,6 +993,77 @@ exports.Kernel_jsonAbi = [
804
993
  "stateMutability": "view",
805
994
  "type": "function"
806
995
  },
996
+ {
997
+ "inputs": [
998
+ {
999
+ "components": [
1000
+ {
1001
+ "internalType": "address",
1002
+ "name": "sender",
1003
+ "type": "address"
1004
+ },
1005
+ {
1006
+ "internalType": "uint256",
1007
+ "name": "nonce",
1008
+ "type": "uint256"
1009
+ },
1010
+ {
1011
+ "internalType": "bytes",
1012
+ "name": "initCode",
1013
+ "type": "bytes"
1014
+ },
1015
+ {
1016
+ "internalType": "bytes",
1017
+ "name": "callData",
1018
+ "type": "bytes"
1019
+ },
1020
+ {
1021
+ "internalType": "bytes32",
1022
+ "name": "accountGasLimits",
1023
+ "type": "bytes32"
1024
+ },
1025
+ {
1026
+ "internalType": "uint256",
1027
+ "name": "preVerificationGas",
1028
+ "type": "uint256"
1029
+ },
1030
+ {
1031
+ "internalType": "bytes32",
1032
+ "name": "gasFees",
1033
+ "type": "bytes32"
1034
+ },
1035
+ {
1036
+ "internalType": "bytes",
1037
+ "name": "paymasterAndData",
1038
+ "type": "bytes"
1039
+ },
1040
+ {
1041
+ "internalType": "bytes",
1042
+ "name": "signature",
1043
+ "type": "bytes"
1044
+ }
1045
+ ],
1046
+ "internalType": "struct PackedUserOperation",
1047
+ "name": "userOp",
1048
+ "type": "tuple"
1049
+ },
1050
+ {
1051
+ "internalType": "address",
1052
+ "name": "entryPoint",
1053
+ "type": "address"
1054
+ }
1055
+ ],
1056
+ "name": "replayableUserOpHash",
1057
+ "outputs": [
1058
+ {
1059
+ "internalType": "bytes32",
1060
+ "name": "",
1061
+ "type": "bytes32"
1062
+ }
1063
+ ],
1064
+ "stateMutability": "pure",
1065
+ "type": "function"
1066
+ },
807
1067
  {
808
1068
  "inputs": [],
809
1069
  "name": "rootValidator",
@@ -1076,7 +1336,7 @@ exports.Kernel_jsonAbi = [
1076
1336
  }
1077
1337
  ];
1078
1338
  /**
1079
- * Kernel_json Contract Class
1339
+ * Kernel Contract Class
1080
1340
  *
1081
1341
  * Provides a class-based API similar to TypeChain for interacting with the contract.
1082
1342
  *
@@ -1084,12 +1344,12 @@ exports.Kernel_jsonAbi = [
1084
1344
  * ```typescript
1085
1345
  * import { createPublicClient, createWalletClient, http } from 'viem';
1086
1346
  * import { mainnet } from 'viem/chains';
1087
- * import { Kernel_json } from 'Kernel_json';
1347
+ * import { Kernel } from 'Kernel';
1088
1348
  *
1089
1349
  * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
1090
1350
  * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
1091
1351
  *
1092
- * const contract = new Kernel_json('0x...', { publicClient, walletClient });
1352
+ * const contract = new Kernel('0x...', { publicClient, walletClient });
1093
1353
  *
1094
1354
  * // Read functions
1095
1355
  * const result = await contract.balanceOf('0x...');
@@ -1107,13 +1367,13 @@ exports.Kernel_jsonAbi = [
1107
1367
  * });
1108
1368
  * ```
1109
1369
  */
1110
- class Kernel_json {
1370
+ class Kernel {
1111
1371
  constructor(address, clients) {
1112
1372
  this.contractAddress = address;
1113
1373
  this.publicClient = clients.publicClient;
1114
1374
  this.contract = (0, viem_1.getContract)({
1115
1375
  address,
1116
- abi: exports.Kernel_jsonAbi,
1376
+ abi: exports.KernelAbi,
1117
1377
  client: {
1118
1378
  public: clients.publicClient,
1119
1379
  wallet: clients.walletClient,
@@ -1127,7 +1387,7 @@ class Kernel_json {
1127
1387
  return this.contractAddress;
1128
1388
  }
1129
1389
  /**
1130
- * Get the underlying viem contract instance
1390
+ * Get the underlying viem contract instance.
1131
1391
  */
1132
1392
  getContract() {
1133
1393
  return this.contract;
@@ -1185,8 +1445,29 @@ class Kernel_json {
1185
1445
  * isValidSignature
1186
1446
  * view
1187
1447
  */
1188
- async isValidSignature(hash, signature) {
1189
- return this.contract.read.isValidSignature([hash, signature]);
1448
+ async isValidSignature(hash, data) {
1449
+ return this.contract.read.isValidSignature([hash, data]);
1450
+ }
1451
+ /**
1452
+ * onERC1155BatchReceived
1453
+ * pure
1454
+ */
1455
+ async onERC1155BatchReceived(arg0, arg1, arg2, arg3, arg4) {
1456
+ return this.contract.read.onERC1155BatchReceived([arg0, arg1, arg2, arg3, arg4]);
1457
+ }
1458
+ /**
1459
+ * onERC1155Received
1460
+ * pure
1461
+ */
1462
+ async onERC1155Received(arg0, arg1, arg2, arg3, arg4) {
1463
+ return this.contract.read.onERC1155Received([arg0, arg1, arg2, arg3, arg4]);
1464
+ }
1465
+ /**
1466
+ * onERC721Received
1467
+ * pure
1468
+ */
1469
+ async onERC721Received(arg0, arg1, arg2, arg3) {
1470
+ return this.contract.read.onERC721Received([arg0, arg1, arg2, arg3]);
1190
1471
  }
1191
1472
  /**
1192
1473
  * permissionConfig
@@ -1195,6 +1476,13 @@ class Kernel_json {
1195
1476
  async permissionConfig(pId) {
1196
1477
  return this.contract.read.permissionConfig([pId]);
1197
1478
  }
1479
+ /**
1480
+ * replayableUserOpHash
1481
+ * pure
1482
+ */
1483
+ async replayableUserOpHash(userOp, entryPoint) {
1484
+ return this.contract.read.replayableUserOpHash([userOp, entryPoint]);
1485
+ }
1198
1486
  /**
1199
1487
  * rootValidator
1200
1488
  * view
@@ -1237,6 +1525,17 @@ class Kernel_json {
1237
1525
  async validationConfig(vId) {
1238
1526
  return this.contract.read.validationConfig([vId]);
1239
1527
  }
1528
+ /**
1529
+ * changeRootValidator
1530
+ * payable
1531
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1532
+ */
1533
+ async changeRootValidator(_rootValidator, hook, validatorData, hookData, options) {
1534
+ if (!this.contract.write) {
1535
+ throw new Error('Wallet client is required for write operations');
1536
+ }
1537
+ return this.contract.write.changeRootValidator([_rootValidator, hook, validatorData, hookData], options);
1538
+ }
1240
1539
  /**
1241
1540
  * execute
1242
1541
  * payable
@@ -1270,16 +1569,27 @@ class Kernel_json {
1270
1569
  }
1271
1570
  return this.contract.write.executeUserOp([userOp, userOpHash], options);
1272
1571
  }
1572
+ /**
1573
+ * grantAccess
1574
+ * payable
1575
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1576
+ */
1577
+ async grantAccess(vId, selector, allow, options) {
1578
+ if (!this.contract.write) {
1579
+ throw new Error('Wallet client is required for write operations');
1580
+ }
1581
+ return this.contract.write.grantAccess([vId, selector, allow], options);
1582
+ }
1273
1583
  /**
1274
1584
  * initialize
1275
1585
  * nonpayable
1276
1586
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
1277
1587
  */
1278
- async initialize(_rootValidator, hook, validatorData, hookData, options) {
1588
+ async initialize(_rootValidator, hook, validatorData, hookData, initConfig, options) {
1279
1589
  if (!this.contract.write) {
1280
1590
  throw new Error('Wallet client is required for write operations');
1281
1591
  }
1282
- return this.contract.write.initialize([_rootValidator, hook, validatorData, hookData], options);
1592
+ return this.contract.write.initialize([_rootValidator, hook, validatorData, hookData, initConfig], options);
1283
1593
  }
1284
1594
  /**
1285
1595
  * installModule
@@ -1372,6 +1682,14 @@ class Kernel_json {
1372
1682
  throw new Error('Public client is required for simulation');
1373
1683
  }
1374
1684
  return {
1685
+ /**
1686
+ * Simulate changeRootValidator
1687
+ * Returns gas estimate and result without sending transaction
1688
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1689
+ */
1690
+ async changeRootValidator(_rootValidator, hook, validatorData, hookData, options) {
1691
+ return contract.simulate.changeRootValidator([_rootValidator, hook, validatorData, hookData], options);
1692
+ },
1375
1693
  /**
1376
1694
  * Simulate execute
1377
1695
  * Returns gas estimate and result without sending transaction
@@ -1396,13 +1714,21 @@ class Kernel_json {
1396
1714
  async executeUserOp(userOp, userOpHash, options) {
1397
1715
  return contract.simulate.executeUserOp([userOp, userOpHash], options);
1398
1716
  },
1717
+ /**
1718
+ * Simulate grantAccess
1719
+ * Returns gas estimate and result without sending transaction
1720
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1721
+ */
1722
+ async grantAccess(vId, selector, allow, options) {
1723
+ return contract.simulate.grantAccess([vId, selector, allow], options);
1724
+ },
1399
1725
  /**
1400
1726
  * Simulate initialize
1401
1727
  * Returns gas estimate and result without sending transaction
1402
1728
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
1403
1729
  */
1404
- async initialize(_rootValidator, hook, validatorData, hookData, options) {
1405
- return contract.simulate.initialize([_rootValidator, hook, validatorData, hookData], options);
1730
+ async initialize(_rootValidator, hook, validatorData, hookData, initConfig, options) {
1731
+ return contract.simulate.initialize([_rootValidator, hook, validatorData, hookData, initConfig], options);
1406
1732
  },
1407
1733
  /**
1408
1734
  * Simulate installModule
@@ -1485,7 +1811,7 @@ class Kernel_json {
1485
1811
  ModuleInstalled: (callback) => {
1486
1812
  return this.publicClient.watchContractEvent({
1487
1813
  address: this.contractAddress,
1488
- abi: exports.Kernel_jsonAbi,
1814
+ abi: exports.KernelAbi,
1489
1815
  eventName: 'ModuleInstalled',
1490
1816
  onLogs: (logs) => {
1491
1817
  logs.forEach((log) => {
@@ -1503,7 +1829,7 @@ class Kernel_json {
1503
1829
  ModuleUninstallResult: (callback) => {
1504
1830
  return this.publicClient.watchContractEvent({
1505
1831
  address: this.contractAddress,
1506
- abi: exports.Kernel_jsonAbi,
1832
+ abi: exports.KernelAbi,
1507
1833
  eventName: 'ModuleUninstallResult',
1508
1834
  onLogs: (logs) => {
1509
1835
  logs.forEach((log) => {
@@ -1521,7 +1847,7 @@ class Kernel_json {
1521
1847
  ModuleUninstalled: (callback) => {
1522
1848
  return this.publicClient.watchContractEvent({
1523
1849
  address: this.contractAddress,
1524
- abi: exports.Kernel_jsonAbi,
1850
+ abi: exports.KernelAbi,
1525
1851
  eventName: 'ModuleUninstalled',
1526
1852
  onLogs: (logs) => {
1527
1853
  logs.forEach((log) => {
@@ -1539,7 +1865,7 @@ class Kernel_json {
1539
1865
  NonceInvalidated: (callback) => {
1540
1866
  return this.publicClient.watchContractEvent({
1541
1867
  address: this.contractAddress,
1542
- abi: exports.Kernel_jsonAbi,
1868
+ abi: exports.KernelAbi,
1543
1869
  eventName: 'NonceInvalidated',
1544
1870
  onLogs: (logs) => {
1545
1871
  logs.forEach((log) => {
@@ -1557,7 +1883,7 @@ class Kernel_json {
1557
1883
  PermissionInstalled: (callback) => {
1558
1884
  return this.publicClient.watchContractEvent({
1559
1885
  address: this.contractAddress,
1560
- abi: exports.Kernel_jsonAbi,
1886
+ abi: exports.KernelAbi,
1561
1887
  eventName: 'PermissionInstalled',
1562
1888
  onLogs: (logs) => {
1563
1889
  logs.forEach((log) => {
@@ -1575,7 +1901,7 @@ class Kernel_json {
1575
1901
  PermissionUninstalled: (callback) => {
1576
1902
  return this.publicClient.watchContractEvent({
1577
1903
  address: this.contractAddress,
1578
- abi: exports.Kernel_jsonAbi,
1904
+ abi: exports.KernelAbi,
1579
1905
  eventName: 'PermissionUninstalled',
1580
1906
  onLogs: (logs) => {
1581
1907
  logs.forEach((log) => {
@@ -1593,7 +1919,7 @@ class Kernel_json {
1593
1919
  Received: (callback) => {
1594
1920
  return this.publicClient.watchContractEvent({
1595
1921
  address: this.contractAddress,
1596
- abi: exports.Kernel_jsonAbi,
1922
+ abi: exports.KernelAbi,
1597
1923
  eventName: 'Received',
1598
1924
  onLogs: (logs) => {
1599
1925
  logs.forEach((log) => {
@@ -1611,7 +1937,7 @@ class Kernel_json {
1611
1937
  RootValidatorUpdated: (callback) => {
1612
1938
  return this.publicClient.watchContractEvent({
1613
1939
  address: this.contractAddress,
1614
- abi: exports.Kernel_jsonAbi,
1940
+ abi: exports.KernelAbi,
1615
1941
  eventName: 'RootValidatorUpdated',
1616
1942
  onLogs: (logs) => {
1617
1943
  logs.forEach((log) => {
@@ -1629,7 +1955,7 @@ class Kernel_json {
1629
1955
  SelectorSet: (callback) => {
1630
1956
  return this.publicClient.watchContractEvent({
1631
1957
  address: this.contractAddress,
1632
- abi: exports.Kernel_jsonAbi,
1958
+ abi: exports.KernelAbi,
1633
1959
  eventName: 'SelectorSet',
1634
1960
  onLogs: (logs) => {
1635
1961
  logs.forEach((log) => {
@@ -1647,7 +1973,7 @@ class Kernel_json {
1647
1973
  TryExecuteUnsuccessful: (callback) => {
1648
1974
  return this.publicClient.watchContractEvent({
1649
1975
  address: this.contractAddress,
1650
- abi: exports.Kernel_jsonAbi,
1976
+ abi: exports.KernelAbi,
1651
1977
  eventName: 'TryExecuteUnsuccessful',
1652
1978
  onLogs: (logs) => {
1653
1979
  logs.forEach((log) => {
@@ -1665,7 +1991,7 @@ class Kernel_json {
1665
1991
  Upgraded: (callback, filter) => {
1666
1992
  return this.publicClient.watchContractEvent({
1667
1993
  address: this.contractAddress,
1668
- abi: exports.Kernel_jsonAbi,
1994
+ abi: exports.KernelAbi,
1669
1995
  eventName: 'Upgraded',
1670
1996
  args: filter,
1671
1997
  onLogs: (logs) => {
@@ -1684,7 +2010,7 @@ class Kernel_json {
1684
2010
  ValidatorInstalled: (callback) => {
1685
2011
  return this.publicClient.watchContractEvent({
1686
2012
  address: this.contractAddress,
1687
- abi: exports.Kernel_jsonAbi,
2013
+ abi: exports.KernelAbi,
1688
2014
  eventName: 'ValidatorInstalled',
1689
2015
  onLogs: (logs) => {
1690
2016
  logs.forEach((log) => {
@@ -1702,7 +2028,7 @@ class Kernel_json {
1702
2028
  ValidatorUninstalled: (callback) => {
1703
2029
  return this.publicClient.watchContractEvent({
1704
2030
  address: this.contractAddress,
1705
- abi: exports.Kernel_jsonAbi,
2031
+ abi: exports.KernelAbi,
1706
2032
  eventName: 'ValidatorUninstalled',
1707
2033
  onLogs: (logs) => {
1708
2034
  logs.forEach((log) => {
@@ -1714,4 +2040,4 @@ class Kernel_json {
1714
2040
  };
1715
2041
  }
1716
2042
  }
1717
- exports.Kernel_json = Kernel_json;
2043
+ exports.Kernel = Kernel;