@capxul/mcp 1.0.0-alpha.2 → 1.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -62
- package/dist/{_esm-CA4cvybV.mjs → _esm-DUwdnl5L.mjs} +92 -92
- package/dist/{alchemy-rpc-DEpqt2Jx.mjs → alchemy-rpc-BORldDgR.mjs} +23 -3
- package/dist/alchemy-rpc-BiJgkVvc.mjs +2 -0
- package/dist/main.mjs +4146 -786
- package/dist/src-CIqRZpwl.mjs +2 -0
- package/dist/{src-CJVATdCb.mjs → src-DM3bg5NZ.mjs} +926 -748
- package/package.json +17 -17
- package/dist/alchemy-rpc-BWwk_YTZ.mjs +0 -2
- package/dist/src-D4Y3802K.mjs +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, getContractAddress, hashTypedData, isAddress, keccak256, pad, padHex, parseAbiParameters, stringToHex, toBytes, toHex } from "viem";
|
|
1
|
+
import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, getContractAddress, hashTypedData, isAddress, keccak256, pad, padHex, parseAbiParameters, stringToHex, toBytes, toEventSelector, toFunctionSelector, toHex } from "viem";
|
|
2
2
|
//#region ../../packages/errors/src/errors.ts
|
|
3
3
|
const CAPXUL_ERROR_CODES = [
|
|
4
4
|
"NOT_AUTHENTICATED",
|
|
@@ -156,8 +156,8 @@ const Errors = {
|
|
|
156
156
|
* Method called from a flow state where its precondition fails (TA16). The
|
|
157
157
|
* SDK's method API short-circuits with this error before driving the
|
|
158
158
|
* internal state machine. `currentState` is the Effect-machine snapshot
|
|
159
|
-
* tag (stringified — substrate is `@effect/experimental/Machine
|
|
160
|
-
* `
|
|
159
|
+
* tag (stringified — substrate is `@effect/experimental/Machine`; see
|
|
160
|
+
* `packages/errors/CONTEXT.md`); `validStates`
|
|
161
161
|
* enumerates the states the method accepts.
|
|
162
162
|
*/
|
|
163
163
|
wrongState: (details) => new CapxulError("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
|
|
@@ -212,122 +212,62 @@ function isExactTransferTokenAllowed(tokenAddress) {
|
|
|
212
212
|
return EXACT_TRANSFER_TOKEN_ALLOWLIST.includes(tokenAddress.toLowerCase());
|
|
213
213
|
}
|
|
214
214
|
//#endregion
|
|
215
|
-
//#region ../../packages/config/src/
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* via `swapOwner` (see `capxulClaimOwnerCallData`).
|
|
228
|
-
*/
|
|
229
|
-
const CAPXUL_SAFE_SALT_NAMESPACE = "capxul:safe:email:v2";
|
|
230
|
-
/**
|
|
231
|
-
* The Capxul bootstrap owner — the sole `setup()` owner of every unclaimed
|
|
232
|
-
* personal Safe under derivation v2. This address is part of the CREATE2
|
|
233
|
-
* preimage of EVERY personal Safe address: treat it exactly like
|
|
234
|
-
* `SAFE_PROXY_FACTORY` (changing it is a derivation-version event → v3).
|
|
235
|
-
* The private key lives backend-only (`CAPXUL_BOOTSTRAP_OWNER_PRIVATE_KEY`)
|
|
236
|
-
* and signs exactly one kind of operation: the claim userOp that deploys the
|
|
237
|
-
* Safe and swaps this owner out for the user's signer (PRD #462). The earlier
|
|
238
|
-
* ClaimGuard derivation-v3 placeholder (#461) is closed; future mainnet-scale
|
|
239
|
-
* hardening should be filed against the current payments/claim architecture.
|
|
240
|
-
*/
|
|
241
|
-
const CAPXUL_BOOTSTRAP_OWNER = "0x425fca96f4a3e18fb80974e38096b5da460f2704";
|
|
242
|
-
const UINT48_MAX = 0xffffffffffff;
|
|
243
|
-
const SAFE_PROXY_CREATION_CODE = "0x608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea264697066735822122003d1488ee65e08fa41e58e888a9865554c535f2c77126a82cb4c0f917f31441364736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564";
|
|
244
|
-
/**
|
|
245
|
-
* Normalize an email for use as a Capxul Safe salt input.
|
|
246
|
-
*
|
|
247
|
-
* Trims surrounding whitespace and lowercases the address so that
|
|
248
|
-
* `" User+Demo@Example.COM "` and `"user+demo@example.com"` derive
|
|
249
|
-
* the same `safeAddress`. This is the canonical normalization rule —
|
|
250
|
-
* any future change here would shift every existing user's Safe
|
|
251
|
-
* address, so the rule is pinned by the fixture matrix in
|
|
252
|
-
* `packages/config/tests/safe-address-conformance.test.ts`.
|
|
253
|
-
*
|
|
254
|
-
* @param email - The raw email address to normalize
|
|
255
|
-
* @returns The trimmed, lowercased email
|
|
256
|
-
*/
|
|
257
|
-
function normalizeSafeSaltEmail(email) {
|
|
258
|
-
return email.trim().toLowerCase();
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Compute the deterministic Safe salt nonce for a `(namespace, email)`
|
|
262
|
-
* pair. The salt nonce is the `bigint` reading of
|
|
263
|
-
* `keccak256(namespace + ":" + normalizeSafeSaltEmail(email))`.
|
|
264
|
-
*
|
|
265
|
-
* Namespace defaults to `CAPXUL_SAFE_SALT_NAMESPACE`
|
|
266
|
-
* (`"capxul:safe:email:v2"`) — the per-version Capxul scheme. Pass a
|
|
267
|
-
* different namespace only for pinned pre-v2 artifacts
|
|
268
|
-
* (`CAPXUL_SAFE_SALT_NAMESPACE_V1`, faucet Safe) or when bumping the scheme.
|
|
269
|
-
*
|
|
270
|
-
* @param input.email - The email to derive the salt nonce from
|
|
271
|
-
* @param input.namespace - Optional namespace override (defaults to `CAPXUL_SAFE_SALT_NAMESPACE`)
|
|
272
|
-
* @returns The Capxul-namespaced salt nonce as a `bigint`
|
|
273
|
-
*/
|
|
274
|
-
function computeCapxulSafeSaltNonce(input) {
|
|
275
|
-
const namespace = input.namespace ?? "capxul:safe:email:v2";
|
|
276
|
-
const normalizedEmail = normalizeSafeSaltEmail(input.email);
|
|
277
|
-
return BigInt(keccak256(toBytes(`${namespace}:${normalizedEmail}`)));
|
|
278
|
-
}
|
|
279
|
-
const ZERO_ADDRESS$1 = "0x0000000000000000000000000000000000000000";
|
|
280
|
-
const safeSetupAbi$1 = [{
|
|
215
|
+
//#region ../../packages/config/src/org-payments.ts
|
|
216
|
+
/** Zodiac MultiSendCallOnly module on Base Sepolia. */
|
|
217
|
+
const MULTI_SEND_CALL_ONLY = "0x9641d764fc13c8b624c04430c7356c1c7c8102e2";
|
|
218
|
+
/** Zodiac Roles v2 mastercopy on Base Sepolia. */
|
|
219
|
+
const ROLES_MASTERCOPY = "0x9646fdad06d3e24444381f44362a3b0eb343d337";
|
|
220
|
+
/** Zodiac ModuleProxyFactory on Base Sepolia. */
|
|
221
|
+
const ZODIAC_MODULE_PROXY_FACTORY = "0x000000000000addb49795b0f9ba5bc298cdda236";
|
|
222
|
+
/** Zodiac MultiSend unwrapper on Base Sepolia. */
|
|
223
|
+
const ZODIAC_MULTI_SEND_UNWRAPPER = "0x93b7fcbc63ed8a3a24b59e1c3e6649d50b7427c0";
|
|
224
|
+
/** CapxulPayments proxy on Base Sepolia. */
|
|
225
|
+
const CAPXUL_PAYMENTS_ADDRESS = "0xe740ea65521edc9bef0ea75d30b5334711db99f4";
|
|
226
|
+
const CAPXUL_PAYMENTS_SEND_ABI = [{
|
|
281
227
|
type: "function",
|
|
282
|
-
name: "
|
|
228
|
+
name: "send",
|
|
283
229
|
stateMutability: "nonpayable",
|
|
284
230
|
inputs: [
|
|
285
231
|
{
|
|
286
|
-
name: "
|
|
287
|
-
type: "address[]"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
name: "_threshold",
|
|
291
|
-
type: "uint256"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "to",
|
|
232
|
+
name: "token",
|
|
295
233
|
type: "address"
|
|
296
234
|
},
|
|
297
235
|
{
|
|
298
|
-
name: "
|
|
299
|
-
type: "bytes"
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: "fallbackHandler",
|
|
236
|
+
name: "recipient",
|
|
303
237
|
type: "address"
|
|
304
238
|
},
|
|
305
239
|
{
|
|
306
|
-
name: "
|
|
307
|
-
type: "
|
|
240
|
+
name: "amount",
|
|
241
|
+
type: "uint256"
|
|
308
242
|
},
|
|
309
243
|
{
|
|
310
|
-
name: "
|
|
311
|
-
type: "
|
|
244
|
+
name: "documentHash",
|
|
245
|
+
type: "bytes32"
|
|
312
246
|
},
|
|
313
247
|
{
|
|
314
|
-
name: "
|
|
315
|
-
type: "
|
|
248
|
+
name: "paymentType",
|
|
249
|
+
type: "uint8"
|
|
316
250
|
}
|
|
317
251
|
],
|
|
318
252
|
outputs: []
|
|
319
253
|
}];
|
|
320
|
-
const
|
|
254
|
+
const ERC20_APPROVE_ABI = [{
|
|
321
255
|
type: "function",
|
|
322
|
-
name: "
|
|
256
|
+
name: "approve",
|
|
323
257
|
stateMutability: "nonpayable",
|
|
324
258
|
inputs: [{
|
|
325
|
-
name: "
|
|
326
|
-
type: "address
|
|
259
|
+
name: "spender",
|
|
260
|
+
type: "address"
|
|
261
|
+
}, {
|
|
262
|
+
name: "amount",
|
|
263
|
+
type: "uint256"
|
|
327
264
|
}],
|
|
328
|
-
outputs: [
|
|
265
|
+
outputs: [{
|
|
266
|
+
name: "",
|
|
267
|
+
type: "bool"
|
|
268
|
+
}]
|
|
329
269
|
}];
|
|
330
|
-
const
|
|
270
|
+
const MULTI_SEND_CALL_ONLY_ABI = [{
|
|
331
271
|
type: "function",
|
|
332
272
|
name: "multiSend",
|
|
333
273
|
stateMutability: "payable",
|
|
@@ -337,299 +277,657 @@ const multiSendAbi$1 = [{
|
|
|
337
277
|
}],
|
|
338
278
|
outputs: []
|
|
339
279
|
}];
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
"
|
|
351
|
-
"
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
"
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
280
|
+
const ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI$1 = [{
|
|
281
|
+
type: "function",
|
|
282
|
+
name: "execTransactionWithRole",
|
|
283
|
+
stateMutability: "nonpayable",
|
|
284
|
+
inputs: [
|
|
285
|
+
{
|
|
286
|
+
name: "to",
|
|
287
|
+
type: "address"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "value",
|
|
291
|
+
type: "uint256"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "data",
|
|
295
|
+
type: "bytes"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "operation",
|
|
299
|
+
type: "uint8"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "roleKey",
|
|
303
|
+
type: "bytes32"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "shouldRevert",
|
|
307
|
+
type: "bool"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
outputs: [{
|
|
311
|
+
name: "success",
|
|
312
|
+
type: "bool"
|
|
313
|
+
}]
|
|
314
|
+
}];
|
|
315
|
+
const SAFE4337_EXECUTE_USEROP_ABI = [{
|
|
316
|
+
type: "function",
|
|
317
|
+
name: "executeUserOpWithErrorString",
|
|
318
|
+
stateMutability: "nonpayable",
|
|
319
|
+
inputs: [
|
|
320
|
+
{
|
|
321
|
+
name: "to",
|
|
322
|
+
type: "address"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "value",
|
|
326
|
+
type: "uint256"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: "data",
|
|
330
|
+
type: "bytes"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "operation",
|
|
334
|
+
type: "uint8"
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
outputs: []
|
|
338
|
+
}];
|
|
339
|
+
const OPERATION_CALL = 0;
|
|
340
|
+
const OPERATION_DELEGATECALL = 1;
|
|
341
|
+
const BYTES32_RE = /^0x[0-9a-fA-F]{64}$/;
|
|
342
|
+
function normalizeAddress(address, field) {
|
|
343
|
+
if (!isAddress(address)) throw new RangeError(`${field} must be a valid EVM address`);
|
|
344
|
+
return address.toLowerCase();
|
|
377
345
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (!ADDRESS_REGEX$1.test(address)) throw Errors.invalidInput(field, `must be 0x + 40 hex chars, got ${value}`);
|
|
382
|
-
return address;
|
|
346
|
+
function normalizeBytes32(value, field) {
|
|
347
|
+
if (!BYTES32_RE.test(value)) throw new RangeError(`${field} must be a 32-byte 0x-prefixed hex string`);
|
|
348
|
+
return value.toLowerCase();
|
|
383
349
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
350
|
+
function normalizeUint8(value, field) {
|
|
351
|
+
if (!Number.isInteger(value) || value < 0 || value > 255) throw new RangeError(`${field} must be an integer between 0 and 255`);
|
|
352
|
+
return value;
|
|
353
|
+
}
|
|
354
|
+
function normalizePositiveAmount(value, field) {
|
|
355
|
+
if (value <= 0n) throw new RangeError(`${field} must be positive`);
|
|
356
|
+
return value;
|
|
357
|
+
}
|
|
358
|
+
function buildCapxulPaymentsSendCalls(input) {
|
|
359
|
+
const tokenAddress = normalizeAddress(input.tokenAddress, "tokenAddress");
|
|
360
|
+
const recipientAddress = normalizeAddress(input.recipientAddress, "recipientAddress");
|
|
361
|
+
const amount = normalizePositiveAmount(input.amount, "amount");
|
|
362
|
+
const documentHash = normalizeBytes32(input.documentHash ?? `0x${"0".repeat(64)}`, "documentHash");
|
|
363
|
+
const paymentType = normalizeUint8(input.paymentType ?? 0, "paymentType");
|
|
364
|
+
return [{
|
|
365
|
+
to: tokenAddress,
|
|
366
|
+
data: encodeFunctionData({
|
|
367
|
+
abi: ERC20_APPROVE_ABI,
|
|
368
|
+
functionName: "approve",
|
|
369
|
+
args: [CAPXUL_PAYMENTS_ADDRESS, amount]
|
|
370
|
+
}),
|
|
371
|
+
value: 0n
|
|
372
|
+
}, {
|
|
373
|
+
to: CAPXUL_PAYMENTS_ADDRESS,
|
|
374
|
+
data: encodeFunctionData({
|
|
375
|
+
abi: CAPXUL_PAYMENTS_SEND_ABI,
|
|
376
|
+
functionName: "send",
|
|
377
|
+
args: [
|
|
378
|
+
tokenAddress,
|
|
379
|
+
recipientAddress,
|
|
380
|
+
amount,
|
|
381
|
+
documentHash,
|
|
382
|
+
paymentType
|
|
383
|
+
]
|
|
384
|
+
}),
|
|
385
|
+
value: 0n
|
|
386
|
+
}];
|
|
387
|
+
}
|
|
388
|
+
function buildCapxulCreateCommitmentCalls(input) {
|
|
389
|
+
const tokenAddress = normalizeAddress(input.tokenAddress, "tokenAddress");
|
|
390
|
+
const recipientAddress = normalizeAddress(input.recipientAddress, "recipientAddress");
|
|
391
|
+
const totalAmount = normalizePositiveAmount(input.totalAmount, "totalAmount");
|
|
392
|
+
const startTime = normalizeUint48(input.startTime, "startTime");
|
|
393
|
+
const cliffTime = normalizeUint48(input.cliffTime, "cliffTime");
|
|
394
|
+
const endTime = normalizeUint48(input.endTime, "endTime");
|
|
395
|
+
if (startTime > endTime || cliffTime < startTime || cliffTime > endTime) throw new RangeError("commitment times must satisfy start <= cliff <= end");
|
|
396
|
+
const documentHash = normalizeBytes32(input.documentHash ?? `0x${"0".repeat(64)}`, "documentHash");
|
|
397
|
+
const paymentType = normalizeUint8(input.paymentType ?? 0, "paymentType");
|
|
398
|
+
return [{
|
|
399
|
+
to: tokenAddress,
|
|
400
|
+
data: encodeFunctionData({
|
|
401
|
+
abi: ERC20_APPROVE_ABI,
|
|
402
|
+
functionName: "approve",
|
|
403
|
+
args: [CAPXUL_PAYMENTS_ADDRESS, totalAmount]
|
|
404
|
+
}),
|
|
405
|
+
value: 0n
|
|
406
|
+
}, {
|
|
407
|
+
to: CAPXUL_PAYMENTS_ADDRESS,
|
|
408
|
+
data: encodeFunctionData({
|
|
409
|
+
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
410
|
+
functionName: "createCommitment",
|
|
411
|
+
args: [
|
|
412
|
+
tokenAddress,
|
|
413
|
+
recipientAddress,
|
|
414
|
+
totalAmount,
|
|
415
|
+
startTime,
|
|
416
|
+
cliffTime,
|
|
417
|
+
endTime,
|
|
418
|
+
documentHash,
|
|
419
|
+
paymentType
|
|
420
|
+
]
|
|
421
|
+
}),
|
|
422
|
+
value: 0n
|
|
423
|
+
}];
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Wrap an org Roles `execTransactionWithRole` call (from `*RoleSpendCall` /
|
|
427
|
+
* `*RoleBatchSpendCall`) into the member Safe's `executeUserOpWithErrorString`
|
|
428
|
+
* (operation = CALL into the Roles module) — the full Safe callData a sponsored
|
|
429
|
+
* UserOp from the member's personal Safe carries (G4 · #547).
|
|
409
430
|
*/
|
|
410
|
-
function
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
431
|
+
function buildOrgRoleSpendPersonalCallData(roleSpendCall) {
|
|
432
|
+
return encodeFunctionData({
|
|
433
|
+
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
434
|
+
functionName: "executeUserOpWithErrorString",
|
|
435
|
+
args: [
|
|
436
|
+
normalizeAddress(roleSpendCall.to, "rolesModuleAddress"),
|
|
437
|
+
0n,
|
|
438
|
+
roleSpendCall.data,
|
|
439
|
+
OPERATION_CALL
|
|
440
|
+
]
|
|
414
441
|
});
|
|
415
442
|
}
|
|
416
443
|
/**
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
444
|
+
* Wrap an ARBITRARY batch of calls into a member Safe's
|
|
445
|
+
* `executeUserOpWithErrorString` via a delegatecall into MultiSendCallOnly
|
|
446
|
+
* (G4 · #547 dev seam). Used by the dev MCP proof to drive the org's Zodiac
|
|
447
|
+
* Roles DEPLOY (deployModule + enableModule + setUpRoles) and role GRANT
|
|
448
|
+
* (assignRoles) as ONE sponsored UserOp from the founder's personal Safe —
|
|
449
|
+
* the same `buildSponsoredSafeUserOp` mechanism the spend path uses. A single
|
|
450
|
+
* call is still wrapped (MultiSend of length 1) so the caller need not branch.
|
|
424
451
|
*/
|
|
425
|
-
function
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
452
|
+
function buildOrgPersonalMultiCallData(calls) {
|
|
453
|
+
if (calls.length === 0) throw new RangeError("multi-call batch must include at least one call");
|
|
454
|
+
return encodeFunctionData({
|
|
455
|
+
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
456
|
+
functionName: "executeUserOpWithErrorString",
|
|
457
|
+
args: [
|
|
458
|
+
MULTI_SEND_CALL_ONLY,
|
|
459
|
+
0n,
|
|
460
|
+
encodeFunctionData({
|
|
461
|
+
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
462
|
+
functionName: "multiSend",
|
|
463
|
+
args: [concat(calls.map(encodeMultiSendCallTransaction))]
|
|
464
|
+
}),
|
|
465
|
+
OPERATION_DELEGATECALL
|
|
466
|
+
]
|
|
430
467
|
});
|
|
431
|
-
return getContractAddress({
|
|
432
|
-
opcode: "CREATE2",
|
|
433
|
-
from: SAFE_PROXY_FACTORY,
|
|
434
|
-
salt: keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce])),
|
|
435
|
-
bytecodeHash: keccak256(concat([SAFE_PROXY_CREATION_CODE, encodeAbiParameters([{ type: "uint256" }], [BigInt(SAFE_L2_SINGLETON)])]))
|
|
436
|
-
}).toLowerCase();
|
|
437
468
|
}
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
469
|
+
/**
|
|
470
|
+
* Encode an org PAYROLL BATCH (G4 · #547): one `execTransactionWithRole`
|
|
471
|
+
* (the member's role key) → MultiSendCallOnly → N × (approve + CapxulPayments
|
|
472
|
+
* settlement call), one call per employee. Instant lines use `send`; scheduled
|
|
473
|
+
* and stream salary lines use `createCommitment`. Each line keeps its own
|
|
474
|
+
* recipient + amount, so each is bounded independently by the role's on-chain
|
|
475
|
+
* Zodiac conditions (per-tx cap, per-day allowance, allowed recipient). One
|
|
476
|
+
* sponsored UserOp settles the batch.
|
|
477
|
+
*/
|
|
478
|
+
function buildCapxulPaymentsRoleBatchSpendCall(input) {
|
|
479
|
+
if (input.runs.length === 0) throw new RangeError("payroll batch must include at least one run");
|
|
480
|
+
const roleKey = normalizeBytes32(input.roleKey, "roleKey");
|
|
481
|
+
const paymentType = input.paymentType ?? 0;
|
|
482
|
+
const multiSendData = encodeFunctionData({
|
|
483
|
+
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
484
|
+
functionName: "multiSend",
|
|
485
|
+
args: [concat(input.runs.flatMap((run) => {
|
|
486
|
+
if (run.timing !== void 0) return [...buildCapxulCreateCommitmentCalls({
|
|
487
|
+
tokenAddress: input.tokenAddress,
|
|
488
|
+
recipientAddress: run.recipientAddress,
|
|
489
|
+
totalAmount: run.amount,
|
|
490
|
+
startTime: run.timing.startTime,
|
|
491
|
+
cliffTime: run.timing.cliffTime,
|
|
492
|
+
endTime: run.timing.endTime,
|
|
493
|
+
paymentType,
|
|
494
|
+
...run.documentHash === void 0 ? {} : { documentHash: run.documentHash }
|
|
495
|
+
})];
|
|
496
|
+
return [...buildCapxulPaymentsSendCalls({
|
|
497
|
+
tokenAddress: input.tokenAddress,
|
|
498
|
+
recipientAddress: run.recipientAddress,
|
|
499
|
+
amount: run.amount,
|
|
500
|
+
paymentType,
|
|
501
|
+
...run.documentHash === void 0 ? {} : { documentHash: run.documentHash }
|
|
502
|
+
})];
|
|
503
|
+
}).map(encodeMultiSendCallTransaction))]
|
|
504
|
+
});
|
|
505
|
+
return {
|
|
506
|
+
to: normalizeAddress(input.rolesModuleAddress, "rolesModuleAddress"),
|
|
507
|
+
data: encodeFunctionData({
|
|
508
|
+
abi: ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI$1,
|
|
509
|
+
functionName: "execTransactionWithRole",
|
|
510
|
+
args: [
|
|
511
|
+
MULTI_SEND_CALL_ONLY,
|
|
512
|
+
0n,
|
|
513
|
+
multiSendData,
|
|
514
|
+
OPERATION_DELEGATECALL,
|
|
515
|
+
roleKey,
|
|
516
|
+
true
|
|
517
|
+
]
|
|
518
|
+
}),
|
|
519
|
+
value: 0n
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function encodeMultiSendCallTransaction(call) {
|
|
523
|
+
return encodePacked([
|
|
524
|
+
"uint8",
|
|
525
|
+
"address",
|
|
526
|
+
"uint256",
|
|
527
|
+
"uint256",
|
|
528
|
+
"bytes"
|
|
529
|
+
], [
|
|
530
|
+
OPERATION_CALL,
|
|
531
|
+
call.to,
|
|
532
|
+
call.value,
|
|
533
|
+
BigInt((call.data.length - 2) / 2),
|
|
534
|
+
call.data
|
|
535
|
+
]);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Encode a personal Safe's `executeUserOpWithErrorString` callData that pays via
|
|
539
|
+
* CapxulPayments in one UserOp: approve + send batched through a delegatecall
|
|
540
|
+
* into MultiSendCallOnly. The Safe4337Module invokes this on the Safe; the
|
|
541
|
+
* MultiSend then CALLs each sub-transaction from the Safe's own context.
|
|
542
|
+
*/
|
|
543
|
+
function buildCapxulPaymentsPersonalSendCallData(input) {
|
|
544
|
+
return encodeFunctionData({
|
|
545
|
+
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
546
|
+
functionName: "executeUserOpWithErrorString",
|
|
547
|
+
args: [
|
|
548
|
+
MULTI_SEND_CALL_ONLY,
|
|
549
|
+
0n,
|
|
550
|
+
encodeFunctionData({
|
|
551
|
+
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
552
|
+
functionName: "multiSend",
|
|
553
|
+
args: [concat(buildCapxulPaymentsSendCalls(input).map(encodeMultiSendCallTransaction))]
|
|
554
|
+
}),
|
|
555
|
+
OPERATION_DELEGATECALL
|
|
556
|
+
]
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
const CAPXUL_PAYMENTS_COMMITMENT_ABI = [
|
|
470
560
|
{
|
|
471
|
-
type: "
|
|
472
|
-
name: "
|
|
561
|
+
type: "function",
|
|
562
|
+
name: "createCommitment",
|
|
563
|
+
stateMutability: "nonpayable",
|
|
564
|
+
inputs: [
|
|
565
|
+
{
|
|
566
|
+
name: "token",
|
|
567
|
+
type: "address"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: "recipient",
|
|
571
|
+
type: "address"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "totalAmount",
|
|
575
|
+
type: "uint256"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "startTime",
|
|
579
|
+
type: "uint48"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "cliffTime",
|
|
583
|
+
type: "uint48"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "endTime",
|
|
587
|
+
type: "uint48"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: "documentHash",
|
|
591
|
+
type: "bytes32"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: "paymentType",
|
|
595
|
+
type: "uint8"
|
|
596
|
+
}
|
|
597
|
+
],
|
|
598
|
+
outputs: [{
|
|
599
|
+
name: "commitmentId",
|
|
600
|
+
type: "uint256"
|
|
601
|
+
}]
|
|
473
602
|
},
|
|
474
603
|
{
|
|
475
|
-
type: "
|
|
476
|
-
name: "
|
|
604
|
+
type: "function",
|
|
605
|
+
name: "claim",
|
|
606
|
+
stateMutability: "nonpayable",
|
|
607
|
+
inputs: [{
|
|
608
|
+
name: "commitmentId",
|
|
609
|
+
type: "uint256"
|
|
610
|
+
}],
|
|
611
|
+
outputs: []
|
|
477
612
|
},
|
|
478
613
|
{
|
|
479
|
-
type: "
|
|
480
|
-
name: "
|
|
614
|
+
type: "function",
|
|
615
|
+
name: "cancel",
|
|
616
|
+
stateMutability: "nonpayable",
|
|
617
|
+
inputs: [{
|
|
618
|
+
name: "commitmentId",
|
|
619
|
+
type: "uint256"
|
|
620
|
+
}, {
|
|
621
|
+
name: "documentHash",
|
|
622
|
+
type: "bytes32"
|
|
623
|
+
}],
|
|
624
|
+
outputs: []
|
|
481
625
|
},
|
|
482
626
|
{
|
|
483
|
-
type: "
|
|
484
|
-
name: "
|
|
627
|
+
type: "function",
|
|
628
|
+
name: "redirect",
|
|
629
|
+
stateMutability: "nonpayable",
|
|
630
|
+
inputs: [
|
|
631
|
+
{
|
|
632
|
+
name: "commitmentId",
|
|
633
|
+
type: "uint256"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: "newRecipient",
|
|
637
|
+
type: "address"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: "newDocumentHash",
|
|
641
|
+
type: "bytes32"
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
outputs: []
|
|
485
645
|
},
|
|
486
646
|
{
|
|
487
|
-
type: "
|
|
488
|
-
name: "
|
|
647
|
+
type: "function",
|
|
648
|
+
name: "claimableAmount",
|
|
649
|
+
stateMutability: "view",
|
|
650
|
+
inputs: [{
|
|
651
|
+
name: "commitmentId",
|
|
652
|
+
type: "uint256"
|
|
653
|
+
}],
|
|
654
|
+
outputs: [{
|
|
655
|
+
name: "",
|
|
656
|
+
type: "uint256"
|
|
657
|
+
}]
|
|
489
658
|
},
|
|
490
659
|
{
|
|
491
|
-
type: "
|
|
492
|
-
name: "
|
|
660
|
+
type: "function",
|
|
661
|
+
name: "commitments",
|
|
662
|
+
stateMutability: "view",
|
|
663
|
+
inputs: [{
|
|
664
|
+
name: "",
|
|
665
|
+
type: "uint256"
|
|
666
|
+
}],
|
|
667
|
+
outputs: [
|
|
668
|
+
{
|
|
669
|
+
name: "creator",
|
|
670
|
+
type: "address"
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: "token",
|
|
674
|
+
type: "address"
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
name: "recipient",
|
|
678
|
+
type: "address"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "totalAmount",
|
|
682
|
+
type: "uint256"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
name: "claimed",
|
|
686
|
+
type: "uint256"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: "startTime",
|
|
690
|
+
type: "uint48"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: "cliffTime",
|
|
694
|
+
type: "uint48"
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: "endTime",
|
|
698
|
+
type: "uint48"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "documentHash",
|
|
702
|
+
type: "bytes32"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "paymentType",
|
|
706
|
+
type: "uint8"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
name: "cancelled",
|
|
710
|
+
type: "bool"
|
|
711
|
+
}
|
|
712
|
+
]
|
|
493
713
|
}
|
|
494
|
-
]
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return concat([userOp.factory, userOp.factoryData ?? "0x"]);
|
|
499
|
-
}
|
|
500
|
-
/** Pack EntryPoint v0.7 unpacked paymaster fields into SafeOp `paymasterAndData`. */
|
|
501
|
-
function safe4337PaymasterAndData(userOp) {
|
|
502
|
-
if (userOp.paymaster === void 0 || userOp.paymaster === "0x") return "0x";
|
|
503
|
-
return concat([
|
|
504
|
-
userOp.paymaster,
|
|
505
|
-
pad(toHex(userOp.paymasterVerificationGasLimit ?? 0n), { size: 16 }),
|
|
506
|
-
pad(toHex(userOp.paymasterPostOpGasLimit ?? 0n), { size: 16 }),
|
|
507
|
-
userOp.paymasterData ?? "0x"
|
|
508
|
-
]);
|
|
714
|
+
];
|
|
715
|
+
function normalizeUint48(value, field) {
|
|
716
|
+
if (!Number.isInteger(value) || value < 0 || value > 0xffffffffffff) throw new RangeError(`${field} must be a uint48 (epoch seconds)`);
|
|
717
|
+
return value;
|
|
509
718
|
}
|
|
510
719
|
/**
|
|
511
|
-
*
|
|
512
|
-
*
|
|
720
|
+
* Encode a personal Safe's `createCommitment` UserOp: approve + createCommitment
|
|
721
|
+
* batched through a delegatecall into MultiSendCallOnly (one sponsored UserOp).
|
|
722
|
+
* The creator (payer Safe) escrows `totalAmount` into CapxulPayments.
|
|
513
723
|
*/
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
724
|
+
function buildCapxulCreateCommitmentPersonalCallData(input) {
|
|
725
|
+
const tokenAddress = normalizeAddress(input.tokenAddress, "tokenAddress");
|
|
726
|
+
const recipientAddress = normalizeAddress(input.recipientAddress, "recipientAddress");
|
|
727
|
+
const totalAmount = normalizePositiveAmount(input.totalAmount, "totalAmount");
|
|
728
|
+
const startTime = normalizeUint48(input.startTime, "startTime");
|
|
729
|
+
const cliffTime = normalizeUint48(input.cliffTime, "cliffTime");
|
|
730
|
+
const endTime = normalizeUint48(input.endTime, "endTime");
|
|
731
|
+
if (startTime > endTime || cliffTime < startTime || cliffTime > endTime) throw new RangeError("commitment times must satisfy start <= cliff <= end");
|
|
732
|
+
const documentHash = normalizeBytes32(input.documentHash ?? `0x${"0".repeat(64)}`, "documentHash");
|
|
733
|
+
const paymentType = normalizeUint8(input.paymentType ?? 0, "paymentType");
|
|
734
|
+
return encodeFunctionData({
|
|
735
|
+
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
736
|
+
functionName: "executeUserOpWithErrorString",
|
|
737
|
+
args: [
|
|
738
|
+
MULTI_SEND_CALL_ONLY,
|
|
739
|
+
0n,
|
|
740
|
+
encodeFunctionData({
|
|
741
|
+
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
742
|
+
functionName: "multiSend",
|
|
743
|
+
args: [concat([{
|
|
744
|
+
to: tokenAddress,
|
|
745
|
+
data: encodeFunctionData({
|
|
746
|
+
abi: ERC20_APPROVE_ABI,
|
|
747
|
+
functionName: "approve",
|
|
748
|
+
args: [CAPXUL_PAYMENTS_ADDRESS, totalAmount]
|
|
749
|
+
}),
|
|
750
|
+
value: 0n
|
|
751
|
+
}, {
|
|
752
|
+
to: CAPXUL_PAYMENTS_ADDRESS,
|
|
753
|
+
data: encodeFunctionData({
|
|
754
|
+
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
755
|
+
functionName: "createCommitment",
|
|
756
|
+
args: [
|
|
757
|
+
tokenAddress,
|
|
758
|
+
recipientAddress,
|
|
759
|
+
totalAmount,
|
|
760
|
+
startTime,
|
|
761
|
+
cliffTime,
|
|
762
|
+
endTime,
|
|
763
|
+
documentHash,
|
|
764
|
+
paymentType
|
|
765
|
+
]
|
|
766
|
+
}),
|
|
767
|
+
value: 0n
|
|
768
|
+
}].map(encodeMultiSendCallTransaction))]
|
|
769
|
+
}),
|
|
770
|
+
OPERATION_DELEGATECALL
|
|
771
|
+
]
|
|
537
772
|
});
|
|
538
773
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
input.signature
|
|
551
|
-
]);
|
|
774
|
+
function buildSingleCapxulPaymentsCallData(data) {
|
|
775
|
+
return encodeFunctionData({
|
|
776
|
+
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
777
|
+
functionName: "executeUserOpWithErrorString",
|
|
778
|
+
args: [
|
|
779
|
+
CAPXUL_PAYMENTS_ADDRESS,
|
|
780
|
+
0n,
|
|
781
|
+
data,
|
|
782
|
+
OPERATION_CALL
|
|
783
|
+
]
|
|
784
|
+
});
|
|
552
785
|
}
|
|
553
|
-
|
|
554
|
-
|
|
786
|
+
/** Encode a recipient Safe's `claim(commitmentId)` UserOp callData. */
|
|
787
|
+
function buildCapxulCommitmentClaimCallData(commitmentId) {
|
|
788
|
+
return buildSingleCapxulPaymentsCallData(encodeFunctionData({
|
|
789
|
+
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
790
|
+
functionName: "claim",
|
|
791
|
+
args: [commitmentId]
|
|
792
|
+
}));
|
|
555
793
|
}
|
|
556
|
-
|
|
794
|
+
/** Encode a creator Safe's `cancel(commitmentId, documentHash)` UserOp callData. */
|
|
795
|
+
function buildCapxulCommitmentCancelCallData(commitmentId, documentHash) {
|
|
796
|
+
return buildSingleCapxulPaymentsCallData(encodeFunctionData({
|
|
797
|
+
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
798
|
+
functionName: "cancel",
|
|
799
|
+
args: [commitmentId, normalizeBytes32(documentHash ?? `0x${"0".repeat(64)}`, "documentHash")]
|
|
800
|
+
}));
|
|
801
|
+
}
|
|
802
|
+
/** Encode a creator Safe's `redirect(commitmentId, newRecipient, newDocumentHash)` UserOp callData. */
|
|
803
|
+
function buildCapxulCommitmentRedirectCallData(commitmentId, newRecipient, newDocumentHash) {
|
|
804
|
+
return buildSingleCapxulPaymentsCallData(encodeFunctionData({
|
|
805
|
+
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
806
|
+
functionName: "redirect",
|
|
807
|
+
args: [
|
|
808
|
+
commitmentId,
|
|
809
|
+
normalizeAddress(newRecipient, "newRecipient"),
|
|
810
|
+
normalizeBytes32(newDocumentHash ?? `0x${"0".repeat(64)}`, "newDocumentHash")
|
|
811
|
+
]
|
|
812
|
+
}));
|
|
813
|
+
}
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region ../../packages/config/src/safe.ts
|
|
816
|
+
const BASE_SEPOLIA_CHAIN_ID = 84532;
|
|
817
|
+
const SAFE_PROXY_FACTORY = "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
|
|
818
|
+
const SAFE_L2_SINGLETON = "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762";
|
|
819
|
+
const SAFE_MODULE_SETUP = "0x2dd68b007B46fBe91B9A7c3EDa5A7a1063cB5b47";
|
|
820
|
+
const SAFE_4337_MODULE = "0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226";
|
|
821
|
+
const MULTI_SEND = "0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526";
|
|
822
|
+
/**
|
|
823
|
+
* Canonical personal-Safe salt namespace — **v2** (PRD #462). v2 derives the
|
|
824
|
+
* address from the email ONLY: the initializer's sole owner is the fixed
|
|
825
|
+
* `CAPXUL_BOOTSTRAP_OWNER`, so the address exists before any user signer does
|
|
826
|
+
* and can never rotate with one. The user's signer is installed at claim time
|
|
827
|
+
* via `swapOwner` (see `capxulClaimOwnerCallData`).
|
|
828
|
+
*/
|
|
829
|
+
const CAPXUL_SAFE_SALT_NAMESPACE = "capxul:safe:email:v2";
|
|
830
|
+
/**
|
|
831
|
+
* The Capxul bootstrap owner — the sole `setup()` owner of every unclaimed
|
|
832
|
+
* personal Safe under derivation v2. This address is part of the CREATE2
|
|
833
|
+
* preimage of EVERY personal Safe address: treat it exactly like
|
|
834
|
+
* `SAFE_PROXY_FACTORY` (changing it is a derivation-version event → v3).
|
|
835
|
+
* The private key lives backend-only (`CAPXUL_BOOTSTRAP_OWNER_PRIVATE_KEY`)
|
|
836
|
+
* and signs exactly one kind of operation: the claim userOp that deploys the
|
|
837
|
+
* Safe and swaps this owner out for the user's signer (PRD #462). The earlier
|
|
838
|
+
* ClaimGuard derivation-v3 placeholder (#461) is closed; future mainnet-scale
|
|
839
|
+
* hardening should be filed against the current payments/claim architecture.
|
|
840
|
+
*/
|
|
841
|
+
const CAPXUL_BOOTSTRAP_OWNER = "0x425fca96f4a3e18fb80974e38096b5da460f2704";
|
|
842
|
+
const UINT48_MAX = 0xffffffffffff;
|
|
843
|
+
const SAFE_PROXY_CREATION_CODE = "0x608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea264697066735822122003d1488ee65e08fa41e58e888a9865554c535f2c77126a82cb4c0f917f31441364736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564";
|
|
557
844
|
/**
|
|
558
|
-
*
|
|
559
|
-
*
|
|
845
|
+
* Normalize an email for use as a Capxul Safe salt input.
|
|
846
|
+
*
|
|
847
|
+
* Trims surrounding whitespace and lowercases the address so that
|
|
848
|
+
* `" User+Demo@Example.COM "` and `"user+demo@example.com"` derive
|
|
849
|
+
* the same `safeAddress`. This is the canonical normalization rule —
|
|
850
|
+
* any future change here would shift every existing user's Safe
|
|
851
|
+
* address, so the rule is pinned by the fixture matrix in
|
|
852
|
+
* `packages/config/tests/safe-address-conformance.test.ts`.
|
|
853
|
+
*
|
|
854
|
+
* @param email - The raw email address to normalize
|
|
855
|
+
* @returns The trimmed, lowercased email
|
|
560
856
|
*/
|
|
561
|
-
function
|
|
562
|
-
return
|
|
857
|
+
function normalizeSafeSaltEmail(email) {
|
|
858
|
+
return email.trim().toLowerCase();
|
|
563
859
|
}
|
|
564
|
-
//#endregion
|
|
565
|
-
//#region ../../packages/config/src/binding.ts
|
|
566
|
-
/** Openfort `thirdPartyUserId` namespace for email bindings (epic #331 / #332). */
|
|
567
|
-
const CAPXUL_BINDING_EMAIL_NAMESPACE = "capxul:binding:email:v1";
|
|
568
860
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* `
|
|
861
|
+
* Compute the deterministic Safe salt nonce for a `(namespace, email)`
|
|
862
|
+
* pair. The salt nonce is the `bigint` reading of
|
|
863
|
+
* `keccak256(namespace + ":" + normalizeSafeSaltEmail(email))`.
|
|
864
|
+
*
|
|
865
|
+
* Namespace defaults to `CAPXUL_SAFE_SALT_NAMESPACE`
|
|
866
|
+
* (`"capxul:safe:email:v2"`) — the per-version Capxul scheme. Pass a
|
|
867
|
+
* different namespace only for pinned pre-v2 artifacts
|
|
868
|
+
* (`CAPXUL_SAFE_SALT_NAMESPACE_V1`, faucet Safe) or when bumping the scheme.
|
|
869
|
+
*
|
|
870
|
+
* @param input.email - The email to derive the salt nonce from
|
|
871
|
+
* @param input.namespace - Optional namespace override (defaults to `CAPXUL_SAFE_SALT_NAMESPACE`)
|
|
872
|
+
* @returns The Capxul-namespaced salt nonce as a `bigint`
|
|
572
873
|
*/
|
|
573
|
-
function
|
|
574
|
-
|
|
874
|
+
function computeCapxulSafeSaltNonce(input) {
|
|
875
|
+
const namespace = input.namespace ?? "capxul:safe:email:v2";
|
|
876
|
+
const normalizedEmail = normalizeSafeSaltEmail(input.email);
|
|
877
|
+
return BigInt(keccak256(toBytes(`${namespace}:${normalizedEmail}`)));
|
|
575
878
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
/** Zodiac MultiSendCallOnly module on Base Sepolia. */
|
|
579
|
-
const MULTI_SEND_CALL_ONLY = "0x9641d764fc13c8b624c04430c7356c1c7c8102e2";
|
|
580
|
-
/** Zodiac Roles v2 mastercopy on Base Sepolia. */
|
|
581
|
-
const ROLES_MASTERCOPY = "0x9646fdad06d3e24444381f44362a3b0eb343d337";
|
|
582
|
-
/** Zodiac ModuleProxyFactory on Base Sepolia. */
|
|
583
|
-
const ZODIAC_MODULE_PROXY_FACTORY = "0x000000000000addb49795b0f9ba5bc298cdda236";
|
|
584
|
-
/** Zodiac MultiSend unwrapper on Base Sepolia. */
|
|
585
|
-
const ZODIAC_MULTI_SEND_UNWRAPPER = "0x93b7fcbc63ed8a3a24b59e1c3e6649d50b7427c0";
|
|
586
|
-
/** CapxulPayments proxy on Base Sepolia. */
|
|
587
|
-
const CAPXUL_PAYMENTS_ADDRESS = "0xe740ea65521edc9bef0ea75d30b5334711db99f4";
|
|
588
|
-
const CAPXUL_PAYMENTS_SEND_ABI = [{
|
|
879
|
+
const ZERO_ADDRESS$1 = "0x0000000000000000000000000000000000000000";
|
|
880
|
+
const safeSetupAbi$1 = [{
|
|
589
881
|
type: "function",
|
|
590
|
-
name: "
|
|
882
|
+
name: "setup",
|
|
591
883
|
stateMutability: "nonpayable",
|
|
592
884
|
inputs: [
|
|
593
885
|
{
|
|
594
|
-
name: "
|
|
886
|
+
name: "_owners",
|
|
887
|
+
type: "address[]"
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
name: "_threshold",
|
|
891
|
+
type: "uint256"
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "to",
|
|
595
895
|
type: "address"
|
|
596
896
|
},
|
|
597
897
|
{
|
|
598
|
-
name: "
|
|
898
|
+
name: "data",
|
|
899
|
+
type: "bytes"
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
name: "fallbackHandler",
|
|
599
903
|
type: "address"
|
|
600
904
|
},
|
|
601
905
|
{
|
|
602
|
-
name: "
|
|
603
|
-
type: "
|
|
906
|
+
name: "paymentToken",
|
|
907
|
+
type: "address"
|
|
604
908
|
},
|
|
605
909
|
{
|
|
606
|
-
name: "
|
|
607
|
-
type: "
|
|
910
|
+
name: "payment",
|
|
911
|
+
type: "uint256"
|
|
608
912
|
},
|
|
609
913
|
{
|
|
610
|
-
name: "
|
|
611
|
-
type: "
|
|
914
|
+
name: "paymentReceiver",
|
|
915
|
+
type: "address"
|
|
612
916
|
}
|
|
613
917
|
],
|
|
614
918
|
outputs: []
|
|
615
919
|
}];
|
|
616
|
-
const
|
|
920
|
+
const enableModulesAbi$1 = [{
|
|
617
921
|
type: "function",
|
|
618
|
-
name: "
|
|
922
|
+
name: "enableModules",
|
|
619
923
|
stateMutability: "nonpayable",
|
|
620
924
|
inputs: [{
|
|
621
|
-
name: "
|
|
622
|
-
type: "address"
|
|
623
|
-
}, {
|
|
624
|
-
name: "amount",
|
|
625
|
-
type: "uint256"
|
|
925
|
+
name: "modules",
|
|
926
|
+
type: "address[]"
|
|
626
927
|
}],
|
|
627
|
-
outputs: [
|
|
628
|
-
name: "",
|
|
629
|
-
type: "bool"
|
|
630
|
-
}]
|
|
928
|
+
outputs: []
|
|
631
929
|
}];
|
|
632
|
-
const
|
|
930
|
+
const multiSendAbi$1 = [{
|
|
633
931
|
type: "function",
|
|
634
932
|
name: "multiSend",
|
|
635
933
|
stateMutability: "payable",
|
|
@@ -639,45 +937,10 @@ const MULTI_SEND_CALL_ONLY_ABI = [{
|
|
|
639
937
|
}],
|
|
640
938
|
outputs: []
|
|
641
939
|
}];
|
|
642
|
-
const
|
|
643
|
-
type: "function",
|
|
644
|
-
name: "execTransactionWithRole",
|
|
645
|
-
stateMutability: "nonpayable",
|
|
646
|
-
inputs: [
|
|
647
|
-
{
|
|
648
|
-
name: "to",
|
|
649
|
-
type: "address"
|
|
650
|
-
},
|
|
651
|
-
{
|
|
652
|
-
name: "value",
|
|
653
|
-
type: "uint256"
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
name: "data",
|
|
657
|
-
type: "bytes"
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
name: "operation",
|
|
661
|
-
type: "uint8"
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
name: "roleKey",
|
|
665
|
-
type: "bytes32"
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
name: "shouldRevert",
|
|
669
|
-
type: "bool"
|
|
670
|
-
}
|
|
671
|
-
],
|
|
672
|
-
outputs: [{
|
|
673
|
-
name: "success",
|
|
674
|
-
type: "bool"
|
|
675
|
-
}]
|
|
676
|
-
}];
|
|
677
|
-
const SAFE4337_EXECUTE_USEROP_ABI = [{
|
|
940
|
+
const safeExecTransactionAbi = [{
|
|
678
941
|
type: "function",
|
|
679
|
-
name: "
|
|
680
|
-
stateMutability: "
|
|
942
|
+
name: "execTransaction",
|
|
943
|
+
stateMutability: "payable",
|
|
681
944
|
inputs: [
|
|
682
945
|
{
|
|
683
946
|
name: "to",
|
|
@@ -692,145 +955,74 @@ const SAFE4337_EXECUTE_USEROP_ABI = [{
|
|
|
692
955
|
type: "bytes"
|
|
693
956
|
},
|
|
694
957
|
{
|
|
695
|
-
name: "operation",
|
|
696
|
-
type: "uint8"
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
data: encodeFunctionData({
|
|
729
|
-
abi: ERC20_APPROVE_ABI,
|
|
730
|
-
functionName: "approve",
|
|
731
|
-
args: [CAPXUL_PAYMENTS_ADDRESS, amount]
|
|
732
|
-
}),
|
|
733
|
-
value: 0n
|
|
734
|
-
}, {
|
|
735
|
-
to: CAPXUL_PAYMENTS_ADDRESS,
|
|
736
|
-
data: encodeFunctionData({
|
|
737
|
-
abi: CAPXUL_PAYMENTS_SEND_ABI,
|
|
738
|
-
functionName: "send",
|
|
739
|
-
args: [
|
|
740
|
-
tokenAddress,
|
|
741
|
-
recipientAddress,
|
|
742
|
-
amount,
|
|
743
|
-
documentHash,
|
|
744
|
-
paymentType
|
|
745
|
-
]
|
|
746
|
-
}),
|
|
747
|
-
value: 0n
|
|
748
|
-
}];
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Wrap an org Roles `execTransactionWithRole` call (from `*RoleSpendCall` /
|
|
752
|
-
* `*RoleBatchSpendCall`) into the member Safe's `executeUserOpWithErrorString`
|
|
753
|
-
* (operation = CALL into the Roles module) — the full Safe callData a sponsored
|
|
754
|
-
* UserOp from the member's personal Safe carries (G4 · #547).
|
|
755
|
-
*/
|
|
756
|
-
function buildOrgRoleSpendPersonalCallData(roleSpendCall) {
|
|
757
|
-
return encodeFunctionData({
|
|
758
|
-
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
759
|
-
functionName: "executeUserOpWithErrorString",
|
|
760
|
-
args: [
|
|
761
|
-
normalizeAddress(roleSpendCall.to, "rolesModuleAddress"),
|
|
762
|
-
0n,
|
|
763
|
-
roleSpendCall.data,
|
|
764
|
-
OPERATION_CALL
|
|
765
|
-
]
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Wrap an ARBITRARY batch of calls into a member Safe's
|
|
770
|
-
* `executeUserOpWithErrorString` via a delegatecall into MultiSendCallOnly
|
|
771
|
-
* (G4 · #547 dev seam). Used by the dev MCP proof to drive the org's Zodiac
|
|
772
|
-
* Roles DEPLOY (deployModule + enableModule + setUpRoles) and role GRANT
|
|
773
|
-
* (assignRoles) as ONE sponsored UserOp from the founder's personal Safe —
|
|
774
|
-
* the same `buildSponsoredSafeUserOp` mechanism the spend path uses. A single
|
|
775
|
-
* call is still wrapped (MultiSend of length 1) so the caller need not branch.
|
|
776
|
-
*/
|
|
777
|
-
function buildOrgPersonalMultiCallData(calls) {
|
|
778
|
-
if (calls.length === 0) throw new RangeError("multi-call batch must include at least one call");
|
|
779
|
-
return encodeFunctionData({
|
|
780
|
-
abi: SAFE4337_EXECUTE_USEROP_ABI,
|
|
781
|
-
functionName: "executeUserOpWithErrorString",
|
|
782
|
-
args: [
|
|
783
|
-
MULTI_SEND_CALL_ONLY,
|
|
784
|
-
0n,
|
|
785
|
-
encodeFunctionData({
|
|
786
|
-
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
787
|
-
functionName: "multiSend",
|
|
788
|
-
args: [concat(calls.map(encodeMultiSendCallTransaction))]
|
|
789
|
-
}),
|
|
790
|
-
OPERATION_DELEGATECALL
|
|
791
|
-
]
|
|
792
|
-
});
|
|
793
|
-
}
|
|
958
|
+
name: "operation",
|
|
959
|
+
type: "uint8"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
name: "safeTxGas",
|
|
963
|
+
type: "uint256"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
name: "baseGas",
|
|
967
|
+
type: "uint256"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: "gasPrice",
|
|
971
|
+
type: "uint256"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "gasToken",
|
|
975
|
+
type: "address"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: "refundReceiver",
|
|
979
|
+
type: "address"
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: "signatures",
|
|
983
|
+
type: "bytes"
|
|
984
|
+
}
|
|
985
|
+
],
|
|
986
|
+
outputs: [{
|
|
987
|
+
name: "success",
|
|
988
|
+
type: "bool"
|
|
989
|
+
}]
|
|
990
|
+
}];
|
|
794
991
|
/**
|
|
795
|
-
* Encode
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
992
|
+
* Encode ordered calls as one Safe `execTransaction` through MultiSend.
|
|
993
|
+
*
|
|
994
|
+
* The owner must approve the surrounding transaction, so this builder uses
|
|
995
|
+
* Safe's prevalidated-signature format and delegates the ordered calls through
|
|
996
|
+
* the canonical MultiSend contract.
|
|
800
997
|
*/
|
|
801
|
-
function
|
|
802
|
-
if (input.runs.length === 0) throw new RangeError("payroll batch must include at least one run");
|
|
803
|
-
const roleKey = normalizeBytes32(input.roleKey, "roleKey");
|
|
804
|
-
const paymentType = input.paymentType ?? 0;
|
|
998
|
+
function buildSafeMultiSendExecTransactionCall(input) {
|
|
805
999
|
const multiSendData = encodeFunctionData({
|
|
806
|
-
abi:
|
|
1000
|
+
abi: multiSendAbi$1,
|
|
807
1001
|
functionName: "multiSend",
|
|
808
|
-
args: [concat(input.
|
|
809
|
-
tokenAddress: input.tokenAddress,
|
|
810
|
-
recipientAddress: run.recipientAddress,
|
|
811
|
-
amount: run.amount,
|
|
812
|
-
paymentType,
|
|
813
|
-
...run.documentHash === void 0 ? {} : { documentHash: run.documentHash }
|
|
814
|
-
})]).map(encodeMultiSendCallTransaction))]
|
|
1002
|
+
args: [concat(input.calls.map(encodeSafeMultiSendCallTransaction))]
|
|
815
1003
|
});
|
|
816
1004
|
return {
|
|
817
|
-
to:
|
|
1005
|
+
to: input.safeAddress,
|
|
1006
|
+
value: 0n,
|
|
818
1007
|
data: encodeFunctionData({
|
|
819
|
-
abi:
|
|
820
|
-
functionName: "
|
|
1008
|
+
abi: safeExecTransactionAbi,
|
|
1009
|
+
functionName: "execTransaction",
|
|
821
1010
|
args: [
|
|
822
|
-
|
|
1011
|
+
MULTI_SEND,
|
|
823
1012
|
0n,
|
|
824
1013
|
multiSendData,
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1014
|
+
1,
|
|
1015
|
+
0n,
|
|
1016
|
+
0n,
|
|
1017
|
+
0n,
|
|
1018
|
+
ZERO_ADDRESS$1,
|
|
1019
|
+
ZERO_ADDRESS$1,
|
|
1020
|
+
`${pad(input.ownerAddress, { size: 32 })}${"0".repeat(64)}01`
|
|
828
1021
|
]
|
|
829
|
-
})
|
|
830
|
-
value: 0n
|
|
1022
|
+
})
|
|
831
1023
|
};
|
|
832
1024
|
}
|
|
833
|
-
function
|
|
1025
|
+
function encodeSafeMultiSendCallTransaction(call) {
|
|
834
1026
|
return encodePacked([
|
|
835
1027
|
"uint8",
|
|
836
1028
|
"address",
|
|
@@ -838,289 +1030,248 @@ function encodeMultiSendCallTransaction(call) {
|
|
|
838
1030
|
"uint256",
|
|
839
1031
|
"bytes"
|
|
840
1032
|
], [
|
|
841
|
-
|
|
1033
|
+
0,
|
|
842
1034
|
call.to,
|
|
843
1035
|
call.value,
|
|
844
1036
|
BigInt((call.data.length - 2) / 2),
|
|
845
1037
|
call.data
|
|
846
1038
|
]);
|
|
847
1039
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1040
|
+
function buildCapxulSafeInitializer(owner) {
|
|
1041
|
+
const enableModulesCall = encodeFunctionData({
|
|
1042
|
+
abi: enableModulesAbi$1,
|
|
1043
|
+
functionName: "enableModules",
|
|
1044
|
+
args: [[SAFE_4337_MODULE]]
|
|
1045
|
+
});
|
|
1046
|
+
const setupData = encodeFunctionData({
|
|
1047
|
+
abi: multiSendAbi$1,
|
|
1048
|
+
functionName: "multiSend",
|
|
1049
|
+
args: [encodePacked([
|
|
1050
|
+
"uint8",
|
|
1051
|
+
"address",
|
|
1052
|
+
"uint256",
|
|
1053
|
+
"uint256",
|
|
1054
|
+
"bytes"
|
|
1055
|
+
], [
|
|
1056
|
+
1,
|
|
1057
|
+
SAFE_MODULE_SETUP,
|
|
1058
|
+
0n,
|
|
1059
|
+
BigInt((enableModulesCall.length - 2) / 2),
|
|
1060
|
+
enableModulesCall
|
|
1061
|
+
])]
|
|
1062
|
+
});
|
|
855
1063
|
return encodeFunctionData({
|
|
856
|
-
abi:
|
|
857
|
-
functionName: "
|
|
1064
|
+
abi: safeSetupAbi$1,
|
|
1065
|
+
functionName: "setup",
|
|
858
1066
|
args: [
|
|
859
|
-
|
|
1067
|
+
[owner],
|
|
1068
|
+
1n,
|
|
1069
|
+
MULTI_SEND,
|
|
1070
|
+
setupData,
|
|
1071
|
+
SAFE_4337_MODULE,
|
|
1072
|
+
ZERO_ADDRESS$1,
|
|
860
1073
|
0n,
|
|
861
|
-
|
|
862
|
-
abi: MULTI_SEND_CALL_ONLY_ABI,
|
|
863
|
-
functionName: "multiSend",
|
|
864
|
-
args: [concat(buildCapxulPaymentsSendCalls(input).map(encodeMultiSendCallTransaction))]
|
|
865
|
-
}),
|
|
866
|
-
OPERATION_DELEGATECALL
|
|
1074
|
+
ZERO_ADDRESS$1
|
|
867
1075
|
]
|
|
868
1076
|
});
|
|
869
1077
|
}
|
|
870
|
-
const
|
|
1078
|
+
const ADDRESS_REGEX$1 = /^0x[0-9a-fA-F]{40}$/;
|
|
1079
|
+
function validateAndNormalizeAddress(field, value) {
|
|
1080
|
+
const address = value.toLowerCase();
|
|
1081
|
+
if (!ADDRESS_REGEX$1.test(address)) throw Errors.invalidInput(field, `must be 0x + 40 hex chars, got ${value}`);
|
|
1082
|
+
return address;
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Pure derivation of the Capxul personal Safe address — **v2: email only**
|
|
1086
|
+
* (PRD #462). The Safe v1.4.1 (SafeL2) + 4337-module initializer's sole owner
|
|
1087
|
+
* is the fixed `CAPXUL_BOOTSTRAP_OWNER`, so the address is a pure function of
|
|
1088
|
+
* the (normalized) email and exists before any user signer does. The user's
|
|
1089
|
+
* signer is installed at claim time via `swapOwner` — signer rotation can
|
|
1090
|
+
* never move the address (org-domain rule D7, now system-wide).
|
|
1091
|
+
*
|
|
1092
|
+
* Returns the lowercased `0x` + 40 hex string (raw — no brand applied so this
|
|
1093
|
+
* function is callable from both `@capxul/config` consumers that don't have
|
|
1094
|
+
* `@capxul/types` available, and from packages that re-brand at their own
|
|
1095
|
+
* boundary).
|
|
1096
|
+
*
|
|
1097
|
+
* Algorithm: exactly mirrors `permissionless.toSafeSmartAccount({ version:
|
|
1098
|
+
* "1.4.1", safeSingletonAddress: SAFE_L2_SINGLETON, owners: [BOOTSTRAP] })`
|
|
1099
|
+
* + the Capxul-canonical module setup (delegatecall into
|
|
1100
|
+
* `SafeModuleSetup.enableModules([SAFE_4337_MODULE])` via the MultiSend lane
|
|
1101
|
+
* during proxy setup). The proxy creation code is pinned at
|
|
1102
|
+
* `SAFE_PROXY_CREATION_CODE`; the salt is Capxul-namespaced (v2) via
|
|
1103
|
+
* `computeCapxulSafeSaltNonce({ email })`.
|
|
1104
|
+
*
|
|
1105
|
+
* Canonical: SDK deployment adapters and
|
|
1106
|
+
* `packages/backend/convex/smartAccount/mutations.ts:provision` import this
|
|
1107
|
+
* function; the conformance test at
|
|
1108
|
+
* `packages/config/tests/safe-address-conformance.test.ts` pins the matrix.
|
|
1109
|
+
*/
|
|
1110
|
+
function deriveCapxulSafeAddress(input) {
|
|
1111
|
+
return deriveCapxulSafeAddressForOwner({
|
|
1112
|
+
ownerAddress: CAPXUL_BOOTSTRAP_OWNER,
|
|
1113
|
+
email: input.email
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Owner-parametrized derivation core. Two callers only:
|
|
1118
|
+
* 1. `deriveCapxulSafeAddress` (canonical v2: owner = bootstrap, namespace v2);
|
|
1119
|
+
* 2. the backend faucet Safe (`testUsdcMint.ts`: owner = deployer EOA,
|
|
1120
|
+
* namespace pinned to `CAPXUL_SAFE_SALT_NAMESPACE_V1` so its deployed
|
|
1121
|
+
* address never moves).
|
|
1122
|
+
* Do NOT introduce new owner-parametrized lanes — per-user owners in the
|
|
1123
|
+
* derivation is exactly the v1 mistake v2 removes.
|
|
1124
|
+
*/
|
|
1125
|
+
function deriveCapxulSafeAddressForOwner(input) {
|
|
1126
|
+
const initializer = buildCapxulSafeInitializer(validateAndNormalizeAddress("ownerAddress", input.ownerAddress));
|
|
1127
|
+
const saltNonce = computeCapxulSafeSaltNonce(input.namespace === void 0 ? { email: input.email } : {
|
|
1128
|
+
email: input.email,
|
|
1129
|
+
namespace: input.namespace
|
|
1130
|
+
});
|
|
1131
|
+
return getContractAddress({
|
|
1132
|
+
opcode: "CREATE2",
|
|
1133
|
+
from: SAFE_PROXY_FACTORY,
|
|
1134
|
+
salt: keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce])),
|
|
1135
|
+
bytecodeHash: keccak256(concat([SAFE_PROXY_CREATION_CODE, encodeAbiParameters([{ type: "uint256" }], [BigInt(SAFE_L2_SINGLETON)])]))
|
|
1136
|
+
}).toLowerCase();
|
|
1137
|
+
}
|
|
1138
|
+
/** Canonical ERC-4337 EntryPoint v0.7 address (same on every chain). */
|
|
1139
|
+
const ENTRY_POINT_07_ADDRESS = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
1140
|
+
/** EIP-712 `SafeOp` typed-data fields for EntryPoint v0.7 (Safe4337Module). */
|
|
1141
|
+
const EIP712_SAFE_OPERATION_TYPE_V07 = { SafeOp: [
|
|
871
1142
|
{
|
|
872
|
-
type: "
|
|
873
|
-
name: "
|
|
874
|
-
stateMutability: "nonpayable",
|
|
875
|
-
inputs: [
|
|
876
|
-
{
|
|
877
|
-
name: "token",
|
|
878
|
-
type: "address"
|
|
879
|
-
},
|
|
880
|
-
{
|
|
881
|
-
name: "recipient",
|
|
882
|
-
type: "address"
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
name: "totalAmount",
|
|
886
|
-
type: "uint256"
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
name: "startTime",
|
|
890
|
-
type: "uint48"
|
|
891
|
-
},
|
|
892
|
-
{
|
|
893
|
-
name: "cliffTime",
|
|
894
|
-
type: "uint48"
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
name: "endTime",
|
|
898
|
-
type: "uint48"
|
|
899
|
-
},
|
|
900
|
-
{
|
|
901
|
-
name: "documentHash",
|
|
902
|
-
type: "bytes32"
|
|
903
|
-
},
|
|
904
|
-
{
|
|
905
|
-
name: "paymentType",
|
|
906
|
-
type: "uint8"
|
|
907
|
-
}
|
|
908
|
-
],
|
|
909
|
-
outputs: [{
|
|
910
|
-
name: "commitmentId",
|
|
911
|
-
type: "uint256"
|
|
912
|
-
}]
|
|
1143
|
+
type: "address",
|
|
1144
|
+
name: "safe"
|
|
913
1145
|
},
|
|
914
1146
|
{
|
|
915
|
-
type: "
|
|
916
|
-
name: "
|
|
917
|
-
stateMutability: "nonpayable",
|
|
918
|
-
inputs: [{
|
|
919
|
-
name: "commitmentId",
|
|
920
|
-
type: "uint256"
|
|
921
|
-
}],
|
|
922
|
-
outputs: []
|
|
1147
|
+
type: "uint256",
|
|
1148
|
+
name: "nonce"
|
|
923
1149
|
},
|
|
924
1150
|
{
|
|
925
|
-
type: "
|
|
926
|
-
name: "
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1151
|
+
type: "bytes",
|
|
1152
|
+
name: "initCode"
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
type: "bytes",
|
|
1156
|
+
name: "callData"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
type: "uint128",
|
|
1160
|
+
name: "verificationGasLimit"
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
type: "uint128",
|
|
1164
|
+
name: "callGasLimit"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
type: "uint256",
|
|
1168
|
+
name: "preVerificationGas"
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
type: "uint128",
|
|
1172
|
+
name: "maxPriorityFeePerGas"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
type: "uint128",
|
|
1176
|
+
name: "maxFeePerGas"
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
type: "bytes",
|
|
1180
|
+
name: "paymasterAndData"
|
|
936
1181
|
},
|
|
937
1182
|
{
|
|
938
|
-
type: "
|
|
939
|
-
name: "
|
|
940
|
-
stateMutability: "nonpayable",
|
|
941
|
-
inputs: [
|
|
942
|
-
{
|
|
943
|
-
name: "commitmentId",
|
|
944
|
-
type: "uint256"
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
name: "newRecipient",
|
|
948
|
-
type: "address"
|
|
949
|
-
},
|
|
950
|
-
{
|
|
951
|
-
name: "newDocumentHash",
|
|
952
|
-
type: "bytes32"
|
|
953
|
-
}
|
|
954
|
-
],
|
|
955
|
-
outputs: []
|
|
1183
|
+
type: "uint48",
|
|
1184
|
+
name: "validAfter"
|
|
956
1185
|
},
|
|
957
1186
|
{
|
|
958
|
-
type: "
|
|
959
|
-
name: "
|
|
960
|
-
stateMutability: "view",
|
|
961
|
-
inputs: [{
|
|
962
|
-
name: "commitmentId",
|
|
963
|
-
type: "uint256"
|
|
964
|
-
}],
|
|
965
|
-
outputs: [{
|
|
966
|
-
name: "",
|
|
967
|
-
type: "uint256"
|
|
968
|
-
}]
|
|
1187
|
+
type: "uint48",
|
|
1188
|
+
name: "validUntil"
|
|
969
1189
|
},
|
|
970
1190
|
{
|
|
971
|
-
type: "
|
|
972
|
-
name: "
|
|
973
|
-
stateMutability: "view",
|
|
974
|
-
inputs: [{
|
|
975
|
-
name: "",
|
|
976
|
-
type: "uint256"
|
|
977
|
-
}],
|
|
978
|
-
outputs: [
|
|
979
|
-
{
|
|
980
|
-
name: "creator",
|
|
981
|
-
type: "address"
|
|
982
|
-
},
|
|
983
|
-
{
|
|
984
|
-
name: "token",
|
|
985
|
-
type: "address"
|
|
986
|
-
},
|
|
987
|
-
{
|
|
988
|
-
name: "recipient",
|
|
989
|
-
type: "address"
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
name: "totalAmount",
|
|
993
|
-
type: "uint256"
|
|
994
|
-
},
|
|
995
|
-
{
|
|
996
|
-
name: "claimed",
|
|
997
|
-
type: "uint256"
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
name: "startTime",
|
|
1001
|
-
type: "uint48"
|
|
1002
|
-
},
|
|
1003
|
-
{
|
|
1004
|
-
name: "cliffTime",
|
|
1005
|
-
type: "uint48"
|
|
1006
|
-
},
|
|
1007
|
-
{
|
|
1008
|
-
name: "endTime",
|
|
1009
|
-
type: "uint48"
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
name: "documentHash",
|
|
1013
|
-
type: "bytes32"
|
|
1014
|
-
},
|
|
1015
|
-
{
|
|
1016
|
-
name: "paymentType",
|
|
1017
|
-
type: "uint8"
|
|
1018
|
-
},
|
|
1019
|
-
{
|
|
1020
|
-
name: "cancelled",
|
|
1021
|
-
type: "bool"
|
|
1022
|
-
}
|
|
1023
|
-
]
|
|
1191
|
+
type: "address",
|
|
1192
|
+
name: "entryPoint"
|
|
1024
1193
|
}
|
|
1025
|
-
];
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
return
|
|
1194
|
+
] };
|
|
1195
|
+
/** Pack EntryPoint v0.7 `factory` + `factoryData` into the SafeOp `initCode`. */
|
|
1196
|
+
function safe4337InitCode(userOp) {
|
|
1197
|
+
if (userOp.factory === void 0 || userOp.factory === "0x") return "0x";
|
|
1198
|
+
return concat([userOp.factory, userOp.factoryData ?? "0x"]);
|
|
1199
|
+
}
|
|
1200
|
+
/** Pack EntryPoint v0.7 unpacked paymaster fields into SafeOp `paymasterAndData`. */
|
|
1201
|
+
function safe4337PaymasterAndData(userOp) {
|
|
1202
|
+
if (userOp.paymaster === void 0 || userOp.paymaster === "0x") return "0x";
|
|
1203
|
+
return concat([
|
|
1204
|
+
userOp.paymaster,
|
|
1205
|
+
pad(toHex(userOp.paymasterVerificationGasLimit ?? 0n), { size: 16 }),
|
|
1206
|
+
pad(toHex(userOp.paymasterPostOpGasLimit ?? 0n), { size: 16 }),
|
|
1207
|
+
userOp.paymasterData ?? "0x"
|
|
1208
|
+
]);
|
|
1029
1209
|
}
|
|
1030
1210
|
/**
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
* The creator (payer Safe) escrows `totalAmount` into CapxulPayments.
|
|
1211
|
+
* Compute the EIP-712 `SafeOp` digest the Safe4337Module owner must sign for a
|
|
1212
|
+
* prepared deployment UserOperation. The `CapxulSigner` signs THIS digest.
|
|
1034
1213
|
*/
|
|
1035
|
-
function
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
functionName: "approve",
|
|
1059
|
-
args: [CAPXUL_PAYMENTS_ADDRESS, totalAmount]
|
|
1060
|
-
}),
|
|
1061
|
-
value: 0n
|
|
1062
|
-
}, {
|
|
1063
|
-
to: CAPXUL_PAYMENTS_ADDRESS,
|
|
1064
|
-
data: encodeFunctionData({
|
|
1065
|
-
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
1066
|
-
functionName: "createCommitment",
|
|
1067
|
-
args: [
|
|
1068
|
-
tokenAddress,
|
|
1069
|
-
recipientAddress,
|
|
1070
|
-
totalAmount,
|
|
1071
|
-
startTime,
|
|
1072
|
-
cliffTime,
|
|
1073
|
-
endTime,
|
|
1074
|
-
documentHash,
|
|
1075
|
-
paymentType
|
|
1076
|
-
]
|
|
1077
|
-
}),
|
|
1078
|
-
value: 0n
|
|
1079
|
-
}].map(encodeMultiSendCallTransaction))]
|
|
1080
|
-
}),
|
|
1081
|
-
OPERATION_DELEGATECALL
|
|
1082
|
-
]
|
|
1214
|
+
function safe4337SafeOpDigest(input) {
|
|
1215
|
+
return hashTypedData({
|
|
1216
|
+
domain: {
|
|
1217
|
+
chainId: input.chainId,
|
|
1218
|
+
verifyingContract: input.safe4337ModuleAddress ?? "0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226"
|
|
1219
|
+
},
|
|
1220
|
+
types: EIP712_SAFE_OPERATION_TYPE_V07,
|
|
1221
|
+
primaryType: "SafeOp",
|
|
1222
|
+
message: {
|
|
1223
|
+
safe: input.userOp.sender,
|
|
1224
|
+
nonce: input.userOp.nonce,
|
|
1225
|
+
initCode: safe4337InitCode(input.userOp),
|
|
1226
|
+
callData: input.userOp.callData,
|
|
1227
|
+
verificationGasLimit: input.userOp.verificationGasLimit,
|
|
1228
|
+
callGasLimit: input.userOp.callGasLimit,
|
|
1229
|
+
preVerificationGas: input.userOp.preVerificationGas,
|
|
1230
|
+
maxPriorityFeePerGas: input.userOp.maxPriorityFeePerGas,
|
|
1231
|
+
maxFeePerGas: input.userOp.maxFeePerGas,
|
|
1232
|
+
paymasterAndData: safe4337PaymasterAndData(input.userOp),
|
|
1233
|
+
validAfter: input.validAfter ?? 0,
|
|
1234
|
+
validUntil: input.validUntil ?? 0,
|
|
1235
|
+
entryPoint: input.entryPointAddress ?? "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
|
|
1236
|
+
}
|
|
1083
1237
|
});
|
|
1084
1238
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1239
|
+
/** Pack a single-owner ECDSA signature into the Safe4337 UserOp signature. */
|
|
1240
|
+
function packSafe4337OwnerSignature(input) {
|
|
1241
|
+
assertUint48(input.validAfter ?? 0, "validAfter");
|
|
1242
|
+
assertUint48(input.validUntil ?? 0, "validUntil");
|
|
1243
|
+
return encodePacked([
|
|
1244
|
+
"uint48",
|
|
1245
|
+
"uint48",
|
|
1246
|
+
"bytes"
|
|
1247
|
+
], [
|
|
1248
|
+
input.validAfter ?? 0,
|
|
1249
|
+
input.validUntil ?? 0,
|
|
1250
|
+
input.signature
|
|
1251
|
+
]);
|
|
1096
1252
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
return buildSingleCapxulPaymentsCallData(encodeFunctionData({
|
|
1100
|
-
abi: CAPXUL_PAYMENTS_COMMITMENT_ABI,
|
|
1101
|
-
functionName: "claim",
|
|
1102
|
-
args: [commitmentId]
|
|
1103
|
-
}));
|
|
1253
|
+
function assertUint48(value, field) {
|
|
1254
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > UINT48_MAX) throw Errors.invalidInput(field, `must fit uint48 (0..${UINT48_MAX})`);
|
|
1104
1255
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
})
|
|
1256
|
+
const SAFE4337_STUB_OWNER_ECDSA = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
1257
|
+
/**
|
|
1258
|
+
* Packed Safe4337 stub signature (single static owner) for gas estimation —
|
|
1259
|
+
* byte-for-byte equal to permissionless's `getStubSignature()`.
|
|
1260
|
+
*/
|
|
1261
|
+
function safe4337StubSignature() {
|
|
1262
|
+
return packSafe4337OwnerSignature({ signature: SAFE4337_STUB_OWNER_ECDSA });
|
|
1112
1263
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1264
|
+
//#endregion
|
|
1265
|
+
//#region ../../packages/config/src/binding.ts
|
|
1266
|
+
/** Openfort `thirdPartyUserId` namespace for email bindings (epic #331 / #332). */
|
|
1267
|
+
const CAPXUL_BINDING_EMAIL_NAMESPACE = "capxul:binding:email:v1";
|
|
1268
|
+
/**
|
|
1269
|
+
* Normalize a raw email for binding id + Safe salt derivation.
|
|
1270
|
+
* Delegates to {@link normalizeSafeSaltEmail} so binding resolution and
|
|
1271
|
+
* `deriveCapxulSafeAddress` never drift apart.
|
|
1272
|
+
*/
|
|
1273
|
+
function normalizeBindingEmail(email) {
|
|
1274
|
+
return normalizeSafeSaltEmail(email);
|
|
1124
1275
|
}
|
|
1125
1276
|
//#endregion
|
|
1126
1277
|
//#region ../../packages/config/src/route.ts
|
|
@@ -1628,9 +1779,22 @@ const ORG_ROLE_ALLOWANCE_KEYS = {
|
|
|
1628
1779
|
})
|
|
1629
1780
|
};
|
|
1630
1781
|
const MULTI_SEND_SELECTOR = "0x8d80ff0a";
|
|
1782
|
+
padHex(concat([MULTI_SEND_CALL_ONLY, MULTI_SEND_SELECTOR]), {
|
|
1783
|
+
dir: "right",
|
|
1784
|
+
size: 32
|
|
1785
|
+
});
|
|
1631
1786
|
const ONE_DAY_SECONDS = 86400n;
|
|
1632
1787
|
const ZODIAC_OPERATION_CALL = 0;
|
|
1633
1788
|
const EXEC_TRANSACTION_WITH_ROLE = "zodiac.roles.execTransactionWithRole";
|
|
1789
|
+
const ROLE_MANAGEMENT_SIGNATURES = [
|
|
1790
|
+
"allowTarget(bytes32,address,uint8)",
|
|
1791
|
+
"scopeTarget(bytes32,address)",
|
|
1792
|
+
"revokeTarget(bytes32,address)",
|
|
1793
|
+
"allowFunction(bytes32,address,bytes4,uint8)",
|
|
1794
|
+
"scopeFunction(bytes32,address,bytes4,(uint8,uint8,uint8,bytes)[],uint8)",
|
|
1795
|
+
"revokeFunction(bytes32,address,bytes4)",
|
|
1796
|
+
"setAllowance(bytes32,uint128,uint128,uint128,uint64,uint64)"
|
|
1797
|
+
];
|
|
1634
1798
|
const PARAMETER_TYPE = {
|
|
1635
1799
|
none: 0,
|
|
1636
1800
|
static: 1,
|
|
@@ -1929,6 +2093,10 @@ function rolePermissions(input) {
|
|
|
1929
2093
|
targetAddress: input.rolesModuleAddress,
|
|
1930
2094
|
signature: "assignRoles(address,bytes32[],bool[])"
|
|
1931
2095
|
});
|
|
2096
|
+
if (input.role.definition.canManageRoles === true) permissions.push(...ROLE_MANAGEMENT_SIGNATURES.map((signature) => ({
|
|
2097
|
+
targetAddress: input.rolesModuleAddress,
|
|
2098
|
+
signature
|
|
2099
|
+
})));
|
|
1932
2100
|
if (input.role.allowance === null && input.role.permissions.includes(EXEC_TRANSACTION_WITH_ROLE)) permissions.push(...uncappedPaymentPermissions(), ...uncappedCommitmentPermissions());
|
|
1933
2101
|
if (input.role.allowance?.perTx !== void 0 && input.role.allowance.perDay !== void 0) {
|
|
1934
2102
|
const allowanceKey = orgRoleAllowanceKeyForLabel(input.role.label);
|
|
@@ -2034,5 +2202,15 @@ function buildOrgRoleAssignmentCall(input) {
|
|
|
2034
2202
|
value: 0n
|
|
2035
2203
|
};
|
|
2036
2204
|
}
|
|
2205
|
+
new Map([
|
|
2206
|
+
["assignRoles(address,bytes32[],bool[])", "AssignRoles(address,bytes32[],bool[])"],
|
|
2207
|
+
["allowTarget(bytes32,address,uint8)", "AllowTarget(bytes32,address,uint8)"],
|
|
2208
|
+
["scopeTarget(bytes32,address)", "ScopeTarget(bytes32,address)"],
|
|
2209
|
+
["revokeTarget(bytes32,address)", "RevokeTarget(bytes32,address)"],
|
|
2210
|
+
["allowFunction(bytes32,address,bytes4,uint8)", "AllowFunction(bytes32,address,bytes4,uint8)"],
|
|
2211
|
+
["scopeFunction(bytes32,address,bytes4,(uint8,uint8,uint8,bytes)[],uint8)", "ScopeFunction(bytes32,address,bytes4,(uint8,uint8,uint8,bytes)[],uint8)"],
|
|
2212
|
+
["revokeFunction(bytes32,address,bytes4)", "RevokeFunction(bytes32,address,bytes4)"],
|
|
2213
|
+
["setAllowance(bytes32,uint128,uint128,uint128,uint64,uint64)", "SetAllowance(bytes32,uint128,uint128,uint128,uint64,uint64)"]
|
|
2214
|
+
].map(([functionSignature, eventSignature]) => [toFunctionSelector(functionSignature), toEventSelector(eventSignature)]));
|
|
2037
2215
|
//#endregion
|
|
2038
|
-
export {
|
|
2216
|
+
export { buildCapxulCommitmentRedirectCallData as $, SAFE_MODULE_SETUP as A, safe4337PaymasterAndData as B, BASE_SEPOLIA_CHAIN_ID as C, MULTI_SEND as D, ENTRY_POINT_07_ADDRESS as E, deriveCapxulSafeAddress as F, CAPXUL_PAYMENTS_SEND_ABI as G, safe4337StubSignature as H, deriveCapxulSafeAddressForOwner as I, ROLES_MASTERCOPY as J, ERC20_APPROVE_ABI as K, normalizeSafeSaltEmail as L, SAFE_PROXY_FACTORY as M, buildSafeMultiSendExecTransactionCall as N, SAFE_4337_MODULE as O, computeCapxulSafeSaltNonce as P, buildCapxulCommitmentClaimCallData as Q, packSafe4337OwnerSignature as R, normalizeBindingEmail as S, CAPXUL_SAFE_SALT_NAMESPACE as T, CAPXUL_PAYMENTS_ADDRESS as U, safe4337SafeOpDigest as V, CAPXUL_PAYMENTS_COMMITMENT_ABI as W, ZODIAC_MULTI_SEND_UNWRAPPER as X, ZODIAC_MODULE_PROXY_FACTORY as Y, buildCapxulCommitmentCancelCallData as Z, normalizeOrgHandle as _, computeOrgRolesModuleAddress as a, buildOrgRoleSpendPersonalCallData as at, USDX_BASE_SEPOLIA_TOKEN as b, normalizeOrgRoleLabel as c, isExactTransferTokenAllowed as ct, soloOrgRoleTemplate as d, Errors as dt, buildCapxulCreateCommitmentPersonalCallData as et, startupOrgRoleTemplate as f, deserializeCapxulError as ft, deriveCapxulOrgAddress as g, computeCapxulOrgSaltNonce as h, buildOrgRolesDeployCalls as i, buildOrgPersonalMultiCallData as it, SAFE_PROXY_CREATION_CODE as j, SAFE_L2_SINGLETON as k, orgRoleKeyForLabel as l, decodeConvexError as lt, buildCapxulOrgInitializer as m, ORG_ROLE_ALLOWANCE_KEYS as n, buildCapxulPaymentsRoleBatchSpendCall as nt, orgRoleAllowanceKeyForLabel as o, EXACT_TRANSFER_TOKEN_ALLOWLIST as ot, CAPXUL_ORG_SALT_NAMESPACE as p, isCapxulError as pt, MULTI_SEND_CALL_ONLY as q, buildOrgRoleAssignmentCall as r, buildCapxulPaymentsSendCalls as rt, compileOrgRoleDefinitions as s, USDX_ADDRESS_BASE_SEPOLIA as st, MULTI_SEND_SELECTOR as t, buildCapxulPaymentsPersonalSendCallData as tt, orgRoleTemplateDefinitions as u, CapxulError as ut, validateOrgHandle as v, CAPXUL_BOOTSTRAP_OWNER as w, CAPXUL_BINDING_EMAIL_NAMESPACE as x, DIRECT_BASE_ROUTE as y, safe4337InitCode as z };
|