@charterlabs/rhinestone-sdk 0.3.0 → 0.3.2

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 (129) hide show
  1. package/README.md +31 -200
  2. package/dist/src/accounts/error.d.ts +8 -1
  3. package/dist/src/accounts/error.d.ts.map +1 -1
  4. package/dist/src/accounts/error.js +10 -1
  5. package/dist/src/accounts/index.d.ts +11 -10
  6. package/dist/src/accounts/index.d.ts.map +1 -1
  7. package/dist/src/accounts/index.js +79 -50
  8. package/dist/src/accounts/kernel.d.ts +3 -5
  9. package/dist/src/accounts/kernel.d.ts.map +1 -1
  10. package/dist/src/accounts/kernel.js +8 -17
  11. package/dist/src/accounts/kernel.test.js +10 -3
  12. package/dist/src/accounts/nexus.d.ts +3 -5
  13. package/dist/src/accounts/nexus.d.ts.map +1 -1
  14. package/dist/src/accounts/nexus.js +108 -57
  15. package/dist/src/accounts/nexus.test.js +10 -3
  16. package/dist/src/accounts/passport.d.ts +4 -7
  17. package/dist/src/accounts/passport.d.ts.map +1 -1
  18. package/dist/src/accounts/passport.js +0 -91
  19. package/dist/src/accounts/safe.d.ts +9 -4
  20. package/dist/src/accounts/safe.d.ts.map +1 -1
  21. package/dist/src/accounts/safe.js +108 -38
  22. package/dist/src/accounts/safe.test.js +10 -3
  23. package/dist/src/accounts/signing/common.d.ts +3 -3
  24. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  25. package/dist/src/accounts/signing/common.js +29 -5
  26. package/dist/src/accounts/signing/message.js +2 -2
  27. package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
  28. package/dist/src/accounts/signing/typedData.js +3 -3
  29. package/dist/src/accounts/startale.d.ts +2 -4
  30. package/dist/src/accounts/startale.d.ts.map +1 -1
  31. package/dist/src/accounts/startale.js +0 -4
  32. package/dist/src/accounts/utils.d.ts.map +1 -1
  33. package/dist/src/accounts/utils.js +10 -3
  34. package/dist/src/accounts/walletClient.d.ts.map +1 -1
  35. package/dist/src/accounts/walletClient.js +6 -0
  36. package/dist/src/actions/compact.d.ts +4 -2
  37. package/dist/src/actions/compact.d.ts.map +1 -1
  38. package/dist/src/actions/compact.js +4 -1
  39. package/dist/src/actions/deployment.d.ts +19 -0
  40. package/dist/src/actions/deployment.d.ts.map +1 -0
  41. package/dist/src/actions/deployment.js +78 -0
  42. package/dist/src/actions/index.d.ts +3 -1
  43. package/dist/src/actions/index.d.ts.map +1 -1
  44. package/dist/src/actions/index.js +12 -0
  45. package/dist/src/actions/smart-sessions.d.ts +17 -8
  46. package/dist/src/actions/smart-sessions.d.ts.map +1 -1
  47. package/dist/src/actions/smart-sessions.js +40 -4
  48. package/dist/src/errors/index.d.ts +3 -3
  49. package/dist/src/errors/index.d.ts.map +1 -1
  50. package/dist/src/errors/index.js +3 -1
  51. package/dist/src/execution/compact.d.ts +15 -18
  52. package/dist/src/execution/compact.d.ts.map +1 -1
  53. package/dist/src/execution/compact.js +15 -17
  54. package/dist/src/execution/error.d.ts +2 -8
  55. package/dist/src/execution/error.d.ts.map +1 -1
  56. package/dist/src/execution/error.js +1 -10
  57. package/dist/src/execution/index.d.ts +6 -6
  58. package/dist/src/execution/index.d.ts.map +1 -1
  59. package/dist/src/execution/index.js +22 -28
  60. package/dist/src/execution/permit2.d.ts +12 -17
  61. package/dist/src/execution/permit2.d.ts.map +1 -1
  62. package/dist/src/execution/permit2.js +10 -16
  63. package/dist/src/execution/singleChainOps.d.ts +15 -3
  64. package/dist/src/execution/singleChainOps.d.ts.map +1 -1
  65. package/dist/src/execution/singleChainOps.js +17 -3
  66. package/dist/src/execution/utils.d.ts +36 -12
  67. package/dist/src/execution/utils.d.ts.map +1 -1
  68. package/dist/src/execution/utils.js +180 -133
  69. package/dist/src/index.d.ts +26 -8
  70. package/dist/src/index.d.ts.map +1 -1
  71. package/dist/src/index.js +49 -16
  72. package/dist/src/modules/abi/smart-session-emissary.d.ts +696 -0
  73. package/dist/src/modules/abi/smart-session-emissary.d.ts.map +1 -0
  74. package/dist/src/modules/abi/smart-session-emissary.js +565 -0
  75. package/dist/src/modules/chain-abstraction.d.ts +5 -0
  76. package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
  77. package/dist/src/modules/chain-abstraction.js +7 -0
  78. package/dist/src/modules/common.d.ts +7 -1
  79. package/dist/src/modules/common.d.ts.map +1 -1
  80. package/dist/src/modules/index.d.ts +3 -9
  81. package/dist/src/modules/index.d.ts.map +1 -1
  82. package/dist/src/modules/index.js +11 -8
  83. package/dist/src/modules/index.test.js +3 -9
  84. package/dist/src/modules/legacy.d.ts +10 -0
  85. package/dist/src/modules/legacy.d.ts.map +1 -0
  86. package/dist/src/modules/legacy.js +65 -0
  87. package/dist/src/modules/validators/core.d.ts +2 -1
  88. package/dist/src/modules/validators/core.d.ts.map +1 -1
  89. package/dist/src/modules/validators/core.js +4 -1
  90. package/dist/src/modules/validators/index.d.ts +2 -2
  91. package/dist/src/modules/validators/index.d.ts.map +1 -1
  92. package/dist/src/modules/validators/index.js +1 -6
  93. package/dist/src/modules/validators/smart-sessions.d.ts +112 -23
  94. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  95. package/dist/src/modules/validators/smart-sessions.js +426 -301
  96. package/dist/src/orchestrator/client.d.ts +3 -4
  97. package/dist/src/orchestrator/client.d.ts.map +1 -1
  98. package/dist/src/orchestrator/client.js +49 -53
  99. package/dist/src/orchestrator/error.d.ts +11 -1
  100. package/dist/src/orchestrator/error.d.ts.map +1 -1
  101. package/dist/src/orchestrator/error.js +16 -1
  102. package/dist/src/orchestrator/index.d.ts +5 -5
  103. package/dist/src/orchestrator/index.d.ts.map +1 -1
  104. package/dist/src/orchestrator/index.js +3 -1
  105. package/dist/src/orchestrator/registry.d.ts +3 -2
  106. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  107. package/dist/src/orchestrator/registry.js +15 -14
  108. package/dist/src/orchestrator/registry.test.js +18 -1
  109. package/dist/src/orchestrator/types.d.ts +33 -8
  110. package/dist/src/orchestrator/types.d.ts.map +1 -1
  111. package/dist/src/orchestrator/types.js +15 -1
  112. package/dist/src/types.d.ts +57 -28
  113. package/dist/src/types.d.ts.map +1 -1
  114. package/dist/src/utils/index.d.ts +14 -2
  115. package/dist/src/utils/index.d.ts.map +1 -1
  116. package/dist/src/utils/index.js +46 -4
  117. package/dist/test/utils/utils.d.ts +5 -0
  118. package/dist/test/utils/utils.d.ts.map +1 -0
  119. package/dist/test/utils/utils.js +20 -0
  120. package/package.json +33 -3
  121. package/dist/src/execution/smart-session.d.ts +0 -13
  122. package/dist/src/execution/smart-session.d.ts.map +0 -1
  123. package/dist/src/execution/smart-session.js +0 -178
  124. package/dist/src/modules/omni-account.d.ts +0 -8
  125. package/dist/src/modules/omni-account.d.ts.map +0 -1
  126. package/dist/src/modules/omni-account.js +0 -13
  127. package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
  128. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
  129. package/dist/src/modules/validators/smart-sessions.test.js +0 -222
