@rhinestone/sdk 0.0.0-dev-20260914125047 → 0.0.0-dev-20260914125455

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 (39) hide show
  1. package/README.md +20 -2
  2. package/dist/src/actions/runtime.d.ts.map +1 -1
  3. package/dist/src/api/account.d.ts +88 -59
  4. package/dist/src/api/account.d.ts.map +1 -1
  5. package/dist/src/api/account.js +200 -21
  6. package/dist/src/api/accounts.d.ts +1 -1
  7. package/dist/src/api/accounts.d.ts.map +1 -1
  8. package/dist/src/api/accounts.js +88 -3
  9. package/dist/src/api/compose-types.d.ts +1 -0
  10. package/dist/src/api/compose-types.d.ts.map +1 -1
  11. package/dist/src/api/compose.d.ts.map +1 -1
  12. package/dist/src/api/compose.js +19 -1
  13. package/dist/src/api/sdk.d.ts +2 -2
  14. package/dist/src/api/sdk.d.ts.map +1 -1
  15. package/dist/src/api/sdk.js +1 -1
  16. package/dist/src/chains/non-evm.d.ts +77 -12
  17. package/dist/src/chains/non-evm.d.ts.map +1 -1
  18. package/dist/src/chains/non-evm.js +23 -1
  19. package/dist/src/clients/orchestrator/client.js +1 -1
  20. package/dist/src/clients/orchestrator/mappers.d.ts +2 -0
  21. package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -1
  22. package/dist/src/clients/orchestrator/mappers.js +44 -2
  23. package/dist/src/config/account.d.ts +91 -11
  24. package/dist/src/config/account.d.ts.map +1 -1
  25. package/dist/src/errors/capability.d.ts +23 -0
  26. package/dist/src/errors/capability.d.ts.map +1 -0
  27. package/dist/src/errors/capability.js +40 -0
  28. package/dist/src/errors/index.d.ts +2 -1
  29. package/dist/src/errors/index.d.ts.map +1 -1
  30. package/dist/src/errors/index.js +3 -0
  31. package/dist/src/hypercore/market.d.ts +1 -1
  32. package/dist/src/hypercore/market.js +1 -1
  33. package/dist/src/index.d.ts +5 -5
  34. package/dist/src/index.d.ts.map +1 -1
  35. package/dist/src/index.js +2 -2
  36. package/dist/src/utils/index.d.ts +9 -9
  37. package/dist/src/utils/index.d.ts.map +1 -1
  38. package/dist/src/utils/index.js +6 -6
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -127,14 +127,32 @@ Create a smart account:
127
127
  import { RhinestoneSDK } from '@rhinestone/sdk'
128
128
 
129
129
  const rhinestone = new RhinestoneSDK({ apiKey: 'your-api-key' })
