@rhinestone/sdk 2.0.0-beta.3 → 2.0.0-beta.30
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/dist/src/accounts/error.d.ts +2 -9
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +5 -11
- package/dist/src/accounts/hca.d.ts +25 -0
- package/dist/src/accounts/hca.d.ts.map +1 -0
- package/dist/src/accounts/hca.js +145 -0
- package/dist/src/accounts/index.d.ts +9 -9
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +112 -41
- package/dist/src/accounts/kernel.d.ts +1 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +1 -8
- package/dist/src/accounts/nexus.d.ts +3 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +33 -8
- package/dist/src/accounts/safe.d.ts +1 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -9
- package/dist/src/accounts/signing/common.d.ts +1 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +7 -11
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +1 -4
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +1 -4
- package/dist/src/accounts/startale.d.ts +1 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +2 -5
- package/dist/src/actions/ecdsa.js +5 -5
- package/dist/src/actions/index.js +2 -2
- package/dist/src/actions/mfa.js +2 -2
- package/dist/src/actions/passkeys.js +2 -2
- package/dist/src/actions/smart-sessions.d.ts +29 -5
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +38 -10
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +6 -6
- package/dist/src/execution/error.d.ts +8 -21
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +7 -21
- package/dist/src/execution/index.d.ts +17 -17
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +22 -41
- package/dist/src/execution/utils.d.ts +15 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +279 -75
- package/dist/src/index.d.ts +236 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +60 -115
- package/dist/src/jwt-server/jcs.d.ts +1 -1
- package/dist/src/jwt-server/jcs.js +4 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +0 -5
- package/dist/src/modules/read.d.ts +3 -2
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +33 -4
- package/dist/src/modules/validators/core.d.ts +5 -5
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +45 -34
- package/dist/src/modules/validators/cross-chain-permits.d.ts +11 -0
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/cross-chain-permits.js +76 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +162 -17
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +22 -0
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/arbiters.js +57 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +38 -9
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +509 -92
- package/dist/src/orchestrator/caip2.d.ts +9 -3
- package/dist/src/orchestrator/caip2.d.ts.map +1 -1
- package/dist/src/orchestrator/caip2.js +40 -5
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +44 -21
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -1
- package/dist/src/orchestrator/destinations.d.ts +24 -0
- package/dist/src/orchestrator/destinations.d.ts.map +1 -0
- package/dist/src/orchestrator/destinations.js +55 -0
- package/dist/src/orchestrator/error.d.ts +87 -4
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +237 -3
- package/dist/src/orchestrator/index.d.ts +6 -5
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +2 -1
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +13 -0
- package/dist/src/orchestrator/types.d.ts +114 -28
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +1 -5
- package/dist/src/smart-sessions/index.d.ts +5 -0
- package/dist/src/smart-sessions/index.d.ts.map +1 -0
- package/dist/src/smart-sessions/index.js +6 -0
- package/dist/src/types.d.ts +298 -29
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +59 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +59 -0
- package/package.json +4 -8
- package/dist/src/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- package/dist/src/actions/recovery.js +0 -189
package/dist/src/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { type TransactionResult, type TransactionStatus, type UserOperationResul
|
|
|
4
4
|
import { type PreparedQuotes, type PreparedTransactionData, type PreparedUserOperationData, type QuoteSelection, type SignedTransactionData, type SignedUserOperationData } from './execution/utils.js';
|
|
5
5
|
import { MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './modules/index.js';
|
|
6
6
|
import { type SessionDetails } from './modules/validators/smart-sessions.js';
|
|
7
|
-
import type { ApprovalRequired, AuxiliaryFunds, IntentInput, IntentOpStatus, Portfolio, SettlementLayer, SplitIntentsInput, SplitIntentsResult, TokenRequirements, WrapRequired } from './orchestrator/index.js';
|
|
8
|
-
|
|
7
|
+
import type { ApprovalRequired, AuxiliaryFunds, BridgeFill, ChainOperation, DestinationChain, FailureReason, IntentInput, IntentOpStatus, NonEvmAddress, NonEvmChain, OperationStatus, OriginSignature, Portfolio, Quote, SettlementLayer, SettlementLayerFilter, SignData, SplitIntentsInput, SplitIntentsResult, TokenRequirements, WrapRequired } from './orchestrator/index.js';
|
|
8
|
+
export type { AppFee, AppFeeRate } from './orchestrator/index.js';
|
|
9
|
+
import { hyperCoreMainnet, solanaMainnet, tronMainnet } from './orchestrator/index.js';
|
|
10
|
+
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, ChainSessionConfig, CrossChainPermissionInput, CrossChainPermit, CrossChainSettlementLayer, FromLeg, MultiFactorValidatorConfig, NonEvmTokenRequest, NonEvmTokenRequests, OwnableValidatorConfig, OwnerSet, ParamConstraint, PaymasterConfig, Permission, PermissionFunctionConfig, Permit2ClaimPolicy, Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneSDKConfig, Session, SessionDefinition, SignerSet, SourceCallInput, SourceCallProvidedFunds, TokenRequest, TokenSymbol, ToLeg, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types.js';
|
|
9
11
|
interface SubmitTransactionOptions {
|
|
10
12
|
authorizations?: SignedAuthorizationList;
|
|
11
13
|
/**
|
|
@@ -16,54 +18,219 @@ interface SubmitTransactionOptions {
|
|
|
16
18
|
internal_dryRun?: boolean;
|
|
17
19
|
}
|
|
18
20
|
interface RhinestoneAccount {
|
|
21
|
+
/** The resolved account configuration. */
|
|
19
22
|
config: RhinestoneAccountConfig;
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Deploy the account on a given chain.
|
|
25
|
+
* @param chain Chain to deploy the account on
|
|
26
|
+
* @param params Optional deployment parameters (sponsorship)
|
|
27
|
+
* @returns `true` once the deployment is submitted
|
|
28
|
+
*/
|
|
29
|
+
deploy(chain: Chain, params?: {
|
|
22
30
|
sponsored?: boolean;
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Check whether the account is deployed on a given chain.
|
|
34
|
+
* @param chain Chain to check
|
|
35
|
+
* @returns `true` if the account is deployed, `false` otherwise
|
|
36
|
+
*/
|
|
37
|
+
isDeployed(chain: Chain): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Set up an existing account on a given chain by installing any missing modules.
|
|
40
|
+
* @param chain Chain to set the account up on
|
|
41
|
+
* @returns `true` once setup is submitted
|
|
42
|
+
*/
|
|
43
|
+
setup(chain: Chain): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Get the account initialization data, used to deploy the account onchain.
|
|
46
|
+
* @returns The factory address and factory data
|
|
47
|
+
*/
|
|
26
48
|
getInitData(): {
|
|
27
49
|
factory: Address;
|
|
28
50
|
factoryData: Hex;
|
|
29
51
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Prepare and sign the EIP-7702 account initialization data.
|
|
54
|
+
* @returns The init data signature
|
|
55
|
+
*/
|
|
56
|
+
signEip7702InitData(): Promise<Hex>;
|
|
57
|
+
/**
|
|
58
|
+
* Prepare a transaction for signing.
|
|
59
|
+
* @param transaction Transaction to prepare
|
|
60
|
+
* @returns The prepared transaction data
|
|
61
|
+
* @see {@link signTransaction} to sign the prepared transaction
|
|
62
|
+
* @see {@link submitTransaction} to submit the signed transaction
|
|
63
|
+
*/
|
|
64
|
+
prepareTransaction(transaction: Transaction): Promise<PreparedTransactionData>;
|
|
65
|
+
/**
|
|
66
|
+
* Get the typed-data messages to sign for a prepared transaction.
|
|
67
|
+
* @param preparedTransaction Prepared transaction data
|
|
68
|
+
* @param options Optional override; pass `{ intentId }` to inspect a specific quote from `preparedTransaction.quotes.all`
|
|
69
|
+
* @returns The origin, destination, and (when required) target-execution typed-data messages
|
|
70
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
71
|
+
*/
|
|
72
|
+
getTransactionMessages(preparedTransaction: PreparedTransactionData, options?: QuoteSelection): {
|
|
33
73
|
origin: TypedDataDefinition[];
|
|
34
74
|
destination: TypedDataDefinition;
|
|
35
75
|
targetExecution?: TypedDataDefinition;
|
|
36
76
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Sign a prepared transaction.
|
|
79
|
+
* @param preparedTransaction Prepared transaction data
|
|
80
|
+
* @param options Optional override; pass `{ intentId }` to sign a specific quote from `preparedTransaction.quotes.all`
|
|
81
|
+
* @returns The signed transaction data
|
|
82
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
83
|
+
* @see {@link submitTransaction} to submit the signed transaction
|
|
84
|
+
*/
|
|
85
|
+
signTransaction(preparedTransaction: PreparedTransactionData, options?: QuoteSelection): Promise<SignedTransactionData>;
|
|
86
|
+
/**
|
|
87
|
+
* Sign the EIP-7702 authorizations required for a transaction.
|
|
88
|
+
* @param preparedTransaction Prepared transaction data
|
|
89
|
+
* @returns The signed authorization list
|
|
90
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
91
|
+
*/
|
|
92
|
+
signAuthorizations(preparedTransaction: PreparedTransactionData): Promise<SignedAuthorizationList>;
|
|
93
|
+
/**
|
|
94
|
+
* Sign a message (EIP-191).
|
|
95
|
+
* @param message Message to sign
|
|
96
|
+
* @param chain Chain to sign the message for
|
|
97
|
+
* @param signers Signers to use, or `undefined` for the account default
|
|
98
|
+
* @returns The signature
|
|
99
|
+
* @see {@link signTypedData} to sign EIP-712 typed data
|
|
100
|
+
*/
|
|
101
|
+
signMessage(message: SignableMessage, chain: Chain, signers: SignerSet | undefined): Promise<Hex>;
|
|
102
|
+
/**
|
|
103
|
+
* Sign typed data (EIP-712).
|
|
104
|
+
* @param parameters Typed-data parameters
|
|
105
|
+
* @param chain Chain to sign the typed data for
|
|
106
|
+
* @param signers Signers to use, or `undefined` for the account default
|
|
107
|
+
* @returns The signature
|
|
108
|
+
* @see {@link signMessage} to sign an EIP-191 message
|
|
109
|
+
*/
|
|
110
|
+
signTypedData<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(parameters: HashTypedDataParameters<typedData, primaryType>, chain: Chain, signers: SignerSet | undefined): Promise<Hex>;
|
|
111
|
+
/**
|
|
112
|
+
* Sign an orchestrator intent operation. Used by headless flows that prepare
|
|
113
|
+
* the intent outside the SDK but still need the SDK-owned smart-session
|
|
114
|
+
* signature packing and target-execution signature routing.
|
|
115
|
+
* @param signData Sign data returned by the orchestrator (origin/destination/targetExecution typed data)
|
|
116
|
+
* @param targetChain Chain where the destination execution runs
|
|
117
|
+
* @param signers Signers to use, or `undefined` for the account default
|
|
118
|
+
* @returns The intent signatures, ready for submission
|
|
119
|
+
* @see {@link signTransaction} for the canonical signing path
|
|
120
|
+
*/
|
|
121
|
+
signIntent(signData: SignData, targetChain: DestinationChain, signers?: SignerSet): Promise<SignedIntentData>;
|
|
122
|
+
/**
|
|
123
|
+
* Submit a signed transaction.
|
|
124
|
+
* @param signedTransaction Signed transaction data
|
|
125
|
+
* @param options Optional submission options (e.g. EIP-7702 `authorizations`)
|
|
126
|
+
* @returns The transaction result (an intent ID)
|
|
127
|
+
* @see {@link signTransaction} to sign the transaction data
|
|
128
|
+
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
129
|
+
* @see {@link waitForExecution} to wait for the transaction to execute onchain
|
|
130
|
+
*/
|
|
131
|
+
submitTransaction(signedTransaction: SignedTransactionData, options?: SubmitTransactionOptions): Promise<TransactionResult>;
|
|
132
|
+
/**
|
|
133
|
+
* Prepare a user operation for signing.
|
|
134
|
+
* @param transaction User operation to prepare
|
|
135
|
+
* @returns The prepared user operation data
|
|
136
|
+
* @see {@link signUserOperation} to sign the prepared user operation
|
|
137
|
+
* @see {@link submitUserOperation} to submit the signed user operation
|
|
138
|
+
* @see {@link sendUserOperation} to prepare, sign, and submit in one call
|
|
139
|
+
*/
|
|
140
|
+
prepareUserOperation(transaction: UserOperationTransaction): Promise<PreparedUserOperationData>;
|
|
141
|
+
/**
|
|
142
|
+
* Sign a prepared user operation.
|
|
143
|
+
* @param preparedUserOperation Prepared user operation data
|
|
144
|
+
* @returns The signed user operation data
|
|
145
|
+
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
146
|
+
* @see {@link submitUserOperation} to submit the signed user operation
|
|
147
|
+
*/
|
|
148
|
+
signUserOperation(preparedUserOperation: PreparedUserOperationData): Promise<SignedUserOperationData>;
|
|
149
|
+
/**
|
|
150
|
+
* Submit a signed user operation.
|
|
151
|
+
* @param signedUserOperation Signed user operation data
|
|
152
|
+
* @returns The user operation result (a UserOp hash)
|
|
153
|
+
* @see {@link signUserOperation} to sign the user operation data
|
|
154
|
+
* @see {@link waitForExecution} to wait for the user operation to execute onchain
|
|
155
|
+
*/
|
|
156
|
+
submitUserOperation(signedUserOperation: SignedUserOperationData): Promise<UserOperationResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Prepare, sign, and submit a user operation in a single call.
|
|
159
|
+
* @param transaction User operation to send
|
|
160
|
+
* @returns The user operation result (a UserOp hash)
|
|
161
|
+
* @see {@link waitForExecution} to wait for the user operation to execute onchain
|
|
162
|
+
*/
|
|
163
|
+
sendUserOperation(transaction: UserOperationTransaction): Promise<UserOperationResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Wait for a submitted transaction or user operation to execute onchain.
|
|
166
|
+
* Polls the orchestrator until the intent reaches a terminal state; on failure
|
|
167
|
+
* an `IntentFailedError` is thrown.
|
|
168
|
+
* @param result The result returned by a submit/send call
|
|
169
|
+
* @returns The per-chain operation status (for intents) or a UserOp receipt
|
|
170
|
+
*/
|
|
46
171
|
waitForExecution(result: TransactionResult): Promise<TransactionStatus>;
|
|
47
172
|
waitForExecution(result: UserOperationResult): Promise<UserOperationReceipt>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Get the account address.
|
|
175
|
+
* @returns The smart account address
|
|
176
|
+
*/
|
|
177
|
+
getAddress(): Address;
|
|
178
|
+
/**
|
|
179
|
+
* Get the account portfolio (token balances across chains).
|
|
180
|
+
* @param onTestnets Whether to query testnet balances (default is `false`)
|
|
181
|
+
* @returns The account balances
|
|
182
|
+
*/
|
|
183
|
+
getPortfolio(onTestnets?: boolean): Promise<Portfolio>;
|
|
184
|
+
/**
|
|
185
|
+
* Resolve the smart-session details for a set of sessions.
|
|
186
|
+
* @param sessions Sessions to resolve
|
|
187
|
+
* @returns The resolved session details
|
|
188
|
+
*/
|
|
189
|
+
experimental_getSessionDetails(sessions: Session[]): Promise<SessionDetails>;
|
|
190
|
+
/**
|
|
191
|
+
* Check whether a smart session is enabled on the account.
|
|
192
|
+
* @param session Session to check
|
|
193
|
+
* @returns `true` if the session is enabled
|
|
194
|
+
*/
|
|
195
|
+
experimental_isSessionEnabled(session: Session): Promise<boolean>;
|
|
196
|
+
/**
|
|
197
|
+
* Sign the data required to enable a smart session.
|
|
198
|
+
* @param details Session details to enable
|
|
199
|
+
* @returns The enable-session signature
|
|
200
|
+
*/
|
|
201
|
+
experimental_signEnableSession(details: SessionDetails): Promise<Hex>;
|
|
202
|
+
/**
|
|
203
|
+
* Get the account owners.
|
|
204
|
+
* @remarks Only returns ECDSA owners; owners managed by other validator types are not included.
|
|
205
|
+
* @param chain Chain to read the owners from
|
|
206
|
+
* @returns The owner addresses and threshold, or `null` if unavailable
|
|
207
|
+
*/
|
|
208
|
+
getOwners(chain: Chain): Promise<{
|
|
54
209
|
accounts: Address[];
|
|
55
210
|
threshold: number;
|
|
56
211
|
} | null>;
|
|
57
|
-
|
|
58
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Get the account validator modules.
|
|
214
|
+
* @param chain Chain to read the validators from
|
|
215
|
+
* @returns The validator module addresses
|
|
216
|
+
*/
|
|
217
|
+
getValidators(chain: Chain): Promise<Address[]>;
|
|
218
|
+
/**
|
|
219
|
+
* Get the account executor modules.
|
|
220
|
+
* @param chain Chain to read the executors from
|
|
221
|
+
* @returns The executor module addresses
|
|
222
|
+
*/
|
|
223
|
+
getExecutors(chain: Chain): Promise<Address[]>;
|
|
224
|
+
}
|
|
225
|
+
interface SignedIntentData {
|
|
226
|
+
originSignatures: OriginSignature[];
|
|
227
|
+
destinationSignature: Hex;
|
|
228
|
+
targetExecutionSignature: Hex | undefined;
|
|
59
229
|
}
|
|
60
230
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @param config Account config (e.g. implementation vendor, owner signers, smart sessions)
|
|
64
|
-
* @returns account
|
|
231
|
+
* Stateful entry point that holds shared configuration (auth, provider, bundler,
|
|
232
|
+
* paymaster) and creates accounts from it.
|
|
65
233
|
*/
|
|
66
|
-
declare function createRhinestoneAccount(config: RhinestoneConfig): Promise<RhinestoneAccount>;
|
|
67
234
|
declare class RhinestoneSDK {
|
|
68
235
|
private authProvider;
|
|
69
236
|
private endpointUrl?;
|
|
@@ -72,13 +239,45 @@ declare class RhinestoneSDK {
|
|
|
72
239
|
private paymaster?;
|
|
73
240
|
private useDevContracts?;
|
|
74
241
|
private headers?;
|
|
242
|
+
/**
|
|
243
|
+
* Create a Rhinestone SDK instance.
|
|
244
|
+
* @param options Shared configuration applied to every account created by this instance
|
|
245
|
+
*/
|
|
75
246
|
constructor(options: RhinestoneSDKConfig);
|
|
247
|
+
/**
|
|
248
|
+
* Create an account using this instance's shared configuration.
|
|
249
|
+
* @param config Per-account configuration (owners, account type, modules, sessions)
|
|
250
|
+
* @returns The account instance
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* import { RhinestoneSDK } from '@rhinestone/sdk'
|
|
254
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
255
|
+
*
|
|
256
|
+
* const owner = privateKeyToAccount('0x...')
|
|
257
|
+
*
|
|
258
|
+
* const sdk = new RhinestoneSDK({
|
|
259
|
+
* auth: { mode: 'apiKey', apiKey: process.env.RHINESTONE_API_KEY! },
|
|
260
|
+
* })
|
|
261
|
+
*
|
|
262
|
+
* const account = await sdk.createAccount({
|
|
263
|
+
* owners: { type: 'ecdsa', accounts: [owner] },
|
|
264
|
+
* })
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
76
267
|
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Get the current status of a submitted intent.
|
|
270
|
+
* @param intentId The intent ID returned when the transaction was submitted
|
|
271
|
+
* @returns The intent status
|
|
272
|
+
*/
|
|
273
|
+
getIntentStatus(intentId: string): Promise<TransactionStatus>;
|
|
274
|
+
/**
|
|
275
|
+
* Split a transaction into multiple intents across chains.
|
|
276
|
+
* @param input The intents to split
|
|
277
|
+
* @returns The split-intents result
|
|
278
|
+
*/
|
|
80
279
|
splitIntents(input: SplitIntentsInput): Promise<SplitIntentsResult>;
|
|
81
280
|
}
|
|
82
|
-
export { RhinestoneSDK,
|
|
83
|
-
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, ChainSessionConfig, Session, SessionDefinition,
|
|
281
|
+
export { RhinestoneSDK, hyperCoreMainnet, solanaMainnet, tronMainnet, OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, };
|
|
282
|
+
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, NonEvmTokenRequest, NonEvmTokenRequests, NonEvmAddress, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, SourceCallInput, SourceCallProvidedFunds, ChainSessionConfig, Session, SessionDefinition, Permission, PermissionFunctionConfig, ParamConstraint, Policy, Permit2ClaimPolicy, CrossChainPermissionInput, CrossChainPermit, FromLeg, ToLeg, CrossChainSettlementLayer, UniversalActionPolicyParamCondition, PreparedQuotes, PreparedTransactionData, Quote, QuoteSelection, SignedTransactionData, TransactionResult, PreparedUserOperationData, SignedUserOperationData, UserOperationResult, AuxiliaryFunds, BridgeFill, DestinationChain, NonEvmChain, IntentInput, IntentOpStatus, SettlementLayer, SettlementLayerFilter, SplitIntentsInput, SplitIntentsResult, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, OriginSignature, SignData, SignedIntentData, OperationStatus, FailureReason, ChainOperation, };
|
|
84
283
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.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;AAcpE,OAAO,EAKL,KAAK,i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BAAwB,EACxB,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,yBAAyB,EACzB,mCAAmC,EACnC,cAAc,EACd,uBAAuB,EACvB,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAEhB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAEhB,eAAe,EACf,aAAa,EACb,cAAc,GACf,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { checkAddress, deploy as deployInternal, FactoryArgsNotAvailableError, getAccountProvider, getAddress as getAddressInternal, getInitCode, isDeployed as isDeployedInternal, OwnersFieldRequiredError, setup as setupInternal, signEip7702InitData as signEip7702InitDataInternal, } from './accounts/index.js';
|
|
2
2
|
import { createAuthProvider } from './auth/provider.js';
|
|
3
3
|
import { getIntentStatus as getIntentStatusInternal, getPortfolio as getPortfolioInternal, sendUserOperation as sendUserOperationInternal, splitIntents as splitIntentsInternal, waitForExecution as waitForExecutionInternal, } from './execution/index.js';
|
|
4
|
-
import { getTransactionMessages as getTransactionMessagesInternal, prepareTransaction as prepareTransactionInternal, prepareUserOperation as prepareUserOperationInternal, signAuthorizations as signAuthorizationsInternal, signMessage as signMessageInternal, signTransaction as signTransactionInternal, signTypedData as signTypedDataInternal, signUserOperation as signUserOperationInternal, submitTransaction as submitTransactionInternal, submitUserOperation as submitUserOperationInternal, } from './execution/utils.js';
|
|
4
|
+
import { getTargetExecutionSignature as getTargetExecutionSignatureInternal, getTransactionMessages as getTransactionMessagesInternal, prepareTransaction as prepareTransactionInternal, prepareUserOperation as prepareUserOperationInternal, signAuthorizations as signAuthorizationsInternal, signIntent as signIntentInternal, signMessage as signMessageInternal, signTransaction as signTransactionInternal, signTypedData as signTypedDataInternal, signUserOperation as signUserOperationInternal, submitTransaction as submitTransactionInternal, submitUserOperation as submitUserOperationInternal, } from './execution/utils.js';
|
|
5
5
|
import { getExecutors as getExecutorsInternal, getOwners as getOwnersInternal, getSessionDetails as getSessionDetailsInternal, getValidators as getValidatorsInternal, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, signEnableSession as signEnableSessionInternal, WEBAUTHN_VALIDATOR_ADDRESS, } from './modules/index.js';
|
|
6
6
|
import { isSessionEnabled as isSessionEnabledInternal, } from './modules/validators/smart-sessions.js';
|
|
7
|
+
import { hyperCoreMainnet, solanaMainnet, tronMainnet } from './orchestrator/index.js';
|
|
7
8
|
/**
|
|
8
|
-
* Initialize a Rhinestone account
|
|
9
|
+
* Initialize a Rhinestone account from a fully-resolved config.
|
|
9
10
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
10
|
-
* @
|
|
11
|
-
* @returns account
|
|
11
|
+
* @internal Use {@link RhinestoneSDK.createAccount} instead.
|
|
12
12
|
*/
|
|
13
|
-
async function
|
|
13
|
+
async function createAccountInternal(config) {
|
|
14
14
|
// Sanity check for existing (externally created) accounts
|
|
15
15
|
// Ensures we decode the initdata correctly
|
|
16
16
|
checkAddress(config);
|
|
@@ -21,31 +21,17 @@ async function createRhinestoneAccount(config) {
|
|
|
21
21
|
/**
|
|
22
22
|
* Deploys the account on a given chain
|
|
23
23
|
* @param chain Chain to deploy the account on
|
|
24
|
-
* @param
|
|
24
|
+
* @param params Optional deployment params (e.g. `sponsored`)
|
|
25
25
|
*/
|
|
26
26
|
function deploy(chain, params) {
|
|
27
27
|
return deployInternal(config, chain, params);
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Checks if the account is deployed on a given chain
|
|
31
|
-
* @param chain Chain to check if the account is deployed on
|
|
32
|
-
* @returns true if the account is deployed, false otherwise
|
|
33
|
-
*/
|
|
34
29
|
function isDeployed(chain) {
|
|
35
30
|
return isDeployedInternal(config, chain);
|
|
36
31
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Sets up the existing account on a given chain
|
|
39
|
-
* by installing the missing modules (if any).
|
|
40
|
-
* @param chain Chain to set up the account on
|
|
41
|
-
*/
|
|
42
32
|
function setup(chain) {
|
|
43
33
|
return setupInternal(config, chain);
|
|
44
34
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Get the account initialization data. Used for deploying the account onchain.
|
|
47
|
-
* @returns factory address and factory data
|
|
48
|
-
*/
|
|
49
35
|
function getInitData() {
|
|
50
36
|
const initData = getInitCode(config);
|
|
51
37
|
if (!initData) {
|
|
@@ -59,147 +45,65 @@ async function createRhinestoneAccount(config) {
|
|
|
59
45
|
factoryData: initData.factoryData,
|
|
60
46
|
};
|
|
61
47
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Prepare and sign the EIP-7702 account initialization data
|
|
64
|
-
* @returns init data signature
|
|
65
|
-
*/
|
|
66
48
|
function signEip7702InitData() {
|
|
67
49
|
return signEip7702InitDataInternal(config);
|
|
68
50
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Prepare a transaction data
|
|
71
|
-
* @param transaction Transaction to prepare
|
|
72
|
-
* @returns prepared transaction data
|
|
73
|
-
*/
|
|
74
51
|
function prepareTransaction(transaction) {
|
|
75
52
|
return prepareTransactionInternal(config, transaction);
|
|
76
53
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Get the transaction typed data message to sign
|
|
79
|
-
* @param preparedTransaction Prepared transaction data
|
|
80
|
-
* @param options Optional override; pass `{ intentId }` to inspect a specific quote from `preparedTransaction.quotes.all`
|
|
81
|
-
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
82
|
-
*/
|
|
83
54
|
function getTransactionMessages(preparedTransaction, options) {
|
|
84
55
|
return getTransactionMessagesInternal(config, preparedTransaction, options);
|
|
85
56
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Sign a transaction
|
|
88
|
-
* @param preparedTransaction Prepared transaction data
|
|
89
|
-
* @param options Optional override; pass `{ intentId }` to sign a specific quote from `preparedTransaction.quotes.all`
|
|
90
|
-
* @returns signed transaction data
|
|
91
|
-
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
92
|
-
*/
|
|
93
57
|
function signTransaction(preparedTransaction, options) {
|
|
94
58
|
return signTransactionInternal(config, preparedTransaction, options);
|
|
95
59
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Sign the required EIP-7702 authorizations for a transaction
|
|
98
|
-
* @param preparedTransaction Prepared transaction data
|
|
99
|
-
* @returns signed authorizations
|
|
100
|
-
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
101
|
-
*/
|
|
102
60
|
function signAuthorizations(preparedTransaction) {
|
|
103
61
|
return signAuthorizationsInternal(config, preparedTransaction);
|
|
104
62
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Sign a message (EIP-191)
|
|
107
|
-
* @param message Message to sign
|
|
108
|
-
* @param chain Chain to sign the message on
|
|
109
|
-
* @param signers Signers to use for signing
|
|
110
|
-
* @returns signature
|
|
111
|
-
*/
|
|
112
63
|
function signMessage(message, chain, signers) {
|
|
113
64
|
return signMessageInternal(config, message, chain, signers);
|
|
114
65
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Sign a typed data (EIP-712)
|
|
117
|
-
* @param parameters Typed data parameters
|
|
118
|
-
* @param chain Chain to sign the typed data on
|
|
119
|
-
* @param signers Signers to use for signing
|
|
120
|
-
* @returns signature
|
|
121
|
-
*/
|
|
122
66
|
function signTypedData(parameters, chain, signers) {
|
|
123
67
|
return signTypedDataInternal(config, parameters, chain, signers);
|
|
124
68
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
69
|
+
async function signIntent(signData, targetChain, signers) {
|
|
70
|
+
const { originSignatures, destinationSignature } = await signIntentInternal(config, signData, targetChain, signers, false);
|
|
71
|
+
const targetExecutionSignature = await getTargetExecutionSignatureInternal(config, signData, targetChain, signers);
|
|
72
|
+
return {
|
|
73
|
+
originSignatures,
|
|
74
|
+
destinationSignature,
|
|
75
|
+
targetExecutionSignature,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
134
78
|
function submitTransaction(signedTransaction, options) {
|
|
135
79
|
return submitTransactionInternal(config, signedTransaction, options?.authorizations ?? [], options?.internal_dryRun ?? false);
|
|
136
80
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Prepare a user operation data
|
|
139
|
-
* @param transaction User operation to prepare
|
|
140
|
-
* @returns prepared user operation data
|
|
141
|
-
*/
|
|
142
81
|
function prepareUserOperation(transaction) {
|
|
143
82
|
return prepareUserOperationInternal(config, transaction);
|
|
144
83
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Sign a user operation
|
|
147
|
-
* @param preparedUserOperation Prepared user operation data
|
|
148
|
-
* @returns signed user operation data
|
|
149
|
-
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
150
|
-
*/
|
|
151
84
|
function signUserOperation(preparedUserOperation) {
|
|
152
85
|
return signUserOperationInternal(config, preparedUserOperation);
|
|
153
86
|
}
|
|
154
|
-
/**
|
|
155
|
-
* Submit a transaction
|
|
156
|
-
* @param signedTransaction Signed transaction data
|
|
157
|
-
* @returns transaction result object (a UserOp hash)
|
|
158
|
-
* @see {@link signUserOperation} to sign the user operation data
|
|
159
|
-
*/
|
|
160
87
|
function submitUserOperation(signedUserOperation) {
|
|
161
88
|
return submitUserOperationInternal(config, signedUserOperation);
|
|
162
89
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Sign and send a user operation
|
|
165
|
-
* @param transaction User operation to send
|
|
166
|
-
* @returns user operation result object (a UserOp hash)
|
|
167
|
-
*/
|
|
168
90
|
function sendUserOperation(transaction) {
|
|
169
91
|
return sendUserOperationInternal(config, transaction);
|
|
170
92
|
}
|
|
171
93
|
function waitForExecution(result) {
|
|
172
94
|
return waitForExecutionInternal(config, result);
|
|
173
95
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Get account address
|
|
176
|
-
* @returns Address of the smart account
|
|
177
|
-
*/
|
|
178
96
|
function getAddress() {
|
|
179
97
|
return getAddressInternal(config);
|
|
180
98
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Get account portfolio
|
|
183
|
-
* @param onTestnets Whether to query the testnet balances (default is `false`)
|
|
184
|
-
* @returns Account balances
|
|
185
|
-
*/
|
|
186
99
|
function getPortfolio(onTestnets = false) {
|
|
187
100
|
return getPortfolioInternal(config, onTestnets);
|
|
188
101
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Get account owners (ECDSA)
|
|
191
|
-
* @param chain Chain to get the owners on
|
|
192
|
-
* @returns Account owners
|
|
193
|
-
*/
|
|
194
102
|
function getOwners(chain) {
|
|
103
|
+
const accountType = getAccountProvider(config).type;
|
|
195
104
|
const account = getAddress();
|
|
196
|
-
return getOwnersInternal(account, chain, config.provider);
|
|
105
|
+
return getOwnersInternal(accountType, account, chain, config.provider);
|
|
197
106
|
}
|
|
198
|
-
/**
|
|
199
|
-
* Get account validator modules
|
|
200
|
-
* @param chain Chain to get the validators on
|
|
201
|
-
* @returns List of account validators
|
|
202
|
-
*/
|
|
203
107
|
function getValidators(chain) {
|
|
204
108
|
const accountType = getAccountProvider(config).type;
|
|
205
109
|
const account = getAddress();
|
|
@@ -233,6 +137,7 @@ async function createRhinestoneAccount(config) {
|
|
|
233
137
|
signAuthorizations,
|
|
234
138
|
signMessage,
|
|
235
139
|
signTypedData,
|
|
140
|
+
signIntent,
|
|
236
141
|
submitTransaction,
|
|
237
142
|
prepareUserOperation,
|
|
238
143
|
signUserOperation,
|
|
@@ -250,6 +155,10 @@ async function createRhinestoneAccount(config) {
|
|
|
250
155
|
getInitData,
|
|
251
156
|
};
|
|
252
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Stateful entry point that holds shared configuration (auth, provider, bundler,
|
|
160
|
+
* paymaster) and creates accounts from it.
|
|
161
|
+
*/
|
|
253
162
|
class RhinestoneSDK {
|
|
254
163
|
authProvider;
|
|
255
164
|
endpointUrl;
|
|
@@ -258,6 +167,10 @@ class RhinestoneSDK {
|
|
|
258
167
|
paymaster;
|
|
259
168
|
useDevContracts;
|
|
260
169
|
headers;
|
|
170
|
+
/**
|
|
171
|
+
* Create a Rhinestone SDK instance.
|
|
172
|
+
* @param options Shared configuration applied to every account created by this instance
|
|
173
|
+
*/
|
|
261
174
|
constructor(options) {
|
|
262
175
|
this.authProvider = createAuthProvider(options);
|
|
263
176
|
this.endpointUrl = options.endpointUrl;
|
|
@@ -267,6 +180,26 @@ class RhinestoneSDK {
|
|
|
267
180
|
this.useDevContracts = options.useDevContracts;
|
|
268
181
|
this.headers = options.headers;
|
|
269
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Create an account using this instance's shared configuration.
|
|
185
|
+
* @param config Per-account configuration (owners, account type, modules, sessions)
|
|
186
|
+
* @returns The account instance
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { RhinestoneSDK } from '@rhinestone/sdk'
|
|
190
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
191
|
+
*
|
|
192
|
+
* const owner = privateKeyToAccount('0x...')
|
|
193
|
+
*
|
|
194
|
+
* const sdk = new RhinestoneSDK({
|
|
195
|
+
* auth: { mode: 'apiKey', apiKey: process.env.RHINESTONE_API_KEY! },
|
|
196
|
+
* })
|
|
197
|
+
*
|
|
198
|
+
* const account = await sdk.createAccount({
|
|
199
|
+
* owners: { type: 'ecdsa', accounts: [owner] },
|
|
200
|
+
* })
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
270
203
|
createAccount(config) {
|
|
271
204
|
const rhinestoneConfig = {
|
|
272
205
|
...config,
|
|
@@ -278,15 +211,27 @@ class RhinestoneSDK {
|
|
|
278
211
|
useDevContracts: this.useDevContracts,
|
|
279
212
|
headers: this.headers,
|
|
280
213
|
};
|
|
281
|
-
return
|
|
214
|
+
return createAccountInternal(rhinestoneConfig);
|
|
282
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Get the current status of a submitted intent.
|
|
218
|
+
* @param intentId The intent ID returned when the transaction was submitted
|
|
219
|
+
* @returns The intent status
|
|
220
|
+
*/
|
|
283
221
|
getIntentStatus(intentId) {
|
|
284
222
|
return getIntentStatusInternal(this.authProvider, this.endpointUrl, intentId, this.headers);
|
|
285
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Split a transaction into multiple intents across chains.
|
|
226
|
+
* @param input The intents to split
|
|
227
|
+
* @returns The split-intents result
|
|
228
|
+
*/
|
|
286
229
|
splitIntents(input) {
|
|
287
230
|
return splitIntentsInternal(this.authProvider, this.endpointUrl, input, this.headers);
|
|
288
231
|
}
|
|
289
232
|
}
|
|
290
|
-
export { RhinestoneSDK,
|
|
233
|
+
export { RhinestoneSDK,
|
|
234
|
+
// Non-viem destination chain descriptors (Solana, Tron, HyperCore)
|
|
235
|
+
hyperCoreMainnet, solanaMainnet, tronMainnet,
|
|
291
236
|
// Validator addresses
|
|
292
237
|
OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* RFC 8785 JSON Canonicalization Scheme (JCS).
|
|
3
3
|
*
|
|
4
4
|
* Produces a deterministic JSON serialization by:
|
|
5
|
-
* 1. Sorting object keys lexicographically (
|
|
5
|
+
* 1. Sorting object keys lexicographically (UTF-16 code-unit order, per RFC 8785 §3.2.3)
|
|
6
6
|
* 2. Using ES2015+ `JSON.stringify` number serialization (IEEE 754 → shortest round-trip)
|
|
7
7
|
* 3. No whitespace
|
|
8
8
|
*
|