@zerodev/sdk 5.2.1-alpha-8 → 5.2.1-alpha-10
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/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js +17 -5
- package/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js.map +1 -1
- package/_cjs/accounts/kernel/createKernelAccount.js +2 -2
- package/_cjs/clients/kernelAccountClient.js +20 -4
- package/_cjs/clients/kernelAccountClient.js.map +1 -1
- package/_cjs/clients/paymasterClient.js +18 -1
- package/_cjs/clients/paymasterClient.js.map +1 -1
- package/_cjs/clients/utils.js +31 -0
- package/_cjs/clients/utils.js.map +1 -0
- package/_cjs/constants.js +5 -2
- package/_cjs/constants.js.map +1 -1
- package/_cjs/providers/KernelEIP1193Provider.js +37 -0
- package/_cjs/providers/KernelEIP1193Provider.js.map +1 -1
- package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js +17 -5
- package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js.map +1 -1
- package/_esm/accounts/kernel/createKernelAccount.js +2 -2
- package/_esm/clients/kernelAccountClient.js +21 -5
- package/_esm/clients/kernelAccountClient.js.map +1 -1
- package/_esm/clients/paymasterClient.js +19 -2
- package/_esm/clients/paymasterClient.js.map +1 -1
- package/_esm/clients/utils.js +26 -0
- package/_esm/clients/utils.js.map +1 -0
- package/_esm/constants.js +4 -1
- package/_esm/constants.js.map +1 -1
- package/_esm/providers/KernelEIP1193Provider.js +37 -0
- package/_esm/providers/KernelEIP1193Provider.js.map +1 -1
- package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.d.ts +19 -5
- package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.d.ts.map +1 -1
- package/_types/clients/kernelAccountClient.d.ts +4 -4
- package/_types/clients/kernelAccountClient.d.ts.map +1 -1
- package/_types/clients/paymasterClient.d.ts.map +1 -1
- package/_types/clients/utils.d.ts +3 -0
- package/_types/clients/utils.d.ts.map +1 -0
- package/_types/constants.d.ts +4 -1
- package/_types/constants.d.ts.map +1 -1
- package/_types/providers/KernelEIP1193Provider.d.ts +2 -0
- package/_types/providers/KernelEIP1193Provider.d.ts.map +1 -1
- package/accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.ts +17 -5
- package/accounts/kernel/createKernelAccount.ts +2 -2
- package/clients/kernelAccountClient.ts +25 -5
- package/clients/paymasterClient.ts +24 -1
- package/clients/utils.ts +28 -0
- package/constants.ts +6 -2
- package/package.json +1 -1
- package/providers/KernelEIP1193Provider.ts +51 -0
|
@@ -29,8 +29,13 @@ export class KernelEIP1193Provider<
|
|
|
29
29
|
return this.handleEthAccounts()
|
|
30
30
|
case "eth_sendTransaction":
|
|
31
31
|
return this.handleEthSendTransaction(params)
|
|
32
|
+
case "eth_sign":
|
|
33
|
+
return this.handleEthSign(params as [string, string])
|
|
32
34
|
case "personal_sign":
|
|
33
35
|
return this.handlePersonalSign(params as [string, string])
|
|
36
|
+
case "eth_signTypedData":
|
|
37
|
+
case "eth_signTypedData_v4":
|
|
38
|
+
return this.handleEthSignTypedDataV4(params as [string, string])
|
|
34
39
|
default:
|
|
35
40
|
return this.kernelClient.transport.request({ method, params })
|
|
36
41
|
}
|
|
@@ -55,6 +60,26 @@ export class KernelEIP1193Provider<
|
|
|
55
60
|
return this.kernelClient.sendTransaction(tx)
|
|
56
61
|
}
|
|
57
62
|
|
|
63
|
+
private async handleEthSign(params: [string, string]): Promise<string> {
|
|
64
|
+
if (!this.kernelClient?.account) {
|
|
65
|
+
throw new Error("account not connected!")
|
|
66
|
+
}
|
|
67
|
+
const [address, message] = params
|
|
68
|
+
if (
|
|
69
|
+
address.toLowerCase() !==
|
|
70
|
+
this.kernelClient.account.address.toLowerCase()
|
|
71
|
+
) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
"cannot sign for address that is not the current account"
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return this.kernelClient.signMessage({
|
|
78
|
+
message,
|
|
79
|
+
account: this.kernelClient.account
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
58
83
|
private async handlePersonalSign(
|
|
59
84
|
params: [string, string]
|
|
60
85
|
): Promise<string> {
|
|
@@ -76,4 +101,30 @@ export class KernelEIP1193Provider<
|
|
|
76
101
|
account: this.kernelClient.account
|
|
77
102
|
})
|
|
78
103
|
}
|
|
104
|
+
|
|
105
|
+
private async handleEthSignTypedDataV4(
|
|
106
|
+
params: [string, string]
|
|
107
|
+
): Promise<string> {
|
|
108
|
+
if (!this.kernelClient?.account) {
|
|
109
|
+
throw new Error("account not connected!")
|
|
110
|
+
}
|
|
111
|
+
const [address, typedDataJSON] = params
|
|
112
|
+
const typedData = JSON.parse(typedDataJSON)
|
|
113
|
+
if (
|
|
114
|
+
address.toLowerCase() !==
|
|
115
|
+
this.kernelClient.account.address.toLowerCase()
|
|
116
|
+
) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
"cannot sign for address that is not the current account"
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return this.kernelClient.signTypedData({
|
|
123
|
+
account: this.kernelClient.account,
|
|
124
|
+
domain: typedData.domain,
|
|
125
|
+
types: typedData.types,
|
|
126
|
+
message: typedData.message,
|
|
127
|
+
primaryType: typedData.primaryType
|
|
128
|
+
})
|
|
129
|
+
}
|
|
79
130
|
}
|