@rhinestone/sdk 2.0.0-beta.0 → 2.0.0-beta.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.
- package/README.md +43 -2
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +6 -34
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +3 -2
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +3 -3
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +6 -4
- package/dist/src/execution/compact.d.ts +1 -144
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +1 -109
- package/dist/src/execution/error.d.ts +10 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +9 -1
- package/dist/src/execution/index.d.ts +5 -7
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +24 -44
- package/dist/src/execution/utils.d.ts +29 -13
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +174 -122
- package/dist/src/index.d.ts +21 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -45
- package/dist/src/modules/index.d.ts +2 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +2 -2
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +2 -4
- package/dist/src/modules/validators/index.d.ts +2 -2
- package/dist/src/modules/validators/index.d.ts.map +1 -1
- package/dist/src/modules/validators/index.js +2 -2
- package/dist/src/modules/validators/permissions.d.ts +5 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -0
- package/dist/src/modules/validators/permissions.js +111 -0
- package/dist/src/modules/validators/policies/claim/permit2.d.ts +29 -3
- package/dist/src/modules/validators/policies/claim/permit2.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.d.ts +14 -27
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +74 -22
- package/dist/src/orchestrator/caip2.d.ts +7 -0
- package/dist/src/orchestrator/caip2.d.ts.map +1 -0
- package/dist/src/orchestrator/caip2.js +17 -0
- package/dist/src/orchestrator/client.d.ts +11 -11
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +193 -295
- package/dist/src/orchestrator/consts.d.ts +2 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +2 -2
- package/dist/src/orchestrator/error.d.ts +72 -217
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +117 -195
- package/dist/src/orchestrator/index.d.ts +5 -5
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +3 -3
- package/dist/src/orchestrator/registry.d.ts +1 -8
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +1 -26
- package/dist/src/orchestrator/types.d.ts +97 -232
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +101 -32
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +2 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -1
- package/dist/src/utils/walletClient.d.ts.map +1 -0
- package/dist/src/{accounts → utils}/walletClient.js +1 -1
- package/package.json +1 -5
- package/dist/src/accounts/passport.d.ts +0 -9
- package/dist/src/accounts/passport.d.ts.map +0 -1
- package/dist/src/accounts/passport.js +0 -78
- package/dist/src/accounts/walletClient.d.ts.map +0 -1
- package/dist/src/actions/compact.d.ts +0 -15
- package/dist/src/actions/compact.d.ts.map +0 -1
- package/dist/src/actions/compact.js +0 -200
- package/dist/src/actions/deployment.d.ts +0 -19
- package/dist/src/actions/deployment.d.ts.map +0 -1
- package/dist/src/actions/deployment.js +0 -76
- package/dist/src/execution/permit2.d.ts +0 -143
- package/dist/src/execution/permit2.d.ts.map +0 -1
- package/dist/src/execution/permit2.js +0 -280
- package/dist/src/execution/singleChainOps.d.ts +0 -41
- package/dist/src/execution/singleChainOps.d.ts.map +0 -1
- package/dist/src/execution/singleChainOps.js +0 -42
- package/dist/src/execution/types.d.ts +0 -36
- package/dist/src/execution/types.d.ts.map +0 -1
- package/dist/src/execution/types.js +0 -1
- /package/dist/src/{accounts → utils}/walletClient.d.ts +0 -0
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ const account = await rhinestone.createAccount({
|
|
|
138
138
|
Send a crosschain transaction:
|
|
139
139
|
|
|
140
140
|
```ts
|
|
141
|
-
const
|
|
141
|
+
const prepared = await account.prepareTransaction({
|
|
142
142
|
sourceChains: [baseSepolia],
|
|
143
143
|
targetChain: arbitrumSepolia,
|
|
144
144
|
calls: [
|
|
@@ -155,14 +155,55 @@ const transaction = await account.sendTransaction({
|
|
|
155
155
|
tokenRequests: [{ address: 'USDC', amount }],
|
|
156
156
|
})
|
|
157
157
|
|
|
158
|
+
const signed = await account.signTransaction(prepared)
|
|
159
|
+
const transaction = await account.submitTransaction(signed)
|
|
158
160
|
const result = await account.waitForExecution(transaction)
|
|
159
161
|
```
|
|
160
162
|
|
|
163
|
+
Create a smart session from ABI-driven permissions:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
import { toSession } from '@rhinestone/sdk/smart-sessions'
|
|
167
|
+
|
|
168
|
+
const session = toSession({
|
|
169
|
+
chain: base,
|
|
170
|
+
owners: {
|
|
171
|
+
type: 'ecdsa',
|
|
172
|
+
accounts: [sessionSigner],
|
|
173
|
+
},
|
|
174
|
+
permissions: [
|
|
175
|
+
{
|
|
176
|
+
abi: erc20Abi,
|
|
177
|
+
address: usdc,
|
|
178
|
+
functions: {
|
|
179
|
+
transfer: {
|
|
180
|
+
params: {
|
|
181
|
+
recipient: { condition: 'equal', value: recipient },
|
|
182
|
+
amount: { condition: 'lessThanOrEqual', value: 1000n },
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
claimPolicies: [
|
|
189
|
+
{
|
|
190
|
+
type: 'permit2',
|
|
191
|
+
spenders: [permit2Spender],
|
|
192
|
+
sourceTokens: [{ chain: base, address: usdc }],
|
|
193
|
+
destinationTokens: [{ chain: optimism, address: usdc }],
|
|
194
|
+
recipients: [{ chain: optimism, address: recipient }],
|
|
195
|
+
permitDeadline: { max: permitDeadline },
|
|
196
|
+
fillDeadline: [{ chain: optimism, max: fillDeadline }],
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
})
|
|
200
|
+
```
|
|
201
|
+
|
|
161
202
|
For a complete walkthrough, see the [Quickstart guide](https://docs.rhinestone.dev/smart-wallet/quickstart).
|
|
162
203
|
|
|
163
204
|
## Migrating from Orchestrator SDK
|
|
164
205
|
|
|
165
|
-
To migrate from the [Orchestrator SDK](https://github.com/rhinestonewtf/orchestrator-sdk), replace all imports of `@rhinestone/orchestrator-sdk` with `@rhinestone/sdk
|
|
206
|
+
To migrate from the [Orchestrator SDK](https://github.com/rhinestonewtf/orchestrator-sdk), replace all imports of `@rhinestone/orchestrator-sdk` with `@rhinestone/sdk`.
|
|
166
207
|
|
|
167
208
|
Let us know if you encounter any issues!
|
|
168
209
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EAKV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EAKV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAA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ress,
|
|
2
|
-
import {
|
|
1
|
+
import { concat, createPublicClient, encodeAbiParameters, encodeFunctionData, hashTypedData, size, zeroAddress, } from 'viem';
|
|
2
|
+
import { sendTransactionInternal, sendUserOperationInternal, waitForExecution, } from '../execution/index.js';
|
|
3
3
|
import { getIntentExecutor, getSetup } from '../modules/index.js';
|
|
4
4
|
import { getOwnerValidator } from '../modules/validators/index.js';
|
|
5
5
|
import { getSocialRecoveryValidator } from '../modules/validators/core.js';
|
|
6
6
|
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, } from './error.js';
|
|
7
7
|
import { getAddress as getKernelAddress, getDeployArgs as getKernelDeployArgs, getEip712Domain as getKernelEip712Domain, getGuardianSmartAccount as getKernelGuardianSmartAccount, getInstallData as getKernelInstallData, getSmartAccount as getKernelSmartAccount, packSignature as packKernelSignature, wrapMessageHash as wrapKernelMessageHash, } from './kernel.js';
|
|
8
8
|
import { getAddress as getNexusAddress, getDefaultValidatorAddress as getNexusDefaultValidatorAddress, getDeployArgs as getNexusDeployArgs, getEip712Domain as getNexusEip712Domain, getEip7702InitCall as getNexusEip7702InitCall, getGuardianSmartAccount as getNexusGuardianSmartAccount, getInstallData as getNexusInstallData, getSmartAccount as getNexusSmartAccount, packSignature as packNexusSignature, signEip7702InitData as signNexusEip7702InitData, } from './nexus.js';
|
|
9
|
-
import { getAddress as getPassportAddress, getInstallData as getPassportInstallData, packSignature as packPassportSignature, } from './passport.js';
|
|
10
9
|
import { getAddress as getSafeAddress, getDeployArgs as getSafeDeployArgs, getEip712Domain as getSafeEip712Domain, getGuardianSmartAccount as getSafeGuardianSmartAccount, getInstallData as getSafeInstallData, getSmartAccount as getSafeSmartAccount, getV0DeployArgs as getSafeV0DeployArgs, packSignature as packSafeSignature, } from './safe.js';
|
|
11
10
|
import { convertOwnerSetToSignerSet } from './signing/common.js';
|
|
12
11
|
import { sign as signMessage } from './signing/message.js';
|
|
@@ -28,17 +27,6 @@ function getDeployArgs(config) {
|
|
|
28
27
|
case 'startale': {
|
|
29
28
|
return getStartaleDeployArgs(config);
|
|
30
29
|
}
|
|
31
|
-
case 'passport': {
|
|
32
|
-
// Mocked data; will be overridden by the actual deploy args
|
|
33
|
-
return {
|
|
34
|
-
factory: zeroAddress,
|
|
35
|
-
factoryData: zeroHash,
|
|
36
|
-
salt: zeroHash,
|
|
37
|
-
implementation: zeroAddress,
|
|
38
|
-
initializationCallData: '0x',
|
|
39
|
-
initData: '0x',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
30
|
case 'eoa': {
|
|
43
31
|
throw new Error('EOA accounts do not have deploy args');
|
|
44
32
|
}
|
|
@@ -178,9 +166,6 @@ function getModuleInstallationCalls(config, module) {
|
|
|
178
166
|
case 'startale': {
|
|
179
167
|
return [getStartaleInstallData(module)];
|
|
180
168
|
}
|
|
181
|
-
case 'passport': {
|
|
182
|
-
return [getPassportInstallData(module)];
|
|
183
|
-
}
|
|
184
169
|
case 'eoa': {
|
|
185
170
|
throw new ModuleInstallationNotSupportedError(account.type);
|
|
186
171
|
}
|
|
@@ -244,9 +229,6 @@ function getAddress(config) {
|
|
|
244
229
|
case 'startale': {
|
|
245
230
|
return getStartaleAddress(config);
|
|
246
231
|
}
|
|
247
|
-
case 'passport': {
|
|
248
|
-
return getPassportAddress(config);
|
|
249
|
-
}
|
|
250
232
|
case 'eoa': {
|
|
251
233
|
if (!config.eoa) {
|
|
252
234
|
throw new AccountError({
|
|
@@ -286,10 +268,6 @@ async function getEip1271Signature(config, signers, chain, validator, hash, tran
|
|
|
286
268
|
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
287
269
|
return packNexusSignature(signature, validator, transformSignature, defaultValidatorAddress);
|
|
288
270
|
}
|
|
289
|
-
case 'passport': {
|
|
290
|
-
const signature = await signFn(hash);
|
|
291
|
-
return packPassportSignature(signature, validator, transformSignature);
|
|
292
|
-
}
|
|
293
271
|
case 'kernel': {
|
|
294
272
|
const signature = await signFn(wrapKernelMessageHash(hash, address));
|
|
295
273
|
return packKernelSignature(signature, validator, transformSignature);
|
|
@@ -333,10 +311,6 @@ async function getTypedDataPackedSignature(config, signers, chain, validator, pa
|
|
|
333
311
|
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
334
312
|
return packNexusSignature(signature, validator, transformSignature, defaultValidatorAddress);
|
|
335
313
|
}
|
|
336
|
-
case 'passport': {
|
|
337
|
-
const signature = await signFn(parameters);
|
|
338
|
-
return packPassportSignature(signature, validator, transformSignature);
|
|
339
|
-
}
|
|
340
314
|
case 'kernel': {
|
|
341
315
|
const address = getAddress(config);
|
|
342
316
|
const signMessageFn = (hash) => signMessage(signers, chain, address, hash, false);
|
|
@@ -461,7 +435,7 @@ async function setup(config, chain) {
|
|
|
461
435
|
else {
|
|
462
436
|
result = await sendUserOperationInternal(config, chain, calls);
|
|
463
437
|
}
|
|
464
|
-
await waitForExecution(config, result
|
|
438
|
+
await waitForExecution(config, result);
|
|
465
439
|
return true;
|
|
466
440
|
}
|
|
467
441
|
async function deployWithIntent(chain, config, sponsored, eip7702InitSignature) {
|
|
@@ -480,14 +454,12 @@ async function deployWithIntent(chain, config, sponsored, eip7702InitSignature)
|
|
|
480
454
|
if (!initSignature && is7702(config)) {
|
|
481
455
|
initSignature = await signEip7702InitData(config);
|
|
482
456
|
}
|
|
483
|
-
const result = await
|
|
484
|
-
|
|
485
|
-
targetChain: chain,
|
|
486
|
-
calls: [],
|
|
457
|
+
const result = await sendTransactionInternal(config, [chain], chain, {
|
|
458
|
+
callInputs: [],
|
|
487
459
|
sponsored,
|
|
488
460
|
eip7702InitSignature: initSignature,
|
|
489
461
|
});
|
|
490
|
-
await waitForExecution(config, result
|
|
462
|
+
await waitForExecution(config, result);
|
|
491
463
|
}
|
|
492
464
|
async function deployWithBundler(chain, config) {
|
|
493
465
|
const publicClient = createPublicClient({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAYtE;AAED,iBAAS,YAAY,CACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,GAAG,SAAS,CAEpB;AAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -5,9 +5,10 @@ function getAlchemyUrl(chainId, apiKey) {
|
|
|
5
5
|
if (!chainParam) {
|
|
6
6
|
throw new Error(`Unsupported chain: ${chainId}`);
|
|
7
7
|
}
|
|
8
|
-
return urlTemplate
|
|
8
|
+
return (urlTemplate
|
|
9
9
|
.replace('{{chain_param}}', chainParam)
|
|
10
|
-
|
|
10
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: literal placeholder token in the upstream shared-configs url_template
|
|
11
|
+
.replace('${ALCHEMY_API_KEY}', apiKey));
|
|
11
12
|
}
|
|
12
13
|
function getCustomUrl(chainId, urls) {
|
|
13
14
|
return urls[chainId];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAU/B,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE3D;;;GAGG;AACH,iBAAS,mBAAmB,IAAI,aAAa,CAU5C;AAED;;;GAGG;AACH,iBAAS,oBAAoB,IAAI,aAAa,CAU7C;AAED;;;;GAIG;AACH,iBAAS,0BAA0B,CACjC,OAAO,EAAE,YAAY,EACrB,sBAAsB,EAAE,GAAG,EAC3B,iBAAiB,EAAE;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,GAAG,CAAA;CACnB,EAAE,EACH,oBAAoB,EAAE,MAAM,GAC3B,aAAa,CAmBf;AAED,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getModuleInstallationCalls, getModuleUninstallationCalls, } from '../accounts/index.js';
|
|
2
|
-
import { getEnableSessionCall, getSmartSessionValidator, } from '../modules/validators/smart-sessions.js';
|
|
2
|
+
import { getEnableSessionCall, getSmartSessionValidator, toSession, } from '../modules/validators/smart-sessions.js';
|
|
3
3
|
/**
|
|
4
4
|
* Enable smart sessions
|
|
5
5
|
* @returns Calls to enable smart sessions
|
|
@@ -38,10 +38,10 @@ function experimental_disable() {
|
|
|
38
38
|
function experimental_enableSession(session, enableSessionSignature, hashesAndChainIds, sessionToEnableIndex) {
|
|
39
39
|
return {
|
|
40
40
|
async resolve({ accountAddress, chain, config }) {
|
|
41
|
-
return getEnableSessionCall(accountAddress, {
|
|
41
|
+
return getEnableSessionCall(accountAddress, toSession({
|
|
42
42
|
...session,
|
|
43
43
|
chain,
|
|
44
|
-
}, enableSessionSignature, hashesAndChainIds, sessionToEnableIndex, config.useDevContracts);
|
|
44
|
+
}, { useDevContracts: config.useDevContracts }), enableSessionSignature, hashesAndChainIds, sessionToEnableIndex, config.useDevContracts);
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts/index.js';
|
|
2
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution/index.js';
|
|
3
|
-
import {
|
|
4
|
-
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited,
|
|
2
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError } from '../execution/index.js';
|
|
3
|
+
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError } from '../orchestrator/index.js';
|
|
4
|
+
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, ValidationError, UnsupportedChainError, UnsupportedTokenError, };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"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B,GACtB,CAAA"}
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, } from '../accounts/index.js';
|
|
2
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, } from '../execution/index.js';
|
|
3
|
-
import {
|
|
2
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, } from '../execution/index.js';
|
|
3
|
+
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, } from '../orchestrator/index.js';
|
|
4
4
|
export {
|
|
5
5
|
// Account
|
|
6
6
|
isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError,
|
|
7
7
|
// Execution
|
|
8
|
-
isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError,
|
|
8
|
+
isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError,
|
|
9
9
|
// Orchestrator
|
|
10
|
-
isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited,
|
|
10
|
+
isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, ValidationError,
|
|
11
|
+
// Registry (SDK-local validation)
|
|
12
|
+
UnsupportedChainError, UnsupportedTokenError, };
|
|
@@ -1,148 +1,5 @@
|
|
|
1
|
-
import { type Hex } from 'viem';
|
|
2
|
-
import type { IntentOp, IntentOpElement } from '../orchestrator/types.js';
|
|
3
1
|
declare const SCOPE_MULTICHAIN = 0;
|
|
4
2
|
declare const RESET_PERIOD_ONE_WEEK = 6;
|
|
5
3
|
declare const COMPACT_ADDRESS = "0x00000000000000171ede64904551eeDF3C6C9788";
|
|
6
|
-
|
|
7
|
-
readonly domain: {
|
|
8
|
-
readonly name: "The Compact";
|
|
9
|
-
readonly version: "1";
|
|
10
|
-
readonly chainId: number;
|
|
11
|
-
readonly verifyingContract: "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
12
|
-
};
|
|
13
|
-
readonly types: {
|
|
14
|
-
readonly MultichainCompact: readonly [{
|
|
15
|
-
readonly name: "sponsor";
|
|
16
|
-
readonly type: "address";
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "nonce";
|
|
19
|
-
readonly type: "uint256";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "expires";
|
|
22
|
-
readonly type: "uint256";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "elements";
|
|
25
|
-
readonly type: "Element[]";
|
|
26
|
-
}];
|
|
27
|
-
readonly Element: readonly [{
|
|
28
|
-
readonly name: "arbiter";
|
|
29
|
-
readonly type: "address";
|
|
30
|
-
}, {
|
|
31
|
-
readonly name: "chainId";
|
|
32
|
-
readonly type: "uint256";
|
|
33
|
-
}, {
|
|
34
|
-
readonly name: "commitments";
|
|
35
|
-
readonly type: "Lock[]";
|
|
36
|
-
}, {
|
|
37
|
-
readonly name: "mandate";
|
|
38
|
-
readonly type: "Mandate";
|
|
39
|
-
}];
|
|
40
|
-
readonly Lock: readonly [{
|
|
41
|
-
readonly name: "lockTag";
|
|
42
|
-
readonly type: "bytes12";
|
|
43
|
-
}, {
|
|
44
|
-
readonly name: "token";
|
|
45
|
-
readonly type: "address";
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "amount";
|
|
48
|
-
readonly type: "uint256";
|
|
49
|
-
}];
|
|
50
|
-
readonly Mandate: readonly [{
|
|
51
|
-
readonly name: "target";
|
|
52
|
-
readonly type: "Target";
|
|
53
|
-
}, {
|
|
54
|
-
readonly name: "minGas";
|
|
55
|
-
readonly type: "uint128";
|
|
56
|
-
}, {
|
|
57
|
-
readonly name: "originOps";
|
|
58
|
-
readonly type: "Op";
|
|
59
|
-
}, {
|
|
60
|
-
readonly name: "destOps";
|
|
61
|
-
readonly type: "Op";
|
|
62
|
-
}, {
|
|
63
|
-
readonly name: "q";
|
|
64
|
-
readonly type: "bytes32";
|
|
65
|
-
}];
|
|
66
|
-
readonly Target: readonly [{
|
|
67
|
-
readonly name: "recipient";
|
|
68
|
-
readonly type: "address";
|
|
69
|
-
}, {
|
|
70
|
-
readonly name: "tokenOut";
|
|
71
|
-
readonly type: "Token[]";
|
|
72
|
-
}, {
|
|
73
|
-
readonly name: "targetChain";
|
|
74
|
-
readonly type: "uint256";
|
|
75
|
-
}, {
|
|
76
|
-
readonly name: "fillExpiry";
|
|
77
|
-
readonly type: "uint256";
|
|
78
|
-
}];
|
|
79
|
-
readonly Token: readonly [{
|
|
80
|
-
readonly name: "token";
|
|
81
|
-
readonly type: "address";
|
|
82
|
-
}, {
|
|
83
|
-
readonly name: "amount";
|
|
84
|
-
readonly type: "uint256";
|
|
85
|
-
}];
|
|
86
|
-
readonly Op: readonly [{
|
|
87
|
-
readonly name: "vt";
|
|
88
|
-
readonly type: "bytes32";
|
|
89
|
-
}, {
|
|
90
|
-
readonly name: "ops";
|
|
91
|
-
readonly type: "Ops[]";
|
|
92
|
-
}];
|
|
93
|
-
readonly Ops: readonly [{
|
|
94
|
-
readonly name: "to";
|
|
95
|
-
readonly type: "address";
|
|
96
|
-
}, {
|
|
97
|
-
readonly name: "value";
|
|
98
|
-
readonly type: "uint256";
|
|
99
|
-
}, {
|
|
100
|
-
readonly name: "data";
|
|
101
|
-
readonly type: "bytes";
|
|
102
|
-
}];
|
|
103
|
-
};
|
|
104
|
-
readonly primaryType: "MultichainCompact";
|
|
105
|
-
readonly message: {
|
|
106
|
-
readonly sponsor: `0x${string}`;
|
|
107
|
-
readonly nonce: bigint;
|
|
108
|
-
readonly expires: bigint;
|
|
109
|
-
readonly elements: {
|
|
110
|
-
arbiter: `0x${string}`;
|
|
111
|
-
chainId: bigint;
|
|
112
|
-
commitments: {
|
|
113
|
-
lockTag: `0x${string}`;
|
|
114
|
-
token: `0x${string}`;
|
|
115
|
-
amount: bigint;
|
|
116
|
-
}[];
|
|
117
|
-
mandate: {
|
|
118
|
-
target: {
|
|
119
|
-
recipient: `0x${string}`;
|
|
120
|
-
tokenOut: {
|
|
121
|
-
token: `0x${string}`;
|
|
122
|
-
amount: bigint;
|
|
123
|
-
}[];
|
|
124
|
-
targetChain: bigint;
|
|
125
|
-
fillExpiry: bigint;
|
|
126
|
-
};
|
|
127
|
-
minGas: bigint;
|
|
128
|
-
originOps: import("../orchestrator/types.js").Op;
|
|
129
|
-
destOps: import("../orchestrator/types.js").Op;
|
|
130
|
-
q: `0x${string}`;
|
|
131
|
-
};
|
|
132
|
-
}[];
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Get the compact digest for signing
|
|
137
|
-
* @param intentOp The intent operation
|
|
138
|
-
* @returns The digest hash
|
|
139
|
-
*/
|
|
140
|
-
declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
141
|
-
/**
|
|
142
|
-
* Get the Permit2 digest for signing
|
|
143
|
-
* @param intentOp The intent operation
|
|
144
|
-
* @returns The digest hash
|
|
145
|
-
*/
|
|
146
|
-
declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
|
|
147
|
-
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
4
|
+
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS };
|
|
148
5
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,gBAAgB,IAAI,CAAA;AAC1B,QAAA,MAAM,qBAAqB,IAAI,CAAA;AAE/B,QAAA,MAAM,eAAe,+CAA+C,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,112 +1,4 @@
|
|
|
1
|
-
import { hashTypedData, keccak256, slice, toHex } from 'viem';
|
|
2
|
-
import { getTypedData as getPermit2TypedData } from './permit2.js';
|
|
3
1
|
const SCOPE_MULTICHAIN = 0;
|
|
4
2
|
const RESET_PERIOD_ONE_WEEK = 6;
|
|
5
3
|
const COMPACT_ADDRESS = '0x00000000000000171ede64904551eeDF3C6C9788';
|
|
6
|
-
|
|
7
|
-
const COMPACT_TYPED_DATA_TYPES = {
|
|
8
|
-
MultichainCompact: [
|
|
9
|
-
{ name: 'sponsor', type: 'address' },
|
|
10
|
-
{ name: 'nonce', type: 'uint256' },
|
|
11
|
-
{ name: 'expires', type: 'uint256' },
|
|
12
|
-
{ name: 'elements', type: 'Element[]' },
|
|
13
|
-
],
|
|
14
|
-
Element: [
|
|
15
|
-
{ name: 'arbiter', type: 'address' },
|
|
16
|
-
{ name: 'chainId', type: 'uint256' },
|
|
17
|
-
{ name: 'commitments', type: 'Lock[]' },
|
|
18
|
-
{ name: 'mandate', type: 'Mandate' },
|
|
19
|
-
],
|
|
20
|
-
Lock: [
|
|
21
|
-
{ name: 'lockTag', type: 'bytes12' },
|
|
22
|
-
{ name: 'token', type: 'address' },
|
|
23
|
-
{ name: 'amount', type: 'uint256' },
|
|
24
|
-
],
|
|
25
|
-
Mandate: [
|
|
26
|
-
{ name: 'target', type: 'Target' },
|
|
27
|
-
{ name: 'minGas', type: 'uint128' },
|
|
28
|
-
{ name: 'originOps', type: 'Op' },
|
|
29
|
-
{ name: 'destOps', type: 'Op' },
|
|
30
|
-
{ name: 'q', type: 'bytes32' },
|
|
31
|
-
],
|
|
32
|
-
Target: [
|
|
33
|
-
{ name: 'recipient', type: 'address' },
|
|
34
|
-
{ name: 'tokenOut', type: 'Token[]' },
|
|
35
|
-
{ name: 'targetChain', type: 'uint256' },
|
|
36
|
-
{ name: 'fillExpiry', type: 'uint256' },
|
|
37
|
-
],
|
|
38
|
-
Token: [
|
|
39
|
-
{ name: 'token', type: 'address' },
|
|
40
|
-
{ name: 'amount', type: 'uint256' },
|
|
41
|
-
],
|
|
42
|
-
Op: [
|
|
43
|
-
{ name: 'vt', type: 'bytes32' },
|
|
44
|
-
{ name: 'ops', type: 'Ops[]' },
|
|
45
|
-
],
|
|
46
|
-
Ops: [
|
|
47
|
-
{ name: 'to', type: 'address' },
|
|
48
|
-
{ name: 'value', type: 'uint256' },
|
|
49
|
-
{ name: 'data', type: 'bytes' },
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
function getCompactTypedData(intentOp) {
|
|
53
|
-
const typedData = {
|
|
54
|
-
domain: {
|
|
55
|
-
name: 'The Compact',
|
|
56
|
-
version: '1',
|
|
57
|
-
chainId: Number(intentOp.elements[0].chainId),
|
|
58
|
-
verifyingContract: '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f',
|
|
59
|
-
},
|
|
60
|
-
types: COMPACT_TYPED_DATA_TYPES,
|
|
61
|
-
primaryType: 'MultichainCompact',
|
|
62
|
-
message: {
|
|
63
|
-
sponsor: intentOp.sponsor,
|
|
64
|
-
nonce: BigInt(intentOp.nonce),
|
|
65
|
-
expires: BigInt(intentOp.expires),
|
|
66
|
-
elements: intentOp.elements.map((element) => ({
|
|
67
|
-
arbiter: element.arbiter,
|
|
68
|
-
chainId: BigInt(element.chainId),
|
|
69
|
-
commitments: element.idsAndAmounts.map((token) => ({
|
|
70
|
-
lockTag: slice(toHex(BigInt(token[0])), 0, 12),
|
|
71
|
-
token: slice(toHex(BigInt(token[0])), 12, 32),
|
|
72
|
-
amount: BigInt(token[1]),
|
|
73
|
-
})),
|
|
74
|
-
mandate: {
|
|
75
|
-
target: {
|
|
76
|
-
recipient: element.mandate.recipient,
|
|
77
|
-
tokenOut: element.mandate.tokenOut.map((token) => ({
|
|
78
|
-
token: slice(toHex(BigInt(token[0])), 12, 32),
|
|
79
|
-
amount: BigInt(token[1]),
|
|
80
|
-
})),
|
|
81
|
-
targetChain: BigInt(element.mandate.destinationChainId),
|
|
82
|
-
fillExpiry: BigInt(element.mandate.fillDeadline),
|
|
83
|
-
},
|
|
84
|
-
minGas: BigInt(element.mandate.minGas),
|
|
85
|
-
originOps: element.mandate.preClaimOps,
|
|
86
|
-
destOps: element.mandate.destinationOps,
|
|
87
|
-
q: keccak256(element.mandate.qualifier.encodedVal),
|
|
88
|
-
},
|
|
89
|
-
})),
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
return typedData;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get the compact digest for signing
|
|
96
|
-
* @param intentOp The intent operation
|
|
97
|
-
* @returns The digest hash
|
|
98
|
-
*/
|
|
99
|
-
function getCompactDigest(intentOp) {
|
|
100
|
-
const typedData = getCompactTypedData(intentOp);
|
|
101
|
-
return hashTypedData(typedData);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get the Permit2 digest for signing
|
|
105
|
-
* @param intentOp The intent operation
|
|
106
|
-
* @returns The digest hash
|
|
107
|
-
*/
|
|
108
|
-
function getPermit2Digest(element, nonce, expires) {
|
|
109
|
-
const typedData = getPermit2TypedData(element, nonce, expires);
|
|
110
|
-
return hashTypedData(typedData);
|
|
111
|
-
}
|
|
112
|
-
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
4
|
+
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS };
|
|
@@ -50,6 +50,15 @@ declare class IntentStatusTimeoutError extends ExecutionError {
|
|
|
50
50
|
traceId?: string;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
declare class QuoteNotInPreparedTransactionError extends ExecutionError {
|
|
54
|
+
constructor(params?: {
|
|
55
|
+
context?: {
|
|
56
|
+
intentId?: string;
|
|
57
|
+
};
|
|
58
|
+
errorType?: string;
|
|
59
|
+
traceId?: string;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
53
62
|
declare class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
54
63
|
constructor(params?: {
|
|
55
64
|
context?: any;
|
|
@@ -58,5 +67,5 @@ declare class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
58
67
|
});
|
|
59
68
|
}
|
|
60
69
|
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
61
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
70
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
62
71
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;IAChC,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,uBAAwB,SAAQ,cAAc;gBACtC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,gCAAiC,SAAQ,cAAc;gBAC/C,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,yBAA0B,SAAQ,cAAc;gBACxC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,iBA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F;AAED,cAAM,iCAAkC,SAAQ,cAAc;gBAChD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAE/D;AAED,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iCAAiC,EACjC,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GACxB,CAAA"}
|
|
@@ -63,6 +63,14 @@ class IntentStatusTimeoutError extends ExecutionError {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
class QuoteNotInPreparedTransactionError extends ExecutionError {
|
|
67
|
+
constructor(params) {
|
|
68
|
+
super({
|
|
69
|
+
message: 'Selected quote does not belong to the prepared transaction. Re-prepare and try again.',
|
|
70
|
+
...params,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
66
74
|
class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
67
75
|
constructor(params) {
|
|
68
76
|
super({
|
|
@@ -74,4 +82,4 @@ class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
74
82
|
function isExecutionError(error) {
|
|
75
83
|
return error instanceof ExecutionError;
|
|
76
84
|
}
|
|
77
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
85
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|