@bloxchain/sdk 1.0.0-alpha.7 → 1.0.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/CHANGELOG.md +21 -0
- package/README.md +411 -376
- package/abi/AccountBlox.abi.json +1894 -1851
- package/abi/BaseStateMachine.abi.json +773 -822
- package/abi/CopyBlox.abi.json +1609 -0
- package/abi/EngineBlox.abi.json +562 -552
- package/abi/GuardController.abi.json +1597 -1609
- package/abi/GuardControllerDefinitions.abi.json +235 -199
- package/abi/IDefinition.abi.json +57 -47
- package/abi/RoleBlox.abi.json +2993 -2982
- package/abi/RuntimeRBAC.abi.json +841 -842
- package/abi/RuntimeRBACDefinitions.abi.json +212 -202
- package/abi/SecureBlox.abi.json +2752 -2752
- package/abi/SecureOwnable.abi.json +1365 -1349
- package/abi/SecureOwnableDefinitions.abi.json +174 -164
- package/dist/abi/AccountBlox.abi.json +3978 -0
- package/dist/abi/BareBlox.abi.json +1378 -0
- package/dist/abi/BaseStateMachine.abi.json +1281 -1330
- package/dist/abi/CopyBlox.abi.json +1609 -0
- package/dist/abi/EngineBlox.abi.json +862 -0
- package/dist/abi/GuardController.abi.json +2325 -2337
- package/dist/abi/GuardControllerDefinitions.abi.json +416 -0
- package/dist/abi/IDefinition.abi.json +122 -112
- package/dist/abi/RoleBlox.abi.json +2994 -0
- package/dist/abi/RuntimeRBAC.abi.json +1629 -1630
- package/dist/abi/RuntimeRBACDefinitions.abi.json +386 -0
- package/dist/abi/SecureBlox.abi.json +2753 -0
- package/dist/abi/SecureOwnable.abi.json +2735 -2719
- package/dist/abi/SecureOwnableDefinitions.abi.json +421 -0
- package/{abi → dist/abi}/SimpleRWA20.abi.json +52 -74
- package/{abi → dist/abi}/SimpleRWA20Definitions.abi.json +5 -0
- package/{abi → dist/abi}/SimpleVault.abi.json +54 -76
- package/{abi → dist/abi}/SimpleVaultDefinitions.abi.json +5 -0
- package/dist/abi.d.ts +11 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +10 -0
- package/dist/abi.js.map +1 -0
- package/dist/contracts/core/BaseStateMachine.d.ts +7 -8
- package/dist/contracts/core/BaseStateMachine.d.ts.map +1 -1
- package/dist/contracts/core/BaseStateMachine.js +77 -42
- package/dist/contracts/core/BaseStateMachine.js.map +1 -1
- package/dist/contracts/core/GuardController.d.ts +21 -14
- package/dist/contracts/core/GuardController.d.ts.map +1 -1
- package/dist/contracts/core/GuardController.js +18 -20
- package/dist/contracts/core/GuardController.js.map +1 -1
- package/dist/contracts/core/RuntimeRBAC.d.ts +5 -18
- package/dist/contracts/core/RuntimeRBAC.d.ts.map +1 -1
- package/dist/contracts/core/RuntimeRBAC.js +4 -21
- package/dist/contracts/core/RuntimeRBAC.js.map +1 -1
- package/dist/contracts/core/SecureOwnable.d.ts +14 -16
- package/dist/contracts/core/SecureOwnable.d.ts.map +1 -1
- package/dist/contracts/core/SecureOwnable.js +21 -24
- package/dist/contracts/core/SecureOwnable.js.map +1 -1
- package/dist/index.d.ts +32 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -26
- package/dist/index.js.map +1 -1
- package/dist/interfaces/base.index.d.ts +10 -2
- package/dist/interfaces/base.index.d.ts.map +1 -1
- package/dist/interfaces/base.state.machine.index.d.ts +4 -6
- package/dist/interfaces/base.state.machine.index.d.ts.map +1 -1
- package/dist/interfaces/core.access.index.d.ts +4 -9
- package/dist/interfaces/core.access.index.d.ts.map +1 -1
- package/dist/interfaces/core.execution.index.d.ts +9 -12
- package/dist/interfaces/core.execution.index.d.ts.map +1 -1
- package/dist/interfaces/core.security.index.d.ts +4 -7
- package/dist/interfaces/core.security.index.d.ts.map +1 -1
- package/dist/interfaces/definition.index.d.ts +1 -1
- package/dist/interfaces/definition.index.d.ts.map +1 -1
- package/dist/interfaces/lib.index.d.ts +2 -2
- package/dist/interfaces/lib.index.d.ts.map +1 -1
- package/dist/lib/Definition.d.ts +2 -2
- package/dist/lib/Definition.d.ts.map +1 -1
- package/dist/lib/Definition.js +9 -2
- package/dist/lib/Definition.js.map +1 -1
- package/dist/lib/EngineBlox.d.ts +23 -48
- package/dist/lib/EngineBlox.d.ts.map +1 -1
- package/dist/lib/EngineBlox.js +61 -136
- package/dist/lib/EngineBlox.js.map +1 -1
- package/dist/lib/definitions/GuardControllerDefinitions.d.ts +21 -22
- package/dist/lib/definitions/GuardControllerDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/GuardControllerDefinitions.js +42 -39
- package/dist/lib/definitions/GuardControllerDefinitions.js.map +1 -1
- package/dist/lib/definitions/RuntimeRBACDefinitions.d.ts +24 -27
- package/dist/lib/definitions/RuntimeRBACDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/RuntimeRBACDefinitions.js +42 -51
- package/dist/lib/definitions/RuntimeRBACDefinitions.js.map +1 -1
- package/dist/lib/definitions/SecureOwnableDefinitions.d.ts +12 -7
- package/dist/lib/definitions/SecureOwnableDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/SecureOwnableDefinitions.js +25 -9
- package/dist/lib/definitions/SecureOwnableDefinitions.js.map +1 -1
- package/dist/lib/definitions/index.d.ts +7 -6
- package/dist/lib/definitions/index.d.ts.map +1 -1
- package/dist/lib/definitions/index.js +6 -5
- package/dist/lib/definitions/index.js.map +1 -1
- package/dist/types/base.state.machine.index.d.ts +4 -20
- package/dist/types/base.state.machine.index.d.ts.map +1 -1
- package/dist/types/base.state.machine.index.js +20 -40
- package/dist/types/base.state.machine.index.js.map +1 -1
- package/dist/types/core.access.index.d.ts +0 -16
- package/dist/types/core.access.index.d.ts.map +1 -1
- package/dist/types/core.access.index.js +2 -13
- package/dist/types/core.access.index.js.map +1 -1
- package/dist/types/core.execution.index.d.ts +9 -10
- package/dist/types/core.execution.index.d.ts.map +1 -1
- package/dist/types/core.execution.index.js +16 -13
- package/dist/types/core.execution.index.js.map +1 -1
- package/dist/types/core.security.index.d.ts +4 -6
- package/dist/types/core.security.index.d.ts.map +1 -1
- package/dist/types/core.security.index.js +23 -27
- package/dist/types/core.security.index.js.map +1 -1
- package/dist/types/definition.index.d.ts +8 -1
- package/dist/types/definition.index.d.ts.map +1 -1
- package/dist/types/definition.index.js.map +1 -1
- package/dist/types/lib.index.d.ts +7 -28
- package/dist/types/lib.index.d.ts.map +1 -1
- package/dist/types/lib.index.js +11 -34
- package/dist/types/lib.index.js.map +1 -1
- package/dist/types/meta-transaction.signatures.d.ts +10 -0
- package/dist/types/meta-transaction.signatures.d.ts.map +1 -0
- package/dist/types/meta-transaction.signatures.js +12 -0
- package/dist/types/meta-transaction.signatures.js.map +1 -0
- package/dist/types/meta-tx-signatures.d.ts +9 -0
- package/dist/types/meta-tx-signatures.d.ts.map +1 -0
- package/dist/types/meta-tx-signatures.js +11 -0
- package/dist/types/meta-tx-signatures.js.map +1 -0
- package/dist/utils/bitmap.d.ts +1 -1
- package/dist/utils/bitmap.d.ts.map +1 -1
- package/dist/utils/contract-errors.d.ts +111 -12
- package/dist/utils/contract-errors.d.ts.map +1 -1
- package/dist/utils/contract-errors.js +362 -113
- package/dist/utils/contract-errors.js.map +1 -1
- package/dist/utils/erc20/erc20Token.d.ts +1 -1
- package/dist/utils/erc20/erc20Token.d.ts.map +1 -1
- package/dist/utils/erc20/erc20Token.js +5 -1
- package/dist/utils/erc20/erc20Token.js.map +1 -1
- package/dist/utils/interface-ids.d.ts +5 -31
- package/dist/utils/interface-ids.d.ts.map +1 -1
- package/dist/utils/interface-ids.js +27 -88
- package/dist/utils/interface-ids.js.map +1 -1
- package/dist/utils/metaTx/metaTransaction.d.ts +110 -9
- package/dist/utils/metaTx/metaTransaction.d.ts.map +1 -1
- package/dist/utils/metaTx/metaTransaction.js +146 -26
- package/dist/utils/metaTx/metaTransaction.js.map +1 -1
- package/dist/utils/validations.d.ts +1 -1
- package/dist/utils/validations.d.ts.map +1 -1
- package/dist/utils/validations.js +12 -12
- package/dist/utils/validations.js.map +1 -1
- package/dist/utils/viem-error-handler.d.ts +1 -1
- package/dist/utils/viem-error-handler.d.ts.map +1 -1
- package/dist/utils/viem-error-handler.js +1 -1
- package/dist/utils/viem-error-handler.js.map +1 -1
- package/package.json +77 -71
- package/dist/contracts/BaseStateMachine.d.ts +0 -92
- package/dist/contracts/BaseStateMachine.d.ts.map +0 -1
- package/dist/contracts/BaseStateMachine.js +0 -263
- package/dist/contracts/BaseStateMachine.js.map +0 -1
- package/dist/contracts/GuardController.d.ts +0 -120
- package/dist/contracts/GuardController.d.ts.map +0 -1
- package/dist/contracts/GuardController.js +0 -150
- package/dist/contracts/GuardController.js.map +0 -1
- package/dist/contracts/RuntimeRBAC.d.ts +0 -40
- package/dist/contracts/RuntimeRBAC.d.ts.map +0 -1
- package/dist/contracts/RuntimeRBAC.js +0 -50
- package/dist/contracts/RuntimeRBAC.js.map +0 -1
- package/dist/contracts/SecureOwnable.d.ts +0 -41
- package/dist/contracts/SecureOwnable.d.ts.map +0 -1
- package/dist/contracts/SecureOwnable.js +0 -81
- package/dist/contracts/SecureOwnable.js.map +0 -1
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
{
|
|
19
19
|
"inputs": [
|
|
20
20
|
{
|
|
21
|
-
"internalType": "
|
|
22
|
-
"name": "
|
|
23
|
-
"type": "
|
|
21
|
+
"internalType": "bytes4",
|
|
22
|
+
"name": "functionSelector",
|
|
23
|
+
"type": "bytes4"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
26
|
-
"name": "
|
|
26
|
+
"name": "ContractFunctionMustBeProtected",
|
|
27
27
|
"type": "error"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
@@ -46,27 +46,43 @@
|
|
|
46
46
|
"inputs": [
|
|
47
47
|
{
|
|
48
48
|
"internalType": "uint256",
|
|
49
|
-
"name": "
|
|
49
|
+
"name": "provided",
|
|
50
50
|
"type": "uint256"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"name": "InvalidTimeLockPeriod",
|
|
54
|
+
"type": "error"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"inputs": [
|
|
58
|
+
{
|
|
59
|
+
"internalType": "address",
|
|
60
|
+
"name": "signedContract",
|
|
61
|
+
"type": "address"
|
|
51
62
|
},
|
|
52
63
|
{
|
|
53
|
-
"internalType": "
|
|
54
|
-
"name": "
|
|
55
|
-
"type": "
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "entryContract",
|
|
66
|
+
"type": "address"
|
|
56
67
|
}
|
|
57
68
|
],
|
|
58
|
-
"name": "
|
|
69
|
+
"name": "MetaTxHandlerContractMismatch",
|
|
59
70
|
"type": "error"
|
|
60
71
|
},
|
|
61
72
|
{
|
|
62
73
|
"inputs": [
|
|
63
74
|
{
|
|
64
|
-
"internalType": "
|
|
65
|
-
"name": "
|
|
66
|
-
"type": "
|
|
75
|
+
"internalType": "bytes4",
|
|
76
|
+
"name": "signedSelector",
|
|
77
|
+
"type": "bytes4"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"internalType": "bytes4",
|
|
81
|
+
"name": "entrySelector",
|
|
82
|
+
"type": "bytes4"
|
|
67
83
|
}
|
|
68
84
|
],
|
|
69
|
-
"name": "
|
|
85
|
+
"name": "MetaTxHandlerSelectorMismatch",
|
|
70
86
|
"type": "error"
|
|
71
87
|
},
|
|
72
88
|
{
|
|
@@ -445,25 +461,6 @@
|
|
|
445
461
|
"stateMutability": "nonpayable",
|
|
446
462
|
"type": "function"
|
|
447
463
|
},
|
|
448
|
-
{
|
|
449
|
-
"inputs": [
|
|
450
|
-
{
|
|
451
|
-
"internalType": "bytes4",
|
|
452
|
-
"name": "functionSelector",
|
|
453
|
-
"type": "bytes4"
|
|
454
|
-
}
|
|
455
|
-
],
|
|
456
|
-
"name": "functionSchemaExists",
|
|
457
|
-
"outputs": [
|
|
458
|
-
{
|
|
459
|
-
"internalType": "bool",
|
|
460
|
-
"name": "",
|
|
461
|
-
"type": "bool"
|
|
462
|
-
}
|
|
463
|
-
],
|
|
464
|
-
"stateMutability": "view",
|
|
465
|
-
"type": "function"
|
|
466
|
-
},
|
|
467
464
|
{
|
|
468
465
|
"inputs": [
|
|
469
466
|
{
|
|
@@ -992,6 +989,25 @@
|
|
|
992
989
|
"stateMutability": "view",
|
|
993
990
|
"type": "function"
|
|
994
991
|
},
|
|
992
|
+
{
|
|
993
|
+
"inputs": [
|
|
994
|
+
{
|
|
995
|
+
"internalType": "bytes32",
|
|
996
|
+
"name": "roleHash",
|
|
997
|
+
"type": "bytes32"
|
|
998
|
+
}
|
|
999
|
+
],
|
|
1000
|
+
"name": "getAuthorizedWallets",
|
|
1001
|
+
"outputs": [
|
|
1002
|
+
{
|
|
1003
|
+
"internalType": "address[]",
|
|
1004
|
+
"name": "",
|
|
1005
|
+
"type": "address[]"
|
|
1006
|
+
}
|
|
1007
|
+
],
|
|
1008
|
+
"stateMutability": "view",
|
|
1009
|
+
"type": "function"
|
|
1010
|
+
},
|
|
995
1011
|
{
|
|
996
1012
|
"inputs": [],
|
|
997
1013
|
"name": "getBroadcasters",
|
|
@@ -1042,6 +1058,11 @@
|
|
|
1042
1058
|
"name": "supportedActionsBitmap",
|
|
1043
1059
|
"type": "uint16"
|
|
1044
1060
|
},
|
|
1061
|
+
{
|
|
1062
|
+
"internalType": "bool",
|
|
1063
|
+
"name": "enforceHandlerRelations",
|
|
1064
|
+
"type": "bool"
|
|
1065
|
+
},
|
|
1045
1066
|
{
|
|
1046
1067
|
"internalType": "bool",
|
|
1047
1068
|
"name": "isProtected",
|
|
@@ -1142,7 +1163,7 @@
|
|
|
1142
1163
|
},
|
|
1143
1164
|
{
|
|
1144
1165
|
"internalType": "bytes32",
|
|
1145
|
-
"name": "
|
|
1166
|
+
"name": "hash",
|
|
1146
1167
|
"type": "bytes32"
|
|
1147
1168
|
},
|
|
1148
1169
|
{
|
|
@@ -1489,25 +1510,6 @@
|
|
|
1489
1510
|
"stateMutability": "view",
|
|
1490
1511
|
"type": "function"
|
|
1491
1512
|
},
|
|
1492
|
-
{
|
|
1493
|
-
"inputs": [
|
|
1494
|
-
{
|
|
1495
|
-
"internalType": "bytes32",
|
|
1496
|
-
"name": "roleHash",
|
|
1497
|
-
"type": "bytes32"
|
|
1498
|
-
}
|
|
1499
|
-
],
|
|
1500
|
-
"name": "getWalletsInRole",
|
|
1501
|
-
"outputs": [
|
|
1502
|
-
{
|
|
1503
|
-
"internalType": "address[]",
|
|
1504
|
-
"name": "",
|
|
1505
|
-
"type": "address[]"
|
|
1506
|
-
}
|
|
1507
|
-
],
|
|
1508
|
-
"stateMutability": "view",
|
|
1509
|
-
"type": "function"
|
|
1510
|
-
},
|
|
1511
1513
|
{
|
|
1512
1514
|
"inputs": [
|
|
1513
1515
|
{
|
|
@@ -1545,30 +1547,6 @@
|
|
|
1545
1547
|
"stateMutability": "view",
|
|
1546
1548
|
"type": "function"
|
|
1547
1549
|
},
|
|
1548
|
-
{
|
|
1549
|
-
"inputs": [
|
|
1550
|
-
{
|
|
1551
|
-
"internalType": "bytes4",
|
|
1552
|
-
"name": "functionSelector",
|
|
1553
|
-
"type": "bytes4"
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
"internalType": "enum EngineBlox.TxAction",
|
|
1557
|
-
"name": "action",
|
|
1558
|
-
"type": "uint8"
|
|
1559
|
-
}
|
|
1560
|
-
],
|
|
1561
|
-
"name": "isActionSupportedByFunction",
|
|
1562
|
-
"outputs": [
|
|
1563
|
-
{
|
|
1564
|
-
"internalType": "bool",
|
|
1565
|
-
"name": "",
|
|
1566
|
-
"type": "bool"
|
|
1567
|
-
}
|
|
1568
|
-
],
|
|
1569
|
-
"stateMutability": "view",
|
|
1570
|
-
"type": "function"
|
|
1571
|
-
},
|
|
1572
1550
|
{
|
|
1573
1551
|
"inputs": [],
|
|
1574
1552
|
"name": "owner",
|
package/dist/abi.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports contract ABIs for use by consumers (e.g. error decoding).
|
|
3
|
+
* Import from '@bloxchain/sdk/abi'.
|
|
4
|
+
*/
|
|
5
|
+
/** EngineBlox contract ABI (full). */
|
|
6
|
+
export declare const engineBloxAbi: readonly unknown[];
|
|
7
|
+
/** EngineBlox ABI entries for custom errors only (for decodeErrorResult). */
|
|
8
|
+
export declare const engineBloxErrorAbi: {
|
|
9
|
+
type?: string;
|
|
10
|
+
}[];
|
|
11
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../abi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,sCAAsC;AACtC,eAAO,MAAM,aAAa,EAAwB,SAAS,OAAO,EAAE,CAAC;AAErE,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB;WAAoC,MAAM;GAExE,CAAC"}
|
package/dist/abi.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports contract ABIs for use by consumers (e.g. error decoding).
|
|
3
|
+
* Import from '@bloxchain/sdk/abi'.
|
|
4
|
+
*/
|
|
5
|
+
import engineBloxAbiJson from './abi/EngineBlox.abi.json' with { type: 'json' };
|
|
6
|
+
/** EngineBlox contract ABI (full). */
|
|
7
|
+
export const engineBloxAbi = engineBloxAbiJson;
|
|
8
|
+
/** EngineBlox ABI entries for custom errors only (for decodeErrorResult). */
|
|
9
|
+
export const engineBloxErrorAbi = engineBloxAbi.filter((item) => item.type === 'error');
|
|
10
|
+
//# sourceMappingURL=abi.js.map
|
package/dist/abi.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../abi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,iBAAiB,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhF,sCAAsC;AACtC,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAuC,CAAC;AAErE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAI,aAA0C,CAAC,MAAM,CAClF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAChC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Address, PublicClient, WalletClient, Chain, Hex } from 'viem';
|
|
2
|
-
import { TransactionOptions, TransactionResult } from '../../interfaces/base.index';
|
|
3
|
-
import { IBaseStateMachine } from '../../interfaces/base.state.machine.index';
|
|
4
|
-
import { TxRecord, MetaTransaction, MetaTxParams } from '../../interfaces/lib.index';
|
|
5
|
-
import { TxAction } from '../../types/lib.index';
|
|
6
|
-
import { FunctionSchema } from '../../types/definition.index';
|
|
2
|
+
import { TransactionOptions, TransactionResult } from '../../interfaces/base.index.js';
|
|
3
|
+
import { IBaseStateMachine } from '../../interfaces/base.state.machine.index.js';
|
|
4
|
+
import { TxRecord, MetaTransaction, MetaTxParams } from '../../interfaces/lib.index.js';
|
|
5
|
+
import { TxAction } from '../../types/lib.index.js';
|
|
6
|
+
import { FunctionSchema } from '../../types/definition.index.js';
|
|
7
7
|
/**
|
|
8
8
|
* @title BaseStateMachine
|
|
9
9
|
* @notice TypeScript wrapper for BaseStateMachine smart contract with common utilities
|
|
@@ -30,6 +30,7 @@ export declare abstract class BaseStateMachine implements IBaseStateMachine {
|
|
|
30
30
|
createMetaTxParams(handlerContract: Address, handlerSelector: Hex, action: TxAction, deadline: bigint, maxGasPrice: bigint, signer: Address): Promise<MetaTxParams>;
|
|
31
31
|
generateUnsignedMetaTransactionForNew(requester: Address, target: Address, value: bigint, gasLimit: bigint, operationType: Hex, executionSelector: Hex, executionParams: Hex, metaTxParams: MetaTxParams): Promise<MetaTransaction>;
|
|
32
32
|
generateUnsignedMetaTransactionForExisting(txId: bigint, metaTxParams: MetaTxParams): Promise<MetaTransaction>;
|
|
33
|
+
/** Returns `[]` when there are no txs yet or the clamped id range does not overlap `1..txCounter`. */
|
|
33
34
|
getTransactionHistory(fromTxId: bigint, toTxId: bigint): Promise<TxRecord[]>;
|
|
34
35
|
getTransaction(txId: bigint): Promise<TxRecord>;
|
|
35
36
|
getPendingTransactions(): Promise<bigint[]>;
|
|
@@ -55,10 +56,8 @@ export declare abstract class BaseStateMachine implements IBaseStateMachine {
|
|
|
55
56
|
* @returns Array of authorized wallet addresses
|
|
56
57
|
* @notice Requires caller to have any role for privacy protection
|
|
57
58
|
*/
|
|
58
|
-
|
|
59
|
-
isActionSupportedByFunction(functionSelector: Hex, action: TxAction): Promise<boolean>;
|
|
59
|
+
getAuthorizedWallets(roleHash: Hex): Promise<Address[]>;
|
|
60
60
|
getActiveRolePermissions(roleHash: Hex): Promise<any[]>;
|
|
61
|
-
functionSchemaExists(functionSelector: Hex): Promise<boolean>;
|
|
62
61
|
getFunctionSchema(functionSelector: Hex): Promise<FunctionSchema>;
|
|
63
62
|
getSignerNonce(signer: Address): Promise<bigint>;
|
|
64
63
|
getSupportedOperationTypes(): Promise<Hex[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStateMachine.d.ts","sourceRoot":"","sources":["../../../contracts/core/BaseStateMachine.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"BaseStateMachine.d.ts","sourceRoot":"","sources":["../../../contracts/core/BaseStateMachine.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAa,MAAM,MAAM,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAA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AC,OAAO,CAAC;IAMrC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAI3C;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;;;OAIG;IACG,QAAQ,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAMnD,iBAAiB,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;;OAGG;IACG,iCAAiC,IAAI,OAAO,CAAC,OAAO,CAAC;CAK5D;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseGwei } from 'viem';
|
|
2
|
+
import { handleViemError } from '../../utils/viem-error-handler.js';
|
|
2
3
|
/**
|
|
3
4
|
* @title BaseStateMachine
|
|
4
5
|
* @notice TypeScript wrapper for BaseStateMachine smart contract with common utilities
|
|
5
6
|
*/
|
|
6
7
|
export class BaseStateMachine {
|
|
8
|
+
client;
|
|
9
|
+
walletClient;
|
|
10
|
+
contractAddress;
|
|
11
|
+
chain;
|
|
12
|
+
abi;
|
|
7
13
|
constructor(client, walletClient, contractAddress, chain, abi) {
|
|
8
14
|
this.client = client;
|
|
9
15
|
this.walletClient = walletClient;
|
|
@@ -30,29 +36,6 @@ export class BaseStateMachine {
|
|
|
30
36
|
// Otherwise, let Viem use the WalletClient's account automatically
|
|
31
37
|
const walletClientAccount = this.walletClient.account?.address;
|
|
32
38
|
const requestedAccount = options.from.toLowerCase();
|
|
33
|
-
// For meta-transaction functions, ensure the structure is correct
|
|
34
|
-
if (functionName.includes('RequestAndApprove') || functionName.includes('MetaTx')) {
|
|
35
|
-
if (args.length > 0 && args[0] && typeof args[0] === 'object' && 'txRecord' in args[0]) {
|
|
36
|
-
const metaTx = args[0];
|
|
37
|
-
// Ensure all nested structures are properly formatted
|
|
38
|
-
if (metaTx.txRecord && typeof metaTx.txRecord === 'object') {
|
|
39
|
-
// Ensure txRecord.params exists and is an object
|
|
40
|
-
if (!metaTx.txRecord.params || typeof metaTx.txRecord.params !== 'object') {
|
|
41
|
-
throw new Error('Invalid meta-transaction: txRecord.params must be an object');
|
|
42
|
-
}
|
|
43
|
-
// Ensure txRecord.payment exists and is an object
|
|
44
|
-
if (!metaTx.txRecord.payment || typeof metaTx.txRecord.payment !== 'object') {
|
|
45
|
-
throw new Error('Invalid meta-transaction: txRecord.payment must be an object');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (metaTx.params && typeof metaTx.params === 'object') {
|
|
49
|
-
// Ensure params is properly formatted
|
|
50
|
-
if (typeof metaTx.params.action !== 'number') {
|
|
51
|
-
throw new Error('Invalid meta-transaction: params.action must be a number');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
39
|
const writeContractParams = {
|
|
57
40
|
chain: this.chain,
|
|
58
41
|
address: this.contractAddress,
|
|
@@ -65,17 +48,74 @@ export class BaseStateMachine {
|
|
|
65
48
|
if (!walletClientAccount || walletClientAccount.toLowerCase() !== requestedAccount) {
|
|
66
49
|
writeContractParams.account = options.from;
|
|
67
50
|
}
|
|
51
|
+
// Determine how strictly to enforce pre-flight simulation.
|
|
52
|
+
const simulationMode = options.simulationMode ?? 'strict';
|
|
68
53
|
try {
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
// Simulate the contract call first for better error messages (no gas params for eth_call).
|
|
55
|
+
if (simulationMode !== 'skip') {
|
|
56
|
+
try {
|
|
57
|
+
await this.client.simulateContract({
|
|
58
|
+
...writeContractParams,
|
|
59
|
+
account: writeContractParams.account || this.walletClient.account
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (simulateError) {
|
|
63
|
+
if (simulationMode === 'strict') {
|
|
64
|
+
throw simulateError;
|
|
65
|
+
}
|
|
66
|
+
const msg = simulateError?.shortMessage ??
|
|
67
|
+
simulateError?.message ??
|
|
68
|
+
simulateError?.cause?.shortMessage ??
|
|
69
|
+
simulateError?.cause?.message ??
|
|
70
|
+
String(simulateError);
|
|
71
|
+
// eslint-disable-next-line no-console
|
|
72
|
+
console.warn(`[BaseStateMachine] Pre-flight simulation failed for ${functionName} (mode=${simulationMode}); continuing to send tx: ${msg}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Forward explicit gas limit when provided so callers can bypass eth_estimateGas.
|
|
76
|
+
if (options.gas !== undefined) {
|
|
77
|
+
const rawGas = options.gas;
|
|
78
|
+
let gasLimit;
|
|
79
|
+
if (typeof rawGas === 'bigint') {
|
|
80
|
+
gasLimit = rawGas;
|
|
81
|
+
}
|
|
82
|
+
else if (typeof rawGas === 'number') {
|
|
83
|
+
if (!Number.isSafeInteger(rawGas) || rawGas < 0) {
|
|
84
|
+
throw new Error(`Invalid gas: number inputs must be non-negative safe integers (got "${rawGas}"). ` +
|
|
85
|
+
'Use a bigint or decimal string for larger values.');
|
|
86
|
+
}
|
|
87
|
+
gasLimit = BigInt(rawGas);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const s = String(rawGas).trim();
|
|
91
|
+
if (!/^\d+$/.test(s)) {
|
|
92
|
+
throw new Error(`Invalid gas: must be a non-negative integer (got "${options.gas}"). Use a number-like value, decimal string, or bigint.`);
|
|
93
|
+
}
|
|
94
|
+
gasLimit = BigInt(s);
|
|
95
|
+
}
|
|
96
|
+
if (gasLimit < 0n) {
|
|
97
|
+
throw new Error(`Invalid gas: must be non-negative (got ${gasLimit.toString()})`);
|
|
98
|
+
}
|
|
99
|
+
writeContractParams.gas = gasLimit;
|
|
75
100
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
101
|
+
// Add gas price override for write only (EIP-1559); viem rejects mixing gasPrice with maxFeePerGas.
|
|
102
|
+
if (options.gasPrice !== undefined && options.gasPrice !== '') {
|
|
103
|
+
const raw = options.gasPrice;
|
|
104
|
+
let gasPriceWei;
|
|
105
|
+
if (typeof raw === 'bigint') {
|
|
106
|
+
gasPriceWei = raw;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const s = String(raw).trim();
|
|
110
|
+
if (!/^\d+$/.test(s)) {
|
|
111
|
+
throw new Error(`Invalid gas price: must be a non-negative integer (got "${options.gasPrice}"). Use wei as a string or bigint.`);
|
|
112
|
+
}
|
|
113
|
+
gasPriceWei = BigInt(s);
|
|
114
|
+
}
|
|
115
|
+
writeContractParams.maxFeePerGas = gasPriceWei;
|
|
116
|
+
// Use a separate priority fee so when base fee is high the tip does not go to zero (avoids tx stalling).
|
|
117
|
+
const oneGwei = parseGwei('1');
|
|
118
|
+
writeContractParams.maxPriorityFeePerGas = gasPriceWei <= oneGwei ? gasPriceWei : oneGwei;
|
|
79
119
|
}
|
|
80
120
|
const hash = await this.walletClient.writeContract(writeContractParams);
|
|
81
121
|
return {
|
|
@@ -157,6 +197,7 @@ export class BaseStateMachine {
|
|
|
157
197
|
]);
|
|
158
198
|
}
|
|
159
199
|
// ============ STATE QUERIES ============
|
|
200
|
+
/** Returns `[]` when there are no txs yet or the clamped id range does not overlap `1..txCounter`. */
|
|
160
201
|
async getTransactionHistory(fromTxId, toTxId) {
|
|
161
202
|
return this.executeReadContract('getTransactionHistory', [fromTxId, toTxId]);
|
|
162
203
|
}
|
|
@@ -189,18 +230,12 @@ export class BaseStateMachine {
|
|
|
189
230
|
* @returns Array of authorized wallet addresses
|
|
190
231
|
* @notice Requires caller to have any role for privacy protection
|
|
191
232
|
*/
|
|
192
|
-
async
|
|
193
|
-
return this.executeReadContract('
|
|
194
|
-
}
|
|
195
|
-
async isActionSupportedByFunction(functionSelector, action) {
|
|
196
|
-
return this.executeReadContract('isActionSupportedByFunction', [functionSelector, action]);
|
|
233
|
+
async getAuthorizedWallets(roleHash) {
|
|
234
|
+
return this.executeReadContract('getAuthorizedWallets', [roleHash]);
|
|
197
235
|
}
|
|
198
236
|
async getActiveRolePermissions(roleHash) {
|
|
199
237
|
return this.executeReadContract('getActiveRolePermissions', [roleHash]);
|
|
200
238
|
}
|
|
201
|
-
async functionSchemaExists(functionSelector) {
|
|
202
|
-
return this.executeReadContract('functionSchemaExists', [functionSelector]);
|
|
203
|
-
}
|
|
204
239
|
async getFunctionSchema(functionSelector) {
|
|
205
240
|
return this.executeReadContract('getFunctionSchema', [functionSelector]);
|
|
206
241
|
}
|
|
@@ -263,7 +298,7 @@ export class BaseStateMachine {
|
|
|
263
298
|
*/
|
|
264
299
|
async supportsBaseStateMachineInterface() {
|
|
265
300
|
// Import dynamically to avoid circular dependencies
|
|
266
|
-
const { INTERFACE_IDS } = await import('../../utils/interface-ids');
|
|
301
|
+
const { INTERFACE_IDS } = await import('../../utils/interface-ids.js');
|
|
267
302
|
return this.supportsInterface(INTERFACE_IDS.IBaseStateMachine);
|
|
268
303
|
}
|
|
269
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStateMachine.js","sourceRoot":"","sources":["../../../contracts/core/BaseStateMachine.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseStateMachine.js","sourceRoot":"","sources":["../../../contracts/core/BaseStateMachine.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmD,SAAS,EAAE,MAAM,MAAM,CAAC;AAMlF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAgB,gBAAgB;IAExB;IACA;IACA;IACA;IACA;IALZ,YACY,MAAoB,EACpB,YAAsC,EACtC,eAAwB,EACxB,KAAY,EACZ,GAAQ;QAJR,WAAM,GAAN,MAAM,CAAc;QACpB,iBAAY,GAAZ,YAAY,CAA0B;QACtC,oBAAe,GAAf,eAAe,CAAS;QACxB,UAAK,GAAL,KAAK,CAAO;QACZ,QAAG,GAAH,GA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AAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Address, PublicClient, WalletClient, Chain, Hex } from 'viem';
|
|
2
|
-
import { TransactionOptions, TransactionResult } from '../../interfaces/base.index';
|
|
3
|
-
import { IGuardController } from '../../interfaces/core.execution.index';
|
|
4
|
-
import { MetaTransaction } from '../../interfaces/lib.index';
|
|
5
|
-
import { BaseStateMachine } from './BaseStateMachine';
|
|
2
|
+
import { TransactionOptions, TransactionResult } from '../../interfaces/base.index.js';
|
|
3
|
+
import { IGuardController } from '../../interfaces/core.execution.index.js';
|
|
4
|
+
import { MetaTransaction } from '../../interfaces/lib.index.js';
|
|
5
|
+
import { BaseStateMachine } from './BaseStateMachine.js';
|
|
6
6
|
/**
|
|
7
7
|
* @title GuardController
|
|
8
8
|
* @notice TypeScript wrapper for GuardController smart contract
|
|
@@ -43,6 +43,23 @@ export declare class GuardController extends BaseStateMachine implements IGuardC
|
|
|
43
43
|
* @notice For simple ETH transfers: value>0, functionSelector=0x00000000, params=""
|
|
44
44
|
*/
|
|
45
45
|
executeWithTimeLock(target: Address, value: bigint, functionSelector: Hex, params: Hex, gasLimit: bigint, operationType: Hex, options: TransactionOptions): Promise<TransactionResult>;
|
|
46
|
+
/**
|
|
47
|
+
* @dev Requests a time-locked execution with payment details
|
|
48
|
+
* @param target The address of the target contract
|
|
49
|
+
* @param value The ETH value to send
|
|
50
|
+
* @param functionSelector The function selector to execute
|
|
51
|
+
* @param params The encoded parameters for the function
|
|
52
|
+
* @param gasLimit The gas limit for execution
|
|
53
|
+
* @param operationType The operation type hash
|
|
54
|
+
* @param paymentDetails Payment details (recipient, nativeTokenAmount, erc20TokenAddress, erc20TokenAmount)
|
|
55
|
+
* @param options Transaction options including from address
|
|
56
|
+
*/
|
|
57
|
+
executeWithPayment(target: Address, value: bigint, functionSelector: Hex, params: Hex, gasLimit: bigint, operationType: Hex, paymentDetails: {
|
|
58
|
+
recipient: Address;
|
|
59
|
+
nativeTokenAmount: bigint;
|
|
60
|
+
erc20TokenAddress: Address;
|
|
61
|
+
erc20TokenAmount: bigint;
|
|
62
|
+
}, options: TransactionOptions): Promise<TransactionResult>;
|
|
46
63
|
/**
|
|
47
64
|
* @dev Approves and executes a time-locked transaction
|
|
48
65
|
* @param txId The transaction ID
|
|
@@ -85,15 +102,6 @@ export declare class GuardController extends BaseStateMachine implements IGuardC
|
|
|
85
102
|
* @notice Requires EXECUTE_META_REQUEST_AND_APPROVE permission for the execution function selector
|
|
86
103
|
*/
|
|
87
104
|
requestAndApproveExecution(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
88
|
-
/**
|
|
89
|
-
* @dev Creates execution params for a guard configuration batch (definition helper; no contract call)
|
|
90
|
-
* @param actions Guard configuration actions
|
|
91
|
-
* @return Promise<Hex> The execution params to be used in a meta-transaction
|
|
92
|
-
*/
|
|
93
|
-
guardConfigBatchExecutionParams(actions: Array<{
|
|
94
|
-
actionType: number;
|
|
95
|
-
data: Hex;
|
|
96
|
-
}>): Promise<Hex>;
|
|
97
105
|
/**
|
|
98
106
|
* @dev Requests and approves a guard configuration batch using a meta-transaction
|
|
99
107
|
* @param metaTx The meta-transaction describing the guard configuration batch
|
|
@@ -107,7 +115,6 @@ export declare class GuardController extends BaseStateMachine implements IGuardC
|
|
|
107
115
|
* @dev Gets all whitelisted targets for a function selector (from BaseStateMachine).
|
|
108
116
|
* @param functionSelector The function selector
|
|
109
117
|
* @return Promise<Address[]> Array of whitelisted target addresses
|
|
110
|
-
* @notice Requires caller to have any role (via _validateAnyRole) for privacy protection
|
|
111
118
|
*/
|
|
112
119
|
getFunctionWhitelistTargets(functionSelector: Hex): Promise<Address[]>;
|
|
113
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuardController.d.ts","sourceRoot":"","sources":["../../../contracts/core/GuardController.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,GAA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|
-
import GuardControllerABIJson from '../../abi/GuardController.abi.json';
|
|
2
|
-
import { BaseStateMachine } from './BaseStateMachine';
|
|
3
|
-
import { INTERFACE_IDS } from '../../utils/interface-ids';
|
|
4
|
-
import { guardConfigBatchExecutionParams as defGuardConfigBatchExecutionParams } from '../../lib/definitions/GuardControllerDefinitions';
|
|
1
|
+
import GuardControllerABIJson from '../../abi/GuardController.abi.json' with { type: 'json' };
|
|
2
|
+
import { BaseStateMachine } from './BaseStateMachine.js';
|
|
3
|
+
import { INTERFACE_IDS } from '../../utils/interface-ids.js';
|
|
5
4
|
/**
|
|
6
5
|
* @title GuardController
|
|
7
6
|
* @notice TypeScript wrapper for GuardController smart contract
|
|
@@ -50,6 +49,20 @@ export class GuardController extends BaseStateMachine {
|
|
|
50
49
|
async executeWithTimeLock(target, value, functionSelector, params, gasLimit, operationType, options) {
|
|
51
50
|
return this.executeWriteContract('executeWithTimeLock', [target, value, functionSelector, params, gasLimit, operationType], options);
|
|
52
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* @dev Requests a time-locked execution with payment details
|
|
54
|
+
* @param target The address of the target contract
|
|
55
|
+
* @param value The ETH value to send
|
|
56
|
+
* @param functionSelector The function selector to execute
|
|
57
|
+
* @param params The encoded parameters for the function
|
|
58
|
+
* @param gasLimit The gas limit for execution
|
|
59
|
+
* @param operationType The operation type hash
|
|
60
|
+
* @param paymentDetails Payment details (recipient, nativeTokenAmount, erc20TokenAddress, erc20TokenAmount)
|
|
61
|
+
* @param options Transaction options including from address
|
|
62
|
+
*/
|
|
63
|
+
async executeWithPayment(target, value, functionSelector, params, gasLimit, operationType, paymentDetails, options) {
|
|
64
|
+
return this.executeWriteContract('executeWithPayment', [target, value, functionSelector, params, gasLimit, operationType, paymentDetails], options);
|
|
65
|
+
}
|
|
53
66
|
/**
|
|
54
67
|
* @dev Approves and executes a time-locked transaction
|
|
55
68
|
* @param txId The transaction ID
|
|
@@ -103,14 +116,6 @@ export class GuardController extends BaseStateMachine {
|
|
|
103
116
|
return this.executeWriteContract('requestAndApproveExecution', [metaTx], options);
|
|
104
117
|
}
|
|
105
118
|
// ============ GUARD CONFIGURATION BATCH ============
|
|
106
|
-
/**
|
|
107
|
-
* @dev Creates execution params for a guard configuration batch (definition helper; no contract call)
|
|
108
|
-
* @param actions Guard configuration actions
|
|
109
|
-
* @return Promise<Hex> The execution params to be used in a meta-transaction
|
|
110
|
-
*/
|
|
111
|
-
async guardConfigBatchExecutionParams(actions) {
|
|
112
|
-
return Promise.resolve(defGuardConfigBatchExecutionParams(actions));
|
|
113
|
-
}
|
|
114
119
|
/**
|
|
115
120
|
* @dev Requests and approves a guard configuration batch using a meta-transaction
|
|
116
121
|
* @param metaTx The meta-transaction describing the guard configuration batch
|
|
@@ -126,16 +131,9 @@ export class GuardController extends BaseStateMachine {
|
|
|
126
131
|
* @dev Gets all whitelisted targets for a function selector (from BaseStateMachine).
|
|
127
132
|
* @param functionSelector The function selector
|
|
128
133
|
* @return Promise<Address[]> Array of whitelisted target addresses
|
|
129
|
-
* @notice Requires caller to have any role (via _validateAnyRole) for privacy protection
|
|
130
134
|
*/
|
|
131
135
|
async getFunctionWhitelistTargets(functionSelector) {
|
|
132
|
-
|
|
133
|
-
functionSelector
|
|
134
|
-
]);
|
|
135
|
-
if (!Array.isArray(result)) {
|
|
136
|
-
throw new Error(`Unexpected return type from getFunctionWhitelistTargets: ${typeof result}`);
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
136
|
+
return this.executeReadContract('getFunctionWhitelistTargets', [functionSelector]);
|
|
139
137
|
}
|
|
140
138
|
// ============ INTERFACE SUPPORT ============
|
|
141
139
|
/**
|