@rhinestone/sdk 1.2.5 → 1.2.6

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.
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
 
@@ -81,16 +81,14 @@ function isTokenAddressSupported(address, chainId) {
81
81
  if (!chainEntry) {
82
82
  return false;
83
83
  }
84
- return chainEntry.tokens
85
- .filter((token) => token.supportsMultichain)
86
- .some((token) => token.address.toLowerCase() === address.toLowerCase());
84
+ return chainEntry.tokens.some((token) => token.address.toLowerCase() === address.toLowerCase());
87
85
  }
88
86
  function getSupportedTokens(chainId) {
89
87
  const chainEntry = getChainEntry(chainId);
90
88
  if (!chainEntry) {
91
89
  throw new error_1.UnsupportedChainError(chainId);
92
90
  }
93
- return chainEntry.tokens.filter((token) => token.supportsMultichain);
91
+ return chainEntry.tokens;
94
92
  }
95
93
  function getDefaultAccountAccessList(onTestnets) {
96
94
  const supportedChainIds = getSupportedChainIds();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/sdk",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "End-to-end chain abstraction and modularity toolkit",
5
5
  "author": {
6
6
  "name": "Rhinestone",
@@ -151,7 +151,7 @@
151
151
  "access": "public"
152
152
  },
153
153
  "dependencies": {
154
- "@rhinestone/shared-configs": "1.4.56",
154
+ "@rhinestone/shared-configs": "1.4.74",
155
155
  "ox": "^0.9.11",
156
156
  "solady": "^0.1.26"
157
157
  },