permissionless 0.1.19 → 0.1.21
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 +12 -0
- package/_cjs/accounts/kernel/abi/KernelV3AccountAbi.js +91 -0
- package/_cjs/accounts/kernel/abi/KernelV3AccountAbi.js.map +1 -0
- package/_cjs/accounts/kernel/abi/KernelV3MetaFactoryAbi.js +21 -0
- package/_cjs/accounts/kernel/abi/KernelV3MetaFactoryAbi.js.map +1 -0
- package/_cjs/accounts/kernel/constants.js +27 -0
- package/_cjs/accounts/kernel/constants.js.map +1 -0
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +138 -45
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/encodeCallData.js +89 -0
- package/_cjs/accounts/kernel/utils/encodeCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/getExecMode.js +15 -0
- package/_cjs/accounts/kernel/utils/getExecMode.js.map +1 -0
- package/_cjs/accounts/kernel/utils/getNonceKey.js +24 -0
- package/_cjs/accounts/kernel/utils/getNonceKey.js.map +1 -0
- package/_cjs/accounts/kernel/utils/signMessage.js +28 -0
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -0
- package/_cjs/accounts/kernel/utils/signTypedData.js +40 -0
- package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js +20 -0
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js.map +1 -0
- package/_esm/accounts/kernel/abi/KernelV3AccountAbi.js +88 -0
- package/_esm/accounts/kernel/abi/KernelV3AccountAbi.js.map +1 -0
- package/_esm/accounts/kernel/abi/KernelV3MetaFactoryAbi.js +18 -0
- package/_esm/accounts/kernel/abi/KernelV3MetaFactoryAbi.js.map +1 -0
- package/_esm/accounts/kernel/constants.js +24 -0
- package/_esm/accounts/kernel/constants.js.map +1 -0
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +165 -52
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/encodeCallData.js +89 -0
- package/_esm/accounts/kernel/utils/encodeCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/getExecMode.js +12 -0
- package/_esm/accounts/kernel/utils/getExecMode.js.map +1 -0
- package/_esm/accounts/kernel/utils/getNonceKey.js +21 -0
- package/_esm/accounts/kernel/utils/getNonceKey.js.map +1 -0
- package/_esm/accounts/kernel/utils/signMessage.js +24 -0
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -0
- package/_esm/accounts/kernel/utils/signTypedData.js +38 -0
- package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -0
- package/_esm/accounts/kernel/utils/wrapMessageHash.js +16 -0
- package/_esm/accounts/kernel/utils/wrapMessageHash.js.map +1 -0
- package/_types/accounts/kernel/abi/KernelV3AccountAbi.d.ts +108 -0
- package/_types/accounts/kernel/abi/KernelV3AccountAbi.d.ts.map +1 -0
- package/_types/accounts/kernel/abi/KernelV3MetaFactoryAbi.d.ts +24 -0
- package/_types/accounts/kernel/abi/KernelV3MetaFactoryAbi.d.ts.map +1 -0
- package/_types/accounts/kernel/constants.d.ts +21 -0
- package/_types/accounts/kernel/constants.d.ts.map +1 -0
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +18 -5
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/encodeCallData.d.ts +12 -0
- package/_types/accounts/kernel/utils/encodeCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/getExecMode.d.ts +7 -0
- package/_types/accounts/kernel/utils/getExecMode.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/getNonceKey.d.ts +4 -0
- package/_types/accounts/kernel/utils/getNonceKey.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/signMessage.d.ts +4 -0
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/signTypedData.d.ts +4 -0
- package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +9 -0
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -0
- package/accounts/kernel/abi/KernelV3AccountAbi.ts +88 -0
- package/accounts/kernel/abi/KernelV3MetaFactoryAbi.ts +17 -0
- package/accounts/kernel/constants.ts +21 -0
- package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +252 -71
- package/accounts/kernel/utils/encodeCallData.ts +114 -0
- package/accounts/kernel/utils/getExecMode.ts +18 -0
- package/accounts/kernel/utils/getNonceKey.ts +32 -0
- package/accounts/kernel/utils/signMessage.ts +48 -0
- package/accounts/kernel/utils/signTypedData.ts +74 -0
- package/accounts/kernel/utils/wrapMessageHash.ts +38 -0
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { concatHex, encodeAbiParameters, encodeFunctionData, toHex } from "viem";
|
|
2
|
+
import { KernelExecuteAbi } from "../abi/KernelAccountAbi.js";
|
|
3
|
+
import { KernelV3ExecuteAbi } from "../abi/KernelV3AccountAbi.js";
|
|
4
|
+
import { CALL_TYPE, EXEC_TYPE } from "../constants.js";
|
|
5
|
+
import {} from "../signerToEcdsaKernelSmartAccount.js";
|
|
6
|
+
import { getExecMode } from "./getExecMode.js";
|
|
7
|
+
export const encodeCallData = (_tx, accountVersion) => {
|
|
8
|
+
if (accountVersion === "0.2.2") {
|
|
9
|
+
if (Array.isArray(_tx)) {
|
|
10
|
+
// Encode a batched call
|
|
11
|
+
return encodeFunctionData({
|
|
12
|
+
abi: KernelExecuteAbi,
|
|
13
|
+
functionName: "executeBatch",
|
|
14
|
+
args: [
|
|
15
|
+
_tx.map((tx) => ({
|
|
16
|
+
to: tx.to,
|
|
17
|
+
value: tx.value,
|
|
18
|
+
data: tx.data
|
|
19
|
+
}))
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
// Encode a simple call
|
|
24
|
+
return encodeFunctionData({
|
|
25
|
+
abi: KernelExecuteAbi,
|
|
26
|
+
functionName: "execute",
|
|
27
|
+
args: [_tx.to, _tx.value, _tx.data, 0]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(_tx)) {
|
|
31
|
+
// Encode a batched call
|
|
32
|
+
const calldata = encodeAbiParameters([
|
|
33
|
+
{
|
|
34
|
+
name: "executionBatch",
|
|
35
|
+
type: "tuple[]",
|
|
36
|
+
components: [
|
|
37
|
+
{
|
|
38
|
+
name: "target",
|
|
39
|
+
type: "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "value",
|
|
43
|
+
type: "uint256"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "callData",
|
|
47
|
+
type: "bytes"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
], [
|
|
52
|
+
_tx.map((arg) => {
|
|
53
|
+
return {
|
|
54
|
+
target: arg.to,
|
|
55
|
+
value: arg.value,
|
|
56
|
+
callData: arg.data
|
|
57
|
+
};
|
|
58
|
+
})
|
|
59
|
+
]);
|
|
60
|
+
return encodeFunctionData({
|
|
61
|
+
abi: KernelV3ExecuteAbi,
|
|
62
|
+
functionName: "execute",
|
|
63
|
+
args: [
|
|
64
|
+
getExecMode({
|
|
65
|
+
callType: CALL_TYPE.BATCH,
|
|
66
|
+
execType: EXEC_TYPE.DEFAULT
|
|
67
|
+
}),
|
|
68
|
+
calldata
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const calldata = concatHex([
|
|
73
|
+
_tx.to,
|
|
74
|
+
toHex(_tx.value, { size: 32 }),
|
|
75
|
+
_tx.data
|
|
76
|
+
]);
|
|
77
|
+
return encodeFunctionData({
|
|
78
|
+
abi: KernelV3ExecuteAbi,
|
|
79
|
+
functionName: "execute",
|
|
80
|
+
args: [
|
|
81
|
+
getExecMode({
|
|
82
|
+
callType: CALL_TYPE.SINGLE,
|
|
83
|
+
execType: EXEC_TYPE.DEFAULT
|
|
84
|
+
}),
|
|
85
|
+
calldata
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=encodeCallData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeCallData.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/encodeCallData.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,EACR,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAsB,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,GAUS,EACT,cAA6B,EAC/B,EAAE;IACA,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,wBAAwB;YACxB,OAAO,kBAAkB,CAAC;gBACtB,GAAG,EAAE,gBAAgB;gBACrB,YAAY,EAAE,cAAc;gBAC5B,IAAI,EAAE;oBACF,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wBACb,EAAE,EAAE,EAAE,CAAC,EAAE;wBACT,KAAK,EAAE,EAAE,CAAC,KAAK;wBACf,IAAI,EAAE,EAAE,CAAC,IAAI;qBAChB,CAAC,CAAC;iBACN;aACJ,CAAC,CAAA;QACN,CAAC;QACD,uB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9B,GAAG,CAAC,IAAI;KACX,CAAC,CAAA;IAEF,OAAO,kBAAkB,CAAC;QACtB,GAAG,EAAE,kBAAkB;QACvB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE;YACF,WAAW,CAAC;gBACR,QAAQ,EAAE,SAAS,CAAC,MAAM;gBAC1B,QAAQ,EAAE,SAAS,CAAC,OAAO;aAC9B,CAAC;YACF,QAAQ;SACX;KACJ,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { concatHex, pad } from "viem";
|
|
2
|
+
import { CALL_TYPE, EXEC_TYPE } from "../constants.js";
|
|
3
|
+
export const getExecMode = ({ callType, execType }) => {
|
|
4
|
+
return concatHex([
|
|
5
|
+
callType, // 1 byte
|
|
6
|
+
execType, // 1 byte
|
|
7
|
+
"0x00000000", // 4 bytes
|
|
8
|
+
"0x00000000", // 4 bytes
|
|
9
|
+
pad("0x00000000", { size: 22 })
|
|
10
|
+
]);
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=getExecMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExecMode.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/getExecMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EACxB,QAAQ,EACR,QAAQ,EAIX,EAAO,EAAE;IACN,OAAO,SAAS,CAAC;QACb,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;QACnB,YAAY,EAAE,UAAU;QACxB,YAAY,EAAE,UAAU;QACxB,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAClC,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { concatHex, maxUint16, pad, toHex } from "viem";
|
|
2
|
+
import { VALIDATOR_MODE, VALIDATOR_TYPE } from "../constants.js";
|
|
3
|
+
import {} from "../signerToEcdsaKernelSmartAccount.js";
|
|
4
|
+
export const getNonceKeyWithEncoding = (accountVerion, validatorAddress, nonceKey = 0n) => {
|
|
5
|
+
if (accountVerion === "0.2.2") {
|
|
6
|
+
return nonceKey;
|
|
7
|
+
}
|
|
8
|
+
if (nonceKey > maxUint16)
|
|
9
|
+
throw new Error(`nonce key must be equal or less than 2 bytes(maxUint16) for Kernel version ${accountVerion}`);
|
|
10
|
+
const validatorMode = VALIDATOR_MODE.DEFAULT;
|
|
11
|
+
const validatorType = VALIDATOR_TYPE.ROOT;
|
|
12
|
+
const encoding = pad(concatHex([
|
|
13
|
+
validatorMode, // 1 byte
|
|
14
|
+
validatorType, // 1 byte
|
|
15
|
+
validatorAddress, // 20 bytes
|
|
16
|
+
toHex(nonceKey, { size: 2 }) // 2 byte
|
|
17
|
+
]), { size: 24 }); // 24 bytes
|
|
18
|
+
const encodedNonceKey = BigInt(encoding);
|
|
19
|
+
return encodedNonceKey;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=getNonceKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNonceKey.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/getNonceKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAsB,MAAM,oCAAoC,CAAA;AAEvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,aAA4B,EAC5B,gBAAyB,EACzB,QAAQ,GAAG,EAAE,EACf,EAAE;IACA,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,IAAI,QAAQ,GAAG,SAAS;QACpB,MAAM,IAAI,KAAK,CACX,8EAA8E,aAAa,EAAE,CAChG,CAAA;IAEL,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAA;IAC5C,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAA;IACzC,MAAM,QAAQ,GAAG,GAAG,CAChB,SAAS,CAAC;QACN,aAAa,EAAE,SAAS;QACxB,aAAa,EAAE,SAAS;QACxB,gBAAgB,EAAE,WAAW;QAC7B,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS;KACzC,CAAC,EACF,EAAE,IAAI,EAAE,EAAE,EAAE,CACf,CAAA,CAAC,WAAW;IACb,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,eAAe,CAAA;AAC1B,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { hashMessage, publicActions } from "viem";
|
|
2
|
+
import { signMessage as _signMessage } from "viem/actions";
|
|
3
|
+
import { wrapMessageHash } from "./wrapMessageHash.js";
|
|
4
|
+
export async function signMessage(client, { account: account_ = client.account, message, accountAddress, accountVersion }) {
|
|
5
|
+
if (accountVersion === "0.2.2") {
|
|
6
|
+
return _signMessage(client, {
|
|
7
|
+
account: account_,
|
|
8
|
+
message
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
const wrappedMessageHash = wrapMessageHash(hashMessage(message), {
|
|
12
|
+
accountVersion,
|
|
13
|
+
accountAddress,
|
|
14
|
+
chainId: client.chain
|
|
15
|
+
? client.chain.id
|
|
16
|
+
: await client.extend(publicActions).getChainId()
|
|
17
|
+
});
|
|
18
|
+
const signature = await _signMessage(client, {
|
|
19
|
+
account: account_,
|
|
20
|
+
message: { raw: wrappedMessageHash }
|
|
21
|
+
});
|
|
22
|
+
return signature;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=signMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,WAAW,EACX,aAAa,EAChB,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAA8B,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAE/E,MAAM,CAAC,KAAK,UAAU,WAAW,CAI7B,MAA2C,EAC3C,EACI,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,OAAO,EACP,cAAc,EACd,cAAc,EACwC;IAE1D,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC,MAAM,EAAE;YACxB,OAAO,EAAE,QAAwB;YACjC,OAAO;SACV,CAAC,CAAA;IACN,CAAC;IAED,MAAM,kBAAkB,GAAG,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QAC7D,cAAc;QACd,cAAc;QACd,OAAO,EAAE,MAAM,CAAC,KAAK;YACjB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACjB,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,UAAU,EAAE;KACxD,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE;QACzC,OAAO,EAAE,QAAwB;QACjC,OAAO,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE;KACvC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getTypesForEIP712Domain, hashTypedData, publicActions, validateTypedData } from "viem";
|
|
2
|
+
import { signMessage as _signMessage, signTypedData as _signTypedData } from "viem/actions";
|
|
3
|
+
import { wrapMessageHash } from "./wrapMessageHash.js";
|
|
4
|
+
export async function signTypedData(client, parameters) {
|
|
5
|
+
const { account: account_, accountAddress, accountVersion, ...typedData } = parameters;
|
|
6
|
+
if (accountVersion === "0.2.2") {
|
|
7
|
+
return _signTypedData(client, { account: account_, ...typedData });
|
|
8
|
+
}
|
|
9
|
+
const { message, primaryType, types: _types, domain } = typedData;
|
|
10
|
+
const types = {
|
|
11
|
+
EIP712Domain: getTypesForEIP712Domain({
|
|
12
|
+
domain: domain
|
|
13
|
+
}),
|
|
14
|
+
..._types
|
|
15
|
+
};
|
|
16
|
+
// Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc
|
|
17
|
+
// as we can't statically check this with TypeScript.
|
|
18
|
+
validateTypedData({
|
|
19
|
+
domain,
|
|
20
|
+
message,
|
|
21
|
+
primaryType,
|
|
22
|
+
types
|
|
23
|
+
});
|
|
24
|
+
const typedHash = hashTypedData({ message, primaryType, types, domain });
|
|
25
|
+
const wrappedMessageHash = wrapMessageHash(typedHash, {
|
|
26
|
+
accountVersion,
|
|
27
|
+
accountAddress,
|
|
28
|
+
chainId: client.chain
|
|
29
|
+
? client.chain.id
|
|
30
|
+
: await client.extend(publicActions).getChainId()
|
|
31
|
+
});
|
|
32
|
+
const signature = await _signMessage(client, {
|
|
33
|
+
account: account_,
|
|
34
|
+
message: { raw: wrappedMessageHash }
|
|
35
|
+
});
|
|
36
|
+
return signature;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=signTypedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACpB,MAAM,MAAM,CAAA;AAEb,OAAO,EACH,WAAW,IAAI,YAAY,EAC3B,aAAa,IAAI,cAAc,EAClC,MAAM,cAAc,CAAA;AACrB,OAAO,EAA8B,eAAe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@@
|
|
|
1
|
+
import { concatHex, encodeAbiParameters, keccak256, stringToHex } from "viem";
|
|
2
|
+
import { domainSeparator } from "viem";
|
|
3
|
+
export const wrapMessageHash = (messageHash, { accountAddress, accountVersion, chainId }) => {
|
|
4
|
+
const _domainSeparator = domainSeparator({
|
|
5
|
+
domain: {
|
|
6
|
+
name: "Kernel",
|
|
7
|
+
version: accountVersion,
|
|
8
|
+
chainId,
|
|
9
|
+
verifyingContract: accountAddress
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const wrappedMessageHash = keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }], [keccak256(stringToHex("Kernel(bytes32 hash)")), messageHash]));
|
|
13
|
+
const digest = keccak256(concatHex(["0x1901", _domainSeparator, wrappedMessageHash]));
|
|
14
|
+
return digest;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=wrapMessageHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapMessageHash.js","sourceRoot":"","sources":["../../../../accounts/kernel/utils/wrapMessageHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,WAAW,EACd,MAAM,MAAM,CAAA;AACb,OAAO,EAAgB,eAAe,EAAE,MAAM,MAAM,CAAA;AAQpD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,WAAgB,EAChB,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAyB,EACpE,EAAE;IACA,MAAM,gBAAgB,GAAG,eAAe,CAAC;QACrC,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,cAAc;YACvB,OAAO;YACP,iBAAiB,EAAE,cAAc;SACpC;KACJ,CAAC,CAAA;IACF,MAAM,kBAAkB,GAAG,SAAS,CAChC,mBAAmB,CACf,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC1C,CAAC,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,WAAW,CAAC,CAChE,CACJ,CAAA;IACD,MAAM,MAAM,GAAG,SAAS,CACpB,SAAS,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAC9D,CAAA;IACD,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export declare const KernelV3InitAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "initialize";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "_rootValidator";
|
|
6
|
+
readonly type: "bytes21";
|
|
7
|
+
readonly internalType: "ValidationId";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "hook";
|
|
10
|
+
readonly type: "address";
|
|
11
|
+
readonly internalType: "contract IHook";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "validatorData";
|
|
14
|
+
readonly type: "bytes";
|
|
15
|
+
readonly internalType: "bytes";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "hookData";
|
|
18
|
+
readonly type: "bytes";
|
|
19
|
+
readonly internalType: "bytes";
|
|
20
|
+
}];
|
|
21
|
+
readonly outputs: readonly [];
|
|
22
|
+
readonly stateMutability: "nonpayable";
|
|
23
|
+
}];
|
|
24
|
+
export declare const KernelV3ExecuteAbi: readonly [{
|
|
25
|
+
readonly type: "function";
|
|
26
|
+
readonly name: "execute";
|
|
27
|
+
readonly inputs: readonly [{
|
|
28
|
+
readonly name: "execMode";
|
|
29
|
+
readonly type: "bytes32";
|
|
30
|
+
readonly internalType: "ExecMode";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "executionCalldata";
|
|
33
|
+
readonly type: "bytes";
|
|
34
|
+
readonly internalType: "bytes";
|
|
35
|
+
}];
|
|
36
|
+
readonly outputs: readonly [];
|
|
37
|
+
readonly stateMutability: "payable";
|
|
38
|
+
}, {
|
|
39
|
+
readonly type: "function";
|
|
40
|
+
readonly name: "executeFromExecutor";
|
|
41
|
+
readonly inputs: readonly [{
|
|
42
|
+
readonly name: "execMode";
|
|
43
|
+
readonly type: "bytes32";
|
|
44
|
+
readonly internalType: "ExecMode";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "executionCalldata";
|
|
47
|
+
readonly type: "bytes";
|
|
48
|
+
readonly internalType: "bytes";
|
|
49
|
+
}];
|
|
50
|
+
readonly outputs: readonly [{
|
|
51
|
+
readonly name: "returnData";
|
|
52
|
+
readonly type: "bytes[]";
|
|
53
|
+
readonly internalType: "bytes[]";
|
|
54
|
+
}];
|
|
55
|
+
readonly stateMutability: "payable";
|
|
56
|
+
}, {
|
|
57
|
+
readonly type: "function";
|
|
58
|
+
readonly name: "executeUserOp";
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly name: "userOp";
|
|
61
|
+
readonly type: "tuple";
|
|
62
|
+
readonly internalType: "struct PackedUserOperation";
|
|
63
|
+
readonly components: readonly [{
|
|
64
|
+
readonly name: "sender";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
readonly internalType: "address";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "nonce";
|
|
69
|
+
readonly type: "uint256";
|
|
70
|
+
readonly internalType: "uint256";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "initCode";
|
|
73
|
+
readonly type: "bytes";
|
|
74
|
+
readonly internalType: "bytes";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "callData";
|
|
77
|
+
readonly type: "bytes";
|
|
78
|
+
readonly internalType: "bytes";
|
|
79
|
+
}, {
|
|
80
|
+
readonly name: "accountGasLimits";
|
|
81
|
+
readonly type: "bytes32";
|
|
82
|
+
readonly internalType: "bytes32";
|
|
83
|
+
}, {
|
|
84
|
+
readonly name: "preVerificationGas";
|
|
85
|
+
readonly type: "uint256";
|
|
86
|
+
readonly internalType: "uint256";
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "gasFees";
|
|
89
|
+
readonly type: "bytes32";
|
|
90
|
+
readonly internalType: "bytes32";
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "paymasterAndData";
|
|
93
|
+
readonly type: "bytes";
|
|
94
|
+
readonly internalType: "bytes";
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "signature";
|
|
97
|
+
readonly type: "bytes";
|
|
98
|
+
readonly internalType: "bytes";
|
|
99
|
+
}];
|
|
100
|
+
}, {
|
|
101
|
+
readonly name: "userOpHash";
|
|
102
|
+
readonly type: "bytes32";
|
|
103
|
+
readonly internalType: "bytes32";
|
|
104
|
+
}];
|
|
105
|
+
readonly outputs: readonly [];
|
|
106
|
+
readonly stateMutability: "payable";
|
|
107
|
+
}];
|
|
108
|
+
//# sourceMappingURL=KernelV3AccountAbi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KernelV3AccountAbi.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/abi/KernelV3AccountAbi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;EAiBlB,CAAA;AAEV,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoErB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const KernelV3MetaFactoryDeployWithFactoryAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "deployWithFactory";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "factory";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
readonly internalType: "contract KernelFactory";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "createData";
|
|
10
|
+
readonly type: "bytes";
|
|
11
|
+
readonly internalType: "bytes";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "salt";
|
|
14
|
+
readonly type: "bytes32";
|
|
15
|
+
readonly internalType: "bytes32";
|
|
16
|
+
}];
|
|
17
|
+
readonly outputs: readonly [{
|
|
18
|
+
readonly name: "";
|
|
19
|
+
readonly type: "address";
|
|
20
|
+
readonly internalType: "address";
|
|
21
|
+
}];
|
|
22
|
+
readonly stateMutability: "payable";
|
|
23
|
+
}];
|
|
24
|
+
//# sourceMappingURL=KernelV3MetaFactoryAbi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KernelV3MetaFactoryAbi.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/abi/KernelV3MetaFactoryAbi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;EAgB1C,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const DUMMY_ECDSA_SIGNATURE = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
2
|
+
export declare const ROOT_MODE_KERNEL_V2 = "0x00000000";
|
|
3
|
+
export declare enum CALL_TYPE {
|
|
4
|
+
SINGLE = "0x00",
|
|
5
|
+
BATCH = "0x01",
|
|
6
|
+
DELEGATE_CALL = "0xFF"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EXEC_TYPE {
|
|
9
|
+
DEFAULT = "0x00",
|
|
10
|
+
TRY_EXEC = "0x01"
|
|
11
|
+
}
|
|
12
|
+
export declare const VALIDATOR_TYPE: {
|
|
13
|
+
readonly ROOT: "0x00";
|
|
14
|
+
readonly VALIDATOR: "0x01";
|
|
15
|
+
readonly PERMISSION: "0x02";
|
|
16
|
+
};
|
|
17
|
+
export declare enum VALIDATOR_MODE {
|
|
18
|
+
DEFAULT = "0x00",
|
|
19
|
+
ENABLE = "0x01"
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../accounts/kernel/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,yIACwG,CAAA;AAC1I,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,oBAAY,SAAS;IACjB,MAAM,SAAS;IACf,KAAK,SAAS;IACd,aAAa,SAAS;CACzB;AACD,oBAAY,SAAS;IACjB,OAAO,SAAS;IAChB,QAAQ,SAAS;CACpB;AACD,eAAO,MAAM,cAAc;;;;CAIjB,CAAA;AACV,oBAAY,cAAc;IACtB,OAAO,SAAS;IAChB,MAAM,SAAS;CAClB"}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { type Address, type Chain, type Client, type Transport } from "viem";
|
|
2
|
-
import type { Prettify } from "../../types";
|
|
3
|
-
import type { ENTRYPOINT_ADDRESS_V06_TYPE } from "../../types/entrypoint";
|
|
2
|
+
import type { EntryPoint, Prettify } from "../../types";
|
|
4
3
|
import type { SmartAccount } from "../types";
|
|
5
4
|
import { type SmartAccountSigner } from "../types";
|
|
6
|
-
export type KernelEcdsaSmartAccount<entryPoint extends
|
|
7
|
-
export type
|
|
5
|
+
export type KernelEcdsaSmartAccount<entryPoint extends EntryPoint, transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined> = SmartAccount<entryPoint, "kernelEcdsaSmartAccount", transport, chain>;
|
|
6
|
+
export type KernelVersion = "0.2.2" | "0.3.0-beta";
|
|
7
|
+
/**
|
|
8
|
+
* Default addresses map for different kernel smart account versions
|
|
9
|
+
*/
|
|
10
|
+
export declare const KERNEL_VERSION_TO_ADDRESSES_MAP: {
|
|
11
|
+
[key in KernelVersion]: {
|
|
12
|
+
ECDSA_VALIDATOR: Address;
|
|
13
|
+
ACCOUNT_LOGIC: Address;
|
|
14
|
+
FACTORY_ADDRESS: Address;
|
|
15
|
+
META_FACTORY_ADDRESS?: Address;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const getEcdsaRootIdentifierForKernelV3: (validatorAddress: Address) => `0x${string}`;
|
|
19
|
+
export type SignerToEcdsaKernelSmartAccountParameters<entryPoint extends EntryPoint, TSource extends string = string, TAddress extends Address = Address> = Prettify<{
|
|
8
20
|
signer: SmartAccountSigner<TSource, TAddress>;
|
|
9
21
|
entryPoint: entryPoint;
|
|
10
22
|
address?: Address;
|
|
11
23
|
index?: bigint;
|
|
12
24
|
factoryAddress?: Address;
|
|
25
|
+
metaFactoryAddress?: Address;
|
|
13
26
|
accountLogicAddress?: Address;
|
|
14
27
|
ecdsaValidatorAddress?: Address;
|
|
15
28
|
deployedAccountAddress?: Address;
|
|
@@ -25,5 +38,5 @@ export type SignerToEcdsaKernelSmartAccountParameters<entryPoint extends ENTRYPO
|
|
|
25
38
|
* @param ecdsaValidatorAddress
|
|
26
39
|
* @param deployedAccountAddress
|
|
27
40
|
*/
|
|
28
|
-
export declare function signerToEcdsaKernelSmartAccount<entryPoint extends
|
|
41
|
+
export declare function signerToEcdsaKernelSmartAccount<entryPoint extends EntryPoint, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSource extends string = string, TAddress extends Address = Address>(client: Client<TTransport, TChain, undefined>, { signer, address, entryPoint: entryPointAddress, index, factoryAddress: _factoryAddress, metaFactoryAddress: _metaFactoryAddress, accountLogicAddress: _accountLogicAddress, ecdsaValidatorAddress: _ecdsaValidatorAddress, deployedAccountAddress }: SignerToEcdsaKernelSmartAccountParameters<entryPoint, TSource, TAddress>): Promise<KernelEcdsaSmartAccount<entryPoint, TTransport, TChain>>;
|
|
29
42
|
//# sourceMappingURL=signerToEcdsaKernelSmartAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signerToEcdsaKernelSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/kernel/signerToEcdsaKernelSmartAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,OAAO,EAC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UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACnC,CAAC,CAAA;AACF;;;;;;;;;;GAUG;AACH,wBAAsB,+BAA+B,CACjD,UAAU,SAAS,UAAU,EAC7B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,QAAQ,SAAS,OAAO,GAAG,OAAO,EAElC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAC7C,EACI,MAAM,EACN,OAAO,EACP,UAAU,EAAE,iBAAiB,EAC7B,KAAiB,EACjB,cAAc,EAAE,eAAe,EAC/B,kBAAkB,EAAE,mBAAmB,EACvC,mBAAmB,EAAE,oBAAoB,EACzC,qBAAqB,EAAE,sBAAsB,EAC7C,sBAAsB,EACzB,EAAE,yCAAyC,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,GAC5E,OAAO,CAAC,uBAAuB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CA+MlE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type KernelVersion } from "../signerToEcdsaKernelSmartAccount";
|
|
3
|
+
export declare const encodeCallData: (_tx: {
|
|
4
|
+
to: Address;
|
|
5
|
+
value: bigint;
|
|
6
|
+
data: Hex;
|
|
7
|
+
} | {
|
|
8
|
+
to: Address;
|
|
9
|
+
value: bigint;
|
|
10
|
+
data: Hex;
|
|
11
|
+
}[], accountVersion: KernelVersion) => `0x${string}`;
|
|
12
|
+
//# sourceMappingURL=encodeCallData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeCallData.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/encodeCallData.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EAKX,MAAM,MAAM,CAAA;AAIb,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAGvE,eAAO,MAAM,cAAc,QAEjB;IACI,EAAE,EAAE,OAAO,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,CAAA;CACZ,GACD;IACI,EAAE,EAAE,OAAO,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,CAAA;CACZ,EAAE,kBACO,aAAa,kBAuFhC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExecMode.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/getExecMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAkB,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,eAAO,MAAM,WAAW;cAIV,SAAS;cACT,SAAS;MACnB,GAQH,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { type KernelVersion } from "../signerToEcdsaKernelSmartAccount";
|
|
3
|
+
export declare const getNonceKeyWithEncoding: (accountVerion: KernelVersion, validatorAddress: Address, nonceKey?: bigint) => bigint;
|
|
4
|
+
//# sourceMappingURL=getNonceKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNonceKey.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/getNonceKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAoC,MAAM,MAAM,CAAA;AAErE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAEvE,eAAO,MAAM,uBAAuB,kBACjB,aAAa,oBACV,OAAO,8BAyB5B,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Account, type Chain, type Client, type SignMessageParameters, type SignMessageReturnType, type Transport } from "viem";
|
|
2
|
+
import { type WrapMessageHashParams } from "./wrapMessageHash";
|
|
3
|
+
export declare function signMessage<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: Client<Transport, TChain, TAccount>, { account: account_, message, accountAddress, accountVersion }: SignMessageParameters<TAccount> & WrapMessageHashParams): Promise<SignMessageReturnType>;
|
|
4
|
+
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EAGjB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,KAAK,qBAAqB,EAAmB,MAAM,mBAAmB,CAAA;AAE/E,wBAAsB,WAAW,CAC7B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EAEpC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACI,OAAO,EAAE,QAAyB,EAClC,OAAO,EACP,cAAc,EACd,cAAc,EACjB,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GAAG,qBAAqB,GAC3D,OAAO,CAAC,qBAAqB,CAAC,CAsBhC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Account, type Chain, type Client, type SignTypedDataParameters, type SignTypedDataReturnType, type Transport, type TypedData } from "viem";
|
|
2
|
+
import { type WrapMessageHashParams } from "./wrapMessageHash";
|
|
3
|
+
export declare function signTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain", chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: SignTypedDataParameters<typedData, primaryType, account> & WrapMessageHashParams): Promise<SignTypedDataReturnType>;
|
|
4
|
+
//# sourceMappingURL=signTypedData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,SAAS,EAKjB,MAAM,MAAM,CAAA;AAMb,OAAO,EAAE,KAAK,qBAAqB,EAAmB,MAAM,mBAAmB,CAAA;AAE/E,wBAAsB,aAAa,CAC/B,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,EACpD,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,EAEnC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,EACzC,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,GAChE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Hex } from "viem";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
export type WrapMessageHashParams = {
|
|
4
|
+
accountVersion: string;
|
|
5
|
+
accountAddress: Address;
|
|
6
|
+
chainId?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const wrapMessageHash: (messageHash: Hex, { accountAddress, accountVersion, chainId }: WrapMessageHashParams) => `0x${string}`;
|
|
9
|
+
//# sourceMappingURL=wrapMessageHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapMessageHash.d.ts","sourceRoot":"","sources":["../../../../accounts/kernel/utils/wrapMessageHash.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,GAAG,EAKX,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,OAAO,EAAmB,MAAM,MAAM,CAAA;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,eAAe,gBACX,GAAG,+CAC6B,qBAAqB,kBAoBrE,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const KernelV3InitAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "initialize",
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: "_rootValidator",
|
|
8
|
+
type: "bytes21",
|
|
9
|
+
internalType: "ValidationId"
|
|
10
|
+
},
|
|
11
|
+
{ name: "hook", type: "address", internalType: "contract IHook" },
|
|
12
|
+
{ name: "validatorData", type: "bytes", internalType: "bytes" },
|
|
13
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
14
|
+
],
|
|
15
|
+
outputs: [],
|
|
16
|
+
stateMutability: "nonpayable"
|
|
17
|
+
}
|
|
18
|
+
] as const
|
|
19
|
+
|
|
20
|
+
export const KernelV3ExecuteAbi = [
|
|
21
|
+
{
|
|
22
|
+
type: "function",
|
|
23
|
+
name: "execute",
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: "execMode", type: "bytes32", internalType: "ExecMode" },
|
|
26
|
+
{ name: "executionCalldata", type: "bytes", internalType: "bytes" }
|
|
27
|
+
],
|
|
28
|
+
outputs: [],
|
|
29
|
+
stateMutability: "payable"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "function",
|
|
33
|
+
name: "executeFromExecutor",
|
|
34
|
+
inputs: [
|
|
35
|
+
{ name: "execMode", type: "bytes32", internalType: "ExecMode" },
|
|
36
|
+
{ name: "executionCalldata", type: "bytes", internalType: "bytes" }
|
|
37
|
+
],
|
|
38
|
+
outputs: [
|
|
39
|
+
{ name: "returnData", type: "bytes[]", internalType: "bytes[]" }
|
|
40
|
+
],
|
|
41
|
+
stateMutability: "payable"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "function",
|
|
45
|
+
name: "executeUserOp",
|
|
46
|
+
inputs: [
|
|
47
|
+
{
|
|
48
|
+
name: "userOp",
|
|
49
|
+
type: "tuple",
|
|
50
|
+
internalType: "struct PackedUserOperation",
|
|
51
|
+
components: [
|
|
52
|
+
{
|
|
53
|
+
name: "sender",
|
|
54
|
+
type: "address",
|
|
55
|
+
internalType: "address"
|
|
56
|
+
},
|
|
57
|
+
{ name: "nonce", type: "uint256", internalType: "uint256" },
|
|
58
|
+
{ name: "initCode", type: "bytes", internalType: "bytes" },
|
|
59
|
+
{ name: "callData", type: "bytes", internalType: "bytes" },
|
|
60
|
+
{
|
|
61
|
+
name: "accountGasLimits",
|
|
62
|
+
type: "bytes32",
|
|
63
|
+
internalType: "bytes32"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "preVerificationGas",
|
|
67
|
+
type: "uint256",
|
|
68
|
+
internalType: "uint256"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "gasFees",
|
|
72
|
+
type: "bytes32",
|
|
73
|
+
internalType: "bytes32"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "paymasterAndData",
|
|
77
|
+
type: "bytes",
|
|
78
|
+
internalType: "bytes"
|
|
79
|
+
},
|
|
80
|
+
{ name: "signature", type: "bytes", internalType: "bytes" }
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{ name: "userOpHash", type: "bytes32", internalType: "bytes32" }
|
|
84
|
+
],
|
|
85
|
+
outputs: [],
|
|
86
|
+
stateMutability: "payable"
|
|
87
|
+
}
|
|
88
|
+
] as const
|