@account-kit/smart-contracts 4.13.0 → 4.13.1-alpha.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/dist/esm/src/ma-v2/modules/allowlist-module/module.d.ts +14 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js +14 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js.map +1 -1
- package/dist/esm/src/ma-v2/modules/time-range-module/module.d.ts +10 -1
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js +20 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js.map +1 -1
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts +14 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts.map +1 -1
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts +10 -1
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/ma-v2/modules/allowlist-module/module.ts +29 -0
- package/src/ma-v2/modules/time-range-module/module.ts +34 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const AllowlistModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -556,6 +557,19 @@ export declare const AllowlistModule: {
|
|
|
556
557
|
readonly name: "UnexpectedDataPassed";
|
|
557
558
|
readonly inputs: readonly [];
|
|
558
559
|
}];
|
|
560
|
+
buildHook: (installArgs: {
|
|
561
|
+
entityId: number;
|
|
562
|
+
inputs: Array<{
|
|
563
|
+
target: Address;
|
|
564
|
+
hasSelectorAllowlist: boolean;
|
|
565
|
+
hasERC20SpendLimit: boolean;
|
|
566
|
+
erc20SpendLimit: bigint;
|
|
567
|
+
selectors: Array<Hex>;
|
|
568
|
+
}>;
|
|
569
|
+
}, address: Address) => {
|
|
570
|
+
hookConfig: HookConfig;
|
|
571
|
+
initData: Hex;
|
|
572
|
+
};
|
|
559
573
|
encodeOnInstallData: (args: {
|
|
560
574
|
entityId: number;
|
|
561
575
|
inputs: Array<{
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { encodeAbiParameters } from "viem";
|
|
2
2
|
import { allowlistModuleAbi } from "./abis/allowlistModuleAbi.js";
|
|
3
|
+
import { HookType } from "../../actions/common/types.js";
|
|
3
4
|
export const AllowlistModule = {
|
|
4
5
|
abi: allowlistModuleAbi,
|
|
6
|
+
buildHook: (installArgs, address) => {
|
|
7
|
+
const installData = AllowlistModule.encodeOnInstallData(installArgs);
|
|
8
|
+
return {
|
|
9
|
+
hookConfig: {
|
|
10
|
+
address: address,
|
|
11
|
+
entityId: installArgs.entityId,
|
|
12
|
+
hookType: HookType.VALIDATION,
|
|
13
|
+
hasPreHooks: true,
|
|
14
|
+
hasPostHooks: false,
|
|
15
|
+
},
|
|
16
|
+
initData: installData,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
5
19
|
encodeOnInstallData: (args) => {
|
|
6
20
|
const { entityId, inputs } = args;
|
|
7
21
|
return encodeAbiParameters([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,MAAM,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,MAAM,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAmB,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,G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;gBACf,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnB,EAAE,IAAI,EAAE,MAAM,EAAE;oBAChB,EAAE,IAAI,EAAE,MAAM,EAAE;oBAChB,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnB,EAAE,IAAI,EAAE,UAAU,EAAE;iBACrB;aACF;SACF,EACD;YACE,QAAQ;YACR,MAAM,CAAC,GAAG,CACR,CAAC,KAAK,EAAE,EAAE,CACR;gBACE,KAAK,CAAC,MAAM;gBACZ,KAAK,CAAC,oBAAoB;gBAC1B,KAAK,CAAC,kBAAkB;gBACxB,KAAK,CAAC,eAAe;gBACrB,KAAK,CAAC,SAAS;aACP,CACb;SACF,CACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { encodeAbiParameters, type Address, type Hex } from \"viem\";\nimport { allowlistModuleAbi } from \"./abis/allowlistModuleAbi.js\";\nimport { HookType, type HookConfig } from \"../../actions/common/types.js\";\n\nexport const AllowlistModule = {\n abi: allowlistModuleAbi,\n buildHook: (\n installArgs: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n },\n address: Address\n ): {\n hookConfig: HookConfig;\n initData: Hex;\n } => {\n const installData = AllowlistModule.encodeOnInstallData(installArgs);\n return {\n hookConfig: {\n address: address,\n entityId: installArgs.entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: installData,\n };\n },\n encodeOnInstallData: (args: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n }): Hex => {\n const { entityId, inputs } = args;\n return encodeAbiParameters(\n [\n { type: \"uint32\" },\n {\n type: \"tuple[]\",\n components: [\n { type: \"address\" },\n { type: \"bool\" },\n { type: \"bool\" },\n { type: \"uint256\" },\n { type: \"bytes4[]\" },\n ],\n },\n ],\n [\n entityId,\n inputs.map(\n (input) =>\n [\n input.target,\n input.hasSelectorAllowlist,\n input.hasERC20SpendLimit,\n input.erc20SpendLimit,\n input.selectors,\n ] as const\n ),\n ]\n );\n },\n\n encodeOnUninstallData: (args: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n }): Hex => {\n const { entityId, inputs } = args;\n return encodeAbiParameters(\n [\n { type: \"uint32\" },\n {\n type: \"tuple[]\",\n components: [\n { type: \"address\" },\n { type: \"bool\" },\n { type: \"bool\" },\n { type: \"uint256\" },\n { type: \"bytes4[]\" },\n ],\n },\n ],\n [\n entityId,\n inputs.map(\n (input) =>\n [\n input.target,\n input.hasSelectorAllowlist,\n input.hasERC20SpendLimit,\n input.erc20SpendLimit,\n input.selectors,\n ] as const\n ),\n ]\n );\n },\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Hex } from "viem";
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const TimeRangeModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -229,6 +230,14 @@ export declare const TimeRangeModule: {
|
|
|
229
230
|
readonly name: "UnexpectedDataPassed";
|
|
230
231
|
readonly inputs: readonly [];
|
|
231
232
|
}];
|
|
233
|
+
buildHook: (installArgs: {
|
|
234
|
+
entityId: number;
|
|
235
|
+
validUntil: number;
|
|
236
|
+
validAfter: number;
|
|
237
|
+
}, address: Address) => {
|
|
238
|
+
hookConfig: HookConfig;
|
|
239
|
+
initData: Hex;
|
|
240
|
+
};
|
|
232
241
|
encodeOnInstallData: (args: {
|
|
233
242
|
entityId: number;
|
|
234
243
|
validUntil: number;
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { encodeAbiParameters } from "viem";
|
|
2
2
|
import { timeRangeModuleAbi } from "./abis/timeRangeModuleAbi.js";
|
|
3
|
+
import { HookType } from "../../actions/common/types.js";
|
|
3
4
|
export const TimeRangeModule = {
|
|
4
5
|
abi: timeRangeModuleAbi,
|
|
6
|
+
buildHook: (installArgs, address) => {
|
|
7
|
+
if (installArgs.validUntil > 2 ** 48 - 1) {
|
|
8
|
+
throw new Error("TimeRangeModule.buildHook: validUntil > type(uint48).max");
|
|
9
|
+
}
|
|
10
|
+
if (installArgs.validAfter > 2 ** 48 - 1) {
|
|
11
|
+
throw new Error("TimeRangeModule.buildHook: validAfter > type(uint48).max");
|
|
12
|
+
}
|
|
13
|
+
const installData = TimeRangeModule.encodeOnInstallData(installArgs);
|
|
14
|
+
return {
|
|
15
|
+
hookConfig: {
|
|
16
|
+
address: address,
|
|
17
|
+
entityId: installArgs.entityId,
|
|
18
|
+
hookType: HookType.VALIDATION,
|
|
19
|
+
hasPreHooks: false,
|
|
20
|
+
hasPostHooks: false,
|
|
21
|
+
},
|
|
22
|
+
initData: installData,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
5
25
|
encodeOnInstallData: (args) => {
|
|
6
26
|
const { entityId, validUntil, validAfter } = args;
|
|
7
27
|
return encodeAbiParameters([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,MAAM,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAmB,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,MAAM,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E,CAAC,IAIpB,EAAO,EAAE;QACR,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAElD,OAAO,mBAAmB,CACxB;YACE;gBACE,IAAI,EAAE,QAAQ;aACf;YACD;gBACE,IAAI,EAAE,QAAQ;aACf;YACD;gBACE,IAAI,EAAE,QAAQ;aACf;SACF,EACD,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CACnC,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { encodeAbiParameters, type Address, type Hex } from \"viem\";\n\nimport { timeRangeModuleAbi } from \"./abis/timeRangeModuleAbi.js\";\nimport { HookType, type HookConfig } from \"../../actions/common/types.js\";\n\nexport const TimeRangeModule = {\n abi: timeRangeModuleAbi,\n buildHook: (\n installArgs: {\n entityId: number;\n validUntil: number;\n validAfter: number;\n },\n address: Address\n ): { hookConfig: HookConfig; initData: Hex } => {\n if (installArgs.validUntil > 2 ** 48 - 1) {\n throw new Error(\n \"TimeRangeModule.buildHook: validUntil > type(uint48).max\"\n );\n }\n\n if (installArgs.validAfter > 2 ** 48 - 1) {\n throw new Error(\n \"TimeRangeModule.buildHook: validAfter > type(uint48).max\"\n );\n }\n\n const installData = TimeRangeModule.encodeOnInstallData(installArgs);\n return {\n hookConfig: {\n address: address,\n entityId: installArgs.entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: false,\n hasPostHooks: false,\n },\n initData: installData,\n };\n },\n encodeOnInstallData: (args: {\n entityId: number;\n validUntil: number;\n validAfter: number;\n }): Hex => {\n const { entityId, validUntil, validAfter } = args;\n\n return encodeAbiParameters(\n [\n {\n type: \"uint32\",\n },\n {\n type: \"uint48\",\n },\n {\n type: \"uint48\",\n },\n ],\n [entityId, validUntil, validAfter]\n );\n },\n encodeOnUninstallData: (args: { entityId: number }): Hex => {\n const { entityId } = args;\n\n return encodeAbiParameters(\n [\n {\n type: \"uint32\",\n },\n ],\n [entityId]\n );\n },\n encodeSetTimeRange: (args: {\n entityId: number;\n validUntil: number;\n validAfter: number;\n }): Hex => {\n const { entityId, validUntil, validAfter } = args;\n\n return encodeAbiParameters(\n [\n {\n type: \"uint32\",\n },\n {\n type: \"uint48\",\n },\n {\n type: \"uint48\",\n },\n ],\n [entityId, validUntil, validAfter]\n );\n },\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const AllowlistModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -556,6 +557,19 @@ export declare const AllowlistModule: {
|
|
|
556
557
|
readonly name: "UnexpectedDataPassed";
|
|
557
558
|
readonly inputs: readonly [];
|
|
558
559
|
}];
|
|
560
|
+
buildHook: (installArgs: {
|
|
561
|
+
entityId: number;
|
|
562
|
+
inputs: Array<{
|
|
563
|
+
target: Address;
|
|
564
|
+
hasSelectorAllowlist: boolean;
|
|
565
|
+
hasERC20SpendLimit: boolean;
|
|
566
|
+
erc20SpendLimit: bigint;
|
|
567
|
+
selectors: Array<Hex>;
|
|
568
|
+
}>;
|
|
569
|
+
}, address: Address) => {
|
|
570
|
+
hookConfig: HookConfig;
|
|
571
|
+
initData: Hex;
|
|
572
|
+
};
|
|
559
573
|
encodeOnInstallData: (args: {
|
|
560
574
|
entityId: number;
|
|
561
575
|
inputs: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,E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,CAAC;YAC9B,kBAAkB,EAAE,OAAO,CAAC;YAC5B,eAAe,EAAE,MAAM,CAAC;YACxB,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC;SACvB,CAAC,CAAC;KACJ,KAAG,GAAG;kCAgCuB;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM;YACZ,MAAM,EAAE,OAAO,CAAC;YAChB,oBAAoB,EAAE,OAAO,CAAC;YAC9B,kBAAkB,EAAE,OAAO,CAAC;YAC5B,eAAe,EAAE,MAAM,CAAC;YACxB,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC;SACvB,CAAC,CAAC;KACJ,KAAG,GAAG;CA+BR,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Hex } from "viem";
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const TimeRangeModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -229,6 +230,14 @@ export declare const TimeRangeModule: {
|
|
|
229
230
|
readonly name: "UnexpectedDataPassed";
|
|
230
231
|
readonly inputs: readonly [];
|
|
231
232
|
}];
|
|
233
|
+
buildHook: (installArgs: {
|
|
234
|
+
entityId: number;
|
|
235
|
+
validUntil: number;
|
|
236
|
+
validAfter: number;
|
|
237
|
+
}, address: Address) => {
|
|
238
|
+
hookConfig: HookConfig;
|
|
239
|
+
initData: Hex;
|
|
240
|
+
};
|
|
232
241
|
encodeOnInstallData: (args: {
|
|
233
242
|
entityId: number;
|
|
234
243
|
validUntil: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAGnE,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAGX;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,WACQ,OAAO,KACf;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAE;gCAyBhB;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,KAAG,GAAG;kCAkBuB;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAG,GAAG;+BAY7B;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,KAAG,GAAG;CAkBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/smart-contracts",
|
|
3
|
-
"version": "4.13.0",
|
|
3
|
+
"version": "4.13.1-alpha.0",
|
|
4
4
|
"description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test:run": "vitest run"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@account-kit/plugingen": "^4.13.0",
|
|
55
|
+
"@account-kit/plugingen": "^4.13.1-alpha.0",
|
|
56
56
|
"change-case": "^5.1.2",
|
|
57
57
|
"dedent": "^1.5.1",
|
|
58
58
|
"dotenv": "^16.3.1",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
73
73
|
},
|
|
74
74
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d026b488ed279f04424c57b745efb19b8d344056",
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@aa-sdk/core": "^4.13.0",
|
|
78
|
-
"@account-kit/infra": "^4.13.0"
|
|
77
|
+
"@aa-sdk/core": "^4.13.1-alpha.0",
|
|
78
|
+
"@account-kit/infra": "^4.13.1-alpha.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"viem": "^2.22.6"
|
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import { encodeAbiParameters, type Address, type Hex } from "viem";
|
|
2
2
|
import { allowlistModuleAbi } from "./abis/allowlistModuleAbi.js";
|
|
3
|
+
import { HookType, type HookConfig } from "../../actions/common/types.js";
|
|
3
4
|
|
|
4
5
|
export const AllowlistModule = {
|
|
5
6
|
abi: allowlistModuleAbi,
|
|
7
|
+
buildHook: (
|
|
8
|
+
installArgs: {
|
|
9
|
+
entityId: number;
|
|
10
|
+
inputs: Array<{
|
|
11
|
+
target: Address;
|
|
12
|
+
hasSelectorAllowlist: boolean;
|
|
13
|
+
hasERC20SpendLimit: boolean;
|
|
14
|
+
erc20SpendLimit: bigint;
|
|
15
|
+
selectors: Array<Hex>;
|
|
16
|
+
}>;
|
|
17
|
+
},
|
|
18
|
+
address: Address
|
|
19
|
+
): {
|
|
20
|
+
hookConfig: HookConfig;
|
|
21
|
+
initData: Hex;
|
|
22
|
+
} => {
|
|
23
|
+
const installData = AllowlistModule.encodeOnInstallData(installArgs);
|
|
24
|
+
return {
|
|
25
|
+
hookConfig: {
|
|
26
|
+
address: address,
|
|
27
|
+
entityId: installArgs.entityId,
|
|
28
|
+
hookType: HookType.VALIDATION,
|
|
29
|
+
hasPreHooks: true,
|
|
30
|
+
hasPostHooks: false,
|
|
31
|
+
},
|
|
32
|
+
initData: installData,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
6
35
|
encodeOnInstallData: (args: {
|
|
7
36
|
entityId: number;
|
|
8
37
|
inputs: Array<{
|
|
@@ -1,9 +1,42 @@
|
|
|
1
|
-
import { encodeAbiParameters, type Hex } from "viem";
|
|
1
|
+
import { encodeAbiParameters, type Address, type Hex } from "viem";
|
|
2
2
|
|
|
3
3
|
import { timeRangeModuleAbi } from "./abis/timeRangeModuleAbi.js";
|
|
4
|
+
import { HookType, type HookConfig } from "../../actions/common/types.js";
|
|
4
5
|
|
|
5
6
|
export const TimeRangeModule = {
|
|
6
7
|
abi: timeRangeModuleAbi,
|
|
8
|
+
buildHook: (
|
|
9
|
+
installArgs: {
|
|
10
|
+
entityId: number;
|
|
11
|
+
validUntil: number;
|
|
12
|
+
validAfter: number;
|
|
13
|
+
},
|
|
14
|
+
address: Address
|
|
15
|
+
): { hookConfig: HookConfig; initData: Hex } => {
|
|
16
|
+
if (installArgs.validUntil > 2 ** 48 - 1) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"TimeRangeModule.buildHook: validUntil > type(uint48).max"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (installArgs.validAfter > 2 ** 48 - 1) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"TimeRangeModule.buildHook: validAfter > type(uint48).max"
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const installData = TimeRangeModule.encodeOnInstallData(installArgs);
|
|
29
|
+
return {
|
|
30
|
+
hookConfig: {
|
|
31
|
+
address: address,
|
|
32
|
+
entityId: installArgs.entityId,
|
|
33
|
+
hookType: HookType.VALIDATION,
|
|
34
|
+
hasPreHooks: false,
|
|
35
|
+
hasPostHooks: false,
|
|
36
|
+
},
|
|
37
|
+
initData: installData,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
7
40
|
encodeOnInstallData: (args: {
|
|
8
41
|
entityId: number;
|
|
9
42
|
validUntil: number;
|