130
- const account = await rhinestone.createAccount({
130
+ const evmConfig = {
131
131
  owners: {
132
- type: 'ecdsa',
132
+ type: 'ecdsa' as const,
133
133
  accounts: [signer],
134
134
  },
135
+ }
136
+ const account = await rhinestone.createAccount({ evm: evmConfig })
137
+
138
+ const address = account.getAddress('evm')
139
+ ```
140
+
141
+ Add an address-only Solana destination when you need to receive tokens there:
142
+
143
+ ```ts
144
+ import { solanaAddress } from '@rhinestone/sdk'
145
+
146
+ const crossVmAccount = await rhinestone.createAccount({
147
+ evm: evmConfig,
148
+ solana: { address: solanaAddress(existingSolanaAddress) },
135
149
  })
136
150
  ```
137
151
 
152
+ Address-only entries cannot prepare, sign, or execute transactions. Managed
153
+ Solana configuration is reserved for a future release and currently fails during
154
+ account construction; Solana destinations are token-delivery only.
155
+
138
156
  Send a crosschain transaction:
139
157
 
140
158
  ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../actions/runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAU1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAyEtD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,SAAS,EAAE,KAAK,MAAM,EAAE,GACvB,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,EAAE,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;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AC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAW3E;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,SAAS,EAAE,KAAK,MAAM,EAAE,GACvB,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,aAAa,EAAE,CAAC,CA4C1B;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,aAAa,EAAE,CAAC,CAM1B;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,aAAa,EAAE,CAAC,CA2B1B;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAA;CACxB,GAAG,OAAO,CAAC,aAAa,CAAC,CAwBzB"}
@@ -1,8 +1,8 @@
1
1
  import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, TypedDataDefinition } from 'viem';
2
2
  import type { UserOperationReceipt } from 'viem/account-abstraction';
3
- import type { DestinationChain } from '../chains/non-evm.js';
3
+ import { type DestinationChain, type SolanaAddress } from '../chains/non-evm.js';
4
4
  import type { HyperCoreAction, OriginSignature, Portfolio, SignData } from '../clients/orchestrator/public.js';
5
- import type { RhinestoneAccountConfig, Session, SignerSet, Transaction, UserOperationTransaction } from '../config/account.js';
5
+ import type { AccountTransaction, EvmAccountConfig, RhinestoneAccountConfig, Session, SignerSet, SolanaManagedAccountConfig, Transaction, UserOperationTransaction } from '../config/account.js';
6
6
  import type { LegacyAccountConfig } from '../config/legacy.js';
7
7
  import type { AccountInvocationContext } from '../config/resolved.js';
8
8
  import type { SessionDetails } from '../modules/validators/smart-sessions/types.js';
@@ -25,56 +25,39 @@ export interface SignedIntentData {
25
25
  targetExecutionSignature: Hex | undefined;
26
26
  }
27
27
  type Compat = LegacyAccountConfig<unknown>;
28
- /**
29
- * The account facade. Mirrors the published `RhinestoneAccount` surface, but
30
- * every method materializes a fresh invocation context from the retained
31
- * mutable compatibility config and delegates to the SDK-core composition.
32
- */
33
- export interface RhinestoneAccount {
34
- /** The resolved account configuration. */
35
- config: RhinestoneAccountConfig;
28
+ type AccountVm = 'evm' | 'solana';
29
+ type DefaultAccountConfig = Readonly<{
30
+ evm: EvmAccountConfig;
31
+ }>;
32
+ type ConfiguredVm<C> = Extract<keyof C, AccountVm>;
33
+ type NativeAddress<Vm extends AccountVm> = Vm extends 'evm' ? Address : SolanaAddress;
34
+ type RequiredBranch<C, Vm extends AccountVm> = [C] extends [
35
+ Readonly<Record<Vm, infer Branch>>
36
+ ] ? Branch : never;
37
+ type HasManagedEvm<C> = [RequiredBranch<C, 'evm'>] extends [never] ? false : [RequiredBranch<C, 'evm'>] extends [EvmAccountConfig] ? true : false;
38
+ type HasManagedSolana<C> = [RequiredBranch<C, 'solana'>] extends [never] ? false : [RequiredBranch<C, 'solana'>] extends [SolanaManagedAccountConfig] ? true : false;
39
+ /** Address access shared by every account handle. */
40
+ export interface RhinestoneAccountBase<C extends RhinestoneAccountConfig = DefaultAccountConfig> {
41
+ /** Captured composite configuration. VM membership is shallowly immutable. */
42
+ config: Readonly<C>;
36
43
  /**
37
- * Deploy the account on a given chain.
38
- * @param chain Chain to deploy the account on
39
- * @param params Optional deployment parameters (sponsorship)
40
- * @returns `true` once the deployment is submitted
41
- */
42
- deploy(chain: Chain, params?: {
43
- sponsored?: boolean;
44
- }): Promise<boolean>;
45
- /**
46
- * Check whether the account is deployed on a given chain.
47
- * @param chain Chain to check
48
- * @returns `true` if the account is deployed, `false` otherwise
49
- */
50
- isDeployed(chain: Chain): Promise<boolean>;
51
- /**
52
- * Set up an existing account on a given chain by installing any missing modules.
53
- * @param chain Chain to set the account up on
54
- * @returns `true` once setup is submitted
55
- */
56
- setup(chain: Chain): Promise<boolean>;
57
- /**
58
- * Get the account initialization data, used to deploy the account onchain.
59
- * @returns The factory address and factory data
44
+ * Get the native address for a configured VM.
45
+ * @param vm Configured VM to read
46
+ * @returns The account or receiver address in that VM's native format
47
+ * @throws AccountVmNotConfiguredError when a widened input names an absent VM
60
48
  */
61
- getInitData(): {
62
- factory: Address;
63
- factoryData: Hex;
64
- };
65
- /**
66
- * Prepare and sign the EIP-7702 account initialization data.
67
- * @returns The init data signature
68
- */
69
- signEip7702InitData(): Promise<Hex>;
49
+ getAddress<const Vm extends ConfiguredVm<C>>(vm: Vm): C extends Readonly<Record<Vm, unknown>> ? NativeAddress<Vm> : NativeAddress<Vm> | undefined;
50
+ }
51
+ /** Intent transaction lifecycle exposed by accounts with a managed source. */
52
+ export interface ManagedTransactionAccount<_C extends RhinestoneAccountConfig = DefaultAccountConfig> {
70
53
  /**
71
- * Prepare a transaction for signing.
54
+ * Prepare an intent transaction for signing.
72
55
  * @param transaction Transaction to prepare
73
56
  * @returns The prepared transaction data
74
57
  * @see {@link signTransaction} to sign the prepared transaction
75
58
  * @see {@link submitTransaction} to submit the signed transaction
76
59
  */
77
- prepareTransaction(transaction: Transaction): Promise<PreparedTransactionData>;
60
+ prepareTransaction(transaction: AccountTransaction<_C>): Promise<PreparedTransactionData>;
78
61
  /**
79
62
  * Get the typed-data messages to sign for a prepared transaction.
80
63
  * @param preparedTransaction Prepared transaction data
@@ -126,6 +109,57 @@ export interface RhinestoneAccount {
126
109
  * @see {@link prepareTransaction} to prepare the transaction data for signing
127
110
  */
128
111
  signAuthorizations(preparedTransaction: PreparedTransactionData): Promise<SignedAuthorizationList>;
112
+ /**
113
+ * Submit a signed transaction.
114
+ * @param signedTransaction Signed transaction data
115
+ * @param options Optional submission options (e.g. EIP-7702 `authorizations`)
116
+ * @returns The transaction result (an intent ID)
117
+ * @see {@link signTransaction} to sign the transaction data
118
+ * @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
119
+ * @see {@link waitForExecution} to wait for the transaction to execute onchain
120
+ */
121
+ submitTransaction(signedTransaction: SignedTransactionData, options?: SubmitTransactionOptions): Promise<TransactionResult>;
122
+ /** Wait for a submitted intent to reach a terminal state. */
123
+ waitForExecution(result: TransactionResult): Promise<TransactionStatus>;
124
+ }
125
+ /** Full EVM management, signing, UserOperation and account-read capabilities. */
126
+ export interface ManagedEvmAccount<C extends RhinestoneAccountConfig = DefaultAccountConfig> extends ManagedTransactionAccount<C> {
127
+ /** The captured composite account configuration. */
128
+ config: Readonly<C>;
129
+ /**
130
+ * Deploy the account on a given chain.
131
+ * @param chain Chain to deploy the account on
132
+ * @param params Optional deployment parameters (sponsorship)
133
+ * @returns `true` once the deployment is submitted
134
+ */
135
+ deploy(chain: Chain, params?: {
136
+ sponsored?: boolean;
137
+ }): Promise<boolean>;
138
+ /**
139
+ * Check whether the account is deployed on a given chain.
140
+ * @param chain Chain to check
141
+ * @returns `true` if the account is deployed, `false` otherwise
142
+ */
143
+ isDeployed(chain: Chain): Promise<boolean>;
144
+ /**
145
+ * Set up an existing account on a given chain by installing any missing modules.
146
+ * @param chain Chain to set the account up on
147
+ * @returns `true` once setup is submitted
148
+ */
149
+ setup(chain: Chain): Promise<boolean>;
150
+ /**
151
+ * Get the account initialization data, used to deploy the account onchain.
152
+ * @returns The factory address and factory data
153
+ */
154
+ getInitData(): {
155
+ factory: Address;
156
+ factoryData: Hex;
157
+ };
158
+ /**
159
+ * Prepare and sign the EIP-7702 account initialization data.
160
+ * @returns The init data signature
161
+ */
162
+ signEip7702InitData(): Promise<Hex>;
129
163
  /**
130
164
  * Sign a message (EIP-191).
131
165
  * @param message Message to sign
@@ -155,16 +189,6 @@ export interface RhinestoneAccount {
155
189
  * @see {@link signTransaction} for the canonical signing path
156
190
  */
157
191
  signIntent(signData: SignData, targetChain: DestinationChain, signers?: SignerSet): Promise<SignedIntentData>;
158
- /**
159
- * Submit a signed transaction.
160
- * @param signedTransaction Signed transaction data
161
- * @param options Optional submission options (e.g. EIP-7702 `authorizations`)
162
- * @returns The transaction result (an intent ID)
163
- * @see {@link signTransaction} to sign the transaction data
164
- * @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
165
- * @see {@link waitForExecution} to wait for the transaction to execute onchain
166
- */
167
- submitTransaction(signedTransaction: SignedTransactionData, options?: SubmitTransactionOptions): Promise<TransactionResult>;
168
192
  /**
169
193
  * Prepare a user operation for signing.
170
194
  * @param transaction User operation to prepare
@@ -212,10 +236,12 @@ export interface RhinestoneAccount {
212
236
  waitForExecution(result: TransactionResult): Promise<TransactionStatus>;
213
237
  waitForExecution(result: UserOperationResult): Promise<UserOperationReceipt>;
214
238
  /**
215
- * Get the account address.
216
- * @returns The smart account address
239
+ * Get the native address for a configured VM.
240
+ * @param vm Configured VM to read
241
+ * @returns The account or receiver address in that VM's native format
242
+ * @throws AccountVmNotConfiguredError when a widened input names an absent VM
217
243
  */
218
- getAddress(): Address;
244
+ getAddress<const Vm extends ConfiguredVm<C>>(vm: Vm): C extends Readonly<Record<Vm, unknown>> ? NativeAddress<Vm> : NativeAddress<Vm> | undefined;
219
245
  /**
220
246
  * Get the account portfolio (token balances across chains).
221
247
  * @param onTestnets Whether to query testnet balances (default is `false`)
@@ -263,8 +289,11 @@ export interface RhinestoneAccount {
263
289
  */
264
290
  getExecutors(chain: Chain): Promise<Address[]>;
265
291
  }
266
- export declare function createAccountFacade(compatibilityConfig: LegacyAccountConfig<unknown>, composition: CoreComposition<LegacyAccountConfig<unknown>>): RhinestoneAccount;
267
- export declare function adaptTransaction(context: AccountInvocationContext<Compat>, transaction: Transaction, hyperCoreAction?: HyperCoreAction): IntentInput;
292
+ /** Account handle whose methods reflect the definitely configured capabilities. */
293
+ export type RhinestoneAccount<C extends RhinestoneAccountConfig = DefaultAccountConfig> = RhinestoneAccountBase<C> & (HasManagedEvm<C> extends true ? ManagedEvmAccount<C> : HasManagedSolana<C> extends true ? ManagedTransactionAccount<C> : Readonly<Record<never, never>>);
294
+ export declare function createAccountFacade<C extends RhinestoneAccountConfig>(compatibilityConfig: LegacyAccountConfig<unknown>, publicConfig: Readonly<C>, composition: CoreComposition<LegacyAccountConfig<unknown>>): ManagedEvmAccount<C>;
295
+ export declare function normalizeTransaction(transaction: Transaction, config: Readonly<RhinestoneAccountConfig>): Transaction;
296
+ export declare function adaptTransaction(context: AccountInvocationContext<Compat>, transaction: Transaction, hyperCoreAction?: HyperCoreAction, automaticSourceChainIds?: readonly number[]): IntentInput;
268
297
  export declare function authorizationChains(input: IntentInput): readonly IntentInput['destination'][];
269
298
  export {};
270
299
  //# sourceMappingURL=account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../api/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACpB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAGpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,SAAS,EAET,QAAQ,EACT,MAAM,gCAAgC,CAAA;AAKvC,OAAO,KAAK,EAEV,uBAAuB,EACvB,OAAO,EACP,SAAS,EAIT,WAAW,EACX,wBAAwB,EACzB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAK3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAA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,CA0Ib;AA0CD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,GACjB,SAAS,WAAW,CAAC,aAAa,CAAC,EAAE,CAQvC"}
@@ -1,8 +1,10 @@
1
- import { parseCaip2, toEvmChainReference } from '../chains/caip2.js';
1
+ import { formatCaip2, parseCaip2, toEvmChainReference } from '../chains/caip2.js';
2
2
  import { getChainById, getChainReference } from '../chains/catalog.js';
3
+ import { solanaAddress, } from '../chains/non-evm.js';
3
4
  import { normalizeTokenAddress, validateTokenAddresses } from '../chains/tokens.js';
4
5
  import { createStaticAccountRuntime } from '../config/account-runtime.js';
5
6
  import { materializeAccountInvocationContext, resolveAccountConfig, } from '../config/resolve.js';
7
+ import { AccountVmNotConfiguredError, UnsupportedAccountCapabilityError, } from '../errors/capability.js';
6
8
  import { IndependentSigningNotSupportedError, MismatchedOwnerSignaturesError, QuoteNotInPreparedTransactionError, } from '../errors/execution.js';
7
9
  import { resolveHyperCoreAction } from '../hypercore/resolve.js';
8
10
  import { ecdsaSignerId, webauthnSignerId, } from '../modules/validators/signer-id.js';
@@ -87,7 +89,7 @@ function referenceChain() {
87
89
  // needs some EVM chain reference. With no bundled chain set, use mainnet.
88
90
  return toEvmChainReference(1);
89
91
  }
90
- export function createAccountFacade(compatibilityConfig, composition) {
92
+ export function createAccountFacade(compatibilityConfig, publicConfig, composition) {
91
93
  // Intent identity caches are facade-scoped. Values crossing account/SDK
92
94
  // instances are reconstructed and validated by the receiving account.
93
95
  const preparedIntents = new WeakMap();
@@ -95,13 +97,15 @@ export function createAccountFacade(compatibilityConfig, composition) {
95
97
  const context = (method) => materializeAccountInvocationContext(composition.config, compatibilityConfig, method);
96
98
  const workflowsFor = (ctx) => composition.createAccount(ctx).workflows;
97
99
  const resolvePrepared = (ctx, prepared, intentId) => {
100
+ assertSupportedTransaction(prepared.transaction, publicConfig);
101
+ assertSupportedSignData(selectedPublicQuote(prepared, intentId).signData);
98
102
  const cached = preparedIntents.get(prepared);
99
103
  if (cached && !intentId)
100
104
  return Promise.resolve(cached);
101
105
  return workflowsFor(ctx).reconstructPreparedIntent(ctx, reconstructInput(ctx, prepared, intentId));
102
106
  };
103
107
  const account = {
104
- config: compatibilityConfig,
108
+ config: publicConfig,
105
109
  deploy(chain, params) {
106
110
  const ctx = context('deploy');
107
111
  return workflowsFor(ctx).deploy(ctx, toEvmChainReference(chain.id), {
@@ -129,18 +133,29 @@ export function createAccountFacade(compatibilityConfig, composition) {
129
133
  },
130
134
  async prepareTransaction(transaction) {
131
135
  const ctx = context('prepare-intent');
136
+ const normalized = normalizeTransaction(transaction, publicConfig);
132
137
  // Before the quote, not after: the quote's `signData` registers an agent
133
138
  // derived from the action's bytes, so the action has to be concrete here.
134
139
  const hyperCoreAction = await resolveHyperCoreAction({
135
- options: transaction.hyperCore,
136
- account: account.getAddress(),
140
+ options: normalized.hyperCore,
141
+ account: workflowsFor(ctx).getAddress(ctx, referenceChain()),
137
142
  ...(ctx.sdk.hyperliquid ? { hyperliquid: ctx.sdk.hyperliquid } : {}),
138
143
  });
139
- const prepared = await workflowsFor(ctx).prepareIntent(ctx, adaptTransaction(ctx, transaction, hyperCoreAction));
140
- return toPreparedTransactionData(prepared, transaction, preparedIntents);
144
+ const automaticSources = 'targetChain' in normalized &&
145
+ normalized.targetChain !== undefined &&
146
+ normalized.sourceChains === undefined
147
+ ? await workflowsFor(ctx).getEligibleEvmSourceChains(destinationChainReference(normalized.targetChain))
148
+ : undefined;
149
+ if (automaticSources && automaticSources.length === 0) {
150
+ throw new UnsupportedAccountCapabilityError('No managed EVM source chains are eligible for this destination.');
151
+ }
152
+ const prepared = await workflowsFor(ctx).prepareIntent(ctx, adaptTransaction(ctx, normalized, hyperCoreAction, automaticSources?.map(({ id }) => id)));
153
+ return toPreparedTransactionData(prepared, normalized, preparedIntents);
141
154
  },
142
155
  getTransactionMessages(preparedTransaction, options) {
156
+ assertSupportedTransaction(preparedTransaction.transaction, publicConfig);
143
157
  const quote = selectedPublicQuote(preparedTransaction, options?.intentId);
158
+ assertSupportedSignData(quote.signData);
144
159
  return {
145
160
  origin: [...quote.signData.origin],
146
161
  destination: quote.signData.destination,
@@ -149,7 +164,7 @@ export function createAccountFacade(compatibilityConfig, composition) {
149
164
  : {}),
150
165
  };
151
166
  },
152
- signTransaction: ((preparedTransaction, options) => {
167
+ signTransaction: (async (preparedTransaction, options) => {
153
168
  const ctx = context('sign-intent');
154
169
  const workflows = workflowsFor(ctx);
155
170
  if (options && 'owner' in options) {
@@ -157,19 +172,20 @@ export function createAccountFacade(compatibilityConfig, composition) {
157
172
  // reject before resolving sessions (which would issue an RPC read),
158
173
  // matching the legacy fast-fail.
159
174
  if (preparedTransaction.transaction.signers?.type === 'session') {
160
- return Promise.reject(new IndependentSigningNotSupportedError());
175
+ throw new IndependentSigningNotSupportedError();
161
176
  }
162
177
  const signerId = signerIdForOwner(options.owner);
163
- return resolvePrepared(ctx, preparedTransaction, options.intentId).then((internal) => workflows.signIntentAsOwner(ctx, internal, {
178
+ const internal = await resolvePrepared(ctx, preparedTransaction, options.intentId);
179
+ return workflows.signIntentAsOwner(ctx, internal, {
164
180
  signerId,
165
181
  ...(options.validatorId === undefined
166
182
  ? {}
167
183
  : { validatorId: options.validatorId }),
168
- }));
184
+ });
169
185
  }
170
- return resolvePrepared(ctx, preparedTransaction, options?.intentId)
171
- .then((internal) => workflows.signIntent(ctx, internal))
172
- .then(({ intent }) => toSignedTransactionData(preparedTransaction, intent, signedIntents));
186
+ const internal = await resolvePrepared(ctx, preparedTransaction, options?.intentId);
187
+ const { intent } = await workflows.signIntent(ctx, internal);
188
+ return toSignedTransactionData(preparedTransaction, intent, signedIntents);
173
189
  }),
174
190
  async assembleTransaction(preparedTransaction, signatures) {
175
191
  const ctx = context('assemble-intent');
@@ -183,6 +199,7 @@ export function createAccountFacade(compatibilityConfig, composition) {
183
199
  return toSignedTransactionData(preparedTransaction, signed, signedIntents);
184
200
  },
185
201
  async signAuthorizations(preparedTransaction) {
202
+ assertSupportedTransaction(preparedTransaction.transaction, publicConfig);
186
203
  const ctx = context('sign-authorizations');
187
204
  const intentInput = adaptTransaction(ctx, preparedTransaction.transaction);
188
205
  const chains = authorizationChains(intentInput);
@@ -217,6 +234,7 @@ export function createAccountFacade(compatibilityConfig, composition) {
217
234
  return result.signature;
218
235
  },
219
236
  async signIntent(signData, targetChain, signers) {
237
+ assertSupportedSignData(signData);
220
238
  const ctx = context('sign-intent');
221
239
  const result = await workflowsFor(ctx).signIntentFromSignData(ctx, {
222
240
  signData: {
@@ -238,6 +256,8 @@ export function createAccountFacade(compatibilityConfig, composition) {
238
256
  };
239
257
  },
240
258
  async submitTransaction(signedTransaction, options) {
259
+ assertSupportedTransaction(signedTransaction.transaction, publicConfig);
260
+ assertSupportedSignData(signedTransaction.quote.signData);
241
261
  const ctx = context('submit-intent');
242
262
  const workflows = workflowsFor(ctx);
243
263
  // Fast path for the same-instance signed object; otherwise (cross-instance
@@ -361,10 +381,21 @@ export function createAccountFacade(compatibilityConfig, composition) {
361
381
  })
362
382
  .then((status) => status.receipt);
363
383
  }),
364
- getAddress() {
384
+ getAddress: ((vm) => {
385
+ if (vm === 'solana') {
386
+ if (publicConfig.solana &&
387
+ 'address' in publicConfig.solana &&
388
+ publicConfig.solana.address) {
389
+ return publicConfig.solana.address;
390
+ }
391
+ throw new AccountVmNotConfiguredError('solana');
392
+ }
393
+ if (vm !== 'evm' || !publicConfig.evm) {
394
+ throw new AccountVmNotConfiguredError(String(vm));
395
+ }
365
396
  const ctx = context('get-address');
366
397
  return workflowsFor(ctx).getAddress(ctx, referenceChain());
367
- },
398
+ }),
368
399
  getPortfolio(onTestnets = false) {
369
400
  const ctx = context('get-portfolio');
370
401
  return workflowsFor(ctx)
@@ -533,6 +564,140 @@ chainIds) {
533
564
  * authorise. With no session scope there is nothing to narrow against and the
534
565
  * explicit filter stands on its own.
535
566
  */
567
+ function assertSupportedSignData(signData) {
568
+ const payloads = [
569
+ ...signData.origin,
570
+ signData.destination,
571
+ ...(signData.targetExecution ? [signData.targetExecution] : []),
572
+ ];
573
+ for (const payload of payloads) {
574
+ if (!payload ||
575
+ typeof payload !== 'object' ||
576
+ typeof payload.primaryType !== 'string' ||
577
+ !payload.domain ||
578
+ typeof payload.types !== 'object' ||
579
+ typeof payload.message !== 'object') {
580
+ throw new UnsupportedAccountCapabilityError('Only EIP-712 intent signing data is supported by this account.', { capability: 'intent-signing' });
581
+ }
582
+ }
583
+ }
584
+ function assertSupportedTransaction(transaction, config) {
585
+ const input = transaction;
586
+ const hasChain = Object.hasOwn(input, 'chain') && input.chain !== undefined;
587
+ const hasTarget = Object.hasOwn(input, 'targetChain') && input.targetChain !== undefined;
588
+ if (hasChain === hasTarget) {
589
+ throw new UnsupportedAccountCapabilityError('A transaction must set exactly one of `chain` or `targetChain`.');
590
+ }
591
+ if (hasChain && typeof input.chain === 'object' && input.chain !== null) {
592
+ const chain = input.chain;
593
+ if (chain.kind === 'svm') {
594
+ throw new UnsupportedAccountCapabilityError('Solana-origin execution is not supported yet. Use a managed EVM source for token delivery to Solana.', { vm: 'solana' });
595
+ }
596
+ }
597
+ if (hasTarget && typeof input.targetChain === 'object' && input.targetChain) {
598
+ const target = input.targetChain;
599
+ if (!('kind' in target || 'caip2' in target) &&
600
+ (typeof target.id !== 'number' ||
601
+ !Number.isSafeInteger(target.id) ||
602
+ target.id < 0 ||
603
+ !formatCaip2(target.id).startsWith('eip155:'))) {
604
+ throw new UnsupportedAccountCapabilityError('A viem EVM destination must use an eip155 chain ID.');
605
+ }
606
+ if (('kind' in target || 'caip2' in target) &&
607
+ !((target.kind === 'svm' &&
608
+ typeof target.caip2 === 'string' &&
609
+ target.caip2.startsWith('solana:')) ||
610
+ (target.kind === 'tvm' &&
611
+ typeof target.caip2 === 'string' &&
612
+ target.caip2.startsWith('tron:')) ||
613
+ (target.kind === 'stellar' &&
614
+ typeof target.caip2 === 'string' &&
615
+ target.caip2.startsWith('stellar:')) ||
616
+ (target.kind === 'hypercore' &&
617
+ (target.caip2 === 'hypercore:spot' ||
618
+ target.caip2 === 'hypercore:perp')))) {
619
+ throw new UnsupportedAccountCapabilityError('The destination chain descriptor has mismatched VM and CAIP-2 fields.');
620
+ }
621
+ if (target.kind === 'svm') {
622
+ if (!Array.isArray(input.tokenRequests) ||
623
+ input.tokenRequests.length === 0) {
624
+ throw new UnsupportedAccountCapabilityError('Solana destinations require at least one token request.', { vm: 'solana' });
625
+ }
626
+ for (const request of input.tokenRequests) {
627
+ if (typeof request.address !== 'string') {
628
+ throw new UnsupportedAccountCapabilityError('Solana token requests require a Solana address.');
629
+ }
630
+ solanaAddress(request.address);
631
+ if (request.amount !== undefined &&
632
+ (typeof request.amount !== 'bigint' || request.amount <= 0n)) {
633
+ throw new UnsupportedAccountCapabilityError('Solana token request amounts must be positive.');
634
+ }
635
+ }
636
+ if (typeof input.recipient === 'string')
637
+ solanaAddress(input.recipient);
638
+ if (input.calls !== undefined || input.instructions !== undefined) {
639
+ throw new UnsupportedAccountCapabilityError('Solana destinations support token delivery only; calls and custom instructions are unavailable.', { vm: 'solana' });
640
+ }
641
+ if (input.recipient === undefined && !config.solana) {
642
+ throw new AccountVmNotConfiguredError('solana');
643
+ }
644
+ }
645
+ }
646
+ if (input.sourceChains !== undefined) {
647
+ if (!Array.isArray(input.sourceChains)) {
648
+ throw new UnsupportedAccountCapabilityError('`sourceChains` must be an array of managed source chains.');
649
+ }
650
+ if (input.sourceChains.length === 0) {
651
+ throw new UnsupportedAccountCapabilityError('`sourceChains` must contain at least one managed source.');
652
+ }
653
+ const ids = input.sourceChains.map((value) => typeof value === 'object' && value
654
+ ? value.id
655
+ : null);
656
+ const invalidSource = input.sourceChains.some((value) => {
657
+ if (!value || typeof value !== 'object')
658
+ return true;
659
+ const source = value;
660
+ return (typeof source.id !== 'number' ||
661
+ !Number.isSafeInteger(source.id) ||
662
+ source.id < 0 ||
663
+ Object.hasOwn(source, 'kind') ||
664
+ Object.hasOwn(source, 'caip2') ||
665
+ !formatCaip2(source.id).startsWith('eip155:'));
666
+ });
667
+ if (invalidSource) {
668
+ throw new UnsupportedAccountCapabilityError('Only viem EVM chains from the managed EVM account can be used as sources.');
669
+ }
670
+ if (new Set(ids).size !== ids.length) {
671
+ throw new UnsupportedAccountCapabilityError('`sourceChains` cannot contain duplicate chains.');
672
+ }
673
+ }
674
+ const calls = input.calls;
675
+ if (input.recipient !== undefined) {
676
+ if (Array.isArray(calls) && calls.length > 0) {
677
+ throw new UnsupportedAccountCapabilityError('An explicit delivery recipient cannot execute destination calls. Omit `recipient` to execute with the invoking managed EVM account.');
678
+ }
679
+ if (!Array.isArray(input.tokenRequests) ||
680
+ input.tokenRequests.length === 0) {
681
+ throw new UnsupportedAccountCapabilityError('An explicit delivery recipient requires at least one token request.');
682
+ }
683
+ }
684
+ }
685
+ export function normalizeTransaction(transaction, config) {
686
+ assertSupportedTransaction(transaction, config);
687
+ if ('targetChain' in transaction &&
688
+ transaction.targetChain !== undefined &&
689
+ 'kind' in transaction.targetChain &&
690
+ transaction.targetChain.kind === 'svm' &&
691
+ transaction.recipient === undefined &&
692
+ config.solana &&
693
+ 'address' in config.solana) {
694
+ return Object.freeze({
695
+ ...transaction,
696
+ recipient: config.solana.address,
697
+ });
698
+ }
699
+ return Object.freeze({ ...transaction });
700
+ }
536
701
  function narrowQuoterPin(derived, explicit) {
537
702
  if (!explicit)
538
703
  return derived;
@@ -544,7 +709,10 @@ function narrowQuoterPin(derived, explicit) {
544
709
  : derived.include.filter((quoter) => !explicit.exclude.includes(quoter));
545
710
  return { include: narrowed };
546
711
  }
547
- export function adaptTransaction(context, transaction, hyperCoreAction) {
712
+ export function adaptTransaction(context, transaction, hyperCoreAction, automaticSourceChainIds) {
713
+ if ('chain' in transaction && 'kind' in transaction.chain) {
714
+ throw new UnsupportedAccountCapabilityError('Non-EVM origin execution is not supported yet. Use a viem EVM chain as the managed source.', { vm: transaction.chain.kind });
715
+ }
548
716
  const destination = 'chain' in transaction
549
717
  ? getChainReference(transaction.chain.id)
550
718
  : 'kind' in transaction.targetChain
@@ -553,7 +721,7 @@ export function adaptTransaction(context, transaction, hyperCoreAction) {
553
721
  const destinationChainId = destination.kind === 'evm' ? destination.id : undefined;
554
722
  const sourceChains = 'chain' in transaction
555
723
  ? [getChainReference(transaction.chain.id)]
556
- : transaction.sourceChains?.map((chain) => getChainReference(chain.id));
724
+ : (transaction.sourceChains?.map((chain) => getChainReference(chain.id)) ?? automaticSourceChainIds?.map(getChainReference));
557
725
  const evmSources = sourceChains?.flatMap((chain) => chain.kind === 'evm' ? [chain] : []);
558
726
  return {
559
727
  destination,
@@ -722,9 +890,12 @@ function adaptSessionSelection(transaction, chains) {
722
890
  ]));
723
891
  }
724
892
  const chainIds = new Set(chains.flatMap((chain) => chain.kind === 'evm' && chain.id !== undefined ? [chain.id] : []));
725
- if ('chain' in transaction)
893
+ if ('chain' in transaction && !('kind' in transaction.chain)) {
726
894
  chainIds.add(transaction.chain.id);
727
- if ('targetChain' in transaction && 'id' in transaction.targetChain) {
895
+ }
896
+ if ('targetChain' in transaction &&
897
+ transaction.targetChain &&
898
+ 'id' in transaction.targetChain) {
728
899
  chainIds.add(transaction.targetChain.id);
729
900
  }
730
901
  return Object.fromEntries([...chainIds].map((chainId) => [
@@ -738,11 +909,18 @@ function adaptSessionSelection(transaction, chains) {
738
909
  function adaptSourceAssets(sourceAssets, chainIds) {
739
910
  if (!sourceAssets)
740
911
  return chainIds ? { chainIds } : undefined;
912
+ const eligible = chainIds ? new Set(chainIds) : undefined;
913
+ const assertEligible = (chainId) => {
914
+ if (eligible && !eligible.has(chainId)) {
915
+ throw new UnsupportedAccountCapabilityError(`Source assets reference chain ${chainId}, which is outside the eligible source scope.`, { chainId });
916
+ }
917
+ };
741
918
  if (Array.isArray(sourceAssets)) {
742
919
  if (sourceAssets.length > 0 && typeof sourceAssets[0] === 'object') {
743
920
  const chainTokens = {};
744
921
  const chainTokenAmounts = {};
745
922
  for (const item of sourceAssets) {
923
+ assertEligible(item.chain.id);
746
924
  const token = normalizeTokenAddress(item.address, item.chain.id, false);
747
925
  if (item.amount === undefined)
748
926
  (chainTokens[item.chain.id] ??= []).push(token);
@@ -765,7 +943,8 @@ function adaptSourceAssets(sourceAssets, chainIds) {
765
943
  }
766
944
  // ChainTokenMap: validate every per-chain list too, so symbols can't slip
767
945
  // through this input the way they can't through tokenRequests / ExactInputConfig.
768
- for (const tokens of Object.values(sourceAssets)) {
946
+ for (const [chainId, tokens] of Object.entries(sourceAssets)) {
947
+ assertEligible(Number(chainId));
769
948
  validateTokenAddresses(tokens);
770
949
  }
771
950
  return { chainTokens: sourceAssets };
@@ -8,5 +8,5 @@ export interface SdkComposition {
8
8
  readonly snapshot: LegacySdkConfigSnapshot<unknown>;
9
9
  }
10
10
  export declare function composeSdk(input: SdkConstructionInput): SdkComposition;
11
- export declare function attachAccount(sdk: SdkComposition, config: RhinestoneAccountConfig): RhinestoneAccount;
11
+ export declare function attachAccount<const C extends RhinestoneAccountConfig>(sdk: SdkComposition, config: C): RhinestoneAccount<C>;
12
12
  //# sourceMappingURL=accounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../api/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAMzB,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IACnE,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAA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