@rhinestone/sdk 2.0.0-beta.29 → 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 +1 -15
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +1 -17
- package/dist/src/accounts/hca.d.ts +1 -2
- package/dist/src/accounts/hca.d.ts.map +1 -1
- package/dist/src/accounts/hca.js +9 -13
- package/dist/src/accounts/index.d.ts +3 -4
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +8 -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 +1 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +1 -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 +3 -7
- 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/smart-sessions.d.ts +15 -81
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +18 -90
- 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 +4 -4
- package/dist/src/execution/error.d.ts +1 -15
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +1 -17
- package/dist/src/execution/index.d.ts +4 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +5 -11
- package/dist/src/execution/utils.d.ts +2 -2
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +10 -22
- package/dist/src/index.d.ts +5 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -10
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +0 -5
- package/dist/src/modules/validators/core.d.ts +3 -4
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +20 -31
- 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.map +1 -1
- package/dist/src/modules/validators/permissions.js +2 -3
- package/dist/src/modules/validators/smart-sessions.d.ts +5 -1
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +66 -2
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +12 -0
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.js +1 -1
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/types.d.ts +13 -1
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- 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 +81 -26
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +3 -7
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { LazyCallInput, Session } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Enable smart sessions
|
|
5
5
|
* @returns Calls to enable smart sessions
|
|
@@ -27,87 +27,21 @@ declare function experimental_enableSession(session: Session, enableSessionSigna
|
|
|
27
27
|
chainId: bigint;
|
|
28
28
|
sessionDigest: Hex;
|
|
29
29
|
}[], sessionToEnableIndex: number): LazyCallInput;
|
|
30
|
-
interface FromLeg {
|
|
31
|
-
chain: Chain;
|
|
32
|
-
token: Address | TokenSymbol;
|
|
33
|
-
maxAmount?: bigint;
|
|
34
|
-
}
|
|
35
|
-
interface ToLeg {
|
|
36
|
-
chain: Chain;
|
|
37
|
-
token: Address | TokenSymbol;
|
|
38
|
-
recipient?: Address | 'any';
|
|
39
|
-
}
|
|
40
|
-
interface CreateCrossChainPermissionInput {
|
|
41
|
-
/**
|
|
42
|
-
* Source chain + token (+ optional max amount cap). Pass a single leg
|
|
43
|
-
* or an array for multi-leg permits. Omit for no source-token
|
|
44
|
-
* restriction (any token on any chain may be pulled) — the arbiter
|
|
45
|
-
* whitelist, deadline, and bridge-to-self flag still apply.
|
|
46
|
-
*/
|
|
47
|
-
from?: FromLeg | FromLeg[];
|
|
48
|
-
/**
|
|
49
|
-
* Destination chain + token (+ optional recipient pin). Pass a single
|
|
50
|
-
* leg or an array for fan-out destinations. Omit for no
|
|
51
|
-
* destination-token restriction; `recipientIsAccount` still constrains
|
|
52
|
-
* the recipient.
|
|
53
|
-
*/
|
|
54
|
-
to?: ToLeg | ToLeg[];
|
|
55
|
-
/** Upper bound on the permit deadline. Accepts unix-seconds bigint or `Date`. */
|
|
56
|
-
validUntil?: bigint | Date;
|
|
57
|
-
/** Lower bound on the permit deadline. Accepts unix-seconds bigint or `Date`. */
|
|
58
|
-
validAfter?: bigint | Date;
|
|
59
|
-
/** Per-destination fill-deadline windows (unix-seconds bigints). */
|
|
60
|
-
fillDeadline?: {
|
|
61
|
-
chain: Chain;
|
|
62
|
-
min?: bigint;
|
|
63
|
-
max?: bigint;
|
|
64
|
-
}[];
|
|
65
|
-
/**
|
|
66
|
-
* Allow the destination recipient to differ from the smart account
|
|
67
|
-
* (the sponsor funding the cross-chain transfer). Defaults to
|
|
68
|
-
* `false`, which enforces bridge-to-self on-chain — the safer default
|
|
69
|
-
* since it prevents a compromised session key from routing funds to
|
|
70
|
-
* an attacker-controlled address. Set to `true` to opt out explicitly.
|
|
71
|
-
*/
|
|
72
|
-
allowRecipientNotAccount?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Settlement layers this session is permitted to use. Omit (or pass
|
|
75
|
-
* `[]`) to allow **any of the supported settlement layers** — the SDK
|
|
76
|
-
* resolves to the union of every known arbiter from
|
|
77
|
-
* `@rhinestone/shared-configs`. Pass a subset (e.g. `['ECO']`) to
|
|
78
|
-
* narrow.
|
|
79
|
-
*/
|
|
80
|
-
settlementLayers?: CrossChainSettlementLayer[];
|
|
81
|
-
}
|
|
82
30
|
/**
|
|
83
|
-
*
|
|
31
|
+
* Disable a smart session
|
|
84
32
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
33
|
+
* Removes a single session from the smart-session emissary via `removeConfig`.
|
|
34
|
+
* The account executes the call itself, so the emissary skips the disable
|
|
35
|
+
* user-signature — the user authorizes it by signing the outer transaction as
|
|
36
|
+
* usual (no separate, blind session-digest signature). The `session` must be a
|
|
37
|
+
* resolved `Session` (the return value of `toSession(...)`) on the chain where
|
|
38
|
+
* the session is being disabled.
|
|
90
39
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* @
|
|
95
|
-
* ```ts
|
|
96
|
-
* import { arbitrum, mainnet } from 'viem/chains'
|
|
97
|
-
*
|
|
98
|
-
* const permit = createCrossChainPermission({
|
|
99
|
-
* from: { chain: mainnet, token: 'USDC', maxAmount: 1_000_000_000n },
|
|
100
|
-
* to: { chain: arbitrum, token: 'USDC' },
|
|
101
|
-
* validUntil: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
|
|
102
|
-
* })
|
|
103
|
-
*
|
|
104
|
-
* const session = toSession({
|
|
105
|
-
* chain: mainnet,
|
|
106
|
-
* owners: { type: 'ecdsa', accounts: [sessionKey] },
|
|
107
|
-
* crossChainPermits: [permit],
|
|
108
|
-
* })
|
|
109
|
-
* ```
|
|
40
|
+
* @param session resolved session to disable
|
|
41
|
+
* @param expires optional deadline after which this disable call is no longer
|
|
42
|
+
* valid; must be in the future. Omit for no expiry.
|
|
43
|
+
* @returns Calls to disable the smart session
|
|
110
44
|
*/
|
|
111
|
-
declare function
|
|
112
|
-
export { experimental_disable, experimental_enable, experimental_enableSession,
|
|
45
|
+
declare function experimental_disableSession(session: Session, expires?: Date): LazyCallInput;
|
|
46
|
+
export { experimental_disable, experimental_disableSession, experimental_enable, experimental_enableSession, };
|
|
113
47
|
//# sourceMappingURL=smart-sessions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,MAAM,CAAA;AAU3C,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEtD;;;GAGG;AACH,iBAAS,mBAAmB,IAAI,aAAa,CAU5C;AAED;;;GAGG;AACH,iBAAS,oBAAoB,IAAI,aAAa,CAU7C;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,0BAA0B,CACjC,OAAO,EAAE,OAAO,EAChB,sBAAsB,EAAE,GAAG,EAC3B,iBAAiB,EAAE;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,GAAG,CAAA;CACnB,EAAE,EACH,oBAAoB,EAAE,MAAM,GAC3B,aAAa,CAaf;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,2BAA2B,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,IAAI,GACb,aAAa,CAYf;AAED,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,0BAA0B,GAC3B,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { maxUint256 } from 'viem';
|
|
2
2
|
import { getModuleInstallationCalls, getModuleUninstallationCalls, } from '../accounts/index.js';
|
|
3
|
-
import { getEnableSessionCall, getSmartSessionValidator, } from '../modules/validators/smart-sessions.js';
|
|
4
|
-
import { getTokenAddress } from '../orchestrator/registry.js';
|
|
3
|
+
import { getDisableSessionCall, getEnableSessionCall, getSmartSessionValidator, } from '../modules/validators/smart-sessions.js';
|
|
5
4
|
/**
|
|
6
5
|
* Enable smart sessions
|
|
7
6
|
* @returns Calls to enable smart sessions
|
|
@@ -52,97 +51,26 @@ function experimental_enableSession(session, enableSessionSignature, hashesAndCh
|
|
|
52
51
|
},
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
|
-
function toUnixSecondsBigint(input) {
|
|
56
|
-
if (typeof input === 'bigint')
|
|
57
|
-
return input;
|
|
58
|
-
// Date.getTime() returns milliseconds since epoch; the on-chain policy
|
|
59
|
-
// expects unix-seconds. Integer division matches the Permit2 deadline
|
|
60
|
-
// convention.
|
|
61
|
-
return BigInt(Math.floor(input.getTime() / 1000));
|
|
62
|
-
}
|
|
63
|
-
function resolveTokenForChain(token, chainId) {
|
|
64
|
-
return isAddress(token) ? token : getTokenAddress(token, chainId);
|
|
65
|
-
}
|
|
66
54
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* Accepts:
|
|
70
|
-
* - a single `from`/`to` leg or arrays of legs
|
|
71
|
-
* - `TokenSymbol` ("USDC", "USDT", ...) which is resolved to the
|
|
72
|
-
* per-chain ERC-20 address via the shared token registry
|
|
73
|
-
* - `Date` or unix-seconds `bigint` for `validUntil`/`validAfter`
|
|
74
|
-
*
|
|
75
|
-
* Plug the returned object into `SessionDefinition.crossChainPermits`
|
|
76
|
-
* to permission a session key for Permit2-backed cross-chain transfers.
|
|
55
|
+
* Disable a smart session
|
|
77
56
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
57
|
+
* Removes a single session from the smart-session emissary via `removeConfig`.
|
|
58
|
+
* The account executes the call itself, so the emissary skips the disable
|
|
59
|
+
* user-signature — the user authorizes it by signing the outer transaction as
|
|
60
|
+
* usual (no separate, blind session-digest signature). The `session` must be a
|
|
61
|
+
* resolved `Session` (the return value of `toSession(...)`) on the chain where
|
|
62
|
+
* the session is being disabled.
|
|
81
63
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* })
|
|
87
|
-
*
|
|
88
|
-
* const session = toSession({
|
|
89
|
-
* chain: mainnet,
|
|
90
|
-
* owners: { type: 'ecdsa', accounts: [sessionKey] },
|
|
91
|
-
* crossChainPermits: [permit],
|
|
92
|
-
* })
|
|
93
|
-
* ```
|
|
64
|
+
* @param session resolved session to disable
|
|
65
|
+
* @param expires optional deadline after which this disable call is no longer
|
|
66
|
+
* valid; must be in the future. Omit for no expiry.
|
|
67
|
+
* @returns Calls to disable the smart session
|
|
94
68
|
*/
|
|
95
|
-
function
|
|
96
|
-
// Normalise the single-object / array / omitted shapes into arrays.
|
|
97
|
-
// An omitted side stays `undefined` on the returned permit (no
|
|
98
|
-
// restriction), mirroring how the underlying Permit2 policy treats an
|
|
99
|
-
// absent token list.
|
|
100
|
-
const normalizeLegs = (legs) => {
|
|
101
|
-
if (legs === undefined)
|
|
102
|
-
return undefined;
|
|
103
|
-
const arr = Array.isArray(legs) ? legs : [legs];
|
|
104
|
-
return arr.length ? arr : undefined;
|
|
105
|
-
};
|
|
106
|
-
const fromLegs = normalizeLegs(input.from);
|
|
107
|
-
const toLegs = normalizeLegs(input.to);
|
|
108
|
-
const from = fromLegs?.map((leg) => ({
|
|
109
|
-
chain: leg.chain,
|
|
110
|
-
token: resolveTokenForChain(leg.token, leg.chain.id),
|
|
111
|
-
maxAmount: leg.maxAmount,
|
|
112
|
-
}));
|
|
113
|
-
const to = toLegs?.map((leg) => ({
|
|
114
|
-
chain: leg.chain,
|
|
115
|
-
token: resolveTokenForChain(leg.token, leg.chain.id),
|
|
116
|
-
recipient: leg.recipient,
|
|
117
|
-
}));
|
|
118
|
-
const validUntil = input.validUntil !== undefined
|
|
119
|
-
? toUnixSecondsBigint(input.validUntil)
|
|
120
|
-
: undefined;
|
|
121
|
-
const validAfter = input.validAfter !== undefined
|
|
122
|
-
? toUnixSecondsBigint(input.validAfter)
|
|
123
|
-
: undefined;
|
|
124
|
-
// Detect an obviously-broken time window early. The on-chain policy
|
|
125
|
-
// would reject any intent in this state anyway; surfacing it at build
|
|
126
|
-
// time saves a round-trip to chain.
|
|
127
|
-
if (validUntil !== undefined &&
|
|
128
|
-
validAfter !== undefined &&
|
|
129
|
-
validAfter > validUntil) {
|
|
130
|
-
throw new Error(`createCrossChainPermission: validAfter (${validAfter}) is greater than validUntil (${validUntil})`);
|
|
131
|
-
}
|
|
69
|
+
function experimental_disableSession(session, expires) {
|
|
132
70
|
return {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
validAfter,
|
|
137
|
-
fillDeadline: input.fillDeadline,
|
|
138
|
-
// Inverted default: callers must opt out of bridge-to-self
|
|
139
|
-
// explicitly. This stops a session key from quietly bridging to an
|
|
140
|
-
// attacker-controlled recipient.
|
|
141
|
-
recipientIsAccount: !input.allowRecipientNotAccount,
|
|
142
|
-
// Passed through verbatim. `getArbitersForSettlementLayers` expands
|
|
143
|
-
// undefined/empty to "all supported layers" at session-data build
|
|
144
|
-
// time.
|
|
145
|
-
settlementLayers: input.settlementLayers,
|
|
71
|
+
async resolve({ accountAddress, config }) {
|
|
72
|
+
return getDisableSessionCall(accountAddress, session, expires ? BigInt(Math.floor(expires.getTime() / 1000)) : maxUint256, config.provider, config.useDevContracts);
|
|
73
|
+
},
|
|
146
74
|
};
|
|
147
75
|
}
|
|
148
|
-
export { experimental_disable, experimental_enable, experimental_enableSession,
|
|
76
|
+
export { experimental_disable, experimental_disableSession, experimental_enable, experimental_enableSession, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError,
|
|
2
|
-
import { ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError
|
|
1
|
+
import { AccountConfigurationNotSupportedError, AccountError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError } from '../accounts/index.js';
|
|
2
|
+
import { Eip7702InitSignatureRequiredError, ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError } from '../execution/index.js';
|
|
3
3
|
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isSimulationFailed, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, SimulationFailedError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError } from '../orchestrator/index.js';
|
|
4
|
-
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError,
|
|
4
|
+
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isSimulationFailed, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SimulationFailedError, 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,uCAAuC,EACvC,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B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AAqB,EACrB,qBAAqB,GACtB,CAAA"}
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError,
|
|
2
|
-
import { ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
1
|
+
import { AccountConfigurationNotSupportedError, AccountError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, } from '../accounts/index.js';
|
|
2
|
+
import { Eip7702InitSignatureRequiredError, ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, } from '../execution/index.js';
|
|
3
3
|
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isSimulationFailed, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, SimulationFailedError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, } from '../orchestrator/index.js';
|
|
4
4
|
export {
|
|
5
5
|
// Account
|
|
6
|
-
isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError,
|
|
6
|
+
isAccountError, AccountError, AccountConfigurationNotSupportedError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError,
|
|
7
7
|
// Execution
|
|
8
|
-
isExecutionError, ExecutionError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
8
|
+
isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
9
9
|
// Orchestrator
|
|
10
10
|
isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isSimulationFailed, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SimulationFailedError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, ValidationError,
|
|
11
11
|
// Registry (SDK-local validation)
|
|
@@ -14,13 +14,6 @@ declare class ExecutionError extends Error {
|
|
|
14
14
|
get errorType(): string;
|
|
15
15
|
get traceId(): string;
|
|
16
16
|
}
|
|
17
|
-
declare class SignerNotSupportedError extends ExecutionError {
|
|
18
|
-
constructor(params?: {
|
|
19
|
-
context?: any;
|
|
20
|
-
errorType?: string;
|
|
21
|
-
traceId?: string;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
17
|
declare class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
25
18
|
constructor(params?: {
|
|
26
19
|
context?: any;
|
|
@@ -28,13 +21,6 @@ declare class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
|
28
21
|
traceId?: string;
|
|
29
22
|
});
|
|
30
23
|
}
|
|
31
|
-
declare class SessionChainRequiredError extends ExecutionError {
|
|
32
|
-
constructor(params?: {
|
|
33
|
-
context?: any;
|
|
34
|
-
errorType?: string;
|
|
35
|
-
traceId?: string;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
24
|
declare class IntentFailedError extends ExecutionError {
|
|
39
25
|
constructor(params?: {
|
|
40
26
|
intentId?: string;
|
|
@@ -68,5 +54,5 @@ declare class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
68
54
|
});
|
|
69
55
|
}
|
|
70
56
|
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
71
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
57
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, IntentFailedError, };
|
|
72
58
|
//# 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,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"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AAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CASF;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,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,iBAAiB,GAClB,CAAA"}
|
|
@@ -23,14 +23,6 @@ class ExecutionError extends Error {
|
|
|
23
23
|
return this._traceId;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class SignerNotSupportedError extends ExecutionError {
|
|
27
|
-
constructor(params) {
|
|
28
|
-
super({
|
|
29
|
-
message: 'Sending a transaction is not supported for this type of signers. Use user operations instead.',
|
|
30
|
-
...params,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
26
|
class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
35
27
|
constructor(params) {
|
|
36
28
|
super({
|
|
@@ -39,14 +31,6 @@ class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
|
39
31
|
});
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
|
-
class SessionChainRequiredError extends ExecutionError {
|
|
43
|
-
constructor(params) {
|
|
44
|
-
super({
|
|
45
|
-
message: 'Specifying a chain is required when using multi-chain smart sessions',
|
|
46
|
-
...params,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
34
|
class IntentFailedError extends ExecutionError {
|
|
51
35
|
constructor(params) {
|
|
52
36
|
super({
|
|
@@ -84,4 +68,4 @@ class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
84
68
|
function isExecutionError(error) {
|
|
85
69
|
return error instanceof ExecutionError;
|
|
86
70
|
}
|
|
87
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
71
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, IntentFailedError, };
|
|
@@ -2,9 +2,9 @@ import { type Address, type Chain, type Hex } from 'viem';
|
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
3
|
import { type AuthProvider } from '../auth/provider.js';
|
|
4
4
|
import { type IntentOpStatus, type SplitIntentsInput } from '../orchestrator/index.js';
|
|
5
|
-
import type { SettlementLayerFilter } from '../orchestrator/types.js';
|
|
5
|
+
import type { AppFeeRate, SettlementLayerFilter } from '../orchestrator/types.js';
|
|
6
6
|
import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, SourceCallInput, Sponsorship, TokenRequest, TokenSymbol, UserOperationTransaction } from '../types.js';
|
|
7
|
-
import { ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError
|
|
7
|
+
import { Eip7702InitSignatureRequiredError, ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError } from './error.js';
|
|
8
8
|
import type { TransactionResult, UserOperationResult } from './utils.js';
|
|
9
9
|
interface TransactionStatus {
|
|
10
10
|
/** OpenTelemetry trace ID for correlating the status response. */
|
|
@@ -29,12 +29,13 @@ declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains:
|
|
|
29
29
|
settlementLayers?: SettlementLayerFilter;
|
|
30
30
|
sourceAssets?: SourceAssetInput;
|
|
31
31
|
feeAsset?: Address | TokenSymbol;
|
|
32
|
+
appFees?: AppFeeRate;
|
|
32
33
|
}): Promise<TransactionResult>;
|
|
33
34
|
declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
|
|
34
35
|
declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult): Promise<TransactionStatus | UserOperationReceipt>;
|
|
35
36
|
declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator/index.js").Portfolio>;
|
|
36
37
|
declare function getIntentStatus(authProvider: AuthProvider, endpointUrl: string | undefined, intentId: string, headers?: Record<string, string>): Promise<TransactionStatus>;
|
|
37
38
|
declare function splitIntents(authProvider: AuthProvider, endpointUrl: string | undefined, input: SplitIntentsInput, headers?: Record<string, string>): Promise<import("../orchestrator/index.js").SplitIntentsResult>;
|
|
38
|
-
export { sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents, isExecutionError, ExecutionError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
39
|
+
export { sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents, isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, };
|
|
39
40
|
export type { TransactionStatus, TransactionResult, UserOperationResult };
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAGpE,OAAO,EAAE,KAAK,YAAY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AAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAS5B;AAED,iBAAe,YAAY,CACzB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,yDAIjC;AAED,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACd,iCAAiC,EACjC,iBAAiB,EACjB,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,GACnC,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { createTransport, getBundlerClient } from '../accounts/utils.js';
|
|
|
4
4
|
import { createAuthProvider } from '../auth/provider.js';
|
|
5
5
|
import { getOrchestrator, INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, isConnectionError, isRateLimited, isRetryable, } from '../orchestrator/index.js';
|
|
6
6
|
import { getChainById, getSupportedChainIds, isTestnet, } from '../orchestrator/registry.js';
|
|
7
|
-
import { ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
7
|
+
import { Eip7702InitSignatureRequiredError, ExecutionError, IntentFailedError, InvalidSourceCallsError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, } from './error.js';
|
|
8
8
|
import { getTargetExecutionSignature, getTokenRequests, getValidatorAccount, parseCalls, prepareTransactionAsIntent, resolveCallInputs, signAuthorizationsInternal, signIntent, submitIntentInternal, } from './utils.js';
|
|
9
9
|
const POLL_INITIAL_MS = 500;
|
|
10
10
|
const POLL_SLOW_AFTER_MS = 15000;
|
|
@@ -20,13 +20,7 @@ async function sendTransactionInternal(config, sourceChains, targetChain, option
|
|
|
20
20
|
const accountAddress = getAddress(config);
|
|
21
21
|
const resolvedCalls = await resolveCallInputs(options.callInputs, config, targetChain, accountAddress);
|
|
22
22
|
const tokenRequests = getTokenRequests(targetChain, options.initialTokenRequests);
|
|
23
|
-
|
|
24
|
-
if (sendAsUserOp) {
|
|
25
|
-
throw new SignerNotSupportedError();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, options.recipient, options.signers, options.sponsored, options.eip7702InitSignature, options.settlementLayers, options.sourceAssets, options.feeAsset, options.sourceCalls);
|
|
29
|
-
}
|
|
23
|
+
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, options.recipient, options.signers, options.sponsored, options.eip7702InitSignature, options.settlementLayers, options.sourceAssets, options.feeAsset, options.sourceCalls, options.appFees);
|
|
30
24
|
}
|
|
31
25
|
async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
32
26
|
// Make sure the account is deployed
|
|
@@ -51,8 +45,8 @@ async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
|
51
45
|
chain: chain.id,
|
|
52
46
|
};
|
|
53
47
|
}
|
|
54
|
-
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, sourceCalls) {
|
|
55
|
-
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, undefined, undefined, signers, sourceCalls);
|
|
48
|
+
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, sourceCalls, appFees) {
|
|
49
|
+
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, undefined, undefined, signers, sourceCalls, appFees);
|
|
56
50
|
if (!prepared) {
|
|
57
51
|
throw new OrderPathRequiredForIntentsError();
|
|
58
52
|
}
|
|
@@ -186,4 +180,4 @@ async function splitIntents(authProvider, endpointUrl, input, headers) {
|
|
|
186
180
|
}
|
|
187
181
|
export { sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents,
|
|
188
182
|
// Errors
|
|
189
|
-
isExecutionError, ExecutionError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError,
|
|
183
|
+
isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, IntentFailedError, InvalidSourceCallsError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, };
|
|
@@ -3,7 +3,7 @@ import { type UserOperation } from 'viem/account-abstraction';
|
|
|
3
3
|
import { type ResolvedSessionSignerSet } from '../modules/validators/smart-sessions.js';
|
|
4
4
|
import { type Quote, type SignData } from '../orchestrator/index.js';
|
|
5
5
|
import { type DestinationChain, type NonEvmAddress } from '../orchestrator/destinations.js';
|
|
6
|
-
import { type AuxiliaryFunds, type OriginSignature, type SettlementLayerFilter, type SignatureMode } from '../orchestrator/types.js';
|
|
6
|
+
import { type AppFeeRate, type AuxiliaryFunds, type OriginSignature, type SettlementLayerFilter, type SignatureMode } from '../orchestrator/types.js';
|
|
7
7
|
import type { Call, CalldataInput, CallInput, NonEvmTokenRequest, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData, SessionSignerSet, SignerSet, SourceAssetInput, SourceCallInput, Sponsorship, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types.js';
|
|
8
8
|
type InternalSignerSet = Exclude<SignerSet, SessionSignerSet> | ResolvedSessionSignerSet;
|
|
9
9
|
declare function resolveSignatureMode(config: RhinestoneConfig, signers: SignerSet | undefined, sourceChains: Chain[] | undefined, targetChainId: number, preResolved?: Map<number, InternalSignerSet | undefined>): Promise<SignatureMode>;
|
|
@@ -97,7 +97,7 @@ declare function prepareTransactionAsIntent(config: RhinestoneConfig, sourceChai
|
|
|
97
97
|
to: Address;
|
|
98
98
|
data: Hex;
|
|
99
99
|
}[];
|
|
100
|
-
} | undefined, signers: SignerSet | undefined, sourceCalls?: Record<number, SourceCallInput[]
|
|
100
|
+
} | undefined, signers: SignerSet | undefined, sourceCalls?: Record<number, SourceCallInput[]>, appFees?: AppFeeRate): Promise<{
|
|
101
101
|
quotes: {
|
|
102
102
|
traceId: string;
|
|
103
103
|
best: Quote;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAOR,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAGrB,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAOR,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAGrB,MAAM,MAAM,CAAA;AACb,OAAO,EAGL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KAAK,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,CAQnE;AA4LD,iBAAS,6BAA6B,CAAC,EACrC,MAAM,EACN,KAAK,EACL,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,SAAS,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,iBAAiB,EAAE,OAAO,CAAA;QAC1B,IAAI,EAAE,GAAG,CAAA;KACV,CAAA;CACF,GAAG,GAAG,CAsFN;AAED,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,GACrB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { concat, createPublicClient, createWalletClient, encodeAbiParameters, encodePacked, hashDomain, hashMessage, hashStruct, hashTypedData, isAddress, keccak256, publicActions, toHex, } from 'viem';
|
|
2
2
|
import { entryPoint07Address, getUserOperationHash, } from 'viem/account-abstraction';
|
|
3
3
|
import { wrapTypedDataSignature } from 'viem/experimental/erc7739';
|
|
4
|
-
import { EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, FactoryArgsNotAvailableError, getAccountProvider, getAddress, getEip712Domain, getEip1271Signature, getEip7702InitCall, getEmissarySignature,
|
|
4
|
+
import { EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, FactoryArgsNotAvailableError, getAccountProvider, getAddress, getEip712Domain, getEip1271Signature, getEip7702InitCall, getEmissarySignature, getInitCode, getSmartAccount, getTypedDataPackedSignature, is7702, toErc6492Signature, } from '../accounts/index.js';
|
|
5
5
|
import { convertOwnerSetToSignerSet } from '../accounts/signing/common.js';
|
|
6
6
|
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../accounts/startale.js';
|
|
7
7
|
import { createTransport, getBundlerClient, } from '../accounts/utils.js';
|
|
8
8
|
import { createAuthProvider } from '../auth/provider.js';
|
|
9
9
|
import { buildMockSignature, DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, getOwnerValidator, getPermissionId, getSmartSessionValidator, isSessionEnabled, } from '../modules/validators/index.js';
|
|
10
|
-
import { getMultiFactorValidator,
|
|
10
|
+
import { getMultiFactorValidator, getWebAuthnValidator, supportsEip712, } from '../modules/validators/core.js';
|
|
11
11
|
import { buildPermit2ClaimPolicyCalldata, } from '../modules/validators/policies/claim/permit2.js';
|
|
12
12
|
import { resolvePermit2ClaimPolicy, selectPermit2ClaimPolicyForMessage, } from '../modules/validators/smart-sessions.js';
|
|
13
13
|
import { getOrchestrator, } from '../orchestrator/index.js';
|
|
@@ -16,7 +16,7 @@ import { getChainId, isNonEvmChain, } from '../orchestrator/destinations.js';
|
|
|
16
16
|
import { getChainById, getTokenAddress, resolveTokenAddress, } from '../orchestrator/registry.js';
|
|
17
17
|
import { SIG_MODE_EMISSARY_EXECUTION_ERC1271, SIG_MODE_ERC1271, } from '../orchestrator/types.js';
|
|
18
18
|
import { convertBigIntFields } from '../orchestrator/utils.js';
|
|
19
|
-
import { Eip7702InitSignatureRequiredError, InvalidSourceCallsError, QuoteNotInPreparedTransactionError,
|
|
19
|
+
import { Eip7702InitSignatureRequiredError, InvalidSourceCallsError, QuoteNotInPreparedTransactionError, } from './error.js';
|
|
20
20
|
function isResolvedSessionSignerSet(signers) {
|
|
21
21
|
return (signers?.type === 'experimental_session' && 'verifyExecutions' in signers);
|
|
22
22
|
}
|
|
@@ -93,12 +93,8 @@ function resolveSessionForChain(signers, chainId) {
|
|
|
93
93
|
return { session: signers.session, enableData: signers.enableData };
|
|
94
94
|
}
|
|
95
95
|
async function prepareTransaction(config, transaction) {
|
|
96
|
-
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, account, recipient, sourceCalls, } = getTransactionParams(transaction);
|
|
96
|
+
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, appFees, account, recipient, sourceCalls, } = getTransactionParams(transaction);
|
|
97
97
|
const accountAddress = getAddress(config);
|
|
98
|
-
const isUserOpSigner = signers?.type === 'guardians';
|
|
99
|
-
if (isUserOpSigner) {
|
|
100
|
-
throw new SignerNotSupportedError();
|
|
101
|
-
}
|
|
102
98
|
// Destination calls (transaction.calls on a cross-chain transaction) are
|
|
103
99
|
// executed on the destination chain by the solver/account. For non-EVM
|
|
104
100
|
// destinations we can't resolve arbitrary EVM calls; assert there are
|
|
@@ -113,7 +109,7 @@ async function prepareTransaction(config, transaction) {
|
|
|
113
109
|
else {
|
|
114
110
|
resolvedCalls = await resolveCallInputs(transaction.calls, config, targetChain, accountAddress);
|
|
115
111
|
}
|
|
116
|
-
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, account, signers, sourceCalls);
|
|
112
|
+
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, account, signers, sourceCalls, appFees);
|
|
117
113
|
return {
|
|
118
114
|
quotes: prepared.quotes,
|
|
119
115
|
intentInput: prepared.intentInput,
|
|
@@ -388,6 +384,7 @@ function getTransactionParams(transaction) {
|
|
|
388
384
|
const sourceAssets = transaction.sourceAssets;
|
|
389
385
|
const feeAsset = transaction.feeAsset;
|
|
390
386
|
const auxiliaryFunds = transaction.auxiliaryFunds;
|
|
387
|
+
const appFees = transaction.appFees;
|
|
391
388
|
const account = transaction.experimental_accountOverride;
|
|
392
389
|
const recipient = transaction.recipient;
|
|
393
390
|
const sourceCalls = transaction.sourceCalls;
|
|
@@ -404,6 +401,7 @@ function getTransactionParams(transaction) {
|
|
|
404
401
|
sourceAssets,
|
|
405
402
|
feeAsset,
|
|
406
403
|
auxiliaryFunds,
|
|
404
|
+
appFees,
|
|
407
405
|
account,
|
|
408
406
|
recipient,
|
|
409
407
|
sourceCalls,
|
|
@@ -491,7 +489,7 @@ function addProvidedFunds(auxiliaryFunds, chainId, calls) {
|
|
|
491
489
|
}
|
|
492
490
|
return next;
|
|
493
491
|
}
|
|
494
|
-
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, account, signers, sourceCalls) {
|
|
492
|
+
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, auxiliaryFunds, account, signers, sourceCalls, appFees) {
|
|
495
493
|
const targetChainId = getChainId(targetChain);
|
|
496
494
|
const calls = parseCalls(callInputs, targetChainId);
|
|
497
495
|
const accountAccessList = createAccountAccessList(sourceChains, sourceAssets);
|
|
@@ -663,6 +661,7 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
|
|
|
663
661
|
settlementLayers,
|
|
664
662
|
signatureMode,
|
|
665
663
|
auxiliaryFunds: combinedAuxiliaryFunds,
|
|
664
|
+
appFees,
|
|
666
665
|
},
|
|
667
666
|
...(Object.keys(preClaimExecutions).length > 0 && { preClaimExecutions }),
|
|
668
667
|
};
|
|
@@ -997,13 +996,7 @@ async function getValidatorAccount(config, signers, publicClient, chain) {
|
|
|
997
996
|
if (withOwner) {
|
|
998
997
|
return getSmartAccount(config, publicClient, chain);
|
|
999
998
|
}
|
|
1000
|
-
|
|
1001
|
-
return withGuardians
|
|
1002
|
-
? await getGuardianSmartAccount(config, publicClient, chain, {
|
|
1003
|
-
type: 'ecdsa',
|
|
1004
|
-
accounts: withGuardians.guardians,
|
|
1005
|
-
})
|
|
1006
|
-
: null;
|
|
999
|
+
return null;
|
|
1007
1000
|
}
|
|
1008
1001
|
function getValidator(config, signers) {
|
|
1009
1002
|
if (!signers) {
|
|
@@ -1034,11 +1027,6 @@ function getValidator(config, signers) {
|
|
|
1034
1027
|
if (withSession) {
|
|
1035
1028
|
return getSmartSessionValidator(config);
|
|
1036
1029
|
}
|
|
1037
|
-
// Guardians (social recovery)
|
|
1038
|
-
const withGuardians = signers.type === 'guardians' ? signers : null;
|
|
1039
|
-
if (withGuardians) {
|
|
1040
|
-
return getSocialRecoveryValidator(withGuardians.guardians);
|
|
1041
|
-
}
|
|
1042
1030
|
// Fallback
|
|
1043
1031
|
return undefined;
|
|
1044
1032
|
}
|