@rhinestone/sdk 1.13.4 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/src/actions/smart-sessions.d.ts +2 -1
  2. package/dist/src/actions/smart-sessions.d.ts.map +1 -1
  3. package/dist/src/actions/smart-sessions.js +6 -0
  4. package/dist/src/execution/index.d.ts +2 -1
  5. package/dist/src/execution/index.d.ts.map +1 -1
  6. package/dist/src/execution/index.js +5 -4
  7. package/dist/src/execution/quoters.d.ts +7 -0
  8. package/dist/src/execution/quoters.d.ts.map +1 -0
  9. package/dist/src/execution/quoters.js +55 -0
  10. package/dist/src/execution/utils.d.ts +2 -2
  11. package/dist/src/execution/utils.d.ts.map +1 -1
  12. package/dist/src/execution/utils.js +24 -5
  13. package/dist/src/index.d.ts +3 -3
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/modules/validators/smart-sessions/swap/abi.d.ts +3 -0
  16. package/dist/src/modules/validators/smart-sessions/swap/abi.d.ts.map +1 -0
  17. package/dist/src/modules/validators/smart-sessions/swap/abi.js +67 -0
  18. package/dist/src/modules/validators/smart-sessions/swap/fynd.d.ts +92 -0
  19. package/dist/src/modules/validators/smart-sessions/swap/fynd.d.ts.map +1 -0
  20. package/dist/src/modules/validators/smart-sessions/swap/fynd.js +106 -0
  21. package/dist/src/modules/validators/smart-sessions/swap/rhinestone.d.ts +147 -0
  22. package/dist/src/modules/validators/smart-sessions/swap/rhinestone.d.ts.map +1 -0
  23. package/dist/src/modules/validators/smart-sessions/swap/rhinestone.js +311 -0
  24. package/dist/src/modules/validators/smart-sessions/swap/rules.d.ts +73 -0
  25. package/dist/src/modules/validators/smart-sessions/swap/rules.d.ts.map +1 -0
  26. package/dist/src/modules/validators/smart-sessions/swap/rules.js +112 -0
  27. package/dist/src/modules/validators/smart-sessions/swap/scope.d.ts +18 -0
  28. package/dist/src/modules/validators/smart-sessions/swap/scope.d.ts.map +1 -0
  29. package/dist/src/modules/validators/smart-sessions/swap/scope.js +124 -0
  30. package/dist/src/modules/validators/smart-sessions/swap/zero-ex.d.ts +143 -0
  31. package/dist/src/modules/validators/smart-sessions/swap/zero-ex.d.ts.map +1 -0
  32. package/dist/src/modules/validators/smart-sessions/swap/zero-ex.js +170 -0
  33. package/dist/src/modules/validators/smart-sessions.d.ts +9 -3
  34. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  35. package/dist/src/modules/validators/smart-sessions.js +229 -89
  36. package/dist/src/orchestrator/consts.d.ts +1 -1
  37. package/dist/src/orchestrator/consts.js +1 -1
  38. package/dist/src/orchestrator/index.d.ts +2 -2
  39. package/dist/src/orchestrator/index.d.ts.map +1 -1
  40. package/dist/src/orchestrator/types.d.ts +12 -1
  41. package/dist/src/orchestrator/types.d.ts.map +1 -1
  42. package/dist/src/types.d.ts +62 -3
  43. package/dist/src/types.d.ts.map +1 -1
  44. package/package.json +2 -2
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pinValue = pinValue;
4
+ exports.pinWord = pinWord;
5
+ exports.pin = pin;
6
+ exports.cumulativeCap = cumulativeCap;
7
+ exports.swapAction = swapAction;
8
+ /**
9
+ * Shared rule builders for swap-venue scoping.
10
+ *
11
+ * Venue modules describe *what* to pin; these turn that into policy rules with
12
+ * the security-relevant details (cumulative accumulation, zero native value)
13
+ * decided in exactly one place.
14
+ */
15
+ /**
16
+ * Pin a calldata word to an exact numeric value.
17
+ *
18
+ * Used for ABI *shape* words — array pointers, lengths, element offsets. Pinning
19
+ * those is what makes pinning anything inside a dynamic tail sound: without
20
+ * them a caller can re-lay-out the encoding so a fixed offset lands on a
21
+ * different word, and the rule silently validates the wrong bytes.
22
+ */
23
+ function pinValue(calldataOffset, referenceValue) {
24
+ return { condition: 'equal', calldataOffset, referenceValue };
25
+ }
26
+ /** Pin a calldata word to an exact 32-byte value. */
27
+ function pinWord(calldataOffset, referenceValue) {
28
+ return { condition: 'equal', calldataOffset, referenceValue };
29
+ }
30
+ /** Pin a calldata word to an exact address. */
31
+ function pin(calldataOffset, referenceValue) {
32
+ return { condition: 'equal', calldataOffset, referenceValue };
33
+ }
34
+ /**
35
+ * Cap a swap's own sell amount, cumulatively across every call.
36
+ *
37
+ * `usageLimit` is what makes this cumulative: it sets `isLimited` + `usage.limit`
38
+ * on-chain, so the policy accumulates the observed value and reverts once the
39
+ * running total would exceed the cap.
40
+ *
41
+ * A bare comparison would be per-call, which is not enough. A reusable session
42
+ * could then run N swaps of `cap` each, and any allowance that already existed
43
+ * before the session was created is spent without the approve's spending-limit
44
+ * ever observing it.
45
+ */
46
+ function cumulativeCap(calldataOffset, cap) {
47
+ return {
48
+ condition: 'lessThanOrEqual',
49
+ calldataOffset,
50
+ referenceValue: cap,
51
+ usageLimit: cap,
52
+ };
53
+ }
54
+ /**
55
+ * Wrap rules into the action's policy.
56
+ *
57
+ * `valueLimitPerUse: 0n` because the approve cap only bounds ERC-20 pulls —
58
+ * without it, a payable swap selector could still carry arbitrary native value
59
+ * through the router.
60
+ */
61
+ /** Every rule must hold, as a right-folded AND over the expression tree. */
62
+ function allOf(rules) {
63
+ return rules
64
+ .map((rule) => ({ type: 'rule', rule }))
65
+ .reduceRight((right, left) => ({ type: 'and', left, right }));
66
+ }
67
+ /**
68
+ * Wrap rules into the action's policy.
69
+ *
70
+ * `valueLimitPerUse: 0n` because the approve cap only bounds ERC-20 pulls —
71
+ * without it, a payable swap selector could still carry arbitrary native value
72
+ * through the router.
73
+ *
74
+ * UniversalActionPolicy while the rules fit its fixed 16-slot array, which is
75
+ * every venue except a fully-pinned wrapped route — those pin the shape words,
76
+ * both call targets, the approve and the nested exec, and run past 16. ArgPolicy
77
+ * takes a dynamic rule list, so it carries the overflow rather than forcing a
78
+ * pin to be dropped. Preferring the simpler policy keeps the common case on the
79
+ * contract it has always used.
80
+ */
81
+ const UNIVERSAL_ACTION_MAX_RULES = 16;
82
+ function swapAction(target, selector, rules,
83
+ /**
84
+ * Mutually exclusive rule sets, at least one of which must hold — used when
85
+ * several venues authorise the SAME call but pin its tail to different
86
+ * aggregators. One on-chain action id cannot carry two policies, and dropping
87
+ * the pins to share it would authorise a tail neither venue named, so the
88
+ * alternatives become an OR instead.
89
+ */
90
+ alternatives = []) {
91
+ const usable = alternatives.filter((set) => set.length > 0);
92
+ const policy = usable.length > 0
93
+ ? {
94
+ type: 'arg-policy',
95
+ valueLimitPerUse: 0n,
96
+ expression: {
97
+ type: 'and',
98
+ left: allOf(rules),
99
+ right: usable
100
+ .map(allOf)
101
+ .reduce((left, right) => ({ type: 'or', left, right })),
102
+ },
103
+ }
104
+ : rules.length <= UNIVERSAL_ACTION_MAX_RULES
105
+ ? {
106
+ type: 'universal-action',
107
+ valueLimitPerUse: 0n,
108
+ rules: rules,
109
+ }
110
+ : { type: 'arg-policy', valueLimitPerUse: 0n, expression: allOf(rules) };
111
+ return { target, selector, policies: [policy] };
112
+ }
@@ -0,0 +1,18 @@
1
+ import { type Chain } from 'viem';
2
+ import type { FyndVenue, RhinestoneSwapVenue, ScopedAction, Session, SwapScope, SwapVenue, ZeroExVenue } from '../../../../types';
3
+ import { type FyndChainId } from './fynd';
4
+ import { type ZeroExChainId } from './zero-ex';
5
+ export type SwapVenueFor<TChainId extends number> = number extends TChainId ? SwapVenue : RhinestoneSwapVenue | (TChainId extends ZeroExChainId ? ZeroExVenue : never) | (TChainId extends FyndChainId ? FyndVenue : never);
6
+ export type SwapScopeFor<TChainId extends number> = Omit<SwapScope, 'via'> & {
7
+ readonly via?: readonly SwapVenueFor<TChainId>[];
8
+ };
9
+ export interface ResolvedSwapScope {
10
+ readonly actions: ScopedAction[];
11
+ }
12
+ /** Preserve the session chain literal so unavailable venues fail at compile time. */
13
+ export declare function toSession<const TChain extends Chain>(session: Omit<Session, 'chain' | 'swap'> & {
14
+ readonly chain: TChain;
15
+ readonly swap: SwapScopeFor<TChain['id']>;
16
+ }): Session;
17
+ export declare function resolveSwapScope(scope: SwapScope, chainId: number, environment?: 'production' | 'development'): ResolvedSwapScope;
18
+ //# sourceMappingURL=scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../../../../modules/validators/smart-sessions/swap/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAsB,MAAM,MAAM,CAAA;AACnE,OAAO,KAAK,EAEV,SAAS,EAET,mBAAmB,EAEnB,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EAET,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,KAAK,WAAW,EAAa,MAAM,QAAQ,CAAA;AAIpD,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AAE3D,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAI,MAAM,SAAS,QAAQ,GACvE,SAAS,GAEL,mBAAmB,GACnB,CAAC,QAAQ,SAAS,aAAa,GAAG,WAAW,GAAG,KAAK,CAAC,GACtD,CAAC,QAAQ,SAAS,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC,CAAA;AAE1D,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG;IAC3E,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAA;CACjD,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAA;CACjC;AAED,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,EAClD,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,GAAG;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;CAC1C,GACA,OAAO,CAET;AA8CD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,YAAY,GAAG,aAA4B,GACvD,iBAAiB,CA2EnB"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toSession = toSession;
4
+ exports.resolveSwapScope = resolveSwapScope;
5
+ const viem_1 = require("viem");
6
+ const fynd_1 = require("./fynd");
7
+ const rhinestone_1 = require("./rhinestone");
8
+ const rules_1 = require("./rules");
9
+ const zero_ex_1 = require("./zero-ex");
10
+ /** Preserve the session chain literal so unavailable venues fail at compile time. */
11
+ function toSession(session) {
12
+ return session;
13
+ }
14
+ const APPROVE_SELECTOR = (0, viem_1.toFunctionSelector)('approve(address,uint256)');
15
+ function orRules(rules) {
16
+ return rules
17
+ .map((rule) => ({ type: 'rule', rule }))
18
+ .reduceRight((right, left) => ({ type: 'or', left, right }));
19
+ }
20
+ function approveAction(scope, scopings) {
21
+ const spenders = [
22
+ ...new Set(scopings.flatMap((scoping) => scoping.approveSpenders.map((spender) => spender.toLowerCase()))),
23
+ ].map((spender) => spender);
24
+ const rules = spenders.map((spender) => (0, rules_1.pin)(0n, spender));
25
+ const spenderPolicy = rules.length === 1
26
+ ? {
27
+ type: 'universal-action',
28
+ valueLimitPerUse: 0n,
29
+ rules: [rules[0]],
30
+ }
31
+ : {
32
+ type: 'arg-policy',
33
+ valueLimitPerUse: 0n,
34
+ expression: orRules(rules),
35
+ };
36
+ const policies = [spenderPolicy];
37
+ if (scope.sell.maxTotal !== undefined) {
38
+ policies.push({
39
+ type: 'spending-limits',
40
+ limits: [{ token: scope.sell.token, amount: scope.sell.maxTotal }],
41
+ });
42
+ }
43
+ return { target: scope.sell.token, selector: APPROVE_SELECTOR, policies };
44
+ }
45
+ function resolveSwapScope(scope, chainId, environment = 'production') {
46
+ const via = scope.via ?? [(0, rhinestone_1.rhinestoneSwap)()];
47
+ if (via.length === 0) {
48
+ throw new Error('swap.via must list at least one venue — an empty list would authorise nothing');
49
+ }
50
+ if (scope.sell.token.toLowerCase() === scope.buy.token.toLowerCase()) {
51
+ throw new Error(`swap.sell.token and swap.buy.token are the same address (${scope.sell.token})`);
52
+ }
53
+ const contextFor = (venue) => ({
54
+ chainId,
55
+ environment,
56
+ sellToken: scope.sell.token,
57
+ buyToken: scope.buy.token,
58
+ recipient: scope.to,
59
+ cap: venue.maxSpend ?? scope.sell.maxTotal,
60
+ });
61
+ const routes = new Set(via.flatMap((venue) => venue.id === 'fynd'
62
+ ? ['fynd']
63
+ : venue.id === '0x'
64
+ ? ['zeroEx']
65
+ : []));
66
+ const anyAggregatorAllowed = via.some((venue) => venue.id === 'rhinestone');
67
+ const sharedRoute = routes.size === 1 && !anyAggregatorAllowed ? [...routes][0] : undefined;
68
+ const sharedRoutes = routes.size > 1 && !anyAggregatorAllowed ? [...routes] : undefined;
69
+ const zeroExSettler = via.flatMap((venue) => venue.id === '0x' && venue.settler !== undefined ? [venue.settler] : [])[0];
70
+ const wrappedVenue = () => {
71
+ const settler = zeroExSettler ? { settler: zeroExSettler } : {};
72
+ if (sharedRoutes) {
73
+ return { id: 'rhinestone', routes: sharedRoutes, ...settler };
74
+ }
75
+ if (sharedRoute) {
76
+ return {
77
+ id: 'rhinestone',
78
+ route: sharedRoute,
79
+ ...(sharedRoute === 'zeroEx' ? settler : {}),
80
+ };
81
+ }
82
+ return { id: 'rhinestone' };
83
+ };
84
+ const scopings = via.map((venue) => {
85
+ const context = contextFor(venue);
86
+ if (venue.id === 'rhinestone')
87
+ return (0, rhinestone_1.scopeRhinestone)(venue, context);
88
+ const parts = [
89
+ venue.id === 'fynd' ? (0, fynd_1.scopeFynd)(context) : (0, zero_ex_1.scopeZeroEx)(venue, context),
90
+ (0, rhinestone_1.scopeRhinestone)(wrappedVenue(), context),
91
+ ];
92
+ return {
93
+ approveSpenders: parts.flatMap((part) => [...part.approveSpenders]),
94
+ actions: parts.flatMap((part) => [...part.actions]),
95
+ };
96
+ });
97
+ return {
98
+ actions: [
99
+ approveAction(scope, scopings),
100
+ ...dedupeActions(scopings.flatMap((scoping) => [...scoping.actions])),
101
+ ],
102
+ };
103
+ }
104
+ function dedupeActions(actions) {
105
+ const byKey = new Map();
106
+ for (const action of actions) {
107
+ const key = `${action.target.toLowerCase()}|${action.selector.toLowerCase()}`;
108
+ const existing = byKey.get(key);
109
+ if (!existing) {
110
+ byKey.set(key, action);
111
+ continue;
112
+ }
113
+ if (JSON.stringify(existing, replaceBigInt) !==
114
+ JSON.stringify(action, replaceBigInt)) {
115
+ throw new Error(`Conflicting swap actions for ${action.target} ${action.selector}: ` +
116
+ 'two venues authorise the same call with different policies. Give ' +
117
+ 'them the same cap, or list only one.');
118
+ }
119
+ }
120
+ return [...byKey.values()];
121
+ }
122
+ function replaceBigInt(_key, value) {
123
+ return typeof value === 'bigint' ? value.toString() : value;
124
+ }
@@ -0,0 +1,143 @@
1
+ import { type Address } from 'viem';
2
+ import type { ZeroExVenue } from '../../../../types';
3
+ import type { VenueContext, VenueScoping } from './rules';
4
+ /**
5
+ * 0x — Swap API v2, AllowanceHolder flow.
6
+ *
7
+ * Two calls per swap:
8
+ * 1. `approve(AllowanceHolder, amount)` on the sell token
9
+ * 2. `AllowanceHolder.exec(operator, token, amount, target, data)` — pulls the
10
+ * approved sell token and forwards `data` to the Settler.
11
+ *
12
+ * The split matters for scoping. `token` and `amount` are consumed by the
13
+ * AllowanceHolder itself, so pinning them is meaningful no matter what `target`
14
+ * is. `operator` and `target` decide who receives the pulled funds, and nothing
15
+ * on-chain requires them to be a Settler — leave them free and a compromised
16
+ * session key names its own contract.
17
+ */
18
+ /** Permanent across chains — 0x never rotates this. Verified deployed on Plasma. */
19
+ export declare const ZEROX_ALLOWANCE_HOLDER: Address;
20
+ /** Chains where 0x is an enabled quoter with a whitelisted Settler. */
21
+ export declare const ZEROX_CHAIN_IDS: readonly [1, 10, 56, 130, 137, 143, 146, 999, 4663, 8453, 9745, 42161, 43114, 57073];
22
+ export type ZeroExChainId = (typeof ZEROX_CHAIN_IDS)[number];
23
+ export declare const allowanceHolderAbi: readonly [{
24
+ readonly type: "function";
25
+ readonly name: "exec";
26
+ readonly stateMutability: "payable";
27
+ readonly inputs: readonly [{
28
+ readonly name: "operator";
29
+ readonly type: "address";
30
+ }, {
31
+ readonly name: "token";
32
+ readonly type: "address";
33
+ }, {
34
+ readonly name: "amount";
35
+ readonly type: "uint256";
36
+ }, {
37
+ readonly name: "target";
38
+ readonly type: "address";
39
+ }, {
40
+ readonly name: "data";
41
+ readonly type: "bytes";
42
+ }];
43
+ readonly outputs: readonly [{
44
+ readonly name: "result";
45
+ readonly type: "bytes";
46
+ }];
47
+ }];
48
+ export declare const ALLOWANCE_HOLDER_EXEC_SELECTOR: `0x${string}`;
49
+ /**
50
+ * 0x's Settler registry — an ERC-721 whose token owner IS the current Settler
51
+ * for that feature slot. Slot 2 is the taker-submitted Settler used by ordinary
52
+ * swaps.
53
+ *
54
+ * 0x redeploys the Settler every few weeks and moves the token, so there is no
55
+ * safe constant to bundle: any address baked into a release is correct only
56
+ * until the next rotation. Resolve with {@link resolveZeroExSettler} and pin the
57
+ * result, or use `anySettler` to trade the pin for longevity.
58
+ */
59
+ export declare const ZEROX_SETTLER_REGISTRY: Address;
60
+ export declare const ZEROX_SETTLER_FEATURE_ID = 2n;
61
+ export declare const zeroExSettlerRegistryAbi: readonly [{
62
+ readonly type: "function";
63
+ readonly name: "ownerOf";
64
+ readonly stateMutability: "view";
65
+ readonly inputs: readonly [{
66
+ readonly name: "tokenId";
67
+ readonly type: "uint256";
68
+ }];
69
+ readonly outputs: readonly [{
70
+ readonly name: "";
71
+ readonly type: "address";
72
+ }];
73
+ }];
74
+ /** Minimal structural client — avoids coupling this module to a viem client type. */
75
+ interface SettlerRegistryReader {
76
+ readContract(args: {
77
+ address: Address;
78
+ abi: typeof zeroExSettlerRegistryAbi;
79
+ functionName: 'ownerOf';
80
+ args: readonly [bigint];
81
+ }): Promise<Address>;
82
+ }
83
+ /**
84
+ * Read 0x's current Settler for this chain from the on-chain registry.
85
+ *
86
+ * Pin the result at session-enable time; do NOT re-resolve per swap. A session
87
+ * that looked the address up at use time would follow 0x's registry wherever it
88
+ * points, so a compromise of 0x's upgrade multisig could redirect every live
89
+ * session's approved funds. Pinned, the worst case of a rotation is that the
90
+ * session stops working until it is re-enabled.
91
+ *
92
+ * @param client - Any viem public client for the target chain.
93
+ */
94
+ export declare function resolveZeroExSettler(client: SettlerRegistryReader): Promise<Address>;
95
+ /**
96
+ * Pin 0x's Settler to a specific address.
97
+ *
98
+ * Pinning the inner `buyToken` / `recipient` is not a substitute for pinning
99
+ * `target`: those bytes only mean what their names say when the callee is
100
+ * genuinely a Settler.
101
+ */
102
+ export interface ZeroExPinnedOptions {
103
+ /** The Settler to pin. Get the current one with {@link resolveZeroExSettler}. */
104
+ settler: Address;
105
+ anySettler?: never;
106
+ maxSpend?: never;
107
+ }
108
+ /**
109
+ * Leave 0x's Settler unpinned so the session survives 0x's rotations.
110
+ *
111
+ * A deliberate security downgrade, which is why `maxSpend` is mandatory here:
112
+ * with `target` free, a compromised session key can redirect the AllowanceHolder
113
+ * pull to its own contract, and `maxSpend` is then the ONLY bound on what it
114
+ * takes. The blast radius becomes exactly `maxSpend`, never the account's whole
115
+ * balance.
116
+ *
117
+ * Prefer {@link ZeroExPinnedOptions} unless the session must outlive 0x's
118
+ * upgrade cadence (roughly every few weeks).
119
+ */
120
+ export interface ZeroExAnySettlerOptions {
121
+ anySettler: true;
122
+ /** Cumulative cap on sell-token spend across every swap in this session. */
123
+ maxSpend: bigint;
124
+ settler?: never;
125
+ }
126
+ /**
127
+ * Scope a session to 0x swaps, in whichever shape the orchestrator produces.
128
+ *
129
+ * Authorises BOTH the direct `AllowanceHolder.exec` call and the
130
+ * Swapper-wrapped one, and there is no way to narrow that. Whether a swap is
131
+ * wrapped is decided by `ENABLE_SWAPPER`, the account type, and whether the
132
+ * Swapper resolves on the chain — state that is read when the intent executes,
133
+ * not when the session is signed. Authorising one shape is how a session ends
134
+ * up rejecting the swap it was created for.
135
+ *
136
+ * Takes either a pinned `settler` or `anySettler` + `maxSpend`. There is
137
+ * deliberately no zero-argument form: a bundled Settler constant would be stale
138
+ * within weeks of the release that shipped it.
139
+ */
140
+ export declare function zeroEx(options: ZeroExPinnedOptions | ZeroExAnySettlerOptions): ZeroExVenue;
141
+ export declare function scopeZeroEx(venue: ZeroExVenue, ctx: VenueContext): VenueScoping;
142
+ export {};
143
+ //# sourceMappingURL=zero-ex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero-ex.d.ts","sourceRoot":"","sources":["../../../../../../modules/validators/smart-sessions/swap/zero-ex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAsB,MAAM,MAAM,CAAA;AACjE,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;;;;;;;;;;GAaG;AAEH,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,EAAE,OACS,CAAA;AAE9C,uEAAuE;AACvE,eAAO,MAAM,eAAe,sFAElB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAcP,CAAA;AAExB,eAAO,MAAM,8BAA8B,eAE1C,CAAA;AAiCD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,OACS,CAAA;AAE9C,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAQb,CAAA;AAExB,qFAAqF;AACrF,UAAU,qBAAqB;IAC7B,YAAY,CAAC,IAAI,EAAE;QACjB,OAAO,EAAE,OAAO,CAAA;QAChB,GAAG,EAAE,OAAO,wBAAwB,CAAA;QACpC,YAAY,EAAE,SAAS,CAAA;QACvB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,IAAI,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,mBAAmB,GAAG,uBAAuB,GACrD,WAAW,CAOb;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,YAAY,GAChB,YAAY,CAsCd"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zeroExSettlerRegistryAbi = exports.ZEROX_SETTLER_FEATURE_ID = exports.ZEROX_SETTLER_REGISTRY = exports.ALLOWANCE_HOLDER_EXEC_SELECTOR = exports.allowanceHolderAbi = exports.ZEROX_CHAIN_IDS = exports.ZEROX_ALLOWANCE_HOLDER = void 0;
4
+ exports.resolveZeroExSettler = resolveZeroExSettler;
5
+ exports.zeroEx = zeroEx;
6
+ exports.scopeZeroEx = scopeZeroEx;
7
+ const viem_1 = require("viem");
8
+ const abi_1 = require("./abi");
9
+ const rules_1 = require("./rules");
10
+ /**
11
+ * 0x — Swap API v2, AllowanceHolder flow.
12
+ *
13
+ * Two calls per swap:
14
+ * 1. `approve(AllowanceHolder, amount)` on the sell token
15
+ * 2. `AllowanceHolder.exec(operator, token, amount, target, data)` — pulls the
16
+ * approved sell token and forwards `data` to the Settler.
17
+ *
18
+ * The split matters for scoping. `token` and `amount` are consumed by the
19
+ * AllowanceHolder itself, so pinning them is meaningful no matter what `target`
20
+ * is. `operator` and `target` decide who receives the pulled funds, and nothing
21
+ * on-chain requires them to be a Settler — leave them free and a compromised
22
+ * session key names its own contract.
23
+ */
24
+ /** Permanent across chains — 0x never rotates this. Verified deployed on Plasma. */
25
+ exports.ZEROX_ALLOWANCE_HOLDER = '0x0000000000001fF3684f28c67538d4D072C22734';
26
+ /** Chains where 0x is an enabled quoter with a whitelisted Settler. */
27
+ exports.ZEROX_CHAIN_IDS = [
28
+ 1, 10, 56, 130, 137, 143, 146, 999, 4663, 8453, 9745, 42161, 43114, 57073,
29
+ ];
30
+ exports.allowanceHolderAbi = [
31
+ {
32
+ type: 'function',
33
+ name: 'exec',
34
+ stateMutability: 'payable',
35
+ inputs: [
36
+ { name: 'operator', type: 'address' },
37
+ { name: 'token', type: 'address' },
38
+ { name: 'amount', type: 'uint256' },
39
+ { name: 'target', type: 'address' },
40
+ { name: 'data', type: 'bytes' },
41
+ ],
42
+ outputs: [{ name: 'result', type: 'bytes' }],
43
+ },
44
+ ];
45
+ exports.ALLOWANCE_HOLDER_EXEC_SELECTOR = (0, viem_1.toFunctionSelector)(exports.allowanceHolderAbi[0]);
46
+ /** exec's own head offsets, derived from the ABI. */
47
+ const EXEC = (0, abi_1.namedParamOffsets)(exports.allowanceHolderAbi, 'exec');
48
+ /**
49
+ * Offsets of the Settler's slippage fields, measured in EXEC's calldata.
50
+ *
51
+ * These cannot come from an ABI: they live inside `exec.data`, which is opaque
52
+ * `bytes` as far as exec's own signature is concerned. They are stable anyway
53
+ * because the Settler's
54
+ * `execute((recipient, buyToken, minAmountOut) slippage, bytes[] actions, bytes32)`
55
+ * places the fixed-size slippage struct BEFORE the variable-length `actions`.
56
+ *
57
+ * Derivation: exec's `data` content begins at 192 (five head words + the length
58
+ * word), +4 for the inner selector = 196 for `recipient`, +32 = 228 for
59
+ * `buyToken`. Re-derive against a live 0x exec if 0x revs the Settler ABI.
60
+ */
61
+ /**
62
+ * `exec`'s `data` head word, and the canonical tail it must point at.
63
+ *
64
+ * The Settler offsets below are derived from `data` starting at 192, which only
65
+ * holds while this pointer says 160. Unpinned, a session key can aim `data`
66
+ * elsewhere and leave matching decoy words at 196/228 for the policy to read
67
+ * while the Settler decodes a different recipient. `rhinestone.ts` pins the
68
+ * equivalent `calls[]` shape words for the same reason.
69
+ */
70
+ const EXEC_DATA_POINTER_OFFSET = 128n;
71
+ const EXEC_DATA_POINTER = 160n;
72
+ const SETTLER_RECIPIENT_OFFSET = 196n;
73
+ const SETTLER_BUY_TOKEN_OFFSET = 228n;
74
+ /**
75
+ * 0x's Settler registry — an ERC-721 whose token owner IS the current Settler
76
+ * for that feature slot. Slot 2 is the taker-submitted Settler used by ordinary
77
+ * swaps.
78
+ *
79
+ * 0x redeploys the Settler every few weeks and moves the token, so there is no
80
+ * safe constant to bundle: any address baked into a release is correct only
81
+ * until the next rotation. Resolve with {@link resolveZeroExSettler} and pin the
82
+ * result, or use `anySettler` to trade the pin for longevity.
83
+ */
84
+ exports.ZEROX_SETTLER_REGISTRY = '0x00000000000004533Fe15556B1E086BB1A72cEae';
85
+ exports.ZEROX_SETTLER_FEATURE_ID = 2n;
86
+ exports.zeroExSettlerRegistryAbi = [
87
+ {
88
+ type: 'function',
89
+ name: 'ownerOf',
90
+ stateMutability: 'view',
91
+ inputs: [{ name: 'tokenId', type: 'uint256' }],
92
+ outputs: [{ name: '', type: 'address' }],
93
+ },
94
+ ];
95
+ /**
96
+ * Read 0x's current Settler for this chain from the on-chain registry.
97
+ *
98
+ * Pin the result at session-enable time; do NOT re-resolve per swap. A session
99
+ * that looked the address up at use time would follow 0x's registry wherever it
100
+ * points, so a compromise of 0x's upgrade multisig could redirect every live
101
+ * session's approved funds. Pinned, the worst case of a rotation is that the
102
+ * session stops working until it is re-enabled.
103
+ *
104
+ * @param client - Any viem public client for the target chain.
105
+ */
106
+ async function resolveZeroExSettler(client) {
107
+ return client.readContract({
108
+ address: exports.ZEROX_SETTLER_REGISTRY,
109
+ abi: exports.zeroExSettlerRegistryAbi,
110
+ functionName: 'ownerOf',
111
+ args: [exports.ZEROX_SETTLER_FEATURE_ID],
112
+ });
113
+ }
114
+ /**
115
+ * Scope a session to 0x swaps, in whichever shape the orchestrator produces.
116
+ *
117
+ * Authorises BOTH the direct `AllowanceHolder.exec` call and the
118
+ * Swapper-wrapped one, and there is no way to narrow that. Whether a swap is
119
+ * wrapped is decided by `ENABLE_SWAPPER`, the account type, and whether the
120
+ * Swapper resolves on the chain — state that is read when the intent executes,
121
+ * not when the session is signed. Authorising one shape is how a session ends
122
+ * up rejecting the swap it was created for.
123
+ *
124
+ * Takes either a pinned `settler` or `anySettler` + `maxSpend`. There is
125
+ * deliberately no zero-argument form: a bundled Settler constant would be stale
126
+ * within weeks of the release that shipped it.
127
+ */
128
+ function zeroEx(options) {
129
+ return {
130
+ id: '0x',
131
+ ...(options.settler !== undefined ? { settler: options.settler } : {}),
132
+ ...(options.anySettler ? { anySettler: true } : {}),
133
+ ...(options.maxSpend !== undefined ? { maxSpend: options.maxSpend } : {}),
134
+ };
135
+ }
136
+ function scopeZeroEx(venue, ctx) {
137
+ // The union type rejects this at compile time, but a plain-JS caller or an
138
+ // `as any` reaches here with neither, and the rules below would then pin only
139
+ // the sell token — an unbounded AllowanceHolder path.
140
+ if (venue.settler === undefined && !venue.anySettler) {
141
+ throw new Error('zeroEx() requires either a pinned settler or anySettler + maxSpend: ' +
142
+ 'with neither, nothing bounds the operator, target or amount');
143
+ }
144
+ if (venue.anySettler && ctx.cap === undefined) {
145
+ throw new Error('zeroEx({ anySettler: true }) requires maxSpend: with the Settler ' +
146
+ 'unpinned it is the only bound on what a compromised session key can pull');
147
+ }
148
+ // Pinned from the scope, never from venue options — the sell token is a
149
+ // scope-level guarantee and must not depend on the caller restating it.
150
+ const rules = [
151
+ (0, rules_1.pin)(EXEC.token, ctx.sellToken),
152
+ ];
153
+ if (venue.settler !== undefined) {
154
+ rules.push((0, rules_1.pin)(EXEC.operator, venue.settler));
155
+ rules.push((0, rules_1.pin)(EXEC.target, venue.settler));
156
+ // Before any offset inside `exec.data` can be trusted.
157
+ rules.push((0, rules_1.pinValue)(EXEC_DATA_POINTER_OFFSET, EXEC_DATA_POINTER));
158
+ rules.push((0, rules_1.pin)(SETTLER_BUY_TOKEN_OFFSET, ctx.buyToken));
159
+ rules.push((0, rules_1.pin)(SETTLER_RECIPIENT_OFFSET, ctx.recipient));
160
+ }
161
+ if (ctx.cap !== undefined) {
162
+ rules.push((0, rules_1.cumulativeCap)(EXEC.amount, ctx.cap));
163
+ }
164
+ return {
165
+ approveSpenders: [exports.ZEROX_ALLOWANCE_HOLDER],
166
+ actions: [
167
+ (0, rules_1.swapAction)(exports.ZEROX_ALLOWANCE_HOLDER, exports.ALLOWANCE_HOLDER_EXEC_SELECTOR, rules),
168
+ ],
169
+ };
170
+ }
@@ -1,7 +1,11 @@
1
1
  import { type Address, type Hex, type TypedDataDefinition } from 'viem';
2
- import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types';
2
+ import type { FyndVenue, Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSwapVenue, Session, SessionEnableData, SwapScope, SwapVenue, ZeroExVenue } from '../../types';
3
3
  import { type Module } from '../common';
4
4
  import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core';
5
+ import { fynd } from './smart-sessions/swap/fynd';
6
+ import { rhinestoneSwap } from './smart-sessions/swap/rhinestone';
7
+ import { type SwapScopeFor, type SwapVenueFor, toSession } from './smart-sessions/swap/scope';
8
+ import { resolveZeroExSettler, type ZeroExAnySettlerOptions, type ZeroExPinnedOptions, zeroEx } from './smart-sessions/swap/zero-ex';
5
9
  interface SessionData {
6
10
  sessionValidator: Address;
7
11
  sessionValidatorInitData: Hex;
@@ -170,6 +174,7 @@ declare const SPENDING_LIMITS_POLICY_ADDRESS: Address;
170
174
  declare const TIME_FRAME_POLICY_ADDRESS: Address;
171
175
  declare const SUDO_POLICY_ADDRESS: Address;
172
176
  declare const UNIVERSAL_ACTION_POLICY_ADDRESS: Address;
177
+ declare const ARG_POLICY_ADDRESS: Address;
173
178
  declare const USAGE_LIMIT_POLICY_ADDRESS: Address;
174
179
  declare const VALUE_LIMIT_POLICY_ADDRESS: Address;
175
180
  declare const INTENT_EXECUTION_POLICY_ADDRESS: Address;
@@ -179,6 +184,7 @@ interface ResolvedSessionSignerSet {
179
184
  enableData?: SessionEnableData;
180
185
  verifyExecutions: boolean;
181
186
  claimPolicyData?: Hex;
187
+ useDevContracts?: boolean;
182
188
  }
183
189
  declare function packSignature(signers: ResolvedSessionSignerSet, validatorSignature: Hex): Hex;
184
190
  declare function getSessionDetails(account: Address, sessions: Session[], provider: ProviderConfig | undefined, useDevContracts?: boolean): Promise<SessionDetails>;
@@ -204,6 +210,6 @@ declare function getSmartSessionValidator(config: RhinestoneConfig): Module | nu
204
210
  * simulates verifyExecution with the mock emissary to estimate gas before the user signs.
205
211
  */
206
212
  declare function buildMockSignature(session: Session, useDevContracts?: boolean, chainCount?: number, targetChainId?: number): Hex;
207
- export { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, SPENDING_LIMITS_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, packSignature, getSessionData, getPolicyData, getEnableSessionCall, getPermissionId, getSmartSessionValidator, getSessionDetails, isSessionEnabled, signEnableSession, buildMockSignature, };
208
- export type { ChainSession, ChainDigest, ResolvedSessionSignerSet, SessionData, SmartSessionModeType, SessionDetails, };
213
+ export { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, SPENDING_LIMITS_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, ARG_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, packSignature, getSessionData, getPolicyData, getEnableSessionCall, getPermissionId, getSmartSessionValidator, getSessionDetails, isSessionEnabled, signEnableSession, buildMockSignature, fynd, resolveZeroExSettler, rhinestoneSwap, toSession, zeroEx, };
214
+ export type { ChainSession, ChainDigest, FyndVenue, ResolvedSessionSignerSet, RhinestoneSwapVenue, SessionData, SmartSessionModeType, SessionDetails, SwapScope, SwapScopeFor, SwapVenue, SwapVenueFor, ZeroExAnySettlerOptions, ZeroExPinnedOptions, ZeroExVenue, };
209
215
  //# sourceMappingURL=smart-sessions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"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AAA"}
1
+ {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAMZ,KAAK,GAAG,EAOR,KAAK,mBAAmB,EAKzB,MAAM,MAAM,CAAA;AAab,OAAO,KAAK,EAGV,SAAS,EACT,MAAM,EACN,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,SAAS,EAET,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AACjE,OAAO,EAIL,8BAA8B,EAC9B,kCAAkC,EACnC,MAAM,QAAQ,CAAA;AAKf,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,SAAS,EACV,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,MAAM,EACP,MAAM,+BAA+B,CAAA;AAQtC,UAAU,WAAW;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,wBAAwB,EAAE,GAAG,CAAA;IAC7B,IAAI,EAAE,GAAG,CAAA;IACT,eAAe,EAAE;QACf,qBAAqB,EAAE,SAAS,qBAAqB,EAAE,CAAA;QACvD,eAAe,EAAE,SAAS,aAAa,EAAE,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;IAC9B,aAAa,EAAE,SAAS,UAAU,EAAE,CAAA;CACrC;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;CACd;AAED,UAAU,qBAAqB;IAC7B,kBAAkB,EAAE,GAAG,CAA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