@charterlabs/rhinestone-sdk 0.2.7-dev.4 → 0.2.8

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 (63) hide show
  1. package/README.md +46 -8
  2. package/dist/src/accounts/index.d.ts +4 -1
  3. package/dist/src/accounts/index.d.ts.map +1 -1
  4. package/dist/src/accounts/index.js +36 -5
  5. package/dist/src/accounts/passport.d.ts +12 -0
  6. package/dist/src/accounts/passport.d.ts.map +1 -0
  7. package/dist/src/accounts/passport.js +173 -0
  8. package/dist/src/actions/smart-sessions.d.ts +23 -0
  9. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  10. package/dist/src/actions/{smart-session.js → smart-sessions.js} +13 -0
  11. package/dist/src/errors/index.d.ts +2 -2
  12. package/dist/src/errors/index.d.ts.map +1 -1
  13. package/dist/src/errors/index.js +16 -1
  14. package/dist/src/execution/compact.d.ts +3 -3
  15. package/dist/src/execution/compact.d.ts.map +1 -1
  16. package/dist/src/execution/compact.js +3 -3
  17. package/dist/src/execution/error.d.ts +8 -1
  18. package/dist/src/execution/error.d.ts.map +1 -1
  19. package/dist/src/execution/error.js +10 -1
  20. package/dist/src/execution/index.d.ts +3 -2
  21. package/dist/src/execution/index.d.ts.map +1 -1
  22. package/dist/src/execution/index.js +62 -9
  23. package/dist/src/execution/multiChainOps.d.ts +40 -0
  24. package/dist/src/execution/multiChainOps.d.ts.map +1 -0
  25. package/dist/src/execution/multiChainOps.js +39 -0
  26. package/dist/src/execution/permit2.d.ts +2 -2
  27. package/dist/src/execution/permit2.d.ts.map +1 -1
  28. package/dist/src/execution/permit2.js +28 -19
  29. package/dist/src/execution/smart-session.d.ts.map +1 -1
  30. package/dist/src/execution/smart-session.js +3 -3
  31. package/dist/src/execution/types.d.ts +2 -1
  32. package/dist/src/execution/types.d.ts.map +1 -1
  33. package/dist/src/execution/utils.d.ts +15 -8
  34. package/dist/src/execution/utils.d.ts.map +1 -1
  35. package/dist/src/execution/utils.js +88 -72
  36. package/dist/src/index.d.ts +7 -6
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +9 -21
  39. package/dist/src/modules/index.test.js +1 -1
  40. package/dist/src/modules/read.js +2 -2
  41. package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
  42. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  43. package/dist/src/modules/validators/smart-sessions.js +10 -72
  44. package/dist/src/modules/validators/smart-sessions.test.js +4 -5
  45. package/dist/src/orchestrator/client.d.ts +3 -2
  46. package/dist/src/orchestrator/client.d.ts.map +1 -1
  47. package/dist/src/orchestrator/client.js +217 -171
  48. package/dist/src/orchestrator/error.d.ts +111 -1
  49. package/dist/src/orchestrator/error.d.ts.map +1 -1
  50. package/dist/src/orchestrator/error.js +128 -1
  51. package/dist/src/orchestrator/index.d.ts +4 -4
  52. package/dist/src/orchestrator/index.d.ts.map +1 -1
  53. package/dist/src/orchestrator/index.js +16 -1
  54. package/dist/src/orchestrator/types.d.ts +30 -24
  55. package/dist/src/orchestrator/types.d.ts.map +1 -1
  56. package/dist/src/types.d.ts +12 -2
  57. package/dist/src/types.d.ts.map +1 -1
  58. package/dist/src/utils/index.d.ts +3 -0
  59. package/dist/src/utils/index.d.ts.map +1 -0
  60. package/dist/src/utils/index.js +5 -0
  61. package/package.json +1 -1
  62. package/dist/src/actions/smart-session.d.ts +0 -11
  63. package/dist/src/actions/smart-session.d.ts.map +0 -1
