@rhinestone/sdk 0.0.0-dev-20260204114155

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.
Files changed (206) hide show
  1. package/README.md +83 -0
  2. package/dist/src/accounts/error.d.ts +114 -0
  3. package/dist/src/accounts/error.d.ts.map +1 -0
  4. package/dist/src/accounts/error.js +174 -0
  5. package/dist/src/accounts/index.d.ts +48 -0
  6. package/dist/src/accounts/index.d.ts.map +1 -0
  7. package/dist/src/accounts/index.js +643 -0
  8. package/dist/src/accounts/index.test.d.ts +2 -0
  9. package/dist/src/accounts/index.test.d.ts.map +1 -0
  10. package/dist/src/accounts/index.test.js +33 -0
  11. package/dist/src/accounts/json-rpc/index.d.ts +5 -0
  12. package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
  13. package/dist/src/accounts/json-rpc/index.js +20 -0
  14. package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
  15. package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
  16. package/dist/src/accounts/json-rpc/index.test.js +33 -0
  17. package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
  18. package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
  19. package/dist/src/accounts/json-rpc/providers.js +22 -0
  20. package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
  21. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
  22. package/dist/src/accounts/json-rpc/providers.test.js +43 -0
  23. package/dist/src/accounts/kernel.d.ts +27 -0
  24. package/dist/src/accounts/kernel.d.ts.map +1 -0
  25. package/dist/src/accounts/kernel.js +281 -0
  26. package/dist/src/accounts/kernel.test.d.ts +2 -0
  27. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  28. package/dist/src/accounts/kernel.test.js +132 -0
  29. package/dist/src/accounts/nexus.d.ts +33 -0
  30. package/dist/src/accounts/nexus.d.ts.map +1 -0
  31. package/dist/src/accounts/nexus.js +455 -0
  32. package/dist/src/accounts/nexus.test.d.ts +2 -0
  33. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  34. package/dist/src/accounts/nexus.test.js +118 -0
  35. package/dist/src/accounts/passport.d.ts +9 -0
  36. package/dist/src/accounts/passport.d.ts.map +1 -0
  37. package/dist/src/accounts/passport.js +82 -0
  38. package/dist/src/accounts/safe.d.ts +33 -0
  39. package/dist/src/accounts/safe.d.ts.map +1 -0
  40. package/dist/src/accounts/safe.js +349 -0
  41. package/dist/src/accounts/safe.test.d.ts +2 -0
  42. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  43. package/dist/src/accounts/safe.test.js +118 -0
  44. package/dist/src/accounts/signing/common.d.ts +27 -0
  45. package/dist/src/accounts/signing/common.d.ts.map +1 -0
  46. package/dist/src/accounts/signing/common.js +190 -0
  47. package/dist/src/accounts/signing/message.d.ts +5 -0
  48. package/dist/src/accounts/signing/message.d.ts.map +1 -0
  49. package/dist/src/accounts/signing/message.js +47 -0
  50. package/dist/src/accounts/signing/passkeys.d.ts +36 -0
  51. package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
  52. package/dist/src/accounts/signing/passkeys.js +125 -0
  53. package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
  54. package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
  55. package/dist/src/accounts/signing/passkeys.test.js +88 -0
  56. package/dist/src/accounts/signing/typedData.d.ts +5 -0
  57. package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
  58. package/dist/src/accounts/signing/typedData.js +35 -0
  59. package/dist/src/accounts/startale.d.ts +25 -0
  60. package/dist/src/accounts/startale.d.ts.map +1 -0
  61. package/dist/src/accounts/startale.js +112 -0
  62. package/dist/src/accounts/startale.test.d.ts +2 -0
  63. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  64. package/dist/src/accounts/startale.test.js +92 -0
  65. package/dist/src/accounts/utils.d.ts +33 -0
  66. package/dist/src/accounts/utils.d.ts.map +1 -0
  67. package/dist/src/accounts/utils.js +208 -0
  68. package/dist/src/accounts/utils.test.d.ts +2 -0
  69. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  70. package/dist/src/accounts/utils.test.js +49 -0
  71. package/dist/src/accounts/walletClient.d.ts +34 -0
  72. package/dist/src/accounts/walletClient.d.ts.map +1 -0
  73. package/dist/src/accounts/walletClient.js +121 -0
  74. package/dist/src/actions/compact.d.ts +15 -0
  75. package/dist/src/actions/compact.d.ts.map +1 -0
  76. package/dist/src/actions/compact.js +213 -0
  77. package/dist/src/actions/deployment.d.ts +19 -0
  78. package/dist/src/actions/deployment.d.ts.map +1 -0
  79. package/dist/src/actions/deployment.js +78 -0
  80. package/dist/src/actions/ecdsa.d.ts +35 -0
  81. package/dist/src/actions/ecdsa.d.ts.map +1 -0
  82. package/dist/src/actions/ecdsa.js +114 -0
  83. package/dist/src/actions/ecdsa.test.d.ts +2 -0
  84. package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
  85. package/dist/src/actions/ecdsa.test.js +99 -0
  86. package/dist/src/actions/index.d.ts +17 -0
  87. package/dist/src/actions/index.d.ts.map +1 -0
  88. package/dist/src/actions/index.js +53 -0
  89. package/dist/src/actions/mfa.d.ts +37 -0
  90. package/dist/src/actions/mfa.d.ts.map +1 -0
  91. package/dist/src/actions/mfa.js +133 -0
  92. package/dist/src/actions/passkeys.d.ts +37 -0
  93. package/dist/src/actions/passkeys.d.ts.map +1 -0
  94. package/dist/src/actions/passkeys.js +129 -0
  95. package/dist/src/actions/passkeys.test.d.ts +2 -0
  96. package/dist/src/actions/passkeys.test.d.ts.map +1 -0
  97. package/dist/src/actions/passkeys.test.js +54 -0
  98. package/dist/src/actions/recovery.d.ts +33 -0
  99. package/dist/src/actions/recovery.d.ts.map +1 -0
  100. package/dist/src/actions/recovery.js +193 -0
  101. package/dist/src/actions/recovery.test.d.ts +2 -0
  102. package/dist/src/actions/recovery.test.d.ts.map +1 -0
  103. package/dist/src/actions/recovery.test.js +168 -0
  104. package/dist/src/actions/smart-sessions.d.ts +23 -0
  105. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  106. package/dist/src/actions/smart-sessions.js +52 -0
  107. package/dist/src/errors/index.d.ts +5 -0
  108. package/dist/src/errors/index.d.ts.map +1 -0
  109. package/dist/src/errors/index.js +54 -0
  110. package/dist/src/execution/compact.d.ts +148 -0
  111. package/dist/src/execution/compact.d.ts.map +1 -0
  112. package/dist/src/execution/compact.js +120 -0
  113. package/dist/src/execution/error.d.ts +55 -0
  114. package/dist/src/execution/error.d.ts.map +1 -0
  115. package/dist/src/execution/error.js +78 -0
  116. package/dist/src/execution/index.d.ts +41 -0
  117. package/dist/src/execution/index.d.ts.map +1 -0
  118. package/dist/src/execution/index.js +230 -0
  119. package/dist/src/execution/permit2.d.ts +143 -0
  120. package/dist/src/execution/permit2.d.ts.map +1 -0
  121. package/dist/src/execution/permit2.js +285 -0
  122. package/dist/src/execution/singleChainOps.d.ts +40 -0
  123. package/dist/src/execution/singleChainOps.d.ts.map +1 -0
  124. package/dist/src/execution/singleChainOps.js +46 -0
  125. package/dist/src/execution/types.d.ts +36 -0
  126. package/dist/src/execution/types.d.ts.map +1 -0
  127. package/dist/src/execution/types.js +2 -0
  128. package/dist/src/execution/utils.d.ts +87 -0
  129. package/dist/src/execution/utils.d.ts.map +1 -0
  130. package/dist/src/execution/utils.js +783 -0
  131. package/dist/src/index.d.ts +76 -0
  132. package/dist/src/index.d.ts.map +1 -0
  133. package/dist/src/index.js +319 -0
  134. package/dist/src/modules/abi/smart-session-emissary.d.ts +696 -0
  135. package/dist/src/modules/abi/smart-session-emissary.d.ts.map +1 -0
  136. package/dist/src/modules/abi/smart-session-emissary.js +565 -0
  137. package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
  138. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  139. package/dist/src/modules/abi/smart-sessions.js +131 -0
  140. package/dist/src/modules/chain-abstraction.d.ts +5 -0
  141. package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
  142. package/dist/src/modules/chain-abstraction.js +7 -0
  143. package/dist/src/modules/common.d.ts +30 -0
  144. package/dist/src/modules/common.d.ts.map +1 -0
  145. package/dist/src/modules/common.js +42 -0
  146. package/dist/src/modules/index.d.ts +11 -0
  147. package/dist/src/modules/index.d.ts.map +1 -0
  148. package/dist/src/modules/index.js +97 -0
  149. package/dist/src/modules/index.test.d.ts +2 -0
  150. package/dist/src/modules/index.test.d.ts.map +1 -0
  151. package/dist/src/modules/index.test.js +81 -0
  152. package/dist/src/modules/legacy.d.ts +10 -0
  153. package/dist/src/modules/legacy.d.ts.map +1 -0
  154. package/dist/src/modules/legacy.js +65 -0
  155. package/dist/src/modules/read.d.ts +9 -0
  156. package/dist/src/modules/read.d.ts.map +1 -0
  157. package/dist/src/modules/read.js +125 -0
  158. package/dist/src/modules/validators/core.d.ts +31 -0
  159. package/dist/src/modules/validators/core.d.ts.map +1 -0
  160. package/dist/src/modules/validators/core.js +284 -0
  161. package/dist/src/modules/validators/core.test.d.ts +2 -0
  162. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  163. package/dist/src/modules/validators/core.test.js +101 -0
  164. package/dist/src/modules/validators/index.d.ts +4 -0
  165. package/dist/src/modules/validators/index.d.ts.map +1 -0
  166. package/dist/src/modules/validators/index.js +10 -0
  167. package/dist/src/modules/validators/smart-sessions.d.ts +185 -0
  168. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  169. package/dist/src/modules/validators/smart-sessions.js +624 -0
  170. package/dist/src/orchestrator/client.d.ts +22 -0
  171. package/dist/src/orchestrator/client.d.ts.map +1 -0
  172. package/dist/src/orchestrator/client.js +360 -0
  173. package/dist/src/orchestrator/consts.d.ts +5 -0
  174. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  175. package/dist/src/orchestrator/consts.js +9 -0
  176. package/dist/src/orchestrator/error.d.ts +242 -0
  177. package/dist/src/orchestrator/error.d.ts.map +1 -0
  178. package/dist/src/orchestrator/error.js +283 -0
  179. package/dist/src/orchestrator/index.d.ts +10 -0
  180. package/dist/src/orchestrator/index.d.ts.map +1 -0
  181. package/dist/src/orchestrator/index.js +58 -0
  182. package/dist/src/orchestrator/registry.d.ts +22 -0
  183. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  184. package/dist/src/orchestrator/registry.js +116 -0
  185. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  186. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  187. package/dist/src/orchestrator/registry.test.js +154 -0
  188. package/dist/src/orchestrator/types.d.ts +322 -0
  189. package/dist/src/orchestrator/types.d.ts.map +1 -0
  190. package/dist/src/orchestrator/types.js +31 -0
  191. package/dist/src/orchestrator/utils.d.ts +3 -0
  192. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  193. package/dist/src/orchestrator/utils.js +24 -0
  194. package/dist/src/types.d.ts +296 -0
  195. package/dist/src/types.d.ts.map +1 -0
  196. package/dist/src/types.js +2 -0
  197. package/dist/src/utils/index.d.ts +26 -0
  198. package/dist/src/utils/index.d.ts.map +1 -0
  199. package/dist/src/utils/index.js +63 -0
  200. package/dist/test/consts.d.ts +10 -0
  201. package/dist/test/consts.d.ts.map +1 -0
  202. package/dist/test/consts.js +22 -0
  203. package/dist/test/utils/utils.d.ts +5 -0
  204. package/dist/test/utils/utils.d.ts.map +1 -0
  205. package/dist/test/utils/utils.js +20 -0
  206. package/package.json +161 -0
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertOwnerSetToSignerSet = convertOwnerSetToSignerSet;
4
+ exports.signWithMultiFactorAuth = signWithMultiFactorAuth;
5
+ exports.signWithSession = signWithSession;
6
+ exports.signWithGuardians = signWithGuardians;
7
+ exports.signWithOwners = signWithOwners;
8
+ const viem_1 = require("viem");
9
+ const modules_1 = require("../../modules");
10
+ const core_1 = require("../../modules/validators/core");
11
+ const smart_sessions_1 = require("../../modules/validators/smart-sessions");
12
+ const passkeys_1 = require("./passkeys");
13
+ function convertOwnerSetToSignerSet(owners) {
14
+ switch (owners.type) {
15
+ case 'ecdsa': {
16
+ return {
17
+ type: 'owner',
18
+ kind: 'ecdsa',
19
+ accounts: owners.accounts,
20
+ module: owners.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
21
+ };
22
+ }
23
+ case 'ens': {
24
+ return {
25
+ type: 'owner',
26
+ kind: 'ecdsa',
27
+ accounts: owners.accounts,
28
+ module: owners.module ?? core_1.ENS_VALIDATOR_ADDRESS,
29
+ };
30
+ }
31
+ case 'passkey': {
32
+ return {
33
+ type: 'owner',
34
+ kind: 'passkey',
35
+ accounts: owners.accounts,
36
+ module: owners.module,
37
+ };
38
+ }
39
+ case 'multi-factor': {
40
+ return {
41
+ type: 'owner',
42
+ kind: 'multi-factor',
43
+ validators: owners.validators.map((validator, index) => {
44
+ switch (validator.type) {
45
+ case 'ecdsa': {
46
+ return {
47
+ type: validator.type,
48
+ id: index,
49
+ accounts: validator.accounts,
50
+ module: validator.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
51
+ };
52
+ }
53
+ case 'ens': {
54
+ return {
55
+ type: 'ecdsa',
56
+ id: index,
57
+ accounts: validator.accounts,
58
+ module: validator.module ?? core_1.ENS_VALIDATOR_ADDRESS,
59
+ };
60
+ }
61
+ case 'passkey': {
62
+ return {
63
+ type: 'passkey',
64
+ id: index,
65
+ accounts: validator.accounts,
66
+ module: validator.module,
67
+ };
68
+ }
69
+ default: {
70
+ throw new Error(`Unsupported validator type: ${validator.type}`);
71
+ }
72
+ }
73
+ }),
74
+ };
75
+ }
76
+ }
77
+ }
78
+ async function signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain) {
79
+ const signatures = await Promise.all(signers.validators.map(async (validator) => {
80
+ if (validator === null) {
81
+ return '0x';
82
+ }
83
+ const validatorSigners = convertOwnerSetToSignerSet(validator);
84
+ return signMain(validatorSigners, chain, address, params, isUserOpHash);
85
+ }));
86
+ const data = (0, viem_1.encodeAbiParameters)([
87
+ {
88
+ components: [
89
+ {
90
+ internalType: 'bytes32',
91
+ name: 'packedValidatorAndId',
92
+ type: 'bytes32',
93
+ },
94
+ { internalType: 'bytes', name: 'data', type: 'bytes' },
95
+ ],
96
+ name: 'validators',
97
+ type: 'tuple[]',
98
+ },
99
+ ], [
100
+ signers.validators.map((validator, index) => {
101
+ const validatorModule = (0, core_1.getValidator)(validator);
102
+ return {
103
+ packedValidatorAndId: (0, viem_1.concat)([
104
+ (0, viem_1.pad)((0, viem_1.toHex)(validator.id), {
105
+ size: 12,
106
+ }),
107
+ validatorModule.address,
108
+ ]),
109
+ data: signatures[index],
110
+ };
111
+ }),
112
+ ]);
113
+ return data;
114
+ }
115
+ async function signWithSession(signers, chain, address, hash, signMain) {
116
+ const sessionSigners = convertOwnerSetToSignerSet(signers.session.owners);
117
+ const signedHash = signers.verifyExecutions
118
+ ? hash
119
+ : (0, viem_1.hashMessage)({
120
+ raw: (0, viem_1.encodePacked)(['bytes32', 'bytes32'], [(0, viem_1.padHex)(address), hash]),
121
+ });
122
+ const validatorSignature = await signMain(sessionSigners, chain, address, signedHash, false);
123
+ return (0, smart_sessions_1.packSignature)(signers, validatorSignature);
124
+ }
125
+ async function signWithGuardians(signers, params, signingFunctions) {
126
+ const signatures = await Promise.all(signers.guardians.map((account) => signingFunctions.signEcdsa(account, params, false)));
127
+ return (0, viem_1.concat)(signatures);
128
+ }
129
+ async function signWithOwners(signers, chain, address, params, signingFunctions, isUserOpHash, signMain) {
130
+ async function signEcdsWithChain(account, params, updateV, chain) {
131
+ const client = account.client;
132
+ const transport = client?.transport;
133
+ if (transport) {
134
+ // Switch chain
135
+ const walletClient = (0, viem_1.createWalletClient)({
136
+ chain,
137
+ transport: (0, viem_1.custom)(transport),
138
+ account,
139
+ });
140
+ await walletClient.switchChain({
141
+ id: chain.id,
142
+ });
143
+ }
144
+ // Sign
145
+ return signingFunctions.signEcdsa(account, params, updateV);
146
+ }
147
+ switch (signers.kind) {
148
+ case 'ecdsa': {
149
+ // Ownable validator uses `v` value to determine which validation mode to use
150
+ // ENS validator (based on Ownable) also uses the same signature format
151
+ // This is not needed for UserOps
152
+ const isOwnableOrENS = !signers.module ||
153
+ signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS ||
154
+ signers.module?.toLowerCase() === core_1.ENS_VALIDATOR_ADDRESS;
155
+ const updateV = isOwnableOrENS && !isUserOpHash;
156
+ const signatures = await Promise.all(signers.accounts.map((account) => signEcdsWithChain(account, params, updateV, chain)));
157
+ return (0, viem_1.concat)(signatures);
158
+ }
159
+ case 'passkey': {
160
+ const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signPasskey(account, params)));
161
+ const usePrecompile = (0, modules_1.isRip7212SupportedNetwork)(chain);
162
+ const credIds = signers.accounts.map((account) => {
163
+ const publicKey = account.publicKey;
164
+ const { x, y } = (0, passkeys_1.parsePublicKey)(publicKey);
165
+ return (0, passkeys_1.generateCredentialId)(x, y, address);
166
+ });
167
+ const webAuthns = signatures.map((signature) => {
168
+ const { r, s } = (0, passkeys_1.parseSignature)(signature.signature);
169
+ return {
170
+ authenticatorData: signature.webauthn.authenticatorData,
171
+ clientDataJSON: signature.webauthn.clientDataJSON,
172
+ challengeIndex: BigInt(signature.webauthn.challengeIndex ?? 0),
173
+ typeIndex: BigInt(signature.webauthn.typeIndex ?? 0),
174
+ r,
175
+ s,
176
+ };
177
+ });
178
+ if (signers.module?.toLowerCase() === core_1.WEBAUTHN_V0_VALIDATOR_ADDRESS) {
179
+ return (0, passkeys_1.packSignatureV0)(webAuthns[0], usePrecompile);
180
+ }
181
+ return (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
182
+ }
183
+ case 'multi-factor': {
184
+ return signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain);
185
+ }
186
+ default: {
187
+ throw new Error('Unsupported owner kind');
188
+ }
189
+ }
190
+ }
@@ -0,0 +1,5 @@
1
+ import { type Address, type Chain, type Hex } from 'viem';
2
+ import type { SignerSet } from '../../types';
3
+ declare function sign(signers: SignerSet, chain: Chain, address: Address, hash: Hex, isUserOpHash: boolean): Promise<Hex>;
4
+ export { sign };
5
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAS5C,iBAAe,IAAI,CACjB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,GAAG,CAAC,CAyBd;AA4BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sign = sign;
4
+ const viem_1 = require("viem");
5
+ const error_1 = require("../error");
6
+ const common_1 = require("./common");
7
+ async function sign(signers, chain, address, hash, isUserOpHash) {
8
+ const signingFunctions = {
9
+ signEcdsa: (account, hash, updateV) => signEcdsa(account, hash, updateV),
10
+ signPasskey: (account, hash) => signPasskey(account, hash),
11
+ };
12
+ switch (signers.type) {
13
+ case 'owner': {
14
+ return (0, common_1.signWithOwners)(signers, chain, address, hash, signingFunctions, isUserOpHash, sign);
15
+ }
16
+ case 'experimental_session': {
17
+ return (0, common_1.signWithSession)(signers, chain, address, hash, sign);
18
+ }
19
+ case 'guardians': {
20
+ return (0, common_1.signWithGuardians)(signers, hash, signingFunctions);
21
+ }
22
+ }
23
+ }
24
+ async function signEcdsa(account, hash, updateV) {
25
+ if (!account.signMessage) {
26
+ throw new error_1.SigningNotSupportedForAccountError();
27
+ }
28
+ const originalSignature = await account.signMessage({
29
+ message: { raw: hash },
30
+ });
31
+ // Manually tweak the `v` value to trigger the message prefixing onchain
32
+ // https://github.com/rhinestonewtf/checknsignatures/blob/main/src/CheckNSignatures.sol#L53-L61
33
+ const { r, s, v } = (0, viem_1.parseSignature)(originalSignature);
34
+ if (!v) {
35
+ throw new Error('Invalid signature');
36
+ }
37
+ const newV = updateV ? v + 4n : v;
38
+ const newSignature = (0, viem_1.concat)([r, s, (0, viem_1.toHex)(newV)]);
39
+ return newSignature;
40
+ }
41
+ async function signPasskey(account, hash) {
42
+ const { webauthn, signature } = await account.sign({ hash });
43
+ return {
44
+ webauthn,
45
+ signature,
46
+ };
47
+ }
@@ -0,0 +1,36 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ interface WebAuthnSignature {
3
+ authenticatorData: Hex;
4
+ clientDataJSON: string;
5
+ challengeIndex: bigint;
6
+ typeIndex: bigint;
7
+ r: bigint;
8
+ s: bigint;
9
+ }
10
+ declare function parsePublicKey(publicKey: Hex | Uint8Array): {
11
+ x: bigint;
12
+ y: bigint;
13
+ };
14
+ declare function parseSignature(signature: Hex | Uint8Array): {
15
+ r: bigint;
16
+ s: bigint;
17
+ };
18
+ declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint, account: Address): `0x${string}`;
19
+ declare function packSignature(credIds: Hex[], usePrecompile: boolean, webAuthns: {
20
+ authenticatorData: Hex;
21
+ clientDataJSON: string;
22
+ challengeIndex: bigint;
23
+ typeIndex: bigint;
24
+ r: bigint;
25
+ s: bigint;
26
+ }[]): Hex;
27
+ declare function packSignatureV0(webauthn: {
28
+ authenticatorData: Hex;
29
+ clientDataJSON: string;
30
+ typeIndex: number | bigint;
31
+ r: bigint;
32
+ s: bigint;
33
+ }, usePrecompiled: boolean): `0x${string}`;
34
+ export { parsePublicKey, parseSignature, generateCredentialId, packSignature, packSignatureV0, };
35
+ export type { WebAuthnSignature };
36
+ //# sourceMappingURL=passkeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,UAAU,iBAAiB;IACzB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CAUA;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CASA;AAED,iBAAS,oBAAoB,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,iBAkBjB;AAED,iBAAS,aAAa,CACpB,OAAO,EAAE,GAAG,EAAE,EACd,aAAa,EAAE,OAAO,EACtB,SAAS,EAAE;IACT,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,EAAE,GACF,GAAG,CAqDL;AAED,iBAAS,eAAe,CACtB,QAAQ,EAAE;IACR,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,EACD,cAAc,EAAE,OAAO,iBAqCxB;AAED,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,eAAe,GAChB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePublicKey = parsePublicKey;
4
+ exports.parseSignature = parseSignature;
5
+ exports.generateCredentialId = generateCredentialId;
6
+ exports.packSignature = packSignature;
7
+ exports.packSignatureV0 = packSignatureV0;
8
+ const viem_1 = require("viem");
9
+ function parsePublicKey(publicKey) {
10
+ const bytes = typeof publicKey === 'string' ? (0, viem_1.hexToBytes)(publicKey) : publicKey;
11
+ const offset = bytes.length === 65 ? 1 : 0;
12
+ const x = bytes.slice(offset, 32 + offset);
13
+ const y = bytes.slice(32 + offset, 64 + offset);
14
+ return {
15
+ x: BigInt((0, viem_1.bytesToHex)(x)),
16
+ y: BigInt((0, viem_1.bytesToHex)(y)),
17
+ };
18
+ }
19
+ function parseSignature(signature) {
20
+ const bytes = typeof signature === 'string' ? (0, viem_1.hexToBytes)(signature) : signature;
21
+ const r = bytes.slice(0, 32);
22
+ const s = bytes.slice(32, 64);
23
+ return {
24
+ r: BigInt((0, viem_1.bytesToHex)(r)),
25
+ s: BigInt((0, viem_1.bytesToHex)(s)),
26
+ };
27
+ }
28
+ function generateCredentialId(pubKeyX, pubKeyY, account) {
29
+ return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
30
+ {
31
+ type: 'uint256',
32
+ },
33
+ {
34
+ type: 'uint256',
35
+ },
36
+ {
37
+ type: 'address',
38
+ },
39
+ ], [pubKeyX, pubKeyY, account]));
40
+ }
41
+ function packSignature(credIds, usePrecompile, webAuthns) {
42
+ // Sort both `credIds` and `webAuthns` by credIds
43
+ const credIdsAndWebAuthns = credIds.map((credId, index) => ({
44
+ credId,
45
+ webAuthn: webAuthns[index],
46
+ }));
47
+ credIdsAndWebAuthns.sort((a, b) => a.credId.localeCompare(b.credId));
48
+ credIds = credIdsAndWebAuthns.map(({ credId }) => credId);
49
+ webAuthns = credIdsAndWebAuthns.map(({ webAuthn }) => webAuthn);
50
+ // Encode
51
+ return (0, viem_1.encodeAbiParameters)([
52
+ {
53
+ type: 'bytes32[]',
54
+ name: 'credIds',
55
+ },
56
+ {
57
+ type: 'bool',
58
+ name: 'usePrecompile',
59
+ },
60
+ {
61
+ type: 'tuple[]',
62
+ name: 'webAuthns',
63
+ components: [
64
+ {
65
+ type: 'bytes',
66
+ name: 'authenticatorData',
67
+ },
68
+ {
69
+ type: 'string',
70
+ name: 'clientDataJSON',
71
+ },
72
+ {
73
+ type: 'uint256',
74
+ name: 'challengeIndex',
75
+ },
76
+ {
77
+ type: 'uint256',
78
+ name: 'typeIndex',
79
+ },
80
+ {
81
+ type: 'uint256',
82
+ name: 'r',
83
+ },
84
+ {
85
+ type: 'uint256',
86
+ name: 's',
87
+ },
88
+ ],
89
+ },
90
+ ], [credIds, usePrecompile, webAuthns]);
91
+ }
92
+ function packSignatureV0(webauthn, usePrecompiled) {
93
+ return (0, viem_1.encodeAbiParameters)([
94
+ { type: 'bytes', name: 'authenticatorData' },
95
+ {
96
+ type: 'string',
97
+ name: 'clientDataJSON',
98
+ },
99
+ {
100
+ type: 'uint256',
101
+ name: 'responseTypeLocation',
102
+ },
103
+ {
104
+ type: 'uint256',
105
+ name: 'r',
106
+ },
107
+ {
108
+ type: 'uint256',
109
+ name: 's',
110
+ },
111
+ {
112
+ type: 'bool',
113
+ name: 'usePrecompiled',
114
+ },
115
+ ], [
116
+ webauthn.authenticatorData,
117
+ webauthn.clientDataJSON,
118
+ typeof webauthn.typeIndex === 'bigint'
119
+ ? webauthn.typeIndex
120
+ : BigInt(webauthn.typeIndex),
121
+ webauthn.r,
122
+ webauthn.s,
123
+ usePrecompiled,
124
+ ]);
125
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=passkeys.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkeys.test.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const passkeys_1 = require("./passkeys");
5
+ (0, vitest_1.describe)('Passkeys', () => {
6
+ (0, vitest_1.describe)('Parse Public Key', () => {
7
+ (0, vitest_1.test)('default', () => {
8
+ const parsed = (0, passkeys_1.parsePublicKey)('0x7a2b9234dbc079da984e021acb76cf230dff5c03f2c5668024ddaeeb388520294bd61dcef34cade4d3bca405e63179ef022948ac45d0b0530cb125977c118ad7');
9
+ (0, vitest_1.expect)(parsed.x).toEqual(55259151030970399927675340420359705684663366332711724388150056154288143802409n);
10
+ (0, vitest_1.expect)(parsed.y).toEqual(34301774645623054632612895881498878184566570389017277955884655401641769536215n);
11
+ });
12
+ });
13
+ (0, vitest_1.describe)('Parse Signature', () => {
14
+ (0, vitest_1.test)('default', () => {
15
+ const parsed = (0, passkeys_1.parseSignature)('0xf60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8');
16
+ (0, vitest_1.expect)(parsed.r).toEqual(111296353735534357766084082487308191701889898756402773464442570100570127077266n);
17
+ (0, vitest_1.expect)(parsed.s).toEqual(6705566102199758127831148650668918567109283965479844611524279039128750829560n);
18
+ });
19
+ });
20
+ (0, vitest_1.describe)('Generate Credential ID', () => {
21
+ (0, vitest_1.test)('default', () => {
22
+ const id = (0, passkeys_1.generateCredentialId)(55259151030970399927675340420359705684663366332711724388150056154288143802409n, 34301774645623054632612895881498878184566570389017277955884655401641769536215n, '0xb975975c9f381b5df3b4af93bdd1ba739698bc37');
23
+ (0, vitest_1.expect)(id).toEqual('0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea');
24
+ });
25
+ });
26
+ (0, vitest_1.describe)('Pack Signature', () => {
27
+ (0, vitest_1.test)('single', () => {
28
+ const credIds = [
29
+ '0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea',
30
+ ];
31
+ const usePrecompile = false;
32
+ const webAuthns = [
33
+ {
34
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
35
+ clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
36
+ challengeIndex: 23n,
37
+ typeIndex: 1n,
38
+ r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
39
+ s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
40
+ },
41
+ ];
42
+ const packed = (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
43
+ (0, vitest_1.expect)(packed).toEqual('0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000019437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
44
+ });
45
+ (0, vitest_1.test)('multisig', () => {
46
+ const credIds = [
47
+ '0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea',
48
+ '0x6be9646e4d64132d1a1789a467d0501e948d23afce6792d963f401434d7bef33',
49
+ ];
50
+ const usePrecompile = true;
51
+ const webAuthns = [
52
+ {
53
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
54
+ clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
55
+ challengeIndex: 23n,
56
+ typeIndex: 1n,
57
+ r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
58
+ s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
59
+ },
60
+ {
61
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
62
+ clientDataJSON: '{"type":"webauthn.get","challenge":"19qAcQAVCeucFt8tQSizBBdbxW6Jkex_3nAejdRuVek","origin":"http://localhost:5173","crossOrigin":false}',
63
+ challengeIndex: 23n,
64
+ typeIndex: 1n,
65
+ r: 52674584175531096231012948456392242307658490190760877544141461393264453154030n,
66
+ s: 1045924358482323524717958171193057427003444327614976707002321626568131749413n,
67
+ },
68
+ ];
69
+ const packed = (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
70
+ (0, vitest_1.expect)(packed).toEqual('0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026be9646e4d64132d1a1789a467d0501e948d23afce6792d963f401434d7bef339437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000017474c214167b8a4704cf06f75287a738e7ddbcca9cc0383db6dac6a7d090f4ee024ff8e2a2e8c54aa8cf5f36e3b6125016c3d58d896e3a85c5cd2cd0027a2625000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22313971416351415643657563467438745153697a424264627857364a6b65785f336e41656a64527556656b222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
71
+ });
72
+ });
73
+ (0, vitest_1.describe)('Pack Signature V0', () => {
74
+ (0, vitest_1.test)('single', () => {
75
+ const usePrecompile = false;
76
+ const webAuthns = {
77
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
78
+ clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
79
+ challengeIndex: 23n,
80
+ typeIndex: 1n,
81
+ r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
82
+ s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
83
+ };
84
+ const packed = (0, passkeys_1.packSignatureV0)(webAuthns, usePrecompile);
85
+ (0, vitest_1.expect)(packed).toEqual('0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
86
+ });
87
+ });
88
+ });
@@ -0,0 +1,5 @@
1
+ import type { Address, Chain, HashTypedDataParameters, Hex, TypedData } from 'viem';
2
+ import type { SignerSet } from '../../types';
3
+ declare function sign<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(signers: SignerSet, chain: Chain, address: Address, parameters: HashTypedDataParameters<typedData, primaryType>): Promise<Hex>;
4
+ export { sign };
5
+ //# sourceMappingURL=typedData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,SAAS,EACV,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQ5C,iBAAe,IAAI,CACjB,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,SAAS,EAEtE,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,GAC1D,OAAO,CAAC,GAAG,CAAC,CA2Bd;AA6BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sign = sign;
4
+ const error_1 = require("../error");
5
+ const common_1 = require("./common");
6
+ async function sign(signers, chain, address, parameters) {
7
+ const signingFunctions = {
8
+ signEcdsa: (account, params) => signEcdsa(account, params),
9
+ signPasskey: (account, params) => signPasskey(account, params),
10
+ };
11
+ switch (signers.type) {
12
+ case 'owner': {
13
+ return (0, common_1.signWithOwners)(signers, chain, address, parameters, signingFunctions, false, sign);
14
+ }
15
+ case 'guardians': {
16
+ return (0, common_1.signWithGuardians)(signers, parameters, signingFunctions);
17
+ }
18
+ case 'experimental_session': {
19
+ throw new Error('Not supported');
20
+ }
21
+ }
22
+ }
23
+ async function signEcdsa(account, parameters) {
24
+ if (!account.signTypedData) {
25
+ throw new error_1.SigningNotSupportedForAccountError();
26
+ }
27
+ return await account.signTypedData(parameters);
28
+ }
29
+ async function signPasskey(account, parameters) {
30
+ const { webauthn, signature } = await account.signTypedData(parameters);
31
+ return {
32
+ webauthn,
33
+ signature,
34
+ };
35
+ }
@@ -0,0 +1,25 @@
1
+ import type { Address, Chain, Hex, PublicClient } from 'viem';
2
+ import type { Module } from '../modules/common';
3
+ import type { OwnerSet, RhinestoneAccountConfig } from '../types';
4
+ import type { ValidatorConfig } from './utils';
5
+ declare function getDeployArgs(config: RhinestoneAccountConfig): {
6
+ factory: `0x${string}`;
7
+ factoryData: `0x${string}`;
8
+ salt: `0x${string}`;
9
+ implementation: `0x${string}`;
10
+ initializationCallData: `0x${string}`;
11
+ };
12
+ declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
13
+ declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
14
+ name: string;
15
+ version: string;
16
+ chainId: number;
17
+ verifyingContract: `0x${string}`;
18
+ salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
19
+ };
20
+ declare function getInstallData(module: Module): `0x${string}`;
21
+ declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
22
+ declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
23
+ declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
24
+ export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getGuardianSmartAccount, };
25
+ //# sourceMappingURL=startale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../accounts/startale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAa7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EACV,QAAQ,EACR,uBAAuB,EAExB,MAAM,UAAU,CAAA;AAQjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAc9C,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EAwDrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBA4BlD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAarE;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBAErC;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,uBAAuB,GACxB,CAAA"}