@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
|
-
import { TransactionResult, TransactionOptions } from './base.index';
|
|
3
|
-
import { TxRecord, MetaTransaction, MetaTxParams } from './lib.index';
|
|
4
|
-
import { TxAction } from '../types/lib.index';
|
|
2
|
+
import { TransactionResult, TransactionOptions } from './base.index.js';
|
|
3
|
+
import { TxRecord, MetaTransaction, MetaTxParams } from './lib.index.js';
|
|
4
|
+
import { TxAction } from '../types/lib.index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Interface for SecureOwnable contract events
|
|
7
7
|
*/
|
|
@@ -54,14 +54,12 @@ export interface ISecureOwnable {
|
|
|
54
54
|
transferOwnershipApprovalWithMetaTx(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
55
55
|
transferOwnershipCancellation(txId: bigint, options: TransactionOptions): Promise<TransactionResult>;
|
|
56
56
|
transferOwnershipCancellationWithMetaTx(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
57
|
-
updateBroadcasterRequest(newBroadcaster: Address,
|
|
57
|
+
updateBroadcasterRequest(newBroadcaster: Address, currentBroadcaster: Address, options: TransactionOptions): Promise<TransactionResult>;
|
|
58
58
|
updateBroadcasterDelayedApproval(txId: bigint, options: TransactionOptions): Promise<TransactionResult>;
|
|
59
59
|
updateBroadcasterApprovalWithMetaTx(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
60
60
|
updateBroadcasterCancellation(txId: bigint, options: TransactionOptions): Promise<TransactionResult>;
|
|
61
61
|
updateBroadcasterCancellationWithMetaTx(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
62
|
-
updateRecoveryExecutionOptions(newRecoveryAddress: Address): Promise<Hex>;
|
|
63
62
|
updateRecoveryRequestAndApprove(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
64
|
-
updateTimeLockExecutionOptions(newTimeLockPeriodSec: bigint): Promise<Hex>;
|
|
65
63
|
updateTimeLockRequestAndApprove(metaTx: MetaTransaction, options: TransactionOptions): Promise<TransactionResult>;
|
|
66
64
|
createMetaTxParams(handlerContract: Address, handlerSelector: Hex, action: TxAction, deadline: bigint, maxGasPrice: bigint, signer: Address): Promise<MetaTxParams>;
|
|
67
65
|
generateUnsignedMetaTransactionForNew(requester: Address, target: Address, value: bigint, gasLimit: bigint, operationType: Hex, executionSelector: Hex, executionParams: Hex, metaTxParams: MetaTxParams): Promise<MetaTransaction>;
|
|
@@ -74,7 +72,6 @@ export interface ISecureOwnable {
|
|
|
74
72
|
getSupportedRoles(): Promise<Hex[]>;
|
|
75
73
|
getSupportedFunctions(): Promise<Hex[]>;
|
|
76
74
|
hasRole(roleHash: Hex, wallet: Address): Promise<boolean>;
|
|
77
|
-
isActionSupportedByFunction(functionSelector: Hex, action: TxAction): Promise<boolean>;
|
|
78
75
|
getSignerNonce(signer: Address): Promise<bigint>;
|
|
79
76
|
getActiveRolePermissions(roleHash: Hex): Promise<any[]>;
|
|
80
77
|
initialized(): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.security.index.d.ts","sourceRoot":"","sources":["../../interfaces/core.security.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"core.security.index.d.ts","sourceRoot":"","sources":["../../interfaces/core.security.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO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0B,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7C,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACpC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAGxC,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,wBAAwB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAGhC,iBAAiB,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
|
-
import { FunctionSchema, RolePermission } from '../types/definition.index';
|
|
2
|
+
import { FunctionSchema, RolePermission } from '../types/definition.index.js';
|
|
3
3
|
/**
|
|
4
4
|
* TypeScript interface for IDefinition
|
|
5
5
|
* This interface allows interaction with any definition library that implements IDefinition.sol
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.index.d.ts","sourceRoot":"","sources":["../../interfaces/definition.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,cAAc,EACf,MAAM,
|
|
1
|
+
{"version":3,"file":"definition.index.d.ts","sourceRoot":"","sources":["../../interfaces/definition.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEhD;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,GAAG,CAAC;CACtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
|
-
import { TxStatus, TxAction } from '../types/lib.index';
|
|
2
|
+
import { TxStatus, TxAction } from '../types/lib.index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Payment and transaction related interfaces
|
|
5
5
|
*/
|
|
@@ -34,7 +34,7 @@ export interface TxRecord {
|
|
|
34
34
|
status: TxStatus;
|
|
35
35
|
params: TxParams;
|
|
36
36
|
message: Hex;
|
|
37
|
-
|
|
37
|
+
resultHash: Hex;
|
|
38
38
|
payment: PaymentDetails;
|
|
39
39
|
}
|
|
40
40
|
export interface MetaTransaction {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.index.d.ts","sourceRoot":"","sources":["../../interfaces/lib.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"lib.index.d.ts","sourceRoot":"","sources":["../../interfaces/lib.index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EA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AM,EAAE,QAAQ,CAAC,CAAC;IACjC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzB,iBAAiB,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,uBAAuB,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,uBAAuB,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3C,kBAAkB,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B,EAAE,GAAG,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,GAAG,CAAC;IACvB,eAAe,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/lib/Definition.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicClient, WalletClient, Address, Chain, Hex } from 'viem';
|
|
2
|
-
import { IDefinition, DefinitionsConfig } from '../interfaces/definition.index';
|
|
3
|
-
import { FunctionSchema, RolePermission } from '../types/definition.index';
|
|
2
|
+
import { IDefinition, DefinitionsConfig } from '../interfaces/definition.index.js';
|
|
3
|
+
import { FunctionSchema, RolePermission } from '../types/definition.index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Definitions class for interacting with any definition library
|
|
6
6
|
* that implements the IDefinition interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Definition.d.ts","sourceRoot":"","sources":["../../lib/Definition.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EACL,WAAW,EACX,iBAAiB,EAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"Definition.d.ts","sourceRoot":"","sources":["../../lib/Definition.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EACL,WAAW,EACX,iBAAiB,EAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,cAAc,EAEf,MAAM,8BAA8B,CAAC;AAOtC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,WAAY,YAAW,WAAW;IAC7C,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC;IAC/B,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;IACjD,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAGlC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,eAAe,EAAE,OAAO,EACxB,KAAK,EAAE,KAAK,EACZ,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAarC;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAwBrD;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC;IAqBnD;;;;OAIG;IACG,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAM7E;;;;OAIG;IACG,2BAA2B,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAK7F;;;;;;;OAOG;IACG,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAc/E;;;;;OAKG;IACG,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAchE;;;OAGG;IACH,SAAS,IAAI,iBAAiB;IAI9B;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;CAGvD"}
|
package/dist/lib/Definition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fromContractValue } from '../utils/bitmap';
|
|
1
|
+
import { fromContractValue } from '../utils/bitmap.js';
|
|
2
2
|
// Import the ABI
|
|
3
|
-
import IDefinitionABI from '../abi/IDefinition.abi.json';
|
|
3
|
+
import IDefinitionABI from '../abi/IDefinition.abi.json' with { type: 'json' };
|
|
4
4
|
/**
|
|
5
5
|
* Definitions class for interacting with any definition library
|
|
6
6
|
* that implements the IDefinition interface
|
|
@@ -26,6 +26,11 @@ import IDefinitionABI from '../abi/IDefinition.abi.json';
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export class Definitions {
|
|
29
|
+
client;
|
|
30
|
+
walletClient;
|
|
31
|
+
contractAddress;
|
|
32
|
+
chain;
|
|
33
|
+
config;
|
|
29
34
|
constructor(client, walletClient, contractAddress, chain, config) {
|
|
30
35
|
this.client = client;
|
|
31
36
|
this.walletClient = walletClient;
|
|
@@ -54,7 +59,9 @@ export class Definitions {
|
|
|
54
59
|
operationType: item.operationType,
|
|
55
60
|
operationName: item.operationName,
|
|
56
61
|
supportedActionsBitmap: fromContractValue(item.supportedActionsBitmap), // uint16
|
|
62
|
+
enforceHandlerRelations: item.enforceHandlerRelations,
|
|
57
63
|
isProtected: item.isProtected,
|
|
64
|
+
isGrantRevocable: item.isGrantRevocable,
|
|
58
65
|
handlerForSelectors: item.handlerForSelectors.map((selector) => selector)
|
|
59
66
|
}));
|
|
60
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Definition.js","sourceRoot":"","sources":["../../lib/Definition.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Definition.js","sourceRoot":"","sources":["../../lib/Definition.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,iBAAiB;AACjB,OAAO,cAAc,MAAM,6BAA6B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,WAAW;IACZ,MAAM,CAAe;IACrB,YAAY,CAA2B;IACvC,eAAe,CAAU;IACzB,KAAK,CAAQ;IACb,MAAM,CAAoB;IAEpC,YACE,MAAoB,EACpB,YAAsC,EACtC,eAAwB,EACxB,KAAY,EACZ,MAAmC;QAEnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG;YACZ,eAAe;YACf,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,kBAAkB;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;gBAC5C,OAAO,EAAE,IAAI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{ TxAction } from '../types/lib.index';
|
|
3
|
-
import { Uint16Bitmap } from '../utils/bitmap';
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
import { TxAction } from '../types/lib.index.js';
|
|
3
|
+
import { Uint16Bitmap } from '../utils/bitmap.js';
|
|
4
4
|
/**
|
|
5
5
|
* @title EngineBlox Library SDK
|
|
6
6
|
* @dev Provides access to public library constants and pure functions from EngineBlox.sol
|
|
@@ -15,7 +15,7 @@ import { Uint16Bitmap } from '../utils/bitmap';
|
|
|
15
15
|
*
|
|
16
16
|
* // Access constants
|
|
17
17
|
* const protocolName = EngineBlox.PROTOCOL_NAME_HASH;
|
|
18
|
-
* const version =
|
|
18
|
+
* const version = EngineBlox.VERSION;
|
|
19
19
|
*
|
|
20
20
|
* // Use pure functions
|
|
21
21
|
* const signer = EngineBlox.recoverSigner(messageHash, signature);
|
|
@@ -30,17 +30,9 @@ export declare class EngineBlox {
|
|
|
30
30
|
*/
|
|
31
31
|
static readonly PROTOCOL_NAME_HASH: Hex;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Protocol version string (semver, e.g. "1.0.0"). Matches EngineBlox.sol VERSION and EIP-712 domain version.
|
|
34
34
|
*/
|
|
35
|
-
static readonly
|
|
36
|
-
/**
|
|
37
|
-
* Minor version number
|
|
38
|
-
*/
|
|
39
|
-
static readonly VERSION_MINOR: number;
|
|
40
|
-
/**
|
|
41
|
-
* Patch version number
|
|
42
|
-
*/
|
|
43
|
-
static readonly VERSION_PATCH: number;
|
|
35
|
+
static readonly VERSION: string;
|
|
44
36
|
/**
|
|
45
37
|
* Native token transfer selector (reserved signature for simple ETH transfers)
|
|
46
38
|
* Computed as bytes4(keccak256("__bloxchain_native_transfer__()"))
|
|
@@ -50,6 +42,15 @@ export declare class EngineBlox {
|
|
|
50
42
|
* Native token transfer operation type hash
|
|
51
43
|
*/
|
|
52
44
|
static readonly NATIVE_TRANSFER_OPERATION: Hex;
|
|
45
|
+
/**
|
|
46
|
+
* Pseudo-selector: whitelist key for attached payment recipients (native + ERC20 payout addresses).
|
|
47
|
+
* Matches `ATTACHED_PAYMENT_RECIPIENT_SELECTOR` in EngineBlox.sol.
|
|
48
|
+
*/
|
|
49
|
+
static readonly ATTACHED_PAYMENT_RECIPIENT_SELECTOR: Hex;
|
|
50
|
+
/**
|
|
51
|
+
* Standard IERC20 `transfer(address,uint256)` — whitelist key for token contracts in attached ERC20 payments.
|
|
52
|
+
*/
|
|
53
|
+
static readonly ERC20_TRANSFER_SELECTOR: Hex;
|
|
53
54
|
/**
|
|
54
55
|
* Owner role hash
|
|
55
56
|
*/
|
|
@@ -63,43 +64,13 @@ export declare class EngineBlox {
|
|
|
63
64
|
*/
|
|
64
65
|
static readonly RECOVERY_ROLE: Hex;
|
|
65
66
|
/**
|
|
66
|
-
* @dev Recovers the signer address from
|
|
67
|
-
* @param messageHash The
|
|
68
|
-
* @param signature The signature
|
|
67
|
+
* @dev Recovers the signer address from the EIP-712 digest and signature (standard EIP-712; no EIP-191 prefix).
|
|
68
|
+
* @param messageHash The EIP-712 digest (keccak256("\x19\x01" || domainSeparator || structHash))
|
|
69
|
+
* @param signature The signature (65 bytes)
|
|
69
70
|
* @returns Promise that resolves to the address of the signer
|
|
70
|
-
* @
|
|
71
|
-
*
|
|
72
|
-
* @notice This matches the contract's recoverSigner function which uses
|
|
73
|
-
* messageHash.toEthSignedMessageHash() to convert to EIP-191 format
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const messageHash = "0x1234...";
|
|
78
|
-
* const signature = "0xabcd...";
|
|
79
|
-
* const signer = await EngineBlox.recoverSigner(messageHash, signature);
|
|
80
|
-
* ```
|
|
71
|
+
* @notice Matches the contract's recoverSigner which uses ecrecover(messageHash, v, r, s) on the raw digest.
|
|
81
72
|
*/
|
|
82
73
|
static recoverSigner(messageHash: Hex, signature: Hex): Promise<Address>;
|
|
83
|
-
/**
|
|
84
|
-
* @dev Checks if a function selector exists in a contract's bytecode
|
|
85
|
-
* @param client PublicClient instance for reading contract bytecode
|
|
86
|
-
* @param contractAddress The address of the contract to check
|
|
87
|
-
* @param selector The 4-byte function selector to search for
|
|
88
|
-
* @returns Promise that resolves to true if the selector is found in the contract's function selector dispatch table
|
|
89
|
-
*
|
|
90
|
-
* @notice Searches the first 2KB where function selectors are stored in the dispatch table
|
|
91
|
-
* @notice This is a heuristic check - false positives are possible but unlikely
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```typescript
|
|
95
|
-
* const exists = await EngineBlox.selectorExistsInContract(
|
|
96
|
-
* publicClient,
|
|
97
|
-
* '0x1234...',
|
|
98
|
-
* '0xabcd1234'
|
|
99
|
-
* );
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
static selectorExistsInContract(client: PublicClient, contractAddress: Address, selector: Hex): Promise<boolean>;
|
|
103
74
|
/**
|
|
104
75
|
* @dev Checks if a TxAction is present in a bitmap
|
|
105
76
|
* @param bitmap The bitmap to check
|
|
@@ -150,6 +121,10 @@ export declare class EngineBlox {
|
|
|
150
121
|
* ```
|
|
151
122
|
*/
|
|
152
123
|
static convertBitmapToActions(bitmap: Uint16Bitmap): TxAction[];
|
|
124
|
+
/**
|
|
125
|
+
* Hash of execution returndata (`bytes32(0)` when empty). Matches `EngineBlox.executionResultHash` on-chain.
|
|
126
|
+
*/
|
|
127
|
+
static executionResultHash(executionResult: Hex): Hex;
|
|
153
128
|
}
|
|
154
129
|
/**
|
|
155
130
|
* Default export for convenience
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBlox.d.ts","sourceRoot":"","sources":["../../lib/EngineBlox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"EngineBlox.d.ts","sourceRoot":"","sources":["../../lib/EngineBlox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,OAAO,EAAE,GAAG,EAA4C,M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G,YAAY;IAQjE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,EAAE;IAa/D;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,eAAe,EAAE,GAAG,GAAG,GAAG;CAMtD;AAED;;GAEG;AACH,eAAe,UAAU,CAAC"}
|
package/dist/lib/EngineBlox.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keccak256 as k256, recoverAddress } from 'viem';
|
|
2
|
-
import { createUint16Bitmap } from '../utils/bitmap';
|
|
2
|
+
import { createUint16Bitmap } from '../utils/bitmap.js';
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to compute keccak256 of a string
|
|
5
5
|
*/
|
|
@@ -20,7 +20,7 @@ const keccak256 = (str) => {
|
|
|
20
20
|
*
|
|
21
21
|
* // Access constants
|
|
22
22
|
* const protocolName = EngineBlox.PROTOCOL_NAME_HASH;
|
|
23
|
-
* const version =
|
|
23
|
+
* const version = EngineBlox.VERSION;
|
|
24
24
|
*
|
|
25
25
|
* // Use pure functions
|
|
26
26
|
* const signer = EngineBlox.recoverSigner(messageHash, signature);
|
|
@@ -30,115 +30,71 @@ const keccak256 = (str) => {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
export class EngineBlox {
|
|
33
|
+
// ============ VERSION INFORMATION ============
|
|
34
|
+
/**
|
|
35
|
+
* Protocol name hash (keccak256("Bloxchain"))
|
|
36
|
+
*/
|
|
37
|
+
static PROTOCOL_NAME_HASH = keccak256("Bloxchain");
|
|
38
|
+
/**
|
|
39
|
+
* Protocol version string (semver, e.g. "1.0.0"). Matches EngineBlox.sol VERSION and EIP-712 domain version.
|
|
40
|
+
*/
|
|
41
|
+
static VERSION = "1.0.0";
|
|
42
|
+
// ============ FUNCTION SELECTORS ============
|
|
43
|
+
/**
|
|
44
|
+
* Native token transfer selector (reserved signature for simple ETH transfers)
|
|
45
|
+
* Computed as bytes4(keccak256("__bloxchain_native_transfer__()"))
|
|
46
|
+
*/
|
|
47
|
+
static NATIVE_TRANSFER_SELECTOR = ('0x' + k256(new TextEncoder().encode("__bloxchain_native_transfer__()")).slice(2, 10));
|
|
48
|
+
/**
|
|
49
|
+
* Native token transfer operation type hash
|
|
50
|
+
*/
|
|
51
|
+
static NATIVE_TRANSFER_OPERATION = keccak256("NATIVE_TRANSFER");
|
|
52
|
+
/**
|
|
53
|
+
* Pseudo-selector: whitelist key for attached payment recipients (native + ERC20 payout addresses).
|
|
54
|
+
* Matches `ATTACHED_PAYMENT_RECIPIENT_SELECTOR` in EngineBlox.sol.
|
|
55
|
+
*/
|
|
56
|
+
static ATTACHED_PAYMENT_RECIPIENT_SELECTOR = ('0x' + k256(new TextEncoder().encode('__bloxchain_attached_payment_recipient__()')).slice(2, 10));
|
|
57
|
+
/**
|
|
58
|
+
* Standard IERC20 `transfer(address,uint256)` — whitelist key for token contracts in attached ERC20 payments.
|
|
59
|
+
*/
|
|
60
|
+
static ERC20_TRANSFER_SELECTOR = ('0x' + k256(new TextEncoder().encode('transfer(address,uint256)')).slice(2, 10));
|
|
61
|
+
// ============ ROLE CONSTANTS ============
|
|
62
|
+
/**
|
|
63
|
+
* Owner role hash
|
|
64
|
+
*/
|
|
65
|
+
static OWNER_ROLE = keccak256("OWNER_ROLE");
|
|
66
|
+
/**
|
|
67
|
+
* Broadcaster role hash
|
|
68
|
+
*/
|
|
69
|
+
static BROADCASTER_ROLE = keccak256("BROADCASTER_ROLE");
|
|
70
|
+
/**
|
|
71
|
+
* Recovery role hash
|
|
72
|
+
*/
|
|
73
|
+
static RECOVERY_ROLE = keccak256("RECOVERY_ROLE");
|
|
33
74
|
// ============ PURE FUNCTIONS ============
|
|
34
75
|
/**
|
|
35
|
-
* @dev Recovers the signer address from
|
|
36
|
-
* @param messageHash The
|
|
37
|
-
* @param signature The signature
|
|
76
|
+
* @dev Recovers the signer address from the EIP-712 digest and signature (standard EIP-712; no EIP-191 prefix).
|
|
77
|
+
* @param messageHash The EIP-712 digest (keccak256("\x19\x01" || domainSeparator || structHash))
|
|
78
|
+
* @param signature The signature (65 bytes)
|
|
38
79
|
* @returns Promise that resolves to the address of the signer
|
|
39
|
-
* @
|
|
40
|
-
*
|
|
41
|
-
* @notice This matches the contract's recoverSigner function which uses
|
|
42
|
-
* messageHash.toEthSignedMessageHash() to convert to EIP-191 format
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const messageHash = "0x1234...";
|
|
47
|
-
* const signature = "0xabcd...";
|
|
48
|
-
* const signer = await EngineBlox.recoverSigner(messageHash, signature);
|
|
49
|
-
* ```
|
|
80
|
+
* @notice Matches the contract's recoverSigner which uses ecrecover(messageHash, v, r, s) on the raw digest.
|
|
50
81
|
*/
|
|
51
82
|
static async recoverSigner(messageHash, signature) {
|
|
52
|
-
// Validate signature length (65 bytes = 130 hex chars + '0x' prefix)
|
|
53
83
|
if (signature.length !== 132) {
|
|
54
|
-
throw new Error(`Invalid signature length: expected 65 bytes (132 hex chars), got ${signature.length - 2} bytes`);
|
|
84
|
+
throw new Error(`Invalid signature length: expected 65 bytes (132 hex chars), got ${(signature.length - 2) / 2} bytes`);
|
|
55
85
|
}
|
|
56
86
|
try {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const prefix = '\x19Ethereum Signed Message:\n32';
|
|
61
|
-
const messageHashBytes = Buffer.from(messageHash.slice(2), 'hex');
|
|
62
|
-
// Concatenate prefix and hash
|
|
63
|
-
const eip191Message = Buffer.concat([
|
|
64
|
-
Buffer.from(prefix, 'utf8'),
|
|
65
|
-
messageHashBytes
|
|
66
|
-
]);
|
|
67
|
-
// Convert Buffer to Uint8Array for viem
|
|
68
|
-
const eip191MessageBytes = new Uint8Array(eip191Message);
|
|
69
|
-
// Hash the EIP-191 formatted message
|
|
70
|
-
const eip191Hash = (await k256(eip191MessageBytes));
|
|
71
|
-
// Recover address from the EIP-191 formatted hash
|
|
72
|
-
// Note: recoverAddress is async in viem
|
|
73
|
-
const recovered = await recoverAddress({
|
|
74
|
-
hash: eip191Hash,
|
|
75
|
-
signature: signature
|
|
87
|
+
const signer = await recoverAddress({
|
|
88
|
+
hash: messageHash,
|
|
89
|
+
signature
|
|
76
90
|
});
|
|
77
|
-
return
|
|
91
|
+
return signer;
|
|
78
92
|
}
|
|
79
93
|
catch (error) {
|
|
80
94
|
throw new Error(`Failed to recover signer: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
81
95
|
}
|
|
82
96
|
}
|
|
83
97
|
// ============ VIEW FUNCTIONS (No storage access) ============
|
|
84
|
-
/**
|
|
85
|
-
* @dev Checks if a function selector exists in a contract's bytecode
|
|
86
|
-
* @param client PublicClient instance for reading contract bytecode
|
|
87
|
-
* @param contractAddress The address of the contract to check
|
|
88
|
-
* @param selector The 4-byte function selector to search for
|
|
89
|
-
* @returns Promise that resolves to true if the selector is found in the contract's function selector dispatch table
|
|
90
|
-
*
|
|
91
|
-
* @notice Searches the first 2KB where function selectors are stored in the dispatch table
|
|
92
|
-
* @notice This is a heuristic check - false positives are possible but unlikely
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```typescript
|
|
96
|
-
* const exists = await EngineBlox.selectorExistsInContract(
|
|
97
|
-
* publicClient,
|
|
98
|
-
* '0x1234...',
|
|
99
|
-
* '0xabcd1234'
|
|
100
|
-
* );
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
static async selectorExistsInContract(client, contractAddress, selector) {
|
|
104
|
-
try {
|
|
105
|
-
// Get the contract's bytecode
|
|
106
|
-
const code = await client.getCode({ address: contractAddress });
|
|
107
|
-
if (!code || code.length < 12) { // Need at least '0x' + PUSH4 (1 byte = 2 hex chars) + selector (4 bytes = 8 hex chars) = 12 chars
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
// Function selectors are in the dispatch table at the beginning
|
|
111
|
-
// Typical dispatch tables are < 2KB even for large contracts
|
|
112
|
-
// Searching only this area reduces gas cost and false positives from metadata/data
|
|
113
|
-
// 2KB = 2048 bytes = 4096 hex chars (plus '0x' prefix = 4098 total)
|
|
114
|
-
const maxSearchBytes = 2048;
|
|
115
|
-
const codeHexLength = code.length - 2; // Remove '0x' prefix
|
|
116
|
-
const maxSearchHexChars = maxSearchBytes * 2; // Each byte is 2 hex chars
|
|
117
|
-
const searchLength = codeHexLength < maxSearchHexChars ? codeHexLength : maxSearchHexChars;
|
|
118
|
-
// Convert hex strings for searching (normalize to lowercase)
|
|
119
|
-
const codeBytes = code.slice(2).toLowerCase(); // Remove '0x' prefix and normalize
|
|
120
|
-
const selectorBytes = selector.slice(2).toLowerCase(); // Remove '0x' and normalize
|
|
121
|
-
// Scan for PUSH4 opcode (0x63 = "63" in hex) with 1-byte sliding window
|
|
122
|
-
// PUSH4 opcode is followed by 4 bytes (8 hex chars) which is the function selector
|
|
123
|
-
// Function selectors in EVM bytecode are emitted as PUSH4 <selector> instructions
|
|
124
|
-
// These can start at any byte offset, not just 4-byte-aligned positions
|
|
125
|
-
for (let i = 0; i + 10 <= searchLength; i += 2) { // i += 2 because each byte is 2 hex chars
|
|
126
|
-
// Check if current byte is PUSH4 opcode (0x63 = "63" in hex)
|
|
127
|
-
if (codeBytes.slice(i, i + 2) === '63') {
|
|
128
|
-
// Check if the next 8 hex chars (4 bytes) match the selector
|
|
129
|
-
const candidate = codeBytes.slice(i + 2, i + 10);
|
|
130
|
-
if (candidate === selectorBytes) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
// If we can't read the bytecode, return false
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
98
|
// ============ BITMAP HELPER FUNCTIONS ============
|
|
143
99
|
/**
|
|
144
100
|
* @dev Checks if a TxAction is present in a bitmap
|
|
@@ -209,47 +165,16 @@ export class EngineBlox {
|
|
|
209
165
|
}
|
|
210
166
|
return actions;
|
|
211
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Hash of execution returndata (`bytes32(0)` when empty). Matches `EngineBlox.executionResultHash` on-chain.
|
|
170
|
+
*/
|
|
171
|
+
static executionResultHash(executionResult) {
|
|
172
|
+
if (!executionResult || executionResult === '0x') {
|
|
173
|
+
return `0x${'0'.repeat(64)}`;
|
|
174
|
+
}
|
|
175
|
+
return k256(executionResult);
|
|
176
|
+
}
|
|
212
177
|
}
|
|
213
|
-
// ============ VERSION INFORMATION ============
|
|
214
|
-
/**
|
|
215
|
-
* Protocol name hash (keccak256("Bloxchain"))
|
|
216
|
-
*/
|
|
217
|
-
EngineBlox.PROTOCOL_NAME_HASH = keccak256("Bloxchain");
|
|
218
|
-
/**
|
|
219
|
-
* Major version number
|
|
220
|
-
*/
|
|
221
|
-
EngineBlox.VERSION_MAJOR = 1;
|
|
222
|
-
/**
|
|
223
|
-
* Minor version number
|
|
224
|
-
*/
|
|
225
|
-
EngineBlox.VERSION_MINOR = 0;
|
|
226
|
-
/**
|
|
227
|
-
* Patch version number
|
|
228
|
-
*/
|
|
229
|
-
EngineBlox.VERSION_PATCH = 0;
|
|
230
|
-
// ============ FUNCTION SELECTORS ============
|
|
231
|
-
/**
|
|
232
|
-
* Native token transfer selector (reserved signature for simple ETH transfers)
|
|
233
|
-
* Computed as bytes4(keccak256("__bloxchain_native_transfer__()"))
|
|
234
|
-
*/
|
|
235
|
-
EngineBlox.NATIVE_TRANSFER_SELECTOR = ('0x' + k256(new TextEncoder().encode("__bloxchain_native_transfer__()")).slice(2, 10));
|
|
236
|
-
/**
|
|
237
|
-
* Native token transfer operation type hash
|
|
238
|
-
*/
|
|
239
|
-
EngineBlox.NATIVE_TRANSFER_OPERATION = keccak256("NATIVE_TRANSFER");
|
|
240
|
-
// ============ ROLE CONSTANTS ============
|
|
241
|
-
/**
|
|
242
|
-
* Owner role hash
|
|
243
|
-
*/
|
|
244
|
-
EngineBlox.OWNER_ROLE = keccak256("OWNER_ROLE");
|
|
245
|
-
/**
|
|
246
|
-
* Broadcaster role hash
|
|
247
|
-
*/
|
|
248
|
-
EngineBlox.BROADCASTER_ROLE = keccak256("BROADCASTER_ROLE");
|
|
249
|
-
/**
|
|
250
|
-
* Recovery role hash
|
|
251
|
-
*/
|
|
252
|
-
EngineBlox.RECOVERY_ROLE = keccak256("RECOVERY_ROLE");
|
|
253
178
|
/**
|
|
254
179
|
* Default export for convenience
|
|
255
180
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBlox.js","sourceRoot":"","sources":["../../lib/EngineBlox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,IAAI,EAAqC,cAAc,EAAc,MAAM,MAAM,CAAC;AAExG,OAAO,EAAgB,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EngineBlox.js","sourceRoot":"","sources":["../../lib/EngineBlox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,IAAI,EAAqC,cAAc,EAAc,MAAM,MAAM,CAAC;AAExG,OAAO,EAAgB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,GAAW,EAAO,EAAE;IACrC,OAAO,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAQ,CAAC;AACpD,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAU;IACrB,gDAAgD;IAEhD;;OAEG;IACH,MAAM,CAAU,kBAAkB,GAAQ,SAAS,CAAC,WAAW,CAAC,CAAC;IAEjE;;OAEG;IACH,MAAM,CAAU,OAAO,GAAW,OAAO,CAAC;IAE1C,+CAA+C;IAE/C;;;OAGG;IACH,MAAM,CAAU,wBAAwB,GAAQ,CAC9C,IAAI,GAAG,IAAI,CAAC,IAAI,WA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B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,eAAoB;QAC7C,IAAI,CAAC,eAAe,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;YACjD,OAAO,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAS,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAQ,CAAC;IACtC,CAAC;;AAGH;;GAEG;AACH,eAAe,UAAU,CAAC"}
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GuardControllerDefinitions
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Calls the deployed GuardControllerDefinitions contract for specs and encoding.
|
|
4
|
+
* Single source of truth: action names, formats, and encoding come from the contract.
|
|
5
|
+
* @see contracts/core/execution/lib/definitions/GuardControllerDefinitions.sol
|
|
6
|
+
* @see scripts/sanity/guard-controller/base-test.cjs createGuardConfigBatchMetaTx (actionsArray = [actionType, data] per element)
|
|
6
7
|
*/
|
|
7
|
-
import { type Address, type Hex } from 'viem';
|
|
8
|
-
import type { GuardConfigAction } from '../../types/core.execution.index';
|
|
9
|
-
import type { TxAction } from '../../types/lib.index';
|
|
8
|
+
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
9
|
+
import type { GuardConfigAction } from '../../types/core.execution.index.js';
|
|
10
|
+
import type { TxAction } from '../../types/lib.index.js';
|
|
10
11
|
/**
|
|
11
12
|
* Builds execution params for executeGuardConfigBatch((uint8,bytes)[]).
|
|
12
|
-
*
|
|
13
|
-
* Same
|
|
13
|
+
* Encoding matches GuardControllerDefinitions.sol guardConfigBatchExecutionParams (abi.encode(actions)).
|
|
14
|
+
* Same format as scripts/sanity (direct contract tests); single source of truth in this module.
|
|
14
15
|
*/
|
|
15
|
-
export declare function guardConfigBatchExecutionParams(actions: GuardConfigAction[]): Hex;
|
|
16
|
+
export declare function guardConfigBatchExecutionParams(_client: PublicClient, _definitionAddress: Address, actions: GuardConfigAction[]): Hex;
|
|
16
17
|
/**
|
|
17
|
-
* Returns all available GuardConfig action types and their ABI decode formats.
|
|
18
|
-
* Mirrors GuardControllerDefinitions.getGuardConfigActionSpecs in Solidity.
|
|
19
|
-
*
|
|
18
|
+
* Returns all available GuardConfig action types and their ABI decode formats from the contract.
|
|
20
19
|
* Index i in both arrays corresponds to GuardConfigActionType enum value i.
|
|
21
20
|
*/
|
|
22
|
-
export declare function getGuardConfigActionSpecs(): {
|
|
21
|
+
export declare function getGuardConfigActionSpecs(client: PublicClient, definitionAddress: Address): Promise<{
|
|
23
22
|
actionNames: string[];
|
|
24
23
|
formats: string[];
|
|
25
|
-
}
|
|
24
|
+
}>;
|
|
26
25
|
/**
|
|
27
|
-
* Encodes data for ADD_TARGET_TO_WHITELIST.
|
|
26
|
+
* Encodes data for ADD_TARGET_TO_WHITELIST. Matches GuardControllerDefinitions.sol encodeAddTargetToWhitelist (abi.encode(functionSelector, target)).
|
|
28
27
|
*/
|
|
29
|
-
export declare function encodeAddTargetToWhitelist(functionSelector: Hex, target: Address): Hex;
|
|
28
|
+
export declare function encodeAddTargetToWhitelist(_client: PublicClient, _definitionAddress: Address, functionSelector: Hex, target: Address): Hex;
|
|
30
29
|
/**
|
|
31
|
-
* Encodes data for REMOVE_TARGET_FROM_WHITELIST.
|
|
30
|
+
* Encodes data for REMOVE_TARGET_FROM_WHITELIST. Matches GuardControllerDefinitions.sol encodeRemoveTargetFromWhitelist (abi.encode(functionSelector, target)).
|
|
32
31
|
*/
|
|
33
|
-
export declare function encodeRemoveTargetFromWhitelist(functionSelector: Hex, target: Address): Hex;
|
|
32
|
+
export declare function encodeRemoveTargetFromWhitelist(_client: PublicClient, _definitionAddress: Address, functionSelector: Hex, target: Address): Hex;
|
|
34
33
|
/**
|
|
35
|
-
* Encodes data for REGISTER_FUNCTION.
|
|
34
|
+
* Encodes data for REGISTER_FUNCTION. Matches GuardControllerDefinitions.sol encodeRegisterFunction (abi.encode(functionSignature, operationName, supportedActions)).
|
|
36
35
|
* supportedActions: array of TxAction enum values (e.g. TxAction.EXECUTE_TIME_DELAY_REQUEST).
|
|
37
36
|
*/
|
|
38
|
-
export declare function encodeRegisterFunction(functionSignature: string, operationName: string, supportedActions: TxAction[]): Hex;
|
|
37
|
+
export declare function encodeRegisterFunction(_client: PublicClient, _definitionAddress: Address, functionSignature: string, operationName: string, supportedActions: TxAction[]): Hex;
|
|
39
38
|
/**
|
|
40
|
-
* Encodes data for UNREGISTER_FUNCTION.
|
|
39
|
+
* Encodes data for UNREGISTER_FUNCTION. Matches GuardControllerDefinitions.sol encodeUnregisterFunction (abi.encode(functionSelector, safeRemoval)).
|
|
41
40
|
*/
|
|
42
|
-
export declare function encodeUnregisterFunction(functionSelector: Hex, safeRemoval: boolean): Hex;
|
|
41
|
+
export declare function encodeUnregisterFunction(_client: PublicClient, _definitionAddress: Address, functionSelector: Hex, safeRemoval: boolean): Hex;
|
|
43
42
|
//# sourceMappingURL=GuardControllerDefinitions.d.ts.map
|