package/README.md CHANGED
@@ -26,12 +26,37 @@ bun install viem @rhinestone/sdk
26
26
 
27
27
  You'll need a Rhinestone API key, as well as an existing account with some testnet ETH on the source chain.
28
28
 
29
+ ### SDK Initialization
30
+
31
+ To initialize the SDK with your configuration:
32
+
33
+ ```ts
34
+ import { RhinestoneSDK } from '@rhinestone/sdk'
35
+
36
+ const sdk = new RhinestoneSDK({
37
+ apiKey: 'your-rhinestone-api-key',
38
+ // Optional: Provider configuration
39
+ provider: {
40
+ type: 'alchemy',
41
+ apiKey: 'your-alchemy-api-key',
42
+ },
43
+ // Optional: Bundler configuration
44
+ bundler: {
45
+ // the bundler settings
46
+ },
47
+ // Optional: Paymaster configuration
48
+ paymaster: {
49
+ // the paymaster settings
50
+ },
51
+ })
52
+ ```
53
+
29
54
  ### Creating a Wallet
30
55
 
31
56
  Let's create a smart account with a single owner:
32
57
 
33
58
  ```ts
34
- import { createRhinestoneAccount } from '@rhinestone/sdk'
59
+ import { RhinestoneSDK } from '@rhinestone/sdk'
35
60
  import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
36
61
  import { baseSepolia, arbitrumSepolia, optimismSepolia } from 'viem/chains'
37
62
  import {
@@ -63,12 +88,17 @@ const privateKey = generatePrivateKey()
63
88
  console.info(`Owner private key: ${privateKey}`)
64
89
  const account = privateKeyToAccount(privateKey)
65
90
 
66
- const rhinestoneAccount = await createRhinestoneAccount({
91
+ // Initialize the SDK
92
+ const sdk = new RhinestoneSDK({
93
+ apiKey: rhinestoneApiKey,
94
+ })
95
+
96
+ // Create the Rhinestone account
97
+ const rhinestoneAccount = await sdk.createAccount({
67
98
  owners: {
68
99
  type: 'ecdsa',
69
100
  accounts: [account],
70
- }
71
- rhinestoneApiKey,
101
+ },
72
102
  })
73
103
  const address = await rhinestoneAccount.getAddress()
74
104
  console.info(`Smart account address: ${address}`)
@@ -182,13 +212,21 @@ const session: Session = {
182
212
  During account initialization, provide the session you've just created. Make sure to also provide a bundler configuration.
183
213
 
184
214
  ```ts
185
- const rhinestoneAccount = await createRhinestoneAccount({
186
- //
187
- sessions: [session],
215
+ // Initialize the SDK with bundler configuration
216
+ const sdk = new RhinestoneSDK({
217
+ apiKey: rhinestoneApiKey,
188
218
  bundler: {
189
- //
219
+ // bundler configuration
190
220
  },
191
221
  })
222
+
223
+ const rhinestoneAccount = await sdk.createAccount({
224
+ owners: {
225
+ type: 'ecdsa',
226
+ accounts: [account],
227
+ },
228
+ sessions: [session],
229
+ })
192
230
  ```
193
231
 
194
232
  When making a transaction, specify the `signers` object to sign it with the session key:
@@ -25,7 +25,10 @@ declare function checkAddress(config: RhinestoneConfig): boolean;
25
25
  declare function getPackedSignature(config: RhinestoneConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
26
26
  declare function getTypedDataPackedSignature<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(config: RhinestoneConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, parameters: HashTypedDataParameters<typedData, primaryType>, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
27
27
  declare function isDeployed(config: RhinestoneConfig, chain: Chain): Promise<boolean>;
28
- declare function deploy(config: RhinestoneConfig, chain: Chain, session?: Session): Promise<boolean>;
28
+ declare function deploy(config: RhinestoneConfig, chain: Chain, params?: {
29
+ session?: Session;
30
+ sponsored?: boolean;
31
+ }): Promise<boolean>;
29
32
  declare function setup(config: RhinestoneConfig, chain: Chain): Promise<boolean>;
30
33
  declare function deployStandaloneWithEoa(chain: Chain, config: RhinestoneConfig, deployer: Account): Promise<void>;
31
34
  declare function toErc6492Signature(config: RhinestoneConfig, signature: Hex, chain: Chain): Promise<Hex>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,SAAS,EAEf,MAAM,MAAM,CAAA;AAWb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EACV,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,SAAS,EACV,MAAM,UAAU,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BAAgB,GAAG,qBAAqB,CAO3E;AAED,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EAEvB,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,8BAA8B,EAC9B,kCAAkC,EAClC,kCAAkC,EAClC,2BAA2B,EAC3B,wCAAwC,EACxC,4BAA4B,EAC5B,mCAAmC,EACnC,wBAAwB,EACxB,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,GACpC,CAAA"}
@@ -43,6 +43,7 @@ Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: tru
43
43
  Object.defineProperty(exports, "WalletClientNoConnectedAccountError", { enumerable: true, get: function () { return error_1.WalletClientNoConnectedAccountError; } });
44
44
  const kernel_1 = require("./kernel");
45
45
  const nexus_1 = require("./nexus");
46
+ const passport_1 = require("./passport");
46
47
  const safe_1 = require("./safe");
47
48
  const common_1 = require("./signing/common");
48
49
  const message_1 = require("./signing/message");
@@ -64,6 +65,17 @@ function getDeployArgs(config) {
64
65
  case 'startale': {
65
66
  return (0, startale_1.getDeployArgs)(config);
66
67
  }
68
+ case 'passport': {
69
+ // Mocked data; will be overridden by the actual deploy args
70
+ return {
71
+ factory: viem_1.zeroAddress,
72
+ factoryData: viem_1.zeroHash,
73
+ salt: viem_1.zeroHash,
74
+ implementation: viem_1.zeroAddress,
75
+ initializationCallData: '0x',
76
+ initData: '0x',
77
+ };
78
+ }
67
79
  case 'eoa': {
68
80
  throw new Error('EOA accounts do not have deploy args');
69
81
  }
@@ -146,6 +158,9 @@ function getModuleInstallationCalls(config, module) {
146
158
  case 'startale': {
147
159
  return [(0, startale_1.getInstallData)(module)];
148
160
  }
161
+ case 'passport': {
162
+ return [(0, passport_1.getInstallData)(module)];
163
+ }
149
164
  case 'eoa': {
150
165
  throw new error_1.ModuleInstallationNotSupportedError(account.type);
151
166
  }
@@ -209,6 +224,9 @@ function getAddress(config) {
209
224
  case 'startale': {
210
225
  return (0, startale_1.getAddress)(config);
211
226
  }
227
+ case 'passport': {
228
+ return (0, passport_1.getAddress)(config);
229
+ }
212
230
  case 'eoa': {
213
231
  if (!config.eoa) {
214
232
  throw new error_1.AccountError({
@@ -244,6 +262,10 @@ async function getPackedSignature(config, signers, chain, validator, hash, trans
244
262
  const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
245
263
  return (0, nexus_1.packSignature)(signature, validator, transformSignature, defaultValidatorAddress);
246
264
  }
265
+ case 'passport': {
266
+ const signature = await signFn(hash);
267
+ return (0, passport_1.packSignature)(signature, validator, transformSignature);
268
+ }
247
269
  case 'kernel': {
248
270
  const signature = await signFn((0, kernel_1.wrapMessageHash)(hash, address));
249
271
  return (0, kernel_1.packSignature)(signature, validator, transformSignature);
@@ -276,6 +298,10 @@ async function getTypedDataPackedSignature(config, signers, chain, validator, pa
276
298
  const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
277
299
  return (0, nexus_1.packSignature)(signature, validator, transformSignature, defaultValidatorAddress);
278
300
  }
301
+ case 'passport': {
302
+ const signature = await signFn(parameters);
303
+ return (0, passport_1.packSignature)(signature, validator, transformSignature);
304
+ }
279
305
  case 'kernel': {
280
306
  const address = getAddress(config);
281
307
  const signMessageFn = (hash) => (0, message_1.sign)(signers, chain, address, hash, false);
@@ -313,7 +339,7 @@ async function isDeployed(config, chain) {
313
339
  }
314
340
  return (0, viem_1.size)(code) > 0;
315
341
  }
316
- async function deploy(config, chain, session) {
342
+ async function deploy(config, chain, params) {
317
343
  const account = getAccountProvider(config);
318
344
  if (account.type === 'eoa') {
319
345
  return false;
@@ -327,10 +353,10 @@ async function deploy(config, chain, session) {
327
353
  await deployWithBundler(chain, config);
328
354
  }
329
355
  else {
330
- await deployWithIntent(chain, config);
356
+ await deployWithIntent(chain, config, params?.sponsored ?? false);
331
357
  }
332
- if (session) {
333
- await (0, smart_session_1.enableSmartSession)(chain, config, session);
358
+ if (params?.session) {
359
+ await (0, smart_session_1.enableSmartSession)(chain, config, params.session);
334
360
  }
335
361
  return true;
336
362
  }
@@ -398,7 +424,7 @@ async function setup(config, chain) {
398
424
  await (0, execution_1.waitForExecution)(config, result, true);
399
425
  return true;
400
426
  }
401
- async function deployWithIntent(chain, config) {
427
+ async function deployWithIntent(chain, config, sponsored) {
402
428
  const publicClient = (0, viem_1.createPublicClient)({
403
429
  chain,
404
430
  transport: (0, utils_1.createTransport)(chain, config.provider),
@@ -410,6 +436,7 @@ async function deployWithIntent(chain, config) {
410
436
  return;
411
437
  }
412
438
  const result = await (0, execution_1.sendTransaction)(config, {
439
+ sourceChains: [chain],
413
440
  targetChain: chain,
414
441
  calls: [
415
442
  {
@@ -417,6 +444,7 @@ async function deployWithIntent(chain, config) {
417
444
  data: '0x',
418
445
  },
419
446
  ],
447
+ sponsored,
420
448
  });
421
449
  await (0, execution_1.waitForExecution)(config, result, true);
422
450
  }
@@ -548,6 +576,9 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
548
576
  case 'kernel': {
549
577
  return (0, kernel_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
550
578
  }
579
+ case 'passport': {
580
+ return (0, passport_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
581
+ }
551
582
  case 'startale': {
552
583
  return (0, startale_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
553
584
  }
@@ -0,0 +1,12 @@
1
+ import type { Abi, Address, Hex, PublicClient } from 'viem';
2
+ import { SmartAccount, SmartAccountImplementation } from 'viem/account-abstraction';
3
+ import { Module } from '../modules/common';
4
+ import { EnableSessionData } from '../modules/validators/smart-sessions';
5
+ import type { RhinestoneAccountConfig, Session } from '../types';
6
+ import { ValidatorConfig } from './utils';
7
+ declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
8
+ declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
9
+ declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
10
+ declare function getInstallData(module: Module): `0x${string}`;
11
+ export { getAddress, packSignature, getSessionSmartAccount, getInstallData };
12
+ //# sourceMappingURL=passport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../../../accounts/passport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAW,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAWpE,OAAO,EAIL,YAAY,EACZ,0BAA0B,EAE3B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,OAAO,EACL,iBAAiB,EAIlB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAoC,eAAe,EAAE,MAAM,SAAS,CAAA;AAW3E,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAsBlD;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAuClC;AAmHD,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAddress = getAddress;
4
+ exports.packSignature = packSignature;
5
+ exports.getSessionSmartAccount = getSessionSmartAccount;
6
+ exports.getInstallData = getInstallData;
7
+ const viem_1 = require("viem");
8
+ const account_abstraction_1 = require("viem/account-abstraction");
9
+ const validators_1 = require("../modules/validators");
10
+ const smart_sessions_1 = require("../modules/validators/smart-sessions");
11
+ const utils_1 = require("./utils");
12
+ const CREATION_CODE = '0x6054600f3d396034805130553df3fe63906111273d3560e01c14602b57363d3d373d3d3d3d369030545af43d82803e156027573d90f35b3d90fd5b30543d5260203df3';
13
+ const PASSPORT_FACTORY_ADDRESS = '0xD70C6386Ca012CDeb249B4E46C53d3507D9CBB87';
14
+ const PASSPORT_MAIN_MODULE = '0x0d1Bf2f4Ab334324665aeb8d481fF92CdE289439';
15
+ function getAddress(config) {
16
+ const owners = config.owners;
17
+ if (!owners) {
18
+ throw new Error('Owners are required for passport');
19
+ }
20
+ if (owners.type !== 'ecdsa') {
21
+ throw new Error('Only ecdsa owners are supported for passport');
22
+ }
23
+ const ownerAccounts = owners.accounts.map((owner) => ({
24
+ weight: 1,
25
+ account: owner,
26
+ }));
27
+ const salt = encodeImageHash(owners.threshold ?? 1, ownerAccounts);
28
+ const accountInitData = (0, viem_1.padHex)(PASSPORT_MAIN_MODULE, { size: 32 });
29
+ const address = (0, viem_1.getContractAddress)({
30
+ opcode: 'CREATE2',
31
+ from: PASSPORT_FACTORY_ADDRESS,
32
+ salt,
33
+ bytecode: (0, viem_1.concat)([CREATION_CODE, accountInitData]),
34
+ });
35
+ return address;
36
+ }
37
+ async function packSignature(signature, validator, transformSignature = (signature) => signature) {
38
+ const validatorAddress = validator.address;
39
+ const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validatorAddress, transformSignature(signature)]);
40
+ return packedSig;
41
+ }
42
+ async function getSessionSmartAccount(client, address, session, validatorAddress, enableData, sign) {
43
+ return await getBaseSmartAccount(address, client, validatorAddress, async () => {
44
+ const dummyOpSignature = (0, validators_1.getMockSignature)(session.owners);
45
+ if (enableData) {
46
+ return (0, validators_1.encodeSmartSessionSignature)(smart_sessions_1.SMART_SESSION_MODE_ENABLE, (0, smart_sessions_1.getPermissionId)(session), dummyOpSignature, enableData);
47
+ }
48
+ return (0, validators_1.encodeSmartSessionSignature)(smart_sessions_1.SMART_SESSION_MODE_USE, (0, smart_sessions_1.getPermissionId)(session), dummyOpSignature);
49
+ }, async (hash) => {
50
+ const signature = await sign(hash);
51
+ if (enableData) {
52
+ return (0, validators_1.encodeSmartSessionSignature)(smart_sessions_1.SMART_SESSION_MODE_ENABLE, (0, smart_sessions_1.getPermissionId)(session), signature, enableData);
53
+ }
54
+ return (0, validators_1.encodeSmartSessionSignature)(smart_sessions_1.SMART_SESSION_MODE_USE, (0, smart_sessions_1.getPermissionId)(session), signature);
55
+ });
56
+ }
57
+ async function getBaseSmartAccount(address, client, nonceValidatorAddress, getStubSignature, signUserOperation) {
58
+ return await (0, account_abstraction_1.toSmartAccount)({
59
+ client,
60
+ entryPoint: {
61
+ abi: account_abstraction_1.entryPoint07Abi,
62
+ address: account_abstraction_1.entryPoint07Address,
63
+ version: '0.7',
64
+ },
65
+ async decodeCalls() {
66
+ throw new Error('Not implemented');
67
+ },
68
+ async encodeCalls(calls) {
69
+ return (0, utils_1.encode7579Calls)({
70
+ mode: {
71
+ type: calls.length > 1 ? 'batchcall' : 'call',
72
+ revertOnError: false,
73
+ selector: '0x',
74
+ context: '0x',
75
+ },
76
+ callData: calls,
77
+ });
78
+ },
79
+ async getAddress() {
80
+ return address;
81
+ },
82
+ async getFactoryArgs() {
83
+ return {};
84
+ },
85
+ async getNonce(args) {
86
+ const validatorAddress = nonceValidatorAddress;
87
+ const TIMESTAMP_ADJUSTMENT = 16777215n; // max value for size 3
88
+ const defaultedKey = (args?.key ?? 0n) % TIMESTAMP_ADJUSTMENT;
89
+ const defaultedValidationMode = '0x00';
90
+ const key = (0, viem_1.concat)([
91
+ (0, viem_1.toHex)(defaultedKey, { size: 3 }),
92
+ defaultedValidationMode,
93
+ validatorAddress,
94
+ ]);
95
+ return (0, utils_1.getAccountNonce)(client, {
96
+ address,
97
+ entryPointAddress: account_abstraction_1.entryPoint07Address,
98
+ key: BigInt(key),
99
+ });
100
+ },
101
+ async getStubSignature() {
102
+ return getStubSignature();
103
+ },
104
+ async signMessage() {
105
+ throw new Error('Not implemented');
106
+ },
107
+ async signTypedData() {
108
+ throw new Error('Not implemented');
109
+ },
110
+ async signUserOperation(parameters) {
111
+ const { chainId = client.chain?.id, ...userOperation } = parameters;
112
+ if (!chainId)
113
+ throw new Error('Chain id not found');
114
+ const hash = (0, account_abstraction_1.getUserOperationHash)({
115
+ userOperation: {
116
+ ...userOperation,
117
+ sender: userOperation.sender ?? (await this.getAddress()),
118
+ signature: '0x',
119
+ },
120
+ entryPointAddress: account_abstraction_1.entryPoint07Address,
121
+ entryPointVersion: '0.7',
122
+ chainId: chainId,
123
+ });
124
+ return await signUserOperation(hash);
125
+ },
126
+ });
127
+ }
128
+ function encodeImageHash(threshold, accounts) {
129
+ const sorted = accounts.sort((a, b) => a.account.address.toLowerCase() < b.account.address.toLowerCase() ? -1 : 1);
130
+ let imageHash = (0, viem_1.encodePacked)(['uint256'], [BigInt(threshold)]);
131
+ for (const account of sorted) {
132
+ imageHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
133
+ {
134
+ type: 'bytes32',
135
+ },
136
+ {
137
+ type: 'uint8',
138
+ },
139
+ {
140
+ type: 'address',
141
+ },
142
+ ], [imageHash, account.weight, account.account.address]));
143
+ }
144
+ return imageHash;
145
+ }
146
+ function getInstallData(module) {
147
+ return (0, viem_1.encodeFunctionData)({
148
+ abi: [
149
+ {
150
+ type: 'function',
151
+ name: 'installModule',
152
+ inputs: [
153
+ {
154
+ type: 'uint256',
155
+ name: 'moduleTypeId',
156
+ },
157
+ {
158
+ type: 'address',
159
+ name: 'module',
160
+ },
161
+ {
162
+ type: 'bytes',
163
+ name: 'initData',
164
+ },
165
+ ],
166
+ outputs: [],
167
+ stateMutability: 'nonpayable',
168
+ },
169
+ ],
170
+ functionName: 'installModule',
171
+ args: [module.type, module.address, module.initData],
172
+ });
173
+ }
@@ -0,0 +1,23 @@
1
+ import { type Hex } from 'viem';
2
+ import type { SessionDetails } from '../execution/smart-session';
3
+ import { Session } from '../types';
4
+ /**
5
+ * Enable a smart session
6
+ * @param session session to enable
7
+ * @returns Calls to enable the smart session
8
+ */
9
+ declare function enableSession(session: Session): {
10
+ resolve(): Promise<{
11
+ to: `0x${string}`;
12
+ data: `0x${string}`;
13
+ }>;
14
+ };
15
+ /**
16
+ * Encode a smart session signature
17
+ * @param sessionDetails Session details
18
+ * @param sessionSignature Session signature
19
+ * @returns Encoded smart session signature
20
+ */
21
+ declare function encodeSmartSessionSignature(sessionDetails: SessionDetails, sessionSignature: Hex): `0x${string}`;
22
+ export { enableSession, encodeSmartSessionSignature };
23
+ //# 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":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAKhE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC;;;;GAIG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,OAAO;;;;;EAMtC;AAED;;;;;GAKG;AACH,iBAAS,2BAA2B,CAClC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,GAAG,iBAQtB;AAED,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,CAAA"}
@@ -1,7 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enableSession = enableSession;
3
4
  exports.encodeSmartSessionSignature = encodeSmartSessionSignature;
4
5
  const smart_sessions_1 = require("../modules/validators/smart-sessions");
6
+ /**
7
+ * Enable a smart session
8
+ * @param session session to enable
9
+ * @returns Calls to enable the smart session
10
+ */
11
+ function enableSession(session) {
12
+ return {
13
+ async resolve() {
14
+ return (0, smart_sessions_1.getEnableSessionCall)(session);
15
+ },
16
+ };
17
+ }
5
18
  /**
6
19
  * Encode a smart session signature
7
20
  * @param sessionDetails Session details
@@ -1,5 +1,5 @@
1
1
  import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
2
2
  import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution';
3
- import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
4
- export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
3
+ import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
4
+ export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, 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, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,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,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,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,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,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,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,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,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = 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.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
3
+ exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = 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.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
4
4
  const accounts_1 = require("../accounts");
5
5
  Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return accounts_1.AccountConfigurationNotSupportedError; } });
6
6
  Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
@@ -21,15 +21,30 @@ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true,
21
21
  Object.defineProperty(exports, "SignerNotSupportedError", { enumerable: true, get: function () { return execution_1.SignerNotSupportedError; } });
22
22
  const orchestrator_1 = require("../orchestrator");
23
23
  Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
24
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return orchestrator_1.BadRequestError; } });
25
+ Object.defineProperty(exports, "BodyParserError", { enumerable: true, get: function () { return orchestrator_1.BodyParserError; } });
26
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return orchestrator_1.ConflictError; } });
27
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return orchestrator_1.ForbiddenError; } });
24
28
  Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
25
29
  Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
30
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return orchestrator_1.InternalServerError; } });
26
31
  Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
27
32
  Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
33
+ Object.defineProperty(exports, "isAuthError", { enumerable: true, get: function () { return orchestrator_1.isAuthError; } });
28
34
  Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
35
+ Object.defineProperty(exports, "isRateLimited", { enumerable: true, get: function () { return orchestrator_1.isRateLimited; } });
36
+ Object.defineProperty(exports, "isRetryable", { enumerable: true, get: function () { return orchestrator_1.isRetryable; } });
37
+ Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return orchestrator_1.isValidationError; } });
29
38
  Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
30
39
  Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
31
40
  Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
41
+ Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: function () { return orchestrator_1.RateLimitedError; } });
42
+ Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return orchestrator_1.ResourceNotFoundError; } });
43
+ Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return orchestrator_1.SchemaValidationError; } });
44
+ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return orchestrator_1.ServiceUnavailableError; } });
32
45
  Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
46
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return orchestrator_1.UnauthorizedError; } });
47
+ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return orchestrator_1.UnprocessableEntityError; } });
33
48
  Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
34
49
  Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
35
50
  Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
@@ -1,6 +1,6 @@
1
1
  import { type Hex } from 'viem';
2
- import type { IntentOp } from '../orchestrator/types';
3
- declare const COMPACT_ADDRESS = "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
2
+ import type { IntentOp, IntentOpElement } from '../orchestrator/types';
3
+ declare const COMPACT_ADDRESS = "0x00000000000000171ede64904551eeDF3C6C9788";
4
4
  declare function getCompactTypedData(intentOp: IntentOp): {
5
5
  readonly domain: {
6
6
  readonly name: "The Compact";
@@ -146,6 +146,6 @@ declare function getCompactDigest(intentOp: IntentOp): Hex;
146
146
  * @param intentOp The intent operation
147
147
  * @returns The digest hash
148
148
  */
149
- declare function getPermit2Digest(intentOp: IntentOp): Hex;
149
+ declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
150
150
  export { COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
151
151
  //# sourceMappingURL=compact.d.ts.map
@@ -1 +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,MAAM,uBAAuB,CAAA;AAGrD,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,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
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"}
@@ -6,7 +6,7 @@ exports.getCompactDigest = getCompactDigest;
6
6
  exports.getPermit2Digest = getPermit2Digest;
7
7
  const viem_1 = require("viem");
8
8
  const permit2_1 = require("./permit2");
9
- const COMPACT_ADDRESS = '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f';
9
+ const COMPACT_ADDRESS = '0x00000000000000171ede64904551eeDF3C6C9788';
10
10
  exports.COMPACT_ADDRESS = COMPACT_ADDRESS;
11
11
  // Define the typed data structure as const to preserve type safety
12
12
  const COMPACT_TYPED_DATA_TYPES = {
@@ -116,7 +116,7 @@ function getCompactDigest(intentOp) {
116
116
  * @param intentOp The intent operation
117
117
  * @returns The digest hash
118
118
  */
119
- function getPermit2Digest(intentOp) {
120
- const typedData = (0, permit2_1.getTypedData)(intentOp);
119
+ function getPermit2Digest(element, nonce, expires) {
120
+ const typedData = (0, permit2_1.getTypedData)(element, nonce, expires);
121
121
  return (0, viem_1.hashTypedData)(typedData);
122
122
  }
@@ -42,6 +42,13 @@ declare class IntentFailedError extends ExecutionError {
42
42
  traceId?: string;
43
43
  });
44
44
  }
45
+ declare class IntentStatusTimeoutError extends ExecutionError {
46
+ constructor(params?: {
47
+ context?: any;
48
+ errorType?: string;
49
+ traceId?: string;
50
+ });
51
+ }
45
52
  declare function isExecutionError(error: Error): error is ExecutionError;
46
- export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SignerNotSupportedError, };
53
+ export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
47
54
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;IAQD,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,QAEV;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,WAEV;CACF;AAED,cAAM,uBAAwB,SAAQ,cAAc;gBACtC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,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
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SignerNotSupportedError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.ExecutionError = void 0;
3
+ exports.SignerNotSupportedError = exports.IntentStatusTimeoutError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.ExecutionError = void 0;
4
4
  exports.isExecutionError = isExecutionError;
5
5
  class ExecutionError extends Error {
6
6
  _message;
@@ -64,6 +64,15 @@ class IntentFailedError extends ExecutionError {
64
64
  }
65
65
  }
66
66
  exports.IntentFailedError = IntentFailedError;
67
+ class IntentStatusTimeoutError extends ExecutionError {
68
+ constructor(params) {
69
+ super({
70
+ message: 'Intent status polling timed out',
71
+ ...params,
72
+ });
73
+ }
74
+ }
75
+ exports.IntentStatusTimeoutError = IntentStatusTimeoutError;
67
76
  function isExecutionError(error) {
68
77
  return error instanceof ExecutionError;
69
78
  }