package/README.md CHANGED
@@ -1,245 +1,76 @@
1
1
  # Rhinestone SDK
2
2
 
3
- End-to-end chain abstraction and modularity toolkit
3
+ > End-to-end chain abstraction and modularity toolkit
4
4
 
5
- ## Usage
5
+ Rhinestone is a vertically integrated smart wallet and crosschain liquidity platform. The SDK provides a unified interface for deploying and managing self-custodial smart accounts, powered by an intent-based transaction infrastructure that enables seamless crosschain execution without bridging or gas tokens.
6
6
 
7
- ### Installation
7
+ The platform combines modular [smart account tooling](https://docs.rhinestone.dev/smart-wallet/core/create-account) with an intent engine ([Warp](https://docs.rhinestone.dev/home/introduction/rhinestone-intents)) that aggregates settlement layers through a unified relayer market. This handles routing, token liquidity, and crosschain orchestration across all [supported chains](https://docs.rhinestone.dev/home/resources/supported-chains).
8
8
 
9
- ```bash
10
- npm install viem @rhinestone/sdk
11
- ```
9
+ [Documentation](https://docs.rhinestone.dev)
12
10
 
13
- ```bash
14
- pnpm install viem @rhinestone/sdk
15
- ```
11
+ ## Features
16
12
 
17
- ```bash
18
- yarn add viem @rhinestone/sdk
19
- ```
20
13
 
21
- ```bash
22
- bun install viem @rhinestone/sdk
23
- ```
14
+ - **Crosschain Transactions** - Execute transactions on any target chain using assets from any source chain. The orchestrator handles routing and settlement. [Learn more](https://docs.rhinestone.dev/smart-wallet/chain-abstraction/multi-chain-intent)
24
15
 
25
- ## Quickstart
16
+ - **Swaps** - Token exchanges via solver-based swaps or injected DEX aggregator swaps, integrated into crosschain transaction execution. [Learn more](https://docs.rhinestone.dev/smart-wallet/chain-abstraction/swaps)
26
17
 
27
- You'll need a Rhinestone API key, as well as an existing account with some testnet ETH on the source chain.
18
+ - **Passkeys** - WebAuthn-based authentication for smart accounts, replacing seed phrases with device biometrics. [Learn more](https://docs.rhinestone.dev/smart-wallet/core/passkeys)
28
19
 
29
- ### SDK Initialization
20
+ - **Smart Sessions** - Onchain permissions system for scoped transaction automation, enabling one-click UX and server-side execution with granular policies. [Learn more](https://docs.rhinestone.dev/smart-wallet/smart-sessions/overview)
30
21
 
31
- To initialize the SDK with your configuration:
22
+ - **Gas Sponsorship** - Subsidize gas, bridge, and swap fees for users by depositing USDC on Base. Applies across all supported chains. [Learn more](https://docs.rhinestone.dev/smart-wallet/gas-sponsorship/overview)
32
23
 
33
- ```ts
34
- import { RhinestoneSDK } from '@rhinestone/sdk'
24
+ ## Installation
35
25
 
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
- })
26
+ ```bash
27
+ npm install viem @rhinestone/sdk
28
+ ```
29
+
30
+ ```bash
31
+ bun install viem @rhinestone/sdk
52
32
  ```
53
33
 
54
- ### Creating a Wallet
34
+ ## Quickstart
55
35
 
56
- Let's create a smart account with a single owner:
36
+ Create a smart account:
57
37
 
58
38
  ```ts
59
39
  import { RhinestoneSDK } from '@rhinestone/sdk'
60
- import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
61
- import { baseSepolia, arbitrumSepolia, optimismSepolia } from 'viem/chains'
62
- import {
63
- Chain,
64
- createPublicClient,
65
- createWalletClient,
66
- encodeFunctionData,
67
- erc20Abi,
68
- Hex,
69
- http,
70
- parseEther,
71
- } from 'viem'
72
-
73
- const fundingPrivateKey = process.env.FUNDING_PRIVATE_KEY
74
- if (!fundingPrivateKey) {
75
- throw new Error('FUNDING_PRIVATE_KEY is not set')
76
- }
77
-
78
- const rhinestoneApiKey = process.env.RHINESTONE_API_KEY
79
- if (!rhinestoneApiKey) {
80
- throw new Error('RHINESTONE_API_KEY is not set')
81
- }
82
-
83
- const sourceChain = baseSepolia
84
- const targetChain = arbitrumSepolia
85
-
86
- // You can use an existing PK here
87
- const privateKey = generatePrivateKey()
88
- console.info(`Owner private key: ${privateKey}`)
89
- const account = privateKeyToAccount(privateKey)
90
-
91
- // Initialize the SDK
92
- const sdk = new RhinestoneSDK({
93
- apiKey: rhinestoneApiKey,
94
- })
95
40
 
96
- // Create the Rhinestone account
97
- const rhinestoneAccount = await sdk.createAccount({
41
+ const rhinestone = new RhinestoneSDK()
42
+ const account = await rhinestone.createAccount({
98
43
  owners: {
99
44
  type: 'ecdsa',
100
- accounts: [account],
45
+ accounts: [signer],
101
46
  },
102
47
  })
103
- const address = await rhinestoneAccount.getAddress()
104
- console.info(`Smart account address: ${address}`)
105
- ```
106
-
107
- ### Funding the Account
108
-
109
- We will send some ETH from the funding account to the created smart account. The Orchestrator will use some of that ETH to deploy the account on the target chain, as well as to convert it to USDC for a transfer transaction.
110
-
111
- ```ts
112
- const publicClient = createPublicClient({
113
- chain: sourceChain,
114
- transport: http(),
115
- });
116
- const fundingAccount = privateKeyToAccount(fundingPrivateKey as Hex);
117
- const fundingClient = createWalletClient({
118
- account: fundingAccount,
119
- chain: sourceChain,
120
- transport: http(),
121
- });
122
-
123
- const txHash = await fundingClient.sendTransaction({
124
- to: address,
125
- value: parseEther('0.001'),
126
- });
127
- await publicClient.waitForTransactionReceipt({ hash: txHash });
128
48
  ```
129
49
 
130
- ### Sending a Cross-chain Transaction
131
-
132
- Finally, let's make a cross-chain token transfer:
50
+ Send a crosschain transaction:
133
51
 
134
52
  ```ts
135
- const usdcTarget = '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';
136
- const usdcAmount = 1n;
137
-
138
- const transaction = await rhinestoneAccount.sendTransaction({
139
- sourceChain,
140
- targetChain,
53
+ const transaction = await account.sendTransaction({
54
+ sourceChains: [baseSepolia],
55
+ targetChain: arbitrumSepolia,
141
56
  calls: [
142
57
  {
143
- to: usdcTarget,
58
+ to: 'USDC',
144
59
  value: 0n,
145
60
  data: encodeFunctionData({
146
61
  abi: erc20Abi,
147
62
  functionName: 'transfer',
148
- args: ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045', usdcAmount],
63
+ args: [recipient, amount],
149
64
  }),
150
65
  },
151
66
  ],
152
- tokenRequests: [
153
- {
154
- address: usdcTarget,
155
- amount: usdcAmount,
156
- },
157
- ],
158
- });
159
- console.info('Transaction', transaction);
160
-
161
- const transactionResult = await rhinestoneAccount.waitForExecution(transaction);
162
- console.info('Result', transactionResult);
163
- ```
164
-
165
- After running that, you will get a smart account deployed on both Base Sepolia and Arbitrum Sepolia, and make a cross-chain USDC transfer.
166
-
167
- ### Using Smart Sessions
168
-
169
- First, define a session you want to use:
170
-
171
- ```ts
172
- const session: Session = {
173
- owners: {
174
- type: 'ecdsa',
175
- accounts: [sessionOwner],
176
- },
177
- actions: [
178
- {
179
- target: wethAddress,
180
- selector: toFunctionSelector(
181
- getAbiItem({
182
- abi: wethAbi,
183
- name: 'deposit',
184
- }),
185
- ),
186
- },
187
- {
188
- target: wethAddress,
189
- selector: toFunctionSelector(
190
- getAbiItem({
191
- abi: wethAbi,
192
- name: 'transfer',
193
- }),
194
- ),
195
- policies: [
196
- {
197
- type: 'universal-action',
198
- rules: [
199
- {
200
- condition: 'equal',
201
- calldataOffset: 0n,
202
- referenceValue: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
203
- },
204
- ],
205
- },
206
- ],
207
- },
208
- ],
209
- }
210
- ```
211
-
212
- During account initialization, provide the session you've just created. Make sure to also provide a bundler configuration.
213
-
214
- ```ts
215
- // Initialize the SDK with bundler configuration
216
- const sdk = new RhinestoneSDK({
217
- apiKey: rhinestoneApiKey,
218
- bundler: {
219
- // bundler configuration
220
- },
67
+ tokenRequests: [{ address: 'USDC', amount }],
221
68
  })
222
69
 
223
- const rhinestoneAccount = await sdk.createAccount({
224
- owners: {
225
- type: 'ecdsa',
226
- accounts: [account],
227
- },
228
- sessions: [session],
229
- })
70
+ const result = await account.waitForExecution(transaction)
230
71
  ```
231
72
 
232
- When making a transaction, specify the `signers` object to sign it with the session key:
233
-
234
- ```ts
235
- const transactionResult = await rhinestoneAccount.sendTransaction({
236
- // …
237
- signers: {
238
- type: 'session',
239
- session: session,
240
- },
241
- })
242
- ```
73
+ For a complete walkthrough, see the [Quickstart guide](https://docs.rhinestone.dev/smart-wallet/quickstart).
243
74
 
244
75
  ## Migrating from Orchestrator SDK
245
76
 
@@ -29,6 +29,13 @@ declare class ExistingEip7702AccountsNotSupportedError extends AccountError {
29
29
  traceId?: string;
30
30
  });
31
31
  }
32
+ declare class EoaAccountMustHaveAccountError extends AccountError {
33
+ constructor(params?: {
34
+ context?: any;
35
+ errorType?: string;
36
+ traceId?: string;
37
+ });
38
+ }
32
39
  declare class FactoryArgsNotAvailableError extends AccountError {
33
40
  constructor(params?: {
34
41
  context?: any;
@@ -103,5 +110,5 @@ declare class Eip712DomainNotAvailableError extends AccountError {
103
110
  constructor(message: string);
104
111
  }
105
112
  declare function isAccountError(error: Error): error is AccountError;
106
- export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
113
+ export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, EoaAccountMustHaveAccountError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
107
114
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../accounts/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,cAAM,YAAa,SAAQ,KAAK;IAC9B,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,8BAA+B,SAAQ,YAAY;gBAC3C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAA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M,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAQnE;AAED,cAAM,2BAA4B,SAAQ,YAAY;gBAElD,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAOnE;AAED,cAAM,kCAAmC,SAAQ,YAAY;gBAEzD,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAOnE;AAED,cAAM,wBAAyB,SAAQ,YAAY;gBACrC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,6BAA8B,SAAQ,YAAY;gBAC1C,OAAO,EAAE,MAAM;CAK5B;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,YAAY,CAE3D;AAiBD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,wCAAwC,EACxC,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,mCAAmC,EACnC,mCAAmC,EACnC,2BAA2B,EAC3B,kCAAkC,EAClC,wBAAwB,GACzB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OwnersFieldRequiredError = exports.EoaSigningMethodNotConfiguredError = exports.EoaSigningNotSupportedError = exports.ModuleInstallationNotSupportedError = exports.WalletClientNoConnectedAccountError = exports.AccountConfigurationNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountError = void 0;
3
+ exports.OwnersFieldRequiredError = exports.EoaSigningMethodNotConfiguredError = exports.EoaSigningNotSupportedError = exports.ModuleInstallationNotSupportedError = exports.WalletClientNoConnectedAccountError = exports.AccountConfigurationNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.EoaAccountMustHaveAccountError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountError = void 0;
4
4
  exports.isAccountError = isAccountError;
5
5
  class AccountError extends Error {
6
6
  _message;
@@ -46,6 +46,15 @@ class ExistingEip7702AccountsNotSupportedError extends AccountError {
46
46
  }
47
47
  }
48
48
  exports.ExistingEip7702AccountsNotSupportedError = ExistingEip7702AccountsNotSupportedError;
49
+ class EoaAccountMustHaveAccountError extends AccountError {
50
+ constructor(params) {
51
+ super({
52
+ message: 'EOA accounts must have a signer `account` provided',
53
+ ...params,
54
+ });
55
+ }
56
+ }
57
+ exports.EoaAccountMustHaveAccountError = EoaAccountMustHaveAccountError;
49
58
  class FactoryArgsNotAvailableError extends AccountError {
50
59
  constructor(params) {
51
60
  super({
@@ -1,14 +1,16 @@
1
1
  import { type Account, type Chain, type HashTypedDataParameters, type Hex, type PublicClient, type TypedData } from 'viem';
2
2
  import type { Module } from '../modules/common';
3
- import type { EnableSessionData } from '../modules/validators/smart-sessions';
4
- import type { AccountProviderConfig, Call, OwnerSet, RhinestoneConfig, Session, SignerSet } from '../types';
5
- import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from './error';
3
+ import type { AccountProviderConfig, Call, OwnerSet, RhinestoneConfig, SignerSet } from '../types';
4
+ import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from './error';
6
5
  import { type ValidatorConfig } from './utils';
7
6
  declare function getInitCode(config: RhinestoneConfig): {
8
7
  address: import("viem").Address;
9
- factory: import("viem").Address;
10
- factoryData: Hex;
11
- intentExecutorInstalled: boolean;
8
+ } | {
9
+ factory: `0x${string}`;
10
+ factoryData: `0x${string}`;
11
+ } | undefined;
12
+ declare function getV0InitCode(config: RhinestoneConfig): {
13
+ address: import("viem").Address;
12
14
  } | {
13
15
  factory: `0x${string}`;
14
16
  factoryData: `0x${string}`;
@@ -29,20 +31,19 @@ declare function getModuleInstallationCalls(config: RhinestoneConfig, module: Mo
29
31
  declare function getModuleUninstallationCalls(config: RhinestoneConfig, module: Module): Call[];
30
32
  declare function getAddress(config: RhinestoneConfig): `0x${string}`;
31
33
  declare function checkAddress(config: RhinestoneConfig): boolean;
32
- declare function getPackedSignature(config: RhinestoneConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
34
+ declare function getEip1271Signature(config: RhinestoneConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
35
+ declare function getEmissarySignature(config: RhinestoneConfig, signers: SignerSet | undefined, chain: Chain, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
33
36
  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>;
34
37
  declare function isDeployed(config: RhinestoneConfig, chain: Chain): Promise<boolean>;
35
38
  declare function deploy(config: RhinestoneConfig, chain: Chain, params?: {
36
- session?: Session;
37
39
  sponsored?: boolean;
38
40
  }): Promise<boolean>;
39
41
  declare function setup(config: RhinestoneConfig, chain: Chain): Promise<boolean>;
40
42
  declare function deployStandaloneWithEoa(chain: Chain, config: RhinestoneConfig, deployer: Account): Promise<void>;
41
43
  declare function toErc6492Signature(config: RhinestoneConfig, signature: Hex, chain: Chain): Promise<Hex>;
42
44
  declare function getSmartAccount(config: RhinestoneConfig, client: PublicClient, chain: Chain): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | undefined>;
43
- declare function getSmartSessionSmartAccount(config: RhinestoneConfig, client: PublicClient, chain: Chain, session: Session, enableData: EnableSessionData | null): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | undefined>;
44
45
  declare function getGuardianSmartAccount(config: RhinestoneConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | undefined>;
45
46
  declare function is7702(config: RhinestoneConfig): boolean;
46
47
  declare function getAccountProvider(config: RhinestoneConfig): AccountProviderConfig;
47
- export { getEip712Domain, getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, deployStandaloneWithEoa, isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, };
48
+ export { getEip712Domain, getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getGuardianSmartAccount, getEip1271Signature, getEmissarySignature, getTypedDataPackedSignature, deployStandaloneWithEoa, isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, };
48
49
  //# sourceMappingURL=index.d.ts.map
@@ -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,u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Property(exports, "__esModule", { value: true });
3
- exports.WalletClientNoConnectedAccountError = exports.SmartSessionsNotEnabledError = exports.SigningNotSupportedForAccountError = exports.OwnersFieldRequiredError = exports.ModuleInstallationNotSupportedError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.EoaSigningNotSupportedError = exports.EoaSigningMethodNotConfiguredError = exports.Eip7702NotSupportedForAccountError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
3
+ exports.WalletClientNoConnectedAccountError = exports.SmartSessionsNotEnabledError = exports.SigningNotSupportedForAccountError = exports.OwnersFieldRequiredError = exports.ModuleInstallationNotSupportedError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.EoaSigningNotSupportedError = exports.EoaSigningMethodNotConfiguredError = exports.EoaAccountMustHaveAccountError = exports.Eip7702NotSupportedForAccountError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
4
4
  exports.getEip712Domain = getEip712Domain;
5
5
  exports.getModuleInstallationCalls = getModuleInstallationCalls;
6
6
  exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
@@ -8,6 +8,7 @@ exports.getAddress = getAddress;
8
8
  exports.checkAddress = checkAddress;
9
9
  exports.getAccountProvider = getAccountProvider;
10
10
  exports.getInitCode = getInitCode;
11
+ exports.getV0InitCode = getV0InitCode;
11
12
  exports.signEip7702InitData = signEip7702InitData;
12
13
  exports.getEip7702InitCall = getEip7702InitCall;
13
14
  exports.is7702 = is7702;
@@ -16,14 +17,13 @@ exports.deploy = deploy;
16
17
  exports.setup = setup;
17
18
  exports.toErc6492Signature = toErc6492Signature;
18
19
  exports.getSmartAccount = getSmartAccount;
19
- exports.getSmartSessionSmartAccount = getSmartSessionSmartAccount;
20
20
  exports.getGuardianSmartAccount = getGuardianSmartAccount;
21
- exports.getPackedSignature = getPackedSignature;
21
+ exports.getEip1271Signature = getEip1271Signature;
22
+ exports.getEmissarySignature = getEmissarySignature;
22
23
  exports.getTypedDataPackedSignature = getTypedDataPackedSignature;
23
24
  exports.deployStandaloneWithEoa = deployStandaloneWithEoa;
24
25
  const viem_1 = require("viem");
25
26
  const execution_1 = require("../execution");
26
- const smart_session_1 = require("../execution/smart-session");
27
27
  const modules_1 = require("../modules");
28
28
  const validators_1 = require("../modules/validators");
29
29
  const core_1 = require("../modules/validators/core");
@@ -33,6 +33,7 @@ Object.defineProperty(exports, "AccountError", { enumerable: true, get: function
33
33
  Object.defineProperty(exports, "Eip712DomainNotAvailableError", { enumerable: true, get: function () { return error_1.Eip712DomainNotAvailableError; } });
34
34
  Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return error_1.Eip7702AccountMustHaveEoaError; } });
35
35
  Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return error_1.Eip7702NotSupportedForAccountError; } });
36
+ Object.defineProperty(exports, "EoaAccountMustHaveAccountError", { enumerable: true, get: function () { return error_1.EoaAccountMustHaveAccountError; } });
36
37
  Object.defineProperty(exports, "EoaSigningMethodNotConfiguredError", { enumerable: true, get: function () { return error_1.EoaSigningMethodNotConfiguredError; } });
37
38
  Object.defineProperty(exports, "EoaSigningNotSupportedError", { enumerable: true, get: function () { return error_1.EoaSigningNotSupportedError; } });
38
39
  Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return error_1.ExistingEip7702AccountsNotSupportedError; } });
@@ -83,6 +84,17 @@ function getDeployArgs(config) {
83
84
  }
84
85
  }
85
86
  }
87
+ function getV0DeployArgs(config) {
88
+ const account = getAccountProvider(config);
89
+ switch (account.type) {
90
+ case 'safe': {
91
+ return (0, safe_1.getV0DeployArgs)(config);
92
+ }
93
+ default: {
94
+ throw new Error(`Unsupported account type: ${account.type}`);
95
+ }
96
+ }
97
+ }
86
98
  function getInitCode(config) {
87
99
  if (is7702(config)) {
88
100
  return undefined;
@@ -94,10 +106,33 @@ function getInitCode(config) {
94
106
  return config.initData;
95
107
  }
96
108
  else {
97
- const { factory, factoryData } = getDeployArgs(config);
98
- if (!factory || !factoryData) {
109
+ const deployArgs = getDeployArgs(config);
110
+ if (!deployArgs) {
111
+ throw new error_1.FactoryArgsNotAvailableError();
112
+ }
113
+ const { factory, factoryData } = deployArgs;
114
+ return {
115
+ factory,
116
+ factoryData,
117
+ };
118
+ }
119
+ }
120
+ function getV0InitCode(config) {
121
+ if (is7702(config)) {
122
+ return undefined;
123
+ }
124
+ else if (config.account?.type === 'eoa') {
125
+ return undefined;
126
+ }
127
+ else if (config.initData) {
128
+ return config.initData;
129
+ }
130
+ else {
131
+ const deployArgs = getV0DeployArgs(config);
132
+ if (!deployArgs) {
99
133
  throw new error_1.FactoryArgsNotAvailableError();
100
134
  }
135
+ const { factory, factoryData } = deployArgs;
101
136
  return {
102
137
  factory,
103
138
  factoryData,
@@ -269,7 +304,7 @@ function checkAddress(config) {
269
304
  return (config.initData.address.toLowerCase() === getAddress(config).toLowerCase());
270
305
  }
271
306
  // Signs and packs a signature to be EIP-1271 compatible
272
- async function getPackedSignature(config, signers, chain, validator, hash, transformSignature = (signature) => signature) {
307
+ async function getEip1271Signature(config, signers, chain, validator, hash, transformSignature = (signature) => signature) {
273
308
  if (config.account?.type === 'eoa') {
274
309
  throw new error_1.EoaSigningNotSupportedError('packed signatures');
275
310
  }
@@ -304,6 +339,17 @@ async function getPackedSignature(config, signers, chain, validator, hash, trans
304
339
  }
305
340
  }
306
341
  }
342
+ // Signs and packs a signature to be used by the emissary validator
343
+ async function getEmissarySignature(config, signers, chain, hash, transformSignature = (signature) => signature) {
344
+ if (config.account?.type === 'eoa') {
345
+ throw new error_1.EoaSigningNotSupportedError('packed signatures');
346
+ }
347
+ signers = signers ?? (0, common_1.convertOwnerSetToSignerSet)(config.owners);
348
+ const address = getAddress(config);
349
+ const signFn = (hash) => (0, message_1.sign)(signers, chain, address, hash, false);
350
+ const signature = await signFn(hash);
351
+ return transformSignature(signature);
352
+ }
307
353
  // Signs and packs a signature to be EIP-1271 compatible
308
354
  async function getTypedDataPackedSignature(config, signers, chain, validator, parameters, transformSignature = (signature) => signature) {
309
355
  if (config.account?.type === 'eoa') {
@@ -358,14 +404,14 @@ async function isDeployed(config, chain) {
358
404
  if (!code) {
359
405
  return false;
360
406
  }
361
- if (code.startsWith('0xef0100') && code.length === 48) {
362
- // Defensive check to ensure there's no storage conflict; can be lifted in the future
363
- throw new error_1.ExistingEip7702AccountsNotSupportedError();
364
- }
365
407
  return (0, viem_1.size)(code) > 0;
366
408
  }
367
409
  async function deploy(config, chain, params) {
368
410
  const account = getAccountProvider(config);
411
+ const deployArgs = getDeployArgs(config);
412
+ if (!deployArgs) {
413
+ throw new error_1.FactoryArgsNotAvailableError();
414
+ }
369
415
  if (account.type === 'eoa') {
370
416
  return false;
371
417
  }
@@ -373,16 +419,19 @@ async function deploy(config, chain, params) {
373
419
  if (deployed) {
374
420
  return false;
375
421
  }
376
- const asUserOp = config.initData && !config.initData.intentExecutorInstalled;
422
+ const intentExecutorInstalled = 'intentExecutorInstalled' in deployArgs
423
+ ? deployArgs.intentExecutorInstalled
424
+ : false;
425
+ // Use bundler directly when:
426
+ // (account has initData and intent executor is not installed) || (custom bundler is configured)
427
+ const useCustomBundler = config.bundler?.type === 'custom';
428
+ const asUserOp = (config.initData && !intentExecutorInstalled) || useCustomBundler;
377
429
  if (asUserOp) {
378
430
  await deployWithBundler(chain, config);
379
431
  }
380
432
  else {
381
433
  await deployWithIntent(chain, config, params?.sponsored ?? false);
382
434
  }
383
- if (params?.session) {
384
- await (0, smart_session_1.enableSmartSession)(chain, config, params.session);
385
- }
386
435
  return true;
387
436
  }
388
437
  // Installs the missing modules
@@ -477,7 +526,11 @@ async function deployWithBundler(chain, config) {
477
526
  });
478
527
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
479
528
  const smartAccount = await getSmartAccount(config, publicClient, chain);
480
- const { factory, factoryData } = getDeployArgs(config);
529
+ const deployArgs = getDeployArgs(config);
530
+ if (!deployArgs) {
531
+ throw new error_1.FactoryArgsNotAvailableError();
532
+ }
533
+ const { factory, factoryData } = deployArgs;
481
534
  const opHash = await bundlerClient.sendUserOperation({
482
535
  account: smartAccount,
483
536
  factory,
@@ -512,7 +565,11 @@ async function deployStandaloneWithEoa(chain, config, deployer) {
512
565
  if (!initCode) {
513
566
  throw new error_1.FactoryArgsNotAvailableError();
514
567
  }
515
- const { factory, factoryData } = initCode;
568
+ const deployArgs = getDeployArgs(config);
569
+ if (!deployArgs) {
570
+ throw new error_1.FactoryArgsNotAvailableError();
571
+ }
572
+ const { factory, factoryData } = deployArgs;
516
573
  const walletClient = (0, viem_1.createWalletClient)({
517
574
  account: deployer,
518
575
  chain,
@@ -534,7 +591,11 @@ async function toErc6492Signature(config, signature, chain) {
534
591
  if (!initCode) {
535
592
  throw new error_1.FactoryArgsNotAvailableError();
536
593
  }
537
- const { factory, factoryData } = initCode;
594
+ const deployArgs = getDeployArgs(config);
595
+ if (!deployArgs) {
596
+ throw new error_1.FactoryArgsNotAvailableError();
597
+ }
598
+ const { factory, factoryData } = deployArgs;
538
599
  const magicBytes = '0x6492649264926492649264926492649264926492649264926492649264926492';
539
600
  return (0, viem_1.concat)([
540
601
  (0, viem_1.encodeAbiParameters)([
@@ -574,38 +635,6 @@ async function getSmartAccount(config, client, chain) {
574
635
  }
575
636
  }
576
637
  }
577
- async function getSmartSessionSmartAccount(config, client, chain, session, enableData) {
578
- const address = getAddress(config);
579
- const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
580
- if (!smartSessionValidator) {
581
- throw new error_1.SmartSessionsNotEnabledError();
582
- }
583
- const signers = {
584
- type: 'session',
585
- session,
586
- enableData: enableData || undefined,
587
- };
588
- const signFn = (hash) => (0, message_1.sign)(signers, chain, address, hash, true);
589
- const account = getAccountProvider(config);
590
- switch (account.type) {
591
- case 'safe': {
592
- return (0, safe_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
593
- }
594
- case 'nexus': {
595
- const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
596
- return (0, nexus_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn, defaultValidatorAddress);
597
- }
598
- case 'kernel': {
599
- return (0, kernel_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
600
- }
601
- case 'passport': {
602
- return (0, passport_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
603
- }
604
- case 'startale': {
605
- return (0, startale_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
606
- }
607
- }
608
- }
609
638
  async function getGuardianSmartAccount(config, client, chain, guardians) {
610
639
  const address = getAddress(config);
611
640
  const accounts = guardians.type === 'ecdsa' ? guardians.accounts : [];