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

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 (110) hide show
  1. package/README.md +46 -8
  2. package/dist/src/accounts/error.d.ts +4 -1
  3. package/dist/src/accounts/error.d.ts.map +1 -1
  4. package/dist/src/accounts/error.js +9 -1
  5. package/dist/src/accounts/index.d.ts +13 -3
  6. package/dist/src/accounts/index.d.ts.map +1 -1
  7. package/dist/src/accounts/index.js +62 -6
  8. package/dist/src/accounts/json-rpc/index.d.ts.map +1 -1
  9. package/dist/src/accounts/json-rpc/index.js +4 -0
  10. package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
  11. package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
  12. package/dist/src/accounts/json-rpc/index.test.js +33 -0
  13. package/dist/src/accounts/json-rpc/providers.d.ts +2 -1
  14. package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
  15. package/dist/src/accounts/json-rpc/providers.js +8 -0
  16. package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
  17. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
  18. package/dist/src/accounts/json-rpc/providers.test.js +43 -0
  19. package/dist/src/accounts/kernel.d.ts +9 -2
  20. package/dist/src/accounts/kernel.d.ts.map +1 -1
  21. package/dist/src/accounts/kernel.js +13 -0
  22. package/dist/src/accounts/nexus.d.ts +9 -2
  23. package/dist/src/accounts/nexus.d.ts.map +1 -1
  24. package/dist/src/accounts/nexus.js +15 -1
  25. package/dist/src/accounts/passport.d.ts +12 -0
  26. package/dist/src/accounts/passport.d.ts.map +1 -0
  27. package/dist/src/accounts/passport.js +173 -0
  28. package/dist/src/accounts/safe.d.ts +9 -2
  29. package/dist/src/accounts/safe.d.ts.map +1 -1
  30. package/dist/src/accounts/safe.js +15 -0
  31. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  32. package/dist/src/accounts/signing/common.js +26 -5
  33. package/dist/src/accounts/signing/message.js +1 -1
  34. package/dist/src/accounts/startale.d.ts +9 -2
  35. package/dist/src/accounts/startale.d.ts.map +1 -1
  36. package/dist/src/accounts/startale.js +15 -0
  37. package/dist/src/accounts/walletClient.d.ts +27 -0
  38. package/dist/src/accounts/walletClient.d.ts.map +1 -1
  39. package/dist/src/accounts/walletClient.js +77 -0
  40. package/dist/src/actions/smart-sessions.d.ts +14 -0
  41. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  42. package/dist/src/actions/smart-sessions.js +16 -0
  43. package/dist/src/errors/index.d.ts +3 -3
  44. package/dist/src/errors/index.d.ts.map +1 -1
  45. package/dist/src/errors/index.js +18 -1
  46. package/dist/src/execution/compact.d.ts +3 -3
  47. package/dist/src/execution/compact.d.ts.map +1 -1
  48. package/dist/src/execution/compact.js +3 -3
  49. package/dist/src/execution/error.d.ts +8 -1
  50. package/dist/src/execution/error.d.ts.map +1 -1
  51. package/dist/src/execution/error.js +10 -1
  52. package/dist/src/execution/index.d.ts +10 -4
  53. package/dist/src/execution/index.d.ts.map +1 -1
  54. package/dist/src/execution/index.js +85 -12
  55. package/dist/src/execution/permit2.d.ts +2 -2
  56. package/dist/src/execution/permit2.d.ts.map +1 -1
  57. package/dist/src/execution/permit2.js +28 -19
  58. package/dist/src/execution/singleChainOps.d.ts +28 -0
  59. package/dist/src/execution/singleChainOps.d.ts.map +1 -0
  60. package/dist/src/execution/singleChainOps.js +32 -0
  61. package/dist/src/execution/smart-session.d.ts +5 -7
  62. package/dist/src/execution/smart-session.d.ts.map +1 -1
  63. package/dist/src/execution/smart-session.js +114 -229
  64. package/dist/src/execution/types.d.ts +2 -1
  65. package/dist/src/execution/types.d.ts.map +1 -1
  66. package/dist/src/execution/utils.d.ts +16 -9
  67. package/dist/src/execution/utils.d.ts.map +1 -1
  68. package/dist/src/execution/utils.js +151 -76
  69. package/dist/src/index.d.ts +18 -19
  70. package/dist/src/index.d.ts.map +1 -1
  71. package/dist/src/index.js +22 -25
  72. package/dist/src/modules/index.d.ts.map +1 -1
  73. package/dist/src/modules/index.js +1 -1
  74. package/dist/src/modules/index.test.js +1 -1
  75. package/dist/src/modules/read.js +2 -2
  76. package/dist/src/modules/validators/core.d.ts +5 -3
  77. package/dist/src/modules/validators/core.d.ts.map +1 -1
  78. package/dist/src/modules/validators/core.js +39 -2
  79. package/dist/src/modules/validators/smart-sessions.d.ts +8 -8
  80. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  81. package/dist/src/modules/validators/smart-sessions.js +29 -80
  82. package/dist/src/modules/validators/smart-sessions.test.js +4 -5
  83. package/dist/src/orchestrator/client.d.ts +3 -2
  84. package/dist/src/orchestrator/client.d.ts.map +1 -1
  85. package/dist/src/orchestrator/client.js +230 -172
  86. package/dist/src/orchestrator/error.d.ts +137 -1
  87. package/dist/src/orchestrator/error.d.ts.map +1 -1
  88. package/dist/src/orchestrator/error.js +137 -1
  89. package/dist/src/orchestrator/index.d.ts +6 -6
  90. package/dist/src/orchestrator/index.d.ts.map +1 -1
  91. package/dist/src/orchestrator/index.js +19 -3
  92. package/dist/src/orchestrator/registry.d.ts +6 -2
  93. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  94. package/dist/src/orchestrator/registry.js +16 -64
  95. package/dist/src/orchestrator/registry.test.js +24 -24
  96. package/dist/src/orchestrator/types.d.ts +63 -43
  97. package/dist/src/orchestrator/types.d.ts.map +1 -1
  98. package/dist/src/orchestrator/types.js +9 -5
  99. package/dist/src/types.d.ts +42 -9
  100. package/dist/src/types.d.ts.map +1 -1
  101. package/dist/src/utils/index.d.ts +3 -0
  102. package/dist/src/utils/index.d.ts.map +1 -0
  103. package/dist/src/utils/index.js +5 -0
  104. package/package.json +4 -4
  105. package/dist/src/actions/smart-session.d.ts +0 -11
  106. package/dist/src/actions/smart-session.d.ts.map +0 -1
  107. package/dist/src/actions/smart-session.js +0 -13
  108. package/dist/src/execution/smart-session.test.d.ts +0 -2
  109. package/dist/src/execution/smart-session.test.d.ts.map +0 -1
  110. package/dist/src/execution/smart-session.test.js +0 -34
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEip712Domain = getEip712Domain;
3
4
  exports.getInstallData = getInstallData;
4
5
  exports.getAddress = getAddress;
5
6
  exports.getDefaultValidatorAddress = getDefaultValidatorAddress;
@@ -18,6 +19,7 @@ const core_1 = require("../modules/validators/core");
18
19
  const error_1 = require("./error");
19
20
  const utils_1 = require("./utils");
20
21
  const NEXUS_DEFAULT_VALIDATOR_ADDRESS = core_1.OWNABLE_VALIDATOR_ADDRESS;
22
+ const NEXUS_VERSION = '1.2.0';
21
23
  const NEXUS_IMPLEMENTATION_ADDRESS = '0x000000000032dDC454C3BDcba80484Ad5A798705';
22
24
  const NEXUS_FACTORY_ADDRESS = '0x0000000000679A258c64d2F20F310e12B64b7375';
23
25
  const NEXUS_BOOTSTRAP_ADDRESS = '0x00000000006eFb61D8c9546FF1B500de3f244EA7';
@@ -176,6 +178,18 @@ function getAddress(config) {
176
178
  });
177
179
  return address;
178
180
  }
181
+ function getEip712Domain(config, chain) {
182
+ if (config.initData) {
183
+ throw new error_1.Eip712DomainNotAvailableError('Existing Nexus accounts are not yet supported');
184
+ }
185
+ return {
186
+ name: 'Nexus',
187
+ version: NEXUS_VERSION,
188
+ chainId: chain.id,
189
+ verifyingContract: getAddress(config),
190
+ salt: viem_1.zeroHash,
191
+ };
192
+ }
179
193
  function getInstallData(module) {
180
194
  return (0, viem_1.encodeFunctionData)({
181
195
  abi: [
@@ -334,7 +348,7 @@ async function signEip7702InitData(config, eoa) {
334
348
  const signature = await eoa.signTypedData({
335
349
  domain: {
336
350
  name: 'Nexus',
337
- version: '1.2.0',
351
+ version: NEXUS_VERSION,
338
352
  },
339
353
  types: {
340
354
  Initialize: [
@@ -0,0 +1,12 @@
1
+ import type { Abi, Address, Hex, PublicClient } from 'viem';
2
+ import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
3
+ import type { Module } from '../modules/common';
4
+ import { type EnableSessionData } from '../modules/validators/smart-sessions';
5
+ import type { RhinestoneAccountConfig, Session } from '../types';
6
+ import { type 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,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK/C,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAWhF,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
+ }
@@ -1,4 +1,4 @@
1
- import { type Abi, type Address, type Hex, type PublicClient } from 'viem';
1
+ import { type Abi, type Address, type Chain, type Hex, type PublicClient } from 'viem';
2
2
  import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
3
3
  import type { Module } from '../modules/common';
4
4
  import type { EnableSessionData } from '../modules/validators/smart-sessions';
@@ -12,10 +12,17 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
12
12
  initializationCallData: null;
13
13
  };
14
14
  declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
15
+ declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
16
+ name: string;
17
+ version: string;
18
+ chainId: number;
19
+ verifyingContract: `0x${string}`;
20
+ salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
21
+ };
15
22
  declare function getInstallData(module: Module): `0x${string}`;
16
23
  declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
17
24
  declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
18
25
  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">>>;
19
26
  declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
20
- export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
27
+ export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
21
28
  //# sourceMappingURL=safe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAOZ,KAAK,GAAG,EAER,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAK1E,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAgBhF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EA4FrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,e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B,uBAAuB,GACxB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEip712Domain = getEip712Domain;
3
4
  exports.getInstallData = getInstallData;
4
5
  exports.getAddress = getAddress;
5
6
  exports.packSignature = packSignature;
@@ -111,6 +112,18 @@ function getAddress(config) {
111
112
  });
112
113
  return address;
113
114
  }
115
+ function getEip712Domain(config, chain) {
116
+ if (config.initData) {
117
+ throw new error_1.Eip712DomainNotAvailableError('Existing Safe-7579 accounts are not yet supported');
118
+ }
119
+ return {
120
+ name: 'rhinestone safe7579',
121
+ version: 'v1.0.0',
122
+ chainId: chain.id,
123
+ verifyingContract: getAddress(config),
124
+ salt: viem_1.zeroHash,
125
+ };
126
+ }
114
127
  function getInstallData(module) {
115
128
  return (0, viem_1.encodeFunctionData)({
116
129
  abi: [
@@ -240,6 +253,7 @@ function getOwners(config) {
240
253
  const ownerSet = config.owners;
241
254
  switch (ownerSet.type) {
242
255
  case 'ecdsa':
256
+ case 'ens':
243
257
  return ownerSet.accounts.map((account) => account.address);
244
258
  case 'passkey':
245
259
  return [NO_SAFE_OWNER_ADDRESS];
@@ -254,6 +268,7 @@ function getThreshold(config) {
254
268
  const ownerSet = config.owners;
255
269
  switch (ownerSet.type) {
256
270
  case 'ecdsa':
271
+ case 'ens':
257
272
  return ownerSet.threshold ? BigInt(ownerSet.threshold) : 1n;
258
273
  case 'passkey':
259
274
  return 1n;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACtC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAO/D,OAAO,KA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AAO,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,EAC1C,MAAM,EAAE,CAAC,EACT,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACpC,OAAO,CAAC,GAAG,CAAC,CAOd;AAED,iBAAe,cAAc,CAAC,CAAC,EAC7B,OAAO,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EACtC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,EACT,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACrC,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,CACR,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,OAAO,KAClB,OAAO,CAAC,GAAG,CAAC,GAChB,OAAO,CAAC,GAAG,CAAC,CA8Dd;AAED,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,KAAK,gBAAgB,GACtB,CAAA"}
@@ -16,7 +16,15 @@ function convertOwnerSetToSignerSet(owners) {
16
16
  type: 'owner',
17
17
  kind: 'ecdsa',
18
18
  accounts: owners.accounts,
19
- module: owners.module,
19
+ module: owners.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
20
+ };
21
+ }
22
+ case 'ens': {
23
+ return {
24
+ type: 'owner',
25
+ kind: 'ecdsa',
26
+ accounts: owners.accounts,
27
+ module: owners.module ?? core_1.ENS_VALIDATOR_ADDRESS,
20
28
  };
21
29
  }
22
30
  case 'passkey': {
@@ -38,7 +46,15 @@ function convertOwnerSetToSignerSet(owners) {
38
46
  type: validator.type,
39
47
  id: index,
40
48
  accounts: validator.accounts,
41
- module: validator.module,
49
+ module: validator.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
50
+ };
51
+ }
52
+ case 'ens': {
53
+ return {
54
+ type: 'ecdsa',
55
+ id: index,
56
+ accounts: validator.accounts,
57
+ module: validator.module ?? core_1.ENS_VALIDATOR_ADDRESS,
42
58
  };
43
59
  }
44
60
  case 'passkey': {
@@ -49,6 +65,9 @@ function convertOwnerSetToSignerSet(owners) {
49
65
  module: validator.module,
50
66
  };
51
67
  }
68
+ default: {
69
+ throw new Error(`Unsupported validator type: ${validator.type}`);
70
+ }
52
71
  }
53
72
  }),
54
73
  };
@@ -104,10 +123,12 @@ async function signWithOwners(signers, chain, address, params, signingFunctions,
104
123
  switch (signers.kind) {
105
124
  case 'ecdsa': {
106
125
  // Ownable validator uses `v` value to determine which validation mode to use
126
+ // ENS validator (based on Ownable) also uses the same signature format
107
127
  // This is not needed for UserOps
108
- const updateV = (!signers.module ||
109
- signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS) &&
110
- !isUserOpHash;
128
+ const isOwnableOrENS = !signers.module ||
129
+ signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS ||
130
+ signers.module?.toLowerCase() === core_1.ENS_VALIDATOR_ADDRESS;
131
+ const updateV = isOwnableOrENS && !isUserOpHash;
111
132
  const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signEcdsa(account, params, updateV)));
112
133
  return (0, viem_1.concat)(signatures);
113
134
  }
@@ -14,7 +14,7 @@ async function sign(signers, chain, address, hash, isUserOpHash) {
14
14
  return (0, common_1.signWithOwners)(signers, chain, address, hash, signingFunctions, isUserOpHash, sign);
15
15
  }
16
16
  case 'session': {
17
- return (0, common_1.signWithSession)(signers, chain, address, hash, isUserOpHash, sign);
17
+ return (0, common_1.signWithSession)(signers, chain, address, hash, false, sign);
18
18
  }
19
19
  case 'guardians': {
20
20
  return (0, common_1.signWithGuardians)(signers, hash, signingFunctions);
@@ -1,4 +1,4 @@
1
- import type { Address, Hex, PublicClient } from 'viem';
1
+ import type { Address, Chain, Hex, PublicClient } from 'viem';
2
2
  import type { Module } from '../modules/common';
3
3
  import type { EnableSessionData } from '../modules/validators/smart-sessions';
4
4
  import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
@@ -11,10 +11,17 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
11
11
  initializationCallData: `0x${string}`;
12
12
  };
13
13
  declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
14
+ declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
15
+ name: string;
16
+ version: string;
17
+ chainId: number;
18
+ verifyingContract: `0x${string}`;
19
+ salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
20
+ };
14
21
  declare function getInstallData(module: Module): `0x${string}`;
15
22
  declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
16
23
  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">>>;
17
24
  declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
18
25
  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">>>;
19
- export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
26
+ export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
20
27
  //# sourceMappingURL=startale.d.ts.map
@@ -1 +1 @@
1
- {"version":3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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,oKAWlC;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,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEip712Domain = getEip712Domain;
3
4
  exports.getInstallData = getInstallData;
4
5
  exports.getAddress = getAddress;
5
6
  exports.packSignature = packSignature;
@@ -9,8 +10,10 @@ exports.getSessionSmartAccount = getSessionSmartAccount;
9
10
  exports.getGuardianSmartAccount = getGuardianSmartAccount;
10
11
  const viem_1 = require("viem");
11
12
  const modules_1 = require("../modules");
13
+ const error_1 = require("./error");
12
14
  const nexus_1 = require("./nexus");
13
15
  const K1_DEFAULT_VALIDATOR_ADDRESS = '0x00000072f286204bb934ed49d8969e86f7dec7b1';
16
+ const STARTALE_VERSION = '1.0.0';
14
17
  const IMPLEMENTATION_ADDRESS = '0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a';
15
18
  const FACTORY_ADDRESS = '0x0000003B3E7b530b4f981aE80d9350392Defef90';
16
19
  const BOOTSTRAP_ADDRESS = '0x000000552A5fAe3Db7a8F3917C435448F49BA6a9';
@@ -83,6 +86,18 @@ function getAddress(config) {
83
86
  const address = (0, viem_1.slice)(hash, 12, 32);
84
87
  return address;
85
88
  }
89
+ function getEip712Domain(config, chain) {
90
+ if (config.initData) {
91
+ throw new error_1.Eip712DomainNotAvailableError('Existing Startale accounts are not yet supported');
92
+ }
93
+ return {
94
+ name: 'Startale',
95
+ version: STARTALE_VERSION,
96
+ chainId: chain.id,
97
+ verifyingContract: getAddress(config),
98
+ salt: viem_1.zeroHash,
99
+ };
100
+ }
86
101
  function getInstallData(module) {
87
102
  return (0, nexus_1.getInstallData)(module);
88
103
  }
@@ -4,4 +4,31 @@ import type { Account, WalletClient } from 'viem';
4
4
  * Ensures address is set and routes sign methods through the provided client.
5
5
  */
6
6
  export declare function walletClientToAccount(walletClient: WalletClient): Account;
7
+ /**
8
+ * Wraps a Para viem account with custom signing for Rhinestone compatibility.
9
+ *
10
+ * Para's MPC signatures use 0/1 v-byte recovery, but Rhinestone/Smart wallets
11
+ * expect 27/28 v-byte recovery. This wrapper adjusts Para signatures automatically.
12
+ *
13
+ * @param viemAccount - The Para viem account to wrap
14
+ * @param walletId - Optional wallet ID for Para signing operations
15
+ * @returns Account compatible with Rhinestone SDK
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const paraAccount = // ... Para viem account
20
+ * const wrappedAccount = wrapParaAccount(paraAccount, wallet.id)
21
+ *
22
+ * const rhinestoneAccount = await rhinestone.createAccount({
23
+ * owners: {
24
+ * type: "ecdsa",
25
+ * accounts: [wrappedAccount],
26
+ * },
27
+ * })
28
+ *
29
+ * // Also works for EIP-7702 (signAuthorization uses original 0/1 v-byte)
30
+ * const authorization = await wrappedAccount.signAuthorization?.({ ... })
31
+ * ```
32
+ */
33
+ export declare function wrapParaAccount(viemAccount: Account, walletId?: string): Account;
7
34
  //# sourceMappingURL=walletClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA2CzE"}
1
+ {"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA2CzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,OAAO,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAsCT"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.walletClientToAccount = walletClientToAccount;
4
+ exports.wrapParaAccount = wrapParaAccount;
4
5
  const error_1 = require("./error");
5
6
  /**
6
7
  * Adapts a Viem/Wagmi WalletClient into an Account-like signer that the SDK can consume.
@@ -36,3 +37,79 @@ function walletClientToAccount(walletClient) {
36
37
  };
37
38
  return account;
38
39
  }
40
+ /**
41
+ * Wraps a Para viem account with custom signing for Rhinestone compatibility.
42
+ *
43
+ * Para's MPC signatures use 0/1 v-byte recovery, but Rhinestone/Smart wallets
44
+ * expect 27/28 v-byte recovery. This wrapper adjusts Para signatures automatically.
45
+ *
46
+ * @param viemAccount - The Para viem account to wrap
47
+ * @param walletId - Optional wallet ID for Para signing operations
48
+ * @returns Account compatible with Rhinestone SDK
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const paraAccount = // ... Para viem account
53
+ * const wrappedAccount = wrapParaAccount(paraAccount, wallet.id)
54
+ *
55
+ * const rhinestoneAccount = await rhinestone.createAccount({
56
+ * owners: {
57
+ * type: "ecdsa",
58
+ * accounts: [wrappedAccount],
59
+ * },
60
+ * })
61
+ *
62
+ * // Also works for EIP-7702 (signAuthorization uses original 0/1 v-byte)
63
+ * const authorization = await wrappedAccount.signAuthorization?.({ ... })
64
+ * ```
65
+ */
66
+ function wrapParaAccount(viemAccount, walletId) {
67
+ // Store the wallet ID for signing operations (for debugging purposes)
68
+ const effectiveWalletId = walletId || viemAccount.walletId || viemAccount._walletId;
69
+ // Store reference for potential debugging
70
+ if (effectiveWalletId) {
71
+ ;
72
+ viemAccount._paraWalletId = effectiveWalletId;
73
+ }
74
+ return {
75
+ ...viemAccount,
76
+ // Override signMessage to adjust v-byte for smart wallet compatibility
77
+ signMessage: async ({ message }) => {
78
+ if (!viemAccount.signMessage) {
79
+ throw new Error('Account does not support signMessage');
80
+ }
81
+ const originalSignature = await viemAccount.signMessage({ message });
82
+ return adjustVByte(originalSignature);
83
+ },
84
+ // Override signTypedData to adjust v-byte for smart wallet compatibility
85
+ signTypedData: async (typedData) => {
86
+ if (!viemAccount.signTypedData) {
87
+ throw new Error('Account does not support signTypedData');
88
+ }
89
+ const originalSignature = await viemAccount.signTypedData(typedData);
90
+ return adjustVByte(originalSignature);
91
+ },
92
+ // Keep signAuthorization as is for EIP-7702
93
+ signAuthorization: viemAccount.signAuthorization
94
+ ? viemAccount.signAuthorization.bind(viemAccount)
95
+ : undefined,
96
+ };
97
+ }
98
+ /**
99
+ * Adjusts the v-byte in a signature from Para's 0/1 format to Ethereum's 27/28 format.
100
+ * @internal
101
+ */
102
+ function adjustVByte(signature) {
103
+ const V_OFFSET_FOR_ETHEREUM = 27;
104
+ const cleanSig = signature.startsWith('0x') ? signature.slice(2) : signature;
105
+ const r = cleanSig.slice(0, 64);
106
+ const s = cleanSig.slice(64, 128);
107
+ let v = parseInt(cleanSig.slice(128, 130), 16);
108
+ if (v < 27) {
109
+ v += V_OFFSET_FOR_ETHEREUM;
110
+ }
111
+ const adjustedSignature = `0x${r}${s}${v
112
+ .toString(16)
113
+ .padStart(2, '0')}`;
114
+ return adjustedSignature;
115
+ }
@@ -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
+ }
@@ -1,5 +1,5 @@
1
- import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
1
+ import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, 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, SimulationFailedError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
4
+ export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, 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, SimulationFailedError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
5
5
  //# sourceMappingURL=index.d.ts.map