@rhinestone/sdk 1.5.0 → 2.0.0-beta.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.
- package/dist/src/accounts/error.d.ts +1 -1
- package/dist/src/accounts/error.js +1 -19
- package/dist/src/accounts/index.d.ts +5 -5
- package/dist/src/accounts/index.js +121 -157
- package/dist/src/accounts/json-rpc/index.d.ts +1 -1
- package/dist/src/accounts/json-rpc/index.js +8 -10
- package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
- package/dist/src/accounts/json-rpc/providers.js +4 -7
- package/dist/src/accounts/kernel.d.ts +3 -3
- package/dist/src/accounts/kernel.js +66 -75
- package/dist/src/accounts/nexus.d.ts +3 -3
- package/dist/src/accounts/nexus.js +62 -73
- package/dist/src/accounts/passport.d.ts +3 -3
- package/dist/src/accounts/passport.js +9 -13
- package/dist/src/accounts/safe.d.ts +3 -3
- package/dist/src/accounts/safe.js +54 -63
- package/dist/src/accounts/signing/common.d.ts +2 -2
- package/dist/src/accounts/signing/common.js +30 -36
- package/dist/src/accounts/signing/message.d.ts +2 -2
- package/dist/src/accounts/signing/message.js +10 -12
- package/dist/src/accounts/signing/passkeys.js +11 -17
- package/dist/src/accounts/signing/typedData.d.ts +1 -1
- package/dist/src/accounts/signing/typedData.js +6 -8
- package/dist/src/accounts/startale.d.ts +3 -3
- package/dist/src/accounts/startale.js +37 -47
- package/dist/src/accounts/utils.d.ts +2 -2
- package/dist/src/accounts/utils.js +22 -28
- package/dist/src/accounts/walletClient.js +4 -8
- package/dist/src/actions/compact.d.ts +1 -1
- package/dist/src/actions/compact.js +22 -35
- package/dist/src/actions/deployment.d.ts +1 -1
- package/dist/src/actions/deployment.js +11 -13
- package/dist/src/actions/ecdsa.d.ts +1 -1
- package/dist/src/actions/ecdsa.js +14 -20
- package/dist/src/actions/index.d.ts +2 -2
- package/dist/src/actions/index.js +6 -10
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.js +18 -24
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.js +14 -20
- package/dist/src/actions/recovery.d.ts +1 -1
- package/dist/src/actions/recovery.js +25 -29
- package/dist/src/actions/smart-sessions.d.ts +1 -1
- package/dist/src/actions/smart-sessions.js +8 -12
- package/dist/src/auth/provider.d.ts +1 -1
- package/dist/src/auth/provider.js +1 -4
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.js +10 -54
- package/dist/src/execution/compact.d.ts +3 -3
- package/dist/src/execution/compact.js +10 -18
- package/dist/src/execution/error.js +1 -11
- package/dist/src/execution/index.d.ts +8 -8
- package/dist/src/execution/index.js +50 -65
- package/dist/src/execution/permit2.d.ts +5 -5
- package/dist/src/execution/permit2.js +8 -13
- package/dist/src/execution/singleChainOps.d.ts +2 -2
- package/dist/src/execution/singleChainOps.js +1 -3
- package/dist/src/execution/types.d.ts +1 -1
- package/dist/src/execution/types.js +1 -2
- package/dist/src/execution/utils.d.ts +4 -4
- package/dist/src/execution/utils.js +133 -156
- package/dist/src/index.d.ts +9 -9
- package/dist/src/index.js +55 -66
- package/dist/src/jwt-server/digest.js +3 -6
- package/dist/src/jwt-server/express.d.ts +1 -1
- package/dist/src/jwt-server/express.d.ts.map +1 -1
- package/dist/src/jwt-server/express.js +6 -7
- package/dist/src/jwt-server/handlers.d.ts +1 -1
- package/dist/src/jwt-server/handlers.js +7 -11
- package/dist/src/jwt-server/index.d.ts +7 -7
- package/dist/src/jwt-server/index.js +6 -17
- package/dist/src/jwt-server/jcs.js +1 -4
- package/dist/src/jwt-server/signer.d.ts +1 -1
- package/dist/src/jwt-server/signer.js +10 -13
- package/dist/src/jwt-server/sponsorship.js +2 -7
- package/dist/src/jwt-server/web.d.ts +1 -1
- package/dist/src/jwt-server/web.js +5 -9
- package/dist/src/modules/abi/smart-session-emissary.js +1 -3
- package/dist/src/modules/abi/smart-sessions.js +1 -4
- package/dist/src/modules/chain-abstraction.js +1 -5
- package/dist/src/modules/common.d.ts +1 -1
- package/dist/src/modules/common.js +1 -13
- package/dist/src/modules/index.d.ts +5 -5
- package/dist/src/modules/index.js +35 -50
- package/dist/src/modules/legacy.d.ts +2 -2
- package/dist/src/modules/legacy.js +11 -14
- package/dist/src/modules/read.d.ts +1 -1
- package/dist/src/modules/read.js +11 -15
- package/dist/src/modules/validators/core.d.ts +2 -2
- package/dist/src/modules/validators/core.js +26 -44
- package/dist/src/modules/validators/index.d.ts +2 -2
- package/dist/src/modules/validators/index.js +3 -19
- package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
- package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
- package/dist/src/modules/validators/policies/claim/types.js +11 -14
- package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
- package/dist/src/modules/validators/smart-sessions.js +65 -94
- package/dist/src/orchestrator/client.d.ts +2 -2
- package/dist/src/orchestrator/client.js +46 -50
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +2 -8
- package/dist/src/orchestrator/error.js +1 -33
- package/dist/src/orchestrator/index.d.ts +7 -7
- package/dist/src/orchestrator/index.js +7 -56
- package/dist/src/orchestrator/registry.d.ts +2 -2
- package/dist/src/orchestrator/registry.js +19 -33
- package/dist/src/orchestrator/types.js +1 -17
- package/dist/src/orchestrator/utils.js +1 -3
- package/dist/src/types.d.ts +3 -3
- package/dist/src/types.js +1 -2
- package/dist/src/utils/index.d.ts +2 -2
- package/dist/src/utils/index.js +9 -15
- package/package.json +15 -98
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PERMIT2_CLAIM_POLICY_ADDRESS = void 0;
|
|
4
|
-
exports.buildPermit2ClaimPolicyCalldata = buildPermit2ClaimPolicyCalldata;
|
|
5
|
-
exports.encodePermit2ClaimPolicyInitData = encodePermit2ClaimPolicyInitData;
|
|
6
|
-
const viem_1 = require("viem");
|
|
7
|
-
const types_1 = require("./types");
|
|
1
|
+
import { concat, encodeAbiParameters, encodePacked, hashStruct, keccak256, maxUint256, toHex, } from 'viem';
|
|
2
|
+
import { ANY_ADDRESS, FIELD_ARBITER, FIELD_EXPIRY, FIELD_FILL_EXPIRY, FIELD_RECIPIENT, FIELD_RECIPIENT_IS_SPONSOR, FIELD_TOKEN_IN, FIELD_TOKEN_OUT, MODE_CHECK_STORAGE, } from './types.js';
|
|
8
3
|
// EIP-712 type definitions for Permit2/Mandate struct encoding.
|
|
9
4
|
// Note: the token-out struct is named 'Token' in the Solidity contract (matching the
|
|
10
5
|
// signed Permit2 message types in execution/permit2.ts).
|
|
@@ -42,31 +37,31 @@ const PERMIT2_TYPES = {
|
|
|
42
37
|
};
|
|
43
38
|
// --- EIP-712 hash helpers ---
|
|
44
39
|
function hashArray(hashes) {
|
|
45
|
-
return
|
|
40
|
+
return keccak256(hashes.length > 0 ? concat(hashes) : '0x');
|
|
46
41
|
}
|
|
47
42
|
function hashTokenPermissionsArray(permitted) {
|
|
48
|
-
return hashArray(permitted.map(({ token, amount }) =>
|
|
43
|
+
return hashArray(permitted.map(({ token, amount }) => hashStruct({
|
|
49
44
|
primaryType: 'TokenPermissions',
|
|
50
45
|
types: PERMIT2_TYPES,
|
|
51
46
|
data: { token, amount },
|
|
52
47
|
})));
|
|
53
48
|
}
|
|
54
49
|
function hashTokenOutArray(tokenOut) {
|
|
55
|
-
return hashArray(tokenOut.map(({ token, amount }) =>
|
|
50
|
+
return hashArray(tokenOut.map(({ token, amount }) => hashStruct({
|
|
56
51
|
primaryType: 'Token',
|
|
57
52
|
types: PERMIT2_TYPES,
|
|
58
53
|
data: { token, amount },
|
|
59
54
|
})));
|
|
60
55
|
}
|
|
61
56
|
function hashOpStruct(op) {
|
|
62
|
-
return
|
|
57
|
+
return hashStruct({
|
|
63
58
|
primaryType: 'Op',
|
|
64
59
|
types: PERMIT2_TYPES,
|
|
65
60
|
data: { vt: op.vt, ops: Array.from(op.ops) },
|
|
66
61
|
});
|
|
67
62
|
}
|
|
68
63
|
function hashMandateStruct(mandate) {
|
|
69
|
-
return
|
|
64
|
+
return hashStruct({
|
|
70
65
|
primaryType: 'Mandate',
|
|
71
66
|
types: PERMIT2_TYPES,
|
|
72
67
|
data: {
|
|
@@ -89,7 +84,7 @@ function hashMandateStruct(mandate) {
|
|
|
89
84
|
// --- Token array encoding helpers ---
|
|
90
85
|
/** Encodes a token+amount pair as [token_as_uint256:32][amount:32] (64 bytes) */
|
|
91
86
|
function encodeTokenEntry(token, amount) {
|
|
92
|
-
return
|
|
87
|
+
return encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }], [token, amount]);
|
|
93
88
|
}
|
|
94
89
|
/**
|
|
95
90
|
* Builds the policySpecificData calldata for a Permit2ClaimPolicy EIP-1271 check.
|
|
@@ -101,7 +96,7 @@ function encodeTokenEntry(token, amount) {
|
|
|
101
96
|
* else — pre-computed mandateHash [32]
|
|
102
97
|
*
|
|
103
98
|
*/
|
|
104
|
-
function buildPermit2ClaimPolicyCalldata(policy, message) {
|
|
99
|
+
export function buildPermit2ClaimPolicyCalldata(policy, message) {
|
|
105
100
|
const tokenInEnabled = !!policy.tokensIn?.length;
|
|
106
101
|
const recipientEnabled = !!policy.recipients?.length;
|
|
107
102
|
const fillExpiryEnabled = !!policy.fillExpiryBounds?.length;
|
|
@@ -114,13 +109,13 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
|
|
|
114
109
|
recipientIsSponsorEnabled;
|
|
115
110
|
const parts = [];
|
|
116
111
|
// Header: [spender:20][nonce:32][deadline:32] (spender == arbiter in Permit2 context)
|
|
117
|
-
parts.push(
|
|
112
|
+
parts.push(encodePacked(['address', 'uint256', 'uint256'], [message.spender, message.nonce, message.deadline]));
|
|
118
113
|
// TokenIn section
|
|
119
114
|
if (tokenInEnabled) {
|
|
120
115
|
// Expanded: [count:1][token_as_uint256:32][amount:32]...
|
|
121
116
|
if (message.permitted.length > 255)
|
|
122
117
|
throw new Error('permitted array exceeds max length of 255');
|
|
123
|
-
parts.push(
|
|
118
|
+
parts.push(toHex(message.permitted.length, { size: 1 }));
|
|
124
119
|
for (const { token, amount } of message.permitted) {
|
|
125
120
|
parts.push(encodeTokenEntry(token, amount));
|
|
126
121
|
}
|
|
@@ -137,12 +132,12 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
|
|
|
137
132
|
// Expanded mandate: target fields + minGas + ops hashes + q
|
|
138
133
|
const target = message.mandate.target;
|
|
139
134
|
// Target: [recipient:20][targetChain:32][fillExpiry:32]
|
|
140
|
-
parts.push(
|
|
135
|
+
parts.push(encodePacked(['address', 'uint256', 'uint256'], [target.recipient, target.targetChain, target.fillExpiry]));
|
|
141
136
|
// TokenOut (inside target)
|
|
142
137
|
if (tokenOutEnabled) {
|
|
143
138
|
if (target.tokenOut.length > 255)
|
|
144
139
|
throw new Error('tokenOut array exceeds max length of 255');
|
|
145
|
-
parts.push(
|
|
140
|
+
parts.push(toHex(target.tokenOut.length, { size: 1 }));
|
|
146
141
|
for (const { token, amount } of target.tokenOut) {
|
|
147
142
|
parts.push(encodeTokenEntry(token, amount));
|
|
148
143
|
}
|
|
@@ -151,65 +146,65 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
|
|
|
151
146
|
parts.push(hashTokenOutArray(target.tokenOut));
|
|
152
147
|
}
|
|
153
148
|
// minGas: uint128 = 16 bytes
|
|
154
|
-
parts.push(
|
|
149
|
+
parts.push(toHex(message.mandate.minGas, { size: 16 }));
|
|
155
150
|
// originOpsHash and destOpsHash: always 32-byte hashes (we don't support ops checks)
|
|
156
151
|
parts.push(hashOpStruct(message.mandate.originOps));
|
|
157
152
|
parts.push(hashOpStruct(message.mandate.destOps));
|
|
158
153
|
// qualificationHash: q is already keccak256(qualifier.encodedVal)
|
|
159
154
|
parts.push(message.mandate.q);
|
|
160
155
|
}
|
|
161
|
-
return
|
|
156
|
+
return concat(parts);
|
|
162
157
|
}
|
|
163
|
-
|
|
164
|
-
function encodePermit2ClaimPolicyInitData(policy) {
|
|
158
|
+
export const PERMIT2_CLAIM_POLICY_ADDRESS = '0x62E3588C6d861C9f986E82EC3757434EDF16ce91';
|
|
159
|
+
export function encodePermit2ClaimPolicyInitData(policy) {
|
|
165
160
|
let modeConfig = 0;
|
|
166
161
|
const setMode = (fieldId) => {
|
|
167
|
-
modeConfig |=
|
|
162
|
+
modeConfig |= MODE_CHECK_STORAGE << (fieldId * 2);
|
|
168
163
|
};
|
|
169
164
|
if (policy.arbiters?.length)
|
|
170
|
-
setMode(
|
|
165
|
+
setMode(FIELD_ARBITER);
|
|
171
166
|
if (policy.expiryBounds)
|
|
172
|
-
setMode(
|
|
167
|
+
setMode(FIELD_EXPIRY);
|
|
173
168
|
if (policy.tokensIn?.length)
|
|
174
|
-
setMode(
|
|
169
|
+
setMode(FIELD_TOKEN_IN);
|
|
175
170
|
if (policy.recipients?.length)
|
|
176
|
-
setMode(
|
|
171
|
+
setMode(FIELD_RECIPIENT);
|
|
177
172
|
if (policy.fillExpiryBounds?.length)
|
|
178
|
-
setMode(
|
|
173
|
+
setMode(FIELD_FILL_EXPIRY);
|
|
179
174
|
if (policy.tokensOut?.length)
|
|
180
|
-
setMode(
|
|
175
|
+
setMode(FIELD_TOKEN_OUT);
|
|
181
176
|
if (policy.recipientIsSponsor)
|
|
182
|
-
setMode(
|
|
183
|
-
const parts = [
|
|
177
|
+
setMode(FIELD_RECIPIENT_IS_SPONSOR);
|
|
178
|
+
const parts = [toHex(modeConfig, { size: 4 })];
|
|
184
179
|
// Arbiter: [count: 1][address: 20] each
|
|
185
180
|
if (policy.arbiters?.length) {
|
|
186
181
|
if (policy.arbiters.length > 255)
|
|
187
182
|
throw new Error('arbiters array exceeds max length of 255');
|
|
188
|
-
parts.push(
|
|
183
|
+
parts.push(encodePacked(['uint8', ...policy.arbiters.map(() => 'address')], [policy.arbiters.length, ...policy.arbiters]));
|
|
189
184
|
}
|
|
190
185
|
// Expiry: [maxExpiry: 16][minExpiry: 16] packed into uint256
|
|
191
186
|
if (policy.expiryBounds) {
|
|
192
187
|
const mask128 = (1n << 128n) - 1n;
|
|
193
188
|
const min = (policy.expiryBounds.min ?? 0n) & mask128;
|
|
194
|
-
const max = (policy.expiryBounds.max ??
|
|
195
|
-
parts.push(
|
|
189
|
+
const max = (policy.expiryBounds.max ?? maxUint256) & mask128;
|
|
190
|
+
parts.push(toHex((min & mask128) | (max << 128n), { size: 32 }));
|
|
196
191
|
}
|
|
197
192
|
// TokenIn: [count: 1][chainId: 32][token: 20] each
|
|
198
193
|
if (policy.tokensIn?.length) {
|
|
199
194
|
if (policy.tokensIn.length > 255)
|
|
200
195
|
throw new Error('tokensIn array exceeds max length of 255');
|
|
201
|
-
parts.push(
|
|
196
|
+
parts.push(toHex(policy.tokensIn.length, { size: 1 }));
|
|
202
197
|
for (const { chainId, token } of policy.tokensIn) {
|
|
203
|
-
parts.push(
|
|
198
|
+
parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), token]));
|
|
204
199
|
}
|
|
205
200
|
}
|
|
206
201
|
// Recipient: [count: 1][chainId: 32][recipient: 20] each
|
|
207
202
|
if (policy.recipients?.length) {
|
|
208
203
|
if (policy.recipients.length > 255)
|
|
209
204
|
throw new Error('recipients array exceeds max length of 255');
|
|
210
|
-
parts.push(
|
|
205
|
+
parts.push(toHex(policy.recipients.length, { size: 1 }));
|
|
211
206
|
for (const { chainId, recipient } of policy.recipients) {
|
|
212
|
-
parts.push(
|
|
207
|
+
parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), recipient === 'any' ? ANY_ADDRESS : recipient]));
|
|
213
208
|
}
|
|
214
209
|
}
|
|
215
210
|
// FillExpiry: [count: 1][chainId: 32][max<<128|min packed into uint256] each
|
|
@@ -217,23 +212,23 @@ function encodePermit2ClaimPolicyInitData(policy) {
|
|
|
217
212
|
if (policy.fillExpiryBounds.length > 255)
|
|
218
213
|
throw new Error('fillExpiryBounds array exceeds max length of 255');
|
|
219
214
|
const mask128 = (1n << 128n) - 1n;
|
|
220
|
-
parts.push(
|
|
215
|
+
parts.push(toHex(policy.fillExpiryBounds.length, { size: 1 }));
|
|
221
216
|
for (const { chainId, min: fMin, max: fMax } of policy.fillExpiryBounds) {
|
|
222
217
|
const minVal = (fMin ?? 0n) & mask128;
|
|
223
|
-
const maxVal = (fMax ??
|
|
218
|
+
const maxVal = (fMax ?? maxUint256) & mask128;
|
|
224
219
|
const packed = minVal | (maxVal << 128n);
|
|
225
|
-
parts.push(
|
|
220
|
+
parts.push(encodePacked(['uint256', 'uint256'], [BigInt(chainId), packed]));
|
|
226
221
|
}
|
|
227
222
|
}
|
|
228
223
|
// TokenOut: [count: 1][chainId: 32][token: 20] each
|
|
229
224
|
if (policy.tokensOut?.length) {
|
|
230
225
|
if (policy.tokensOut.length > 255)
|
|
231
226
|
throw new Error('tokensOut array exceeds max length of 255');
|
|
232
|
-
parts.push(
|
|
227
|
+
parts.push(toHex(policy.tokensOut.length, { size: 1 }));
|
|
233
228
|
for (const { chainId, token } of policy.tokensOut) {
|
|
234
|
-
parts.push(
|
|
229
|
+
parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), token]));
|
|
235
230
|
}
|
|
236
231
|
}
|
|
237
232
|
// RecipientIsSponsor has no data payload — mode bit alone enables it
|
|
238
|
-
return
|
|
233
|
+
return concat(parts);
|
|
239
234
|
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ANY_ADDRESS = exports.MODE_CHECK_STORAGE = exports.FIELD_RECIPIENT_IS_SPONSOR = exports.FIELD_DEST_OPS = exports.FIELD_ORIGIN_OPS = exports.FIELD_TOKEN_OUT = exports.FIELD_FILL_EXPIRY = exports.FIELD_RECIPIENT = exports.FIELD_TOKEN_IN = exports.FIELD_EXPIRY = exports.FIELD_ARBITER = void 0;
|
|
4
1
|
// Field IDs matching BaseDataTypes.sol
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export const FIELD_ARBITER = 0;
|
|
3
|
+
export const FIELD_EXPIRY = 1;
|
|
4
|
+
export const FIELD_TOKEN_IN = 2;
|
|
5
|
+
export const FIELD_RECIPIENT = 3;
|
|
6
|
+
export const FIELD_FILL_EXPIRY = 4;
|
|
7
|
+
export const FIELD_TOKEN_OUT = 5;
|
|
8
|
+
export const FIELD_ORIGIN_OPS = 6;
|
|
9
|
+
export const FIELD_DEST_OPS = 7;
|
|
13
10
|
// Field 8 is reserved in BaseDataTypes.sol
|
|
14
|
-
|
|
11
|
+
export const FIELD_RECIPIENT_IS_SPONSOR = 9;
|
|
15
12
|
// Mode values
|
|
16
|
-
|
|
13
|
+
export const MODE_CHECK_STORAGE = 1;
|
|
17
14
|
// Sentinel: allows any recipient address
|
|
18
|
-
|
|
15
|
+
export const ANY_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Address, type Hex, type TypedDataDefinition } from 'viem';
|
|
2
|
-
import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types';
|
|
3
|
-
import { type Module } from '../common';
|
|
4
|
-
import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core';
|
|
2
|
+
import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types.js';
|
|
3
|
+
import { type Module } from '../common.js';
|
|
4
|
+
import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core.js';
|
|
5
5
|
interface SessionData {
|
|
6
6
|
sessionValidator: Address;
|
|
7
7
|
sessionValidatorInitData: Hex;
|
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.isSessionEnabled = isSessionEnabled;
|
|
15
|
-
exports.signEnableSession = signEnableSession;
|
|
16
|
-
exports.buildMockSignature = buildMockSignature;
|
|
17
|
-
const solady_1 = require("solady");
|
|
18
|
-
const viem_1 = require("viem");
|
|
19
|
-
const chains_1 = require("viem/chains");
|
|
20
|
-
const accounts_1 = require("../../accounts");
|
|
21
|
-
const startale_1 = require("../../accounts/startale");
|
|
22
|
-
const utils_1 = require("../../accounts/utils");
|
|
23
|
-
const compact_1 = require("../../execution/compact");
|
|
24
|
-
const utils_2 = require("../../execution/utils");
|
|
25
|
-
const registry_1 = require("../../orchestrator/registry");
|
|
26
|
-
const smart_session_emissary_1 = __importDefault(require("../abi/smart-session-emissary"));
|
|
27
|
-
const common_1 = require("../common");
|
|
28
|
-
const core_1 = require("./core");
|
|
29
|
-
Object.defineProperty(exports, "SMART_SESSION_EMISSARY_ADDRESS", { enumerable: true, get: function () { return core_1.SMART_SESSION_EMISSARY_ADDRESS; } });
|
|
30
|
-
Object.defineProperty(exports, "SMART_SESSION_EMISSARY_ADDRESS_DEV", { enumerable: true, get: function () { return core_1.SMART_SESSION_EMISSARY_ADDRESS_DEV; } });
|
|
31
|
-
const permit2_1 = require("./policies/claim/permit2");
|
|
1
|
+
import { LibZip } from 'solady';
|
|
2
|
+
import { concat, createPublicClient, encodeAbiParameters, encodeFunctionData, encodePacked, hashStruct, isHex, keccak256, maxUint256, padHex, size, toFunctionSelector, toHex, zeroAddress, zeroHash, } from 'viem';
|
|
3
|
+
import { mainnet } from 'viem/chains';
|
|
4
|
+
import { getAccountProvider } from '../../accounts/index.js';
|
|
5
|
+
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../../accounts/startale.js';
|
|
6
|
+
import { createTransport } from '../../accounts/utils.js';
|
|
7
|
+
import { RESET_PERIOD_ONE_WEEK, SCOPE_MULTICHAIN, } from '../../execution/compact.js';
|
|
8
|
+
import { signTypedData } from '../../execution/utils.js';
|
|
9
|
+
import { getChainById, getWrappedTokenAddress, } from '../../orchestrator/registry.js';
|
|
10
|
+
import smartSessionEmissaryAbi from '../abi/smart-session-emissary.js';
|
|
11
|
+
import { MODULE_TYPE_ID_VALIDATOR } from '../common.js';
|
|
12
|
+
import { getOwnerValidator, getValidator, SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, } from './core.js';
|
|
13
|
+
import { encodePermit2ClaimPolicyInitData, PERMIT2_CLAIM_POLICY_ADDRESS, } from './policies/claim/permit2.js';
|
|
32
14
|
const types = {
|
|
33
15
|
PolicyData: [
|
|
34
16
|
{ name: 'policy', type: 'address' },
|
|
@@ -76,11 +58,8 @@ const types = {
|
|
|
76
58
|
const SMART_SESSION_MODE_USE = '0x00';
|
|
77
59
|
const SMART_SESSION_MODE_ENABLE = '0x01';
|
|
78
60
|
const SMART_SESSIONS_FALLBACK_TARGET_FLAG = '0x0000000000000000000000000000000000000001';
|
|
79
|
-
exports.SMART_SESSIONS_FALLBACK_TARGET_FLAG = SMART_SESSIONS_FALLBACK_TARGET_FLAG;
|
|
80
61
|
const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG = '0x00000001';
|
|
81
|
-
exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG = SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG;
|
|
82
62
|
const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION = '0x00000002';
|
|
83
|
-
exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION = SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION;
|
|
84
63
|
// Dummy preclaimop action injected into every session so that the filler can trigger
|
|
85
64
|
// verifyExecution (ENABLE mode) using an injected dummy preclaimop when there are no
|
|
86
65
|
// real preclaimops. Target 0x...0001 is the ecRecover precompile; calls to it fail
|
|
@@ -89,23 +68,14 @@ exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESS
|
|
|
89
68
|
// SMART_SESSIONS_FALLBACK_TARGET_FLAG — that is harmless because they operate in
|
|
90
69
|
// different contexts (action matching vs. literal execution target).
|
|
91
70
|
const DUMMY_PRECLAIMOP_TARGET = '0x0000000000000000000000000000000000000001';
|
|
92
|
-
exports.DUMMY_PRECLAIMOP_TARGET = DUMMY_PRECLAIMOP_TARGET;
|
|
93
71
|
const DUMMY_PRECLAIMOP_SELECTOR = '0x69123456';
|
|
94
|
-
exports.DUMMY_PRECLAIMOP_SELECTOR = DUMMY_PRECLAIMOP_SELECTOR;
|
|
95
72
|
const SPENDING_LIMITS_POLICY_ADDRESS = '0x00000088d48cf102a8cdb0137a9b173f957c6343';
|
|
96
|
-
exports.SPENDING_LIMITS_POLICY_ADDRESS = SPENDING_LIMITS_POLICY_ADDRESS;
|
|
97
73
|
const TIME_FRAME_POLICY_ADDRESS = '0x8177451511de0577b911c254e9551d981c26dc72';
|
|
98
|
-
exports.TIME_FRAME_POLICY_ADDRESS = TIME_FRAME_POLICY_ADDRESS;
|
|
99
74
|
const SUDO_POLICY_ADDRESS = '0x0000003111cd8e92337c100f22b7a9dbf8dee301';
|
|
100
|
-
exports.SUDO_POLICY_ADDRESS = SUDO_POLICY_ADDRESS;
|
|
101
75
|
const UNIVERSAL_ACTION_POLICY_ADDRESS = '0x0000006dda6c463511c4e9b05cfc34c1247fcf1f';
|
|
102
|
-
exports.UNIVERSAL_ACTION_POLICY_ADDRESS = UNIVERSAL_ACTION_POLICY_ADDRESS;
|
|
103
76
|
const USAGE_LIMIT_POLICY_ADDRESS = '0x1f34ef8311345a3a4a4566af321b313052f51493';
|
|
104
|
-
exports.USAGE_LIMIT_POLICY_ADDRESS = USAGE_LIMIT_POLICY_ADDRESS;
|
|
105
77
|
const VALUE_LIMIT_POLICY_ADDRESS = '0x730da93267e7e513e932301b47f2ac7d062abc83';
|
|
106
|
-
exports.VALUE_LIMIT_POLICY_ADDRESS = VALUE_LIMIT_POLICY_ADDRESS;
|
|
107
78
|
const INTENT_EXECUTION_POLICY_ADDRESS = '0xe9eA54d063975cDee9e06b7636d5563d95a7A23C';
|
|
108
|
-
exports.INTENT_EXECUTION_POLICY_ADDRESS = INTENT_EXECUTION_POLICY_ADDRESS;
|
|
109
79
|
const INTENT_EXECUTION_POLICY_ADDRESS_DEV = '0xa09b47de6e510cbdc18b97e9239bedcb44fb4901';
|
|
110
80
|
const ACTION_CONDITION_EQUAL = 0;
|
|
111
81
|
const ACTION_CONDITION_GREATER_THAN = 1;
|
|
@@ -123,7 +93,7 @@ function packSignature(signers, validatorSignature) {
|
|
|
123
93
|
: SMART_SESSION_MODE_USE;
|
|
124
94
|
const sessionData = getSessionData(signers.session);
|
|
125
95
|
const packedSignature = signers.enableData
|
|
126
|
-
?
|
|
96
|
+
? LibZip.flzCompress(encodeAbiParameters([
|
|
127
97
|
{
|
|
128
98
|
type: 'tuple',
|
|
129
99
|
name: 'enableData',
|
|
@@ -222,9 +192,9 @@ function packSignature(signers, validatorSignature) {
|
|
|
222
192
|
{ type: 'bytes' },
|
|
223
193
|
], [
|
|
224
194
|
{
|
|
225
|
-
allocatorSig:
|
|
195
|
+
allocatorSig: zeroHash,
|
|
226
196
|
userSig: signers.enableData.userSignature,
|
|
227
|
-
expires:
|
|
197
|
+
expires: maxUint256,
|
|
228
198
|
enableSession: {
|
|
229
199
|
chainDigestIndex: signers.enableData.sessionToEnableIndex,
|
|
230
200
|
hashesAndChainIds: signers.enableData.hashesAndChainIds,
|
|
@@ -232,24 +202,24 @@ function packSignature(signers, validatorSignature) {
|
|
|
232
202
|
},
|
|
233
203
|
},
|
|
234
204
|
{
|
|
235
|
-
scope:
|
|
236
|
-
resetPeriod:
|
|
237
|
-
allocator:
|
|
205
|
+
scope: SCOPE_MULTICHAIN,
|
|
206
|
+
resetPeriod: RESET_PERIOD_ONE_WEEK,
|
|
207
|
+
allocator: zeroAddress,
|
|
238
208
|
permissionId: getPermissionId(signers.session),
|
|
239
209
|
},
|
|
240
210
|
validatorSignature,
|
|
241
211
|
]))
|
|
242
212
|
: validatorSignature;
|
|
243
213
|
return signers.enableData
|
|
244
|
-
?
|
|
245
|
-
:
|
|
214
|
+
? encodePacked(['bytes1', 'bytes'], [smartSessionMode, packedSignature])
|
|
215
|
+
: encodePacked(['bytes1', 'bytes32', 'bytes'], [smartSessionMode, permissionId, packedSignature]);
|
|
246
216
|
}
|
|
247
217
|
else {
|
|
248
218
|
const SIGNATURE_IS_VALID_SIG_1271 = '0x00';
|
|
249
|
-
const policyDataOffset = BigInt(64 +
|
|
219
|
+
const policyDataOffset = BigInt(64 + size(validatorSignature));
|
|
250
220
|
const mode = SIGNATURE_IS_VALID_SIG_1271;
|
|
251
221
|
const policySpecificData = signers.claimPolicyData ?? '0x';
|
|
252
|
-
const signature =
|
|
222
|
+
const signature = encodePacked(['bytes1', 'bytes32', 'uint256', 'bytes', 'bytes'], [
|
|
253
223
|
mode,
|
|
254
224
|
permissionId,
|
|
255
225
|
policyDataOffset,
|
|
@@ -267,7 +237,7 @@ async function getSessionDetails(account, sessions, provider, useDevContracts) {
|
|
|
267
237
|
const chains = sessions.map((session) => session.chain);
|
|
268
238
|
const hashesAndChainIds = signedSessions.map((session, index) => ({
|
|
269
239
|
chainId: BigInt(chains[index].id),
|
|
270
|
-
sessionDigest:
|
|
240
|
+
sessionDigest: hashStruct({
|
|
271
241
|
types,
|
|
272
242
|
primaryType: 'SignedSession',
|
|
273
243
|
data: session,
|
|
@@ -294,9 +264,9 @@ async function getSessionDetails(account, sessions, provider, useDevContracts) {
|
|
|
294
264
|
};
|
|
295
265
|
}
|
|
296
266
|
async function isSessionEnabled(account, provider, session, useDevContracts) {
|
|
297
|
-
const publicClient =
|
|
267
|
+
const publicClient = createPublicClient({
|
|
298
268
|
chain: session.chain,
|
|
299
|
-
transport:
|
|
269
|
+
transport: createTransport(session.chain, provider),
|
|
300
270
|
});
|
|
301
271
|
const isEnabled = await publicClient.readContract({
|
|
302
272
|
address: getSmartSessionEmissaryAddress(useDevContracts),
|
|
@@ -318,30 +288,30 @@ async function isSessionEnabled(account, provider, session, useDevContracts) {
|
|
|
318
288
|
return isEnabled;
|
|
319
289
|
}
|
|
320
290
|
async function signEnableSession(config, details) {
|
|
321
|
-
const account =
|
|
322
|
-
const validator =
|
|
291
|
+
const account = getAccountProvider(config);
|
|
292
|
+
const validator = getOwnerValidator(config);
|
|
323
293
|
const isStartaleK1 = account.type === 'startale' &&
|
|
324
294
|
validator.address.toLowerCase() ===
|
|
325
|
-
|
|
295
|
+
K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
326
296
|
if (isStartaleK1) {
|
|
327
297
|
const chainIds = details.hashesAndChainIds.map((h) => h.chainId);
|
|
328
298
|
const uniqueChainIds = [...new Set(chainIds.map((c) => c.toString()))];
|
|
329
299
|
if (uniqueChainIds.length > 1) {
|
|
330
300
|
throw new Error('Startale accounts with K1 validator do not support multi-chain session enable');
|
|
331
301
|
}
|
|
332
|
-
const chain =
|
|
333
|
-
return
|
|
302
|
+
const chain = getChainById(Number(chainIds[0]));
|
|
303
|
+
return signTypedData(config, details.data, chain, undefined, {
|
|
334
304
|
skipErc6492: true,
|
|
335
305
|
});
|
|
336
306
|
}
|
|
337
|
-
return
|
|
307
|
+
return signTypedData(config, details.data, mainnet, undefined, {
|
|
338
308
|
skipErc6492: true,
|
|
339
309
|
});
|
|
340
310
|
}
|
|
341
311
|
async function getSessionNonce(account, session, lockTag, provider, useDevContracts) {
|
|
342
|
-
const publicClient =
|
|
312
|
+
const publicClient = createPublicClient({
|
|
343
313
|
chain: session.chain,
|
|
344
|
-
transport:
|
|
314
|
+
transport: createTransport(session.chain, provider),
|
|
345
315
|
});
|
|
346
316
|
const nonce = await publicClient.readContract({
|
|
347
317
|
address: getSmartSessionEmissaryAddress(useDevContracts),
|
|
@@ -386,7 +356,7 @@ function getSignedSession(account, lockTag, session, nonce, useDevContracts) {
|
|
|
386
356
|
sessionValidatorInitData: session.sessionValidatorInitData,
|
|
387
357
|
salt: session.salt,
|
|
388
358
|
smartSessionEmissary: getSmartSessionEmissaryAddress(useDevContracts),
|
|
389
|
-
expires:
|
|
359
|
+
expires: maxUint256,
|
|
390
360
|
nonce,
|
|
391
361
|
};
|
|
392
362
|
}
|
|
@@ -395,21 +365,21 @@ async function getEnableSessionCall(account, session, enableSessionSignature, ha
|
|
|
395
365
|
const permissionId = getPermissionId(session);
|
|
396
366
|
return {
|
|
397
367
|
to: getSmartSessionEmissaryAddress(useDevContracts),
|
|
398
|
-
data:
|
|
399
|
-
abi:
|
|
368
|
+
data: encodeFunctionData({
|
|
369
|
+
abi: smartSessionEmissaryAbi,
|
|
400
370
|
functionName: 'setConfig',
|
|
401
371
|
args: [
|
|
402
372
|
account,
|
|
403
373
|
{
|
|
404
|
-
scope:
|
|
405
|
-
resetPeriod:
|
|
406
|
-
allocator:
|
|
374
|
+
scope: SCOPE_MULTICHAIN,
|
|
375
|
+
resetPeriod: RESET_PERIOD_ONE_WEEK,
|
|
376
|
+
allocator: zeroAddress,
|
|
407
377
|
permissionId,
|
|
408
378
|
},
|
|
409
379
|
{
|
|
410
|
-
allocatorSig:
|
|
380
|
+
allocatorSig: zeroHash,
|
|
411
381
|
userSig: enableSessionSignature,
|
|
412
|
-
expires:
|
|
382
|
+
expires: maxUint256,
|
|
413
383
|
session: {
|
|
414
384
|
chainDigestIndex: sessionToEnableIndex,
|
|
415
385
|
hashesAndChainIds,
|
|
@@ -421,11 +391,11 @@ async function getEnableSessionCall(account, session, enableSessionSignature, ha
|
|
|
421
391
|
};
|
|
422
392
|
}
|
|
423
393
|
function getSessionData(session, useDevContracts) {
|
|
424
|
-
const validator =
|
|
394
|
+
const validator = getValidator(session.owners);
|
|
425
395
|
const allowedContent = [
|
|
426
396
|
{
|
|
427
397
|
contentNames: [''],
|
|
428
|
-
appDomainSeparator:
|
|
398
|
+
appDomainSeparator: zeroHash,
|
|
429
399
|
},
|
|
430
400
|
];
|
|
431
401
|
const erc7739Data = {
|
|
@@ -451,8 +421,8 @@ function getSessionData(session, useDevContracts) {
|
|
|
451
421
|
const injectedActions = [
|
|
452
422
|
// Native token wrapping
|
|
453
423
|
{
|
|
454
|
-
target:
|
|
455
|
-
selector:
|
|
424
|
+
target: getWrappedTokenAddress(session.chain),
|
|
425
|
+
selector: toFunctionSelector({
|
|
456
426
|
type: 'function',
|
|
457
427
|
name: 'deposit',
|
|
458
428
|
inputs: [],
|
|
@@ -493,20 +463,20 @@ function getSessionData(session, useDevContracts) {
|
|
|
493
463
|
: [sudoAction];
|
|
494
464
|
return {
|
|
495
465
|
sessionValidator: validator.address,
|
|
496
|
-
salt:
|
|
466
|
+
salt: zeroHash,
|
|
497
467
|
sessionValidatorInitData: validator.initData,
|
|
498
468
|
erc7739Policies: erc7739Data,
|
|
499
469
|
actions,
|
|
500
470
|
// Note: Permit2ClaimPolicy has no dev deployment — same address in all environments
|
|
501
471
|
claimPolicies: session.claimPolicies?.map((p) => ({
|
|
502
|
-
policy:
|
|
503
|
-
initData:
|
|
472
|
+
policy: PERMIT2_CLAIM_POLICY_ADDRESS,
|
|
473
|
+
initData: encodePermit2ClaimPolicyInitData(p),
|
|
504
474
|
})) ?? [],
|
|
505
475
|
};
|
|
506
476
|
}
|
|
507
477
|
function getPermissionId(session) {
|
|
508
478
|
const sessionData = getSessionData(session);
|
|
509
|
-
return
|
|
479
|
+
return keccak256(encodeAbiParameters([
|
|
510
480
|
{
|
|
511
481
|
type: 'address',
|
|
512
482
|
name: 'sessionValidator',
|
|
@@ -563,14 +533,14 @@ function getPolicyData(policy, useDevContracts) {
|
|
|
563
533
|
condition: ACTION_CONDITION_EQUAL,
|
|
564
534
|
offset: 0n,
|
|
565
535
|
isLimited: false,
|
|
566
|
-
ref:
|
|
536
|
+
ref: zeroHash,
|
|
567
537
|
usage: { limit: 0n, used: 0n },
|
|
568
538
|
}));
|
|
569
539
|
for (let i = 0; i < policy.rules.length; i++) {
|
|
570
540
|
const rule = policy.rules[i];
|
|
571
|
-
const ref =
|
|
572
|
-
?
|
|
573
|
-
:
|
|
541
|
+
const ref = isHex(rule.referenceValue)
|
|
542
|
+
? padHex(rule.referenceValue)
|
|
543
|
+
: toHex(rule.referenceValue, { size: 32 });
|
|
574
544
|
rules[i] = {
|
|
575
545
|
condition: getCondition(rule.condition),
|
|
576
546
|
offset: rule.calldataOffset,
|
|
@@ -584,7 +554,7 @@ function getPolicyData(policy, useDevContracts) {
|
|
|
584
554
|
}
|
|
585
555
|
return {
|
|
586
556
|
policy: UNIVERSAL_ACTION_POLICY_ADDRESS,
|
|
587
|
-
initData:
|
|
557
|
+
initData: encodeAbiParameters([
|
|
588
558
|
{
|
|
589
559
|
components: [
|
|
590
560
|
{
|
|
@@ -657,13 +627,13 @@ function getPolicyData(policy, useDevContracts) {
|
|
|
657
627
|
const limits = policy.limits.map(({ amount }) => amount);
|
|
658
628
|
return {
|
|
659
629
|
policy: SPENDING_LIMITS_POLICY_ADDRESS,
|
|
660
|
-
initData:
|
|
630
|
+
initData: encodeAbiParameters([{ type: 'address[]' }, { type: 'uint256[]' }], [tokens, limits]),
|
|
661
631
|
};
|
|
662
632
|
}
|
|
663
633
|
case 'time-frame': {
|
|
664
634
|
return {
|
|
665
635
|
policy: TIME_FRAME_POLICY_ADDRESS,
|
|
666
|
-
initData:
|
|
636
|
+
initData: encodePacked(['uint48', 'uint48'], [
|
|
667
637
|
Math.floor(policy.validUntil / 1000),
|
|
668
638
|
Math.floor(policy.validAfter / 1000),
|
|
669
639
|
]),
|
|
@@ -672,13 +642,13 @@ function getPolicyData(policy, useDevContracts) {
|
|
|
672
642
|
case 'usage-limit': {
|
|
673
643
|
return {
|
|
674
644
|
policy: USAGE_LIMIT_POLICY_ADDRESS,
|
|
675
|
-
initData:
|
|
645
|
+
initData: encodePacked(['uint128'], [policy.limit]),
|
|
676
646
|
};
|
|
677
647
|
}
|
|
678
648
|
case 'value-limit': {
|
|
679
649
|
return {
|
|
680
650
|
policy: VALUE_LIMIT_POLICY_ADDRESS,
|
|
681
|
-
initData:
|
|
651
|
+
initData: encodeAbiParameters([{ type: 'uint256' }], [policy.limit]),
|
|
682
652
|
};
|
|
683
653
|
}
|
|
684
654
|
}
|
|
@@ -696,13 +666,13 @@ function getSmartSessionValidator(config) {
|
|
|
696
666
|
initData: '0x',
|
|
697
667
|
deInitData: '0x',
|
|
698
668
|
additionalContext: '0x',
|
|
699
|
-
type:
|
|
669
|
+
type: MODULE_TYPE_ID_VALIDATOR,
|
|
700
670
|
};
|
|
701
671
|
}
|
|
702
672
|
function getSmartSessionEmissaryAddress(useDevContracts) {
|
|
703
673
|
return useDevContracts === true
|
|
704
|
-
?
|
|
705
|
-
:
|
|
674
|
+
? SMART_SESSION_EMISSARY_ADDRESS_DEV
|
|
675
|
+
: SMART_SESSION_EMISSARY_ADDRESS;
|
|
706
676
|
}
|
|
707
677
|
/**
|
|
708
678
|
* Builds a mockSignature for SSX validation gas estimation.
|
|
@@ -728,7 +698,7 @@ function buildMockSignature(session, useDevContracts, chainCount = 1, targetChai
|
|
|
728
698
|
// mock emissary, so sessionDigest can be zeroHash throughout.
|
|
729
699
|
const hashesAndChainIds = Array.from({ length: safeChainCount }, (_, i) => ({
|
|
730
700
|
chainId: i === 0 ? BigInt(primaryChainId) : 0n,
|
|
731
|
-
sessionDigest:
|
|
701
|
+
sessionDigest: zeroHash,
|
|
732
702
|
}));
|
|
733
703
|
const dummySigners = {
|
|
734
704
|
type: 'experimental_session',
|
|
@@ -742,8 +712,9 @@ function buildMockSignature(session, useDevContracts, chainCount = 1, targetChai
|
|
|
742
712
|
};
|
|
743
713
|
const dummyValidatorSignature = `0x${'00'.repeat(65)}`;
|
|
744
714
|
const sigData = packSignature(dummySigners, dummyValidatorSignature);
|
|
745
|
-
return
|
|
715
|
+
return concat([emissaryAddress, sigData]);
|
|
746
716
|
}
|
|
747
717
|
function createFixedArray(length, getValue) {
|
|
748
718
|
return Array.from({ length }, (_, i) => getValue(i));
|
|
749
719
|
}
|
|
720
|
+
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, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
|
-
import type { AuthProvider } from '../auth/provider';
|
|
3
|
-
import type { IntentInput, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SignedIntentOp, SplitIntentsInput, SplitIntentsResult } from './types';
|
|
2
|
+
import type { AuthProvider } from '../auth/provider.js';
|
|
3
|
+
import type { IntentInput, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SignedIntentOp, SplitIntentsInput, SplitIntentsResult } from './types.js';
|
|
4
4
|
export declare class Orchestrator {
|
|
5
5
|
private serverUrl;
|
|
6
6
|
private authProvider;
|