@rhinestone/sdk 1.0.41-alpha.0 → 1.0.41

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 (208) hide show
  1. package/dist/src/accounts/error.d.ts +114 -0
  2. package/dist/src/accounts/error.d.ts.map +1 -0
  3. package/dist/src/accounts/error.js +174 -0
  4. package/dist/src/accounts/index.d.ts +50 -0
  5. package/dist/src/accounts/index.d.ts.map +1 -0
  6. package/dist/src/accounts/index.js +669 -0
  7. package/dist/src/accounts/index.test.d.ts +2 -0
  8. package/dist/src/accounts/index.test.d.ts.map +1 -0
  9. package/dist/src/accounts/index.test.js +33 -0
  10. package/dist/src/accounts/json-rpc/index.d.ts +5 -0
  11. package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
  12. package/dist/src/accounts/json-rpc/index.js +20 -0
  13. package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
  14. package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
  15. package/dist/src/accounts/json-rpc/index.test.js +33 -0
  16. package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
  17. package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
  18. package/dist/src/accounts/json-rpc/providers.js +22 -0
  19. package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
  20. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
  21. package/dist/src/accounts/json-rpc/providers.test.js +43 -0
  22. package/dist/src/accounts/kernel.d.ts +29 -0
  23. package/dist/src/accounts/kernel.d.ts.map +1 -0
  24. package/dist/src/accounts/kernel.js +297 -0
  25. package/dist/src/accounts/kernel.test.d.ts +2 -0
  26. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  27. package/dist/src/accounts/kernel.test.js +132 -0
  28. package/dist/src/accounts/nexus.d.ts +35 -0
  29. package/dist/src/accounts/nexus.d.ts.map +1 -0
  30. package/dist/src/accounts/nexus.js +471 -0
  31. package/dist/src/accounts/nexus.test.d.ts +2 -0
  32. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  33. package/dist/src/accounts/nexus.test.js +118 -0
  34. package/dist/src/accounts/passport.d.ts +12 -0
  35. package/dist/src/accounts/passport.d.ts.map +1 -0
  36. package/dist/src/accounts/passport.js +173 -0
  37. package/dist/src/accounts/safe.d.ts +35 -0
  38. package/dist/src/accounts/safe.d.ts.map +1 -0
  39. package/dist/src/accounts/safe.js +365 -0
  40. package/dist/src/accounts/safe.test.d.ts +2 -0
  41. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  42. package/dist/src/accounts/safe.test.js +118 -0
  43. package/dist/src/accounts/signing/common.d.ts +27 -0
  44. package/dist/src/accounts/signing/common.d.ts.map +1 -0
  45. package/dist/src/accounts/signing/common.js +183 -0
  46. package/dist/src/accounts/signing/message.d.ts +5 -0
  47. package/dist/src/accounts/signing/message.d.ts.map +1 -0
  48. package/dist/src/accounts/signing/message.js +47 -0
  49. package/dist/src/accounts/signing/passkeys.d.ts +36 -0
  50. package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
  51. package/dist/src/accounts/signing/passkeys.js +125 -0
  52. package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
  53. package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
  54. package/dist/src/accounts/signing/passkeys.test.js +88 -0
  55. package/dist/src/accounts/signing/typedData.d.ts +5 -0
  56. package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
  57. package/dist/src/accounts/signing/typedData.js +35 -0
  58. package/dist/src/accounts/startale.d.ts +27 -0
  59. package/dist/src/accounts/startale.d.ts.map +1 -0
  60. package/dist/src/accounts/startale.js +116 -0
  61. package/dist/src/accounts/startale.test.d.ts +2 -0
  62. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  63. package/dist/src/accounts/startale.test.js +92 -0
  64. package/dist/src/accounts/utils.d.ts +33 -0
  65. package/dist/src/accounts/utils.d.ts.map +1 -0
  66. package/dist/src/accounts/utils.js +208 -0
  67. package/dist/src/accounts/utils.test.d.ts +2 -0
  68. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  69. package/dist/src/accounts/utils.test.js +49 -0
  70. package/dist/src/accounts/walletClient.d.ts +34 -0
  71. package/dist/src/accounts/walletClient.d.ts.map +1 -0
  72. package/dist/src/accounts/walletClient.js +121 -0
  73. package/dist/src/actions/compact.d.ts +13 -0
  74. package/dist/src/actions/compact.d.ts.map +1 -0
  75. package/dist/src/actions/compact.js +210 -0
  76. package/dist/src/actions/deployment.d.ts +19 -0
  77. package/dist/src/actions/deployment.d.ts.map +1 -0
  78. package/dist/src/actions/deployment.js +78 -0
  79. package/dist/src/actions/ecdsa.d.ts +35 -0
  80. package/dist/src/actions/ecdsa.d.ts.map +1 -0
  81. package/dist/src/actions/ecdsa.js +114 -0
  82. package/dist/src/actions/ecdsa.test.d.ts +2 -0
  83. package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
  84. package/dist/src/actions/ecdsa.test.js +99 -0
  85. package/dist/src/actions/index.d.ts +17 -0
  86. package/dist/src/actions/index.d.ts.map +1 -0
  87. package/dist/src/actions/index.js +53 -0
  88. package/dist/src/actions/mfa.d.ts +37 -0
  89. package/dist/src/actions/mfa.d.ts.map +1 -0
  90. package/dist/src/actions/mfa.js +133 -0
  91. package/dist/src/actions/passkeys.d.ts +37 -0
  92. package/dist/src/actions/passkeys.d.ts.map +1 -0
  93. package/dist/src/actions/passkeys.js +129 -0
  94. package/dist/src/actions/passkeys.test.d.ts +2 -0
  95. package/dist/src/actions/passkeys.test.d.ts.map +1 -0
  96. package/dist/src/actions/passkeys.test.js +54 -0
  97. package/dist/src/actions/recovery.d.ts +33 -0
  98. package/dist/src/actions/recovery.d.ts.map +1 -0
  99. package/dist/src/actions/recovery.js +193 -0
  100. package/dist/src/actions/recovery.test.d.ts +2 -0
  101. package/dist/src/actions/recovery.test.d.ts.map +1 -0
  102. package/dist/src/actions/recovery.test.js +168 -0
  103. package/dist/src/actions/smart-sessions.d.ts +14 -0
  104. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  105. package/dist/src/actions/smart-sessions.js +16 -0
  106. package/dist/src/errors/index.d.ts +5 -0
  107. package/dist/src/errors/index.d.ts.map +1 -0
  108. package/dist/src/errors/index.js +53 -0
  109. package/dist/src/execution/compact.d.ts +151 -0
  110. package/dist/src/execution/compact.d.ts.map +1 -0
  111. package/dist/src/execution/compact.js +122 -0
  112. package/dist/src/execution/error.d.ts +61 -0
  113. package/dist/src/execution/error.d.ts.map +1 -0
  114. package/dist/src/execution/error.js +87 -0
  115. package/dist/src/execution/index.d.ts +41 -0
  116. package/dist/src/execution/index.d.ts.map +1 -0
  117. package/dist/src/execution/index.js +233 -0
  118. package/dist/src/execution/permit2.d.ts +148 -0
  119. package/dist/src/execution/permit2.d.ts.map +1 -0
  120. package/dist/src/execution/permit2.js +291 -0
  121. package/dist/src/execution/singleChainOps.d.ts +28 -0
  122. package/dist/src/execution/singleChainOps.d.ts.map +1 -0
  123. package/dist/src/execution/singleChainOps.js +32 -0
  124. package/dist/src/execution/smart-session.d.ts +13 -0
  125. package/dist/src/execution/smart-session.d.ts.map +1 -0
  126. package/dist/src/execution/smart-session.js +178 -0
  127. package/dist/src/execution/types.d.ts +36 -0
  128. package/dist/src/execution/types.d.ts.map +1 -0
  129. package/dist/src/execution/types.js +2 -0
  130. package/dist/src/execution/utils.d.ts +83 -0
  131. package/dist/src/execution/utils.d.ts.map +1 -0
  132. package/dist/src/execution/utils.js +705 -0
  133. package/dist/src/index.d.ts +74 -0
  134. package/dist/src/index.d.ts.map +1 -0
  135. package/dist/src/index.js +317 -0
  136. package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
  137. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  138. package/dist/src/modules/abi/smart-sessions.js +131 -0
  139. package/dist/src/modules/chain-abstraction.d.ts +5 -0
  140. package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
  141. package/dist/src/modules/chain-abstraction.js +7 -0
  142. package/dist/src/modules/common.d.ts +30 -0
  143. package/dist/src/modules/common.d.ts.map +1 -0
  144. package/dist/src/modules/common.js +42 -0
  145. package/dist/src/modules/index.d.ts +10 -0
  146. package/dist/src/modules/index.d.ts.map +1 -0
  147. package/dist/src/modules/index.js +94 -0
  148. package/dist/src/modules/index.test.d.ts +2 -0
  149. package/dist/src/modules/index.test.d.ts.map +1 -0
  150. package/dist/src/modules/index.test.js +81 -0
  151. package/dist/src/modules/legacy.d.ts +10 -0
  152. package/dist/src/modules/legacy.d.ts.map +1 -0
  153. package/dist/src/modules/legacy.js +65 -0
  154. package/dist/src/modules/read.d.ts +9 -0
  155. package/dist/src/modules/read.d.ts.map +1 -0
  156. package/dist/src/modules/read.js +125 -0
  157. package/dist/src/modules/validators/core.d.ts +29 -0
  158. package/dist/src/modules/validators/core.d.ts.map +1 -0
  159. package/dist/src/modules/validators/core.js +278 -0
  160. package/dist/src/modules/validators/core.test.d.ts +2 -0
  161. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  162. package/dist/src/modules/validators/core.test.js +101 -0
  163. package/dist/src/modules/validators/index.d.ts +4 -0
  164. package/dist/src/modules/validators/index.d.ts.map +1 -0
  165. package/dist/src/modules/validators/index.js +15 -0
  166. package/dist/src/modules/validators/smart-sessions.d.ts +96 -0
  167. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  168. package/dist/src/modules/validators/smart-sessions.js +497 -0
  169. package/dist/src/modules/validators/smart-sessions.test.d.ts +2 -0
  170. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +1 -0
  171. package/dist/src/modules/validators/smart-sessions.test.js +219 -0
  172. package/dist/src/orchestrator/client.d.ts +27 -0
  173. package/dist/src/orchestrator/client.d.ts.map +1 -0
  174. package/dist/src/orchestrator/client.js +354 -0
  175. package/dist/src/orchestrator/consts.d.ts +5 -0
  176. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  177. package/dist/src/orchestrator/consts.js +9 -0
  178. package/dist/src/orchestrator/error.d.ts +232 -0
  179. package/dist/src/orchestrator/error.d.ts.map +1 -0
  180. package/dist/src/orchestrator/error.js +268 -0
  181. package/dist/src/orchestrator/index.d.ts +10 -0
  182. package/dist/src/orchestrator/index.d.ts.map +1 -0
  183. package/dist/src/orchestrator/index.js +57 -0
  184. package/dist/src/orchestrator/registry.d.ts +22 -0
  185. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  186. package/dist/src/orchestrator/registry.js +121 -0
  187. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  188. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  189. package/dist/src/orchestrator/registry.test.js +150 -0
  190. package/dist/src/orchestrator/types.d.ts +295 -0
  191. package/dist/src/orchestrator/types.d.ts.map +1 -0
  192. package/dist/src/orchestrator/types.js +17 -0
  193. package/dist/src/orchestrator/utils.d.ts +3 -0
  194. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  195. package/dist/src/orchestrator/utils.js +24 -0
  196. package/dist/src/types.d.ts +284 -0
  197. package/dist/src/types.d.ts.map +1 -0
  198. package/dist/src/types.js +2 -0
  199. package/dist/src/utils/index.d.ts +26 -0
  200. package/dist/src/utils/index.d.ts.map +1 -0
  201. package/dist/src/utils/index.js +63 -0
  202. package/dist/test/consts.d.ts +10 -0
  203. package/dist/test/consts.d.ts.map +1 -0
  204. package/dist/test/consts.js +22 -0
  205. package/dist/test/utils/utils.d.ts +5 -0
  206. package/dist/test/utils/utils.d.ts.map +1 -0
  207. package/dist/test/utils/utils.js +20 -0
  208. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enable = enable;
4
+ exports.recoverEcdsaOwnership = recoverEcdsaOwnership;
5
+ exports.recoverPasskeyOwnership = recoverPasskeyOwnership;
6
+ const viem_1 = require("viem");
7
+ const accounts_1 = require("../accounts");
8
+ const json_rpc_1 = require("../accounts/json-rpc");
9
+ const utils_1 = require("../execution/utils");
10
+ const core_1 = require("../modules/validators/core");
11
+ const ecdsa_1 = require("./ecdsa");
12
+ const passkeys_1 = require("./passkeys");
13
+ /**
14
+ * Set up social recovery
15
+ * @param guardians Guardians to use for recovery
16
+ * @param threshold Threshold for the guardians
17
+ * @returns Calls to set up social recovery
18
+ */
19
+ function enable(guardians, threshold = 1) {
20
+ const module = (0, core_1.getSocialRecoveryValidator)(guardians, threshold);
21
+ return {
22
+ async resolve({ config }) {
23
+ return (0, accounts_1.getModuleInstallationCalls)(config, module);
24
+ },
25
+ };
26
+ }
27
+ /**
28
+ * Recover an account's ownership (ECDSA)
29
+ * @param address Account address
30
+ * @param newOwners New owners
31
+ * @param chain Chain to recover ownership on
32
+ * @param provider Provider to use for the recovery
33
+ * @returns Calls to recover ownership
34
+ */
35
+ async function recoverEcdsaOwnership(address, newOwners, chain, config) {
36
+ const publicClient = (0, viem_1.createPublicClient)({
37
+ chain,
38
+ transport: (0, json_rpc_1.createTransport)(chain, config.provider),
39
+ });
40
+ // Read the existing config
41
+ const results = await publicClient.multicall({
42
+ contracts: [
43
+ {
44
+ address: core_1.OWNABLE_VALIDATOR_ADDRESS,
45
+ abi: [
46
+ {
47
+ inputs: [
48
+ { internalType: 'address', name: 'account', type: 'address' },
49
+ ],
50
+ name: 'getOwners',
51
+ outputs: [
52
+ {
53
+ internalType: 'address[]',
54
+ name: 'ownersArray',
55
+ type: 'address[]',
56
+ },
57
+ ],
58
+ stateMutability: 'view',
59
+ type: 'function',
60
+ },
61
+ ],
62
+ functionName: 'getOwners',
63
+ args: [address],
64
+ },
65
+ {
66
+ address: core_1.OWNABLE_VALIDATOR_ADDRESS,
67
+ abi: [
68
+ {
69
+ inputs: [
70
+ { internalType: 'address', name: 'account', type: 'address' },
71
+ ],
72
+ name: 'threshold',
73
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
74
+ stateMutability: 'view',
75
+ type: 'function',
76
+ },
77
+ ],
78
+ functionName: 'threshold',
79
+ args: [address],
80
+ },
81
+ ],
82
+ });
83
+ const existingOwnersResult = results[0];
84
+ const existingThresholdResult = results[1];
85
+ if (existingOwnersResult.error || existingThresholdResult.error) {
86
+ throw new Error('Failed to read existing owners or threshold');
87
+ }
88
+ const existingOwners = existingOwnersResult.result;
89
+ const existingThreshold = existingThresholdResult.result;
90
+ const normalizedExistingOwners = existingOwners.map((owner) => owner.toLowerCase());
91
+ const callInputs = [];
92
+ // Convert new owners config to addresses and threshold
93
+ const newOwnerAddresses = newOwners.accounts
94
+ .map((account) => account.address.toLowerCase())
95
+ .sort();
96
+ const newThreshold = newOwners.threshold ?? 1;
97
+ // Check if threshold needs to be updated
98
+ if (Number(existingThreshold) !== newThreshold) {
99
+ callInputs.push((0, ecdsa_1.changeThreshold)(newThreshold));
100
+ }
101
+ const ownersToAdd = newOwnerAddresses.filter((owner) => !normalizedExistingOwners.includes(owner));
102
+ const ownersToRemove = normalizedExistingOwners.filter((owner) => !newOwnerAddresses.includes(owner));
103
+ // Maintain the list as making changes to keep track of the previous owner for removals
104
+ // Note: new owners are added to the START of the linked list
105
+ let currentOwners = [...normalizedExistingOwners];
106
+ for (const owner of ownersToAdd) {
107
+ callInputs.push((0, ecdsa_1.addOwner)(owner));
108
+ currentOwners.unshift(owner);
109
+ }
110
+ for (const ownerToRemove of ownersToRemove) {
111
+ const ownerIndex = currentOwners.indexOf(ownerToRemove);
112
+ let prevOwner;
113
+ if (ownerIndex === 0) {
114
+ // If it's the first owner, use the sentinel address
115
+ prevOwner = '0x0000000000000000000000000000000000000001';
116
+ }
117
+ else {
118
+ prevOwner = currentOwners[ownerIndex - 1];
119
+ }
120
+ callInputs.push((0, ecdsa_1.removeOwner)(prevOwner, ownerToRemove));
121
+ currentOwners = currentOwners.filter((owner) => owner !== ownerToRemove);
122
+ }
123
+ const calls = await (0, utils_1.resolveCallInputs)(callInputs, config, chain, address);
124
+ return calls;
125
+ }
126
+ /**
127
+ * Recover an account's ownership (Passkey)
128
+ * @param address Account address
129
+ * @param oldCredentials Old credentials to be replaced (with pubKeyX, pubKeyY)
130
+ * @param newOwners New passkey owners
131
+ * @param chain Chain to recover ownership on
132
+ * @param provider Provider to use for the recovery
133
+ * @returns Calls to recover ownership
134
+ */
135
+ async function recoverPasskeyOwnership(address, oldCredentials, newOwners, chain, config) {
136
+ const publicClient = (0, viem_1.createPublicClient)({
137
+ chain,
138
+ transport: (0, json_rpc_1.createTransport)(chain, config.provider),
139
+ });
140
+ const existingThreshold = await publicClient.readContract({
141
+ address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
142
+ abi: [
143
+ {
144
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
145
+ name: 'threshold',
146
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
147
+ stateMutability: 'view',
148
+ type: 'function',
149
+ },
150
+ ],
151
+ functionName: 'threshold',
152
+ args: [address],
153
+ });
154
+ const callInputs = [];
155
+ // Convert new owners config to credentials and threshold
156
+ const newCredentials = newOwners.accounts.map((account) => {
157
+ const publicKey = account.publicKey;
158
+ // Parse the public key hex string to extract x and y coordinates
159
+ const publicKeyBytes = publicKey.startsWith('0x')
160
+ ? publicKey.slice(2)
161
+ : publicKey;
162
+ // The public key is 64 bytes: 32 bytes for x, 32 bytes for y
163
+ const x = BigInt(`0x${publicKeyBytes.slice(0, 64)}`);
164
+ const y = BigInt(`0x${publicKeyBytes.slice(64, 128)}`);
165
+ return {
166
+ pubKeyX: x,
167
+ pubKeyY: y,
168
+ requireUV: false, // Default to false for now
169
+ };
170
+ });
171
+ const newThreshold = newOwners.threshold ?? 1;
172
+ // Check if threshold needs to be updated
173
+ if (Number(existingThreshold) !== newThreshold) {
174
+ callInputs.push((0, passkeys_1.changeThreshold)(newThreshold));
175
+ }
176
+ // Compare existing and new credentials to determine what to add/remove
177
+ const existingCredentialKeys = oldCredentials.map((cred) => `${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`);
178
+ const newCredentialKeys = newCredentials.map((cred) => `${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`);
179
+ // Find credentials to add (new ones not in existing)
180
+ const credentialsToAdd = newCredentials.filter((cred) => !existingCredentialKeys.includes(`${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`));
181
+ // Find credentials to remove (existing ones not in new)
182
+ const credentialsToRemove = oldCredentials.filter((cred) => !newCredentialKeys.includes(`${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`));
183
+ // Remove old credentials first (important for security in recovery scenarios)
184
+ for (const credential of credentialsToRemove) {
185
+ callInputs.push((0, passkeys_1.removeOwner)(credential.pubKeyX, credential.pubKeyY));
186
+ }
187
+ // Then add new credentials
188
+ for (const credential of credentialsToAdd) {
189
+ callInputs.push((0, passkeys_1.addOwner)(credential.pubKeyX, credential.pubKeyY, credential.requireUV));
190
+ }
191
+ const calls = await (0, utils_1.resolveCallInputs)(callInputs, config, chain, address);
192
+ return calls;
193
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=recovery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery.test.d.ts","sourceRoot":"","sources":["../../../actions/recovery.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const viem_1 = require("viem");
4
+ const chains_1 = require("viem/chains");
5
+ const vitest_1 = require("vitest");
6
+ const consts_1 = require("../../test/consts");
7
+ const __1 = require("..");
8
+ const utils_1 = require("../execution/utils");
9
+ const recovery_1 = require("./recovery");
10
+ const accountAddress = '0x36C03e7D593F7B2C6b06fC18B5f4E9a4A29C99b0';
11
+ // Mock viem
12
+ vitest_1.vi.mock('viem', async (importOriginal) => {
13
+ const actual = await importOriginal();
14
+ return {
15
+ // @ts-ignore
16
+ ...actual,
17
+ createPublicClient: vitest_1.vi.fn(),
18
+ };
19
+ });
20
+ (0, vitest_1.describe)('Recovery Actions', () => {
21
+ (0, vitest_1.describe)('Set Up Recovery', async () => {
22
+ const rhinestone = new __1.RhinestoneSDK();
23
+ const rhinestoneAccount = await rhinestone.createAccount({
24
+ owners: {
25
+ type: 'ecdsa',
26
+ accounts: [consts_1.accountA],
27
+ },
28
+ });
29
+ (0, vitest_1.test)('Single Guardian', async () => {
30
+ const calls = await (0, utils_1.resolveCallInputs)([(0, recovery_1.enable)([consts_1.accountB], 1)], rhinestoneAccount.config, chains_1.base, accountAddress);
31
+ (0, vitest_1.expect)(calls).toEqual([
32
+ {
33
+ to: accountAddress,
34
+ value: 0n,
35
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a04d053b3c8021e8d5bf641816c42daa75d8b597000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
36
+ },
37
+ ]);
38
+ });
39
+ (0, vitest_1.test)('Guardian Multi-Sig', async () => {
40
+ const calls = await (0, utils_1.resolveCallInputs)([(0, recovery_1.enable)([consts_1.accountB, consts_1.accountC, consts_1.accountD], 2)], rhinestoneAccount.config, chains_1.base, accountAddress);
41
+ (0, vitest_1.expect)(calls).toEqual([
42
+ {
43
+ to: accountAddress,
44
+ value: 0n,
45
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a04d053b3c8021e8d5bf641816c42daa75d8b597000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
46
+ },
47
+ ]);
48
+ });
49
+ });
50
+ (0, vitest_1.describe)('Recover', () => {
51
+ const rhinestone = new __1.RhinestoneSDK();
52
+ const accountPromise = rhinestone.createAccount({
53
+ owners: {
54
+ type: 'ecdsa',
55
+ accounts: [consts_1.accountA],
56
+ },
57
+ });
58
+ const mockPublicClient = {
59
+ readContract: vitest_1.vi.fn(),
60
+ multicall: vitest_1.vi.fn(),
61
+ };
62
+ (0, vitest_1.beforeEach)(() => {
63
+ const createPublicClientMock = viem_1.createPublicClient;
64
+ createPublicClientMock.mockReturnValue(mockPublicClient);
65
+ vitest_1.vi.clearAllMocks();
66
+ });
67
+ (0, vitest_1.test)('1/1 Owners - Single owner to different single owner', async () => {
68
+ const rhinestoneAccount = await accountPromise;
69
+ // Initial state
70
+ mockPublicClient.multicall.mockResolvedValueOnce([
71
+ { result: [consts_1.accountA.address.toLowerCase()], status: 'success' },
72
+ { result: 1n, status: 'success' },
73
+ ]);
74
+ const newOwners = {
75
+ type: 'ecdsa',
76
+ accounts: [consts_1.accountB],
77
+ threshold: 1,
78
+ };
79
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
80
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
81
+ (0, vitest_1.expect)(result).toEqual([
82
+ {
83
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
84
+ value: 0n,
85
+ data: '0x7065cb480000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
86
+ },
87
+ {
88
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
89
+ value: 0n,
90
+ data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
91
+ },
92
+ ]);
93
+ });
94
+ (0, vitest_1.test)('1/N Owners - Single owner to multiple owners', async () => {
95
+ const rhinestoneAccount = await accountPromise;
96
+ // Initial state
97
+ mockPublicClient.multicall.mockResolvedValueOnce([
98
+ {
99
+ result: [
100
+ consts_1.accountA.address.toLowerCase(),
101
+ consts_1.accountB.address.toLowerCase(),
102
+ consts_1.accountC.address.toLowerCase(),
103
+ ],
104
+ status: 'success',
105
+ },
106
+ { result: 1n, status: 'success' },
107
+ ]);
108
+ const newOwners = {
109
+ type: 'ecdsa',
110
+ accounts: [consts_1.accountB, consts_1.accountC, consts_1.accountD],
111
+ threshold: 1,
112
+ };
113
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
114
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
115
+ (0, vitest_1.expect)(result).toEqual([
116
+ {
117
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
118
+ value: 0n,
119
+ data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
120
+ },
121
+ {
122
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
123
+ value: 0n,
124
+ data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
125
+ },
126
+ ]);
127
+ });
128
+ (0, vitest_1.test)('M/N Owners - Multiple owners to different multiple owners', async () => {
129
+ const rhinestoneAccount = await accountPromise;
130
+ // Initial state
131
+ mockPublicClient.multicall.mockResolvedValueOnce([
132
+ {
133
+ result: [
134
+ consts_1.accountA.address.toLowerCase(),
135
+ consts_1.accountB.address.toLowerCase(),
136
+ consts_1.accountC.address.toLowerCase(),
137
+ ],
138
+ status: 'success',
139
+ },
140
+ { result: 2n, status: 'success' },
141
+ ]);
142
+ const newOwners = {
143
+ type: 'ecdsa',
144
+ accounts: [consts_1.accountB, consts_1.accountD],
145
+ threshold: 2,
146
+ };
147
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
148
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
149
+ (0, vitest_1.expect)(result).toEqual([
150
+ {
151
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
152
+ value: 0n,
153
+ data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
154
+ },
155
+ {
156
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
157
+ value: 0n,
158
+ data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
159
+ },
160
+ {
161
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
162
+ value: 0n,
163
+ data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596',
164
+ },
165
+ ]);
166
+ });
167
+ });
168
+ });
@@ -0,0 +1,14 @@
1
+ import type { Session } from '../types';
2
+ /**
3
+ * Enable a smart session
4
+ * @param session session to enable
5
+ * @returns Calls to enable the smart session
6
+ */
7
+ declare function enableSession(session: Session): {
8
+ resolve(): Promise<{
9
+ to: `0x${string}`;
10
+ data: `0x${string}`;
11
+ }>;
12
+ };
13
+ export { enableSession };
14
+ //# sourceMappingURL=smart-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;GAIG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,OAAO;;;;;EAMtC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enableSession = enableSession;
4
+ const smart_sessions_1 = require("../modules/validators/smart-sessions");
5
+ /**
6
+ * Enable a smart session
7
+ * @param session session to enable
8
+ * @returns Calls to enable the smart session
9
+ */
10
+ function enableSession(session) {
11
+ return {
12
+ async resolve() {
13
+ return (0, smart_sessions_1.getEnableSessionCall)(session);
14
+ },
15
+ };
16
+ }
@@ -0,0 +1,5 @@
1
+ import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
2
+ import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution';
3
+ import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
4
+ export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.SimulationFailedError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.EoaAccountMustHaveAccountError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
4
+ const accounts_1 = require("../accounts");
5
+ Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return accounts_1.AccountConfigurationNotSupportedError; } });
6
+ Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
7
+ Object.defineProperty(exports, "Eip712DomainNotAvailableError", { enumerable: true, get: function () { return accounts_1.Eip712DomainNotAvailableError; } });
8
+ Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
9
+ Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
10
+ Object.defineProperty(exports, "EoaAccountMustHaveAccountError", { enumerable: true, get: function () { return accounts_1.EoaAccountMustHaveAccountError; } });
11
+ Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
12
+ Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return accounts_1.FactoryArgsNotAvailableError; } });
13
+ Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return accounts_1.isAccountError; } });
14
+ Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
15
+ Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
16
+ Object.defineProperty(exports, "WalletClientNoConnectedAccountError", { enumerable: true, get: function () { return accounts_1.WalletClientNoConnectedAccountError; } });
17
+ const execution_1 = require("../execution");
18
+ Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
19
+ Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
20
+ Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
21
+ Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
22
+ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
23
+ Object.defineProperty(exports, "SignerNotSupportedError", { enumerable: true, get: function () { return execution_1.SignerNotSupportedError; } });
24
+ const orchestrator_1 = require("../orchestrator");
25
+ Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
26
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return orchestrator_1.BadRequestError; } });
27
+ Object.defineProperty(exports, "BodyParserError", { enumerable: true, get: function () { return orchestrator_1.BodyParserError; } });
28
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return orchestrator_1.ConflictError; } });
29
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return orchestrator_1.ForbiddenError; } });
30
+ Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
31
+ Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
32
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return orchestrator_1.InternalServerError; } });
33
+ Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
34
+ Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
35
+ Object.defineProperty(exports, "isAuthError", { enumerable: true, get: function () { return orchestrator_1.isAuthError; } });
36
+ Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
37
+ Object.defineProperty(exports, "isRateLimited", { enumerable: true, get: function () { return orchestrator_1.isRateLimited; } });
38
+ Object.defineProperty(exports, "isRetryable", { enumerable: true, get: function () { return orchestrator_1.isRetryable; } });
39
+ Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return orchestrator_1.isValidationError; } });
40
+ Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
41
+ Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
42
+ Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
43
+ Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: function () { return orchestrator_1.RateLimitedError; } });
44
+ Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return orchestrator_1.ResourceNotFoundError; } });
45
+ Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return orchestrator_1.SchemaValidationError; } });
46
+ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return orchestrator_1.ServiceUnavailableError; } });
47
+ Object.defineProperty(exports, "SimulationFailedError", { enumerable: true, get: function () { return orchestrator_1.SimulationFailedError; } });
48
+ Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
49
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return orchestrator_1.UnauthorizedError; } });
50
+ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return orchestrator_1.UnprocessableEntityError; } });
51
+ Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
52
+ Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
53
+ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
@@ -0,0 +1,151 @@
1
+ import { type Hex } from 'viem';
2
+ import type { IntentOp, IntentOpElement } from '../orchestrator/types';
3
+ declare const COMPACT_ADDRESS = "0x00000000000000171ede64904551eeDF3C6C9788";
4
+ declare function getCompactTypedData(intentOp: IntentOp): {
5
+ readonly domain: {
6
+ readonly name: "The Compact";
7
+ readonly version: "1";
8
+ readonly chainId: number;
9
+ readonly verifyingContract: "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
10
+ };
11
+ readonly types: {
12
+ readonly MultichainCompact: readonly [{
13
+ readonly name: "sponsor";
14
+ readonly type: "address";
15
+ }, {
16
+ readonly name: "nonce";
17
+ readonly type: "uint256";
18
+ }, {
19
+ readonly name: "expires";
20
+ readonly type: "uint256";
21
+ }, {
22
+ readonly name: "elements";
23
+ readonly type: "Element[]";
24
+ }];
25
+ readonly Element: readonly [{
26
+ readonly name: "arbiter";
27
+ readonly type: "address";
28
+ }, {
29
+ readonly name: "chainId";
30
+ readonly type: "uint256";
31
+ }, {
32
+ readonly name: "commitments";
33
+ readonly type: "Lock[]";
34
+ }, {
35
+ readonly name: "mandate";
36
+ readonly type: "Mandate";
37
+ }];
38
+ readonly Lock: readonly [{
39
+ readonly name: "lockTag";
40
+ readonly type: "bytes12";
41
+ }, {
42
+ readonly name: "token";
43
+ readonly type: "address";
44
+ }, {
45
+ readonly name: "amount";
46
+ readonly type: "uint256";
47
+ }];
48
+ readonly Mandate: readonly [{
49
+ readonly name: "target";
50
+ readonly type: "Target";
51
+ }, {
52
+ readonly name: "v";
53
+ readonly type: "uint8";
54
+ }, {
55
+ readonly name: "minGas";
56
+ readonly type: "uint128";
57
+ }, {
58
+ readonly name: "originOps";
59
+ readonly type: "Op[]";
60
+ }, {
61
+ readonly name: "destOps";
62
+ readonly type: "Op[]";
63
+ }, {
64
+ readonly name: "q";
65
+ readonly type: "bytes32";
66
+ }];
67
+ readonly Target: readonly [{
68
+ readonly name: "recipient";
69
+ readonly type: "address";
70
+ }, {
71
+ readonly name: "tokenOut";
72
+ readonly type: "Token[]";
73
+ }, {
74
+ readonly name: "targetChain";
75
+ readonly type: "uint256";
76
+ }, {
77
+ readonly name: "fillExpiry";
78
+ readonly type: "uint256";
79
+ }];
80
+ readonly Token: readonly [{
81
+ readonly name: "token";
82
+ readonly type: "address";
83
+ }, {
84
+ readonly name: "amount";
85
+ readonly type: "uint256";
86
+ }];
87
+ readonly Op: readonly [{
88
+ readonly name: "to";
89
+ readonly type: "address";
90
+ }, {
91
+ readonly name: "value";
92
+ readonly type: "uint256";
93
+ }, {
94
+ readonly name: "data";
95
+ readonly type: "bytes";
96
+ }];
97
+ };
98
+ readonly primaryType: "MultichainCompact";
99
+ readonly message: {
100
+ readonly sponsor: `0x${string}`;
101
+ readonly nonce: bigint;
102
+ readonly expires: bigint;
103
+ readonly elements: {
104
+ arbiter: `0x${string}`;
105
+ chainId: bigint;
106
+ commitments: {
107
+ lockTag: `0x${string}`;
108
+ token: `0x${string}`;
109
+ amount: bigint;
110
+ }[];
111
+ mandate: {
112
+ target: {
113
+ recipient: `0x${string}`;
114
+ tokenOut: {
115
+ token: `0x${string}`;
116
+ amount: bigint;
117
+ }[];
118
+ targetChain: bigint;
119
+ fillExpiry: bigint;
120
+ };
121
+ v: number;
122
+ minGas: bigint;
123
+ originOps: {
124
+ to: `0x${string}`;
125
+ value: bigint;
126
+ data: `0x${string}`;
127
+ }[];
128
+ destOps: {
129
+ to: `0x${string}`;
130
+ value: bigint;
131
+ data: `0x${string}`;
132
+ }[];
133
+ q: `0x${string}`;
134
+ };
135
+ }[];
136
+ };
137
+ };
138
+ /**
139
+ * Get the compact digest for signing
140
+ * @param intentOp The intent operation
141
+ * @returns The digest hash
142
+ */
143
+ declare function getCompactDigest(intentOp: IntentOp): Hex;
144
+ /**
145
+ * Get the Permit2 digest for signing
146
+ * @param intentOp The intent operation
147
+ * @returns The digest hash
148
+ */
149
+ declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
150
+ export { COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
151
+ //# sourceMappingURL=compact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGtE,QAAA,MAAM,eAAe,+CAA+C,CAAA;AA8CpE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD9C;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,GAAG,CAGL;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}