@pafi-dev/core 0.3.0-alpha.0 → 0.3.0-beta.1
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/chunk-CXFUP2YK.cjs +311 -0
- package/dist/chunk-CXFUP2YK.cjs.map +1 -0
- package/dist/chunk-IK4UK7KT.js +311 -0
- package/dist/chunk-IK4UK7KT.js.map +1 -0
- package/dist/contract/index.d.cts +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/eip712/index.d.cts +1 -1
- package/dist/eip712/index.d.ts +1 -1
- package/dist/index-BpUYHGu3.d.cts +244 -0
- package/dist/index-CNALKsH1.d.ts +244 -0
- package/dist/index.cjs +200 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +474 -73
- package/dist/index.d.ts +474 -73
- package/dist/index.js +196 -90
- package/dist/index.js.map +1 -1
- package/dist/quoting/index.d.cts +1 -1
- package/dist/quoting/index.d.ts +1 -1
- package/dist/relay/index.d.cts +1 -1
- package/dist/relay/index.d.ts +1 -1
- package/dist/swap/index.cjs +4 -2
- package/dist/swap/index.cjs.map +1 -1
- package/dist/swap/index.d.cts +3 -84
- package/dist/swap/index.d.ts +3 -84
- package/dist/swap/index.js +3 -1
- package/dist/{types-CkRJzrZr.d.cts → types-BDOnH5Le.d.cts} +1 -1
- package/dist/{types-CkRJzrZr.d.ts → types-BDOnH5Le.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-6I6K43RQ.cjs +0 -149
- package/dist/chunk-6I6K43RQ.cjs.map +0 -1
- package/dist/chunk-UU72CX7E.js +0 -149
- package/dist/chunk-UU72CX7E.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { P as PoolKey, C as ChainConfig, a as
|
|
3
|
-
export { I as Issuer } from './types-
|
|
2
|
+
import { P as PoolKey, C as ChainConfig, a as PointTokenDomainConfig, E as EIP712Signature, S as SignatureVerification, b as PafiSDKConfig, M as MintRequest, R as ReceiverConsent, c as MintParams, d as SwapParams, B as BestQuote, Q as QuoteResult, e as PathKey } from './types-BDOnH5Le.cjs';
|
|
3
|
+
export { I as Issuer } from './types-BDOnH5Le.cjs';
|
|
4
4
|
export { erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, relayAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
|
|
5
5
|
export { buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signMintRequest, signReceiverConsent, verifyMintRequest, verifyReceiverConsent } from './eip712/index.cjs';
|
|
6
6
|
import { SimulationResult } from './relay/index.cjs';
|
|
7
7
|
export { buildRelaySwapParams, decodeExtData, decodeMintAndSwap, encodeExtData, encodeMintAndSwap, simulateMintAndSwap } from './relay/index.cjs';
|
|
8
8
|
export { getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, getUsdt, isActiveIssuer, isMinter, verifyMintCap } from './contract/index.cjs';
|
|
9
9
|
export { buildAllPaths, combineRoutes, findBestQuote, quoteBestRoute, quoteExactInput, quoteExactInputSingle } from './quoting/index.cjs';
|
|
10
|
-
import { SwapSimulationResult } from './
|
|
11
|
-
export { SETTLE_ALL, SWAP_EXACT_IN, TAKE_ALL, V4_SWAP, buildErc20ApprovalCalldata, buildPermit2ApprovalCalldata, buildSwapFromQuote, buildUniversalRouterExecuteArgs, buildV4SwapInput, checkAllowance, simulateSwap } from './
|
|
10
|
+
import { O as Operation, P as PartialUserOperation, U as UserOperation, S as SwapSimulationResult } from './index-BpUYHGu3.cjs';
|
|
11
|
+
export { B as BuildSwapWithGasDeductionParams, E as ENTRY_POINT_V07, a as PaymasterFields, b as SETTLE_ALL, c as SWAP_EXACT_IN, T as TAKE_ALL, d as UserOpReceipt, V as V4_SWAP, Z as ZERO_VALUE, e as buildErc20ApprovalCalldata, f as buildPermit2ApprovalCalldata, g as buildSwapFromQuote, h as buildSwapWithGasDeduction, i as buildUniversalRouterExecuteArgs, j as buildV4SwapInput, k as checkAllowance, s as simulateSwap } from './index-BpUYHGu3.cjs';
|
|
12
12
|
import { LoginMessageParams } from './auth/index.cjs';
|
|
13
13
|
export { VerifyLoginResult, createLoginMessage, parseLoginMessage, verifyLoginMessage } from './auth/index.cjs';
|
|
14
14
|
|
|
@@ -74,74 +74,6 @@ declare class ApiError extends PafiSDKError {
|
|
|
74
74
|
constructor(message: string, status?: number | undefined);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
/**
|
|
78
|
-
* ERC-4337 v0.7 EntryPoint standard address (deployed deterministically
|
|
79
|
-
* at the same address across chains).
|
|
80
|
-
* https://eips.ethereum.org/EIPS/eip-4337
|
|
81
|
-
*/
|
|
82
|
-
declare const ENTRY_POINT_V07: Address;
|
|
83
|
-
/**
|
|
84
|
-
* A single call inside a batch. `BatchExecutor.execute(Call[])` iterates
|
|
85
|
-
* and invokes each one. When the batch runs via EIP-7702 delegation,
|
|
86
|
-
* `msg.sender` for each call is the user's EOA.
|
|
87
|
-
*/
|
|
88
|
-
interface Operation {
|
|
89
|
-
target: Address;
|
|
90
|
-
value: bigint;
|
|
91
|
-
data: Hex;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Paymaster fields attached to a UserOperation. Populated by the
|
|
95
|
-
* Coinbase Paymaster (via PAFI Backend proxy) before the user signs.
|
|
96
|
-
*/
|
|
97
|
-
interface PaymasterFields {
|
|
98
|
-
paymaster: Address;
|
|
99
|
-
paymasterData: Hex;
|
|
100
|
-
paymasterVerificationGasLimit: bigint;
|
|
101
|
-
paymasterPostOpGasLimit: bigint;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Partial UserOp used during preparation — before paymaster fields are
|
|
105
|
-
* attached or the user signs.
|
|
106
|
-
*/
|
|
107
|
-
interface PartialUserOperation {
|
|
108
|
-
sender: Address;
|
|
109
|
-
nonce: bigint;
|
|
110
|
-
callData: Hex;
|
|
111
|
-
callGasLimit: bigint;
|
|
112
|
-
verificationGasLimit: bigint;
|
|
113
|
-
preVerificationGas: bigint;
|
|
114
|
-
maxFeePerGas: bigint;
|
|
115
|
-
maxPriorityFeePerGas: bigint;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Full ERC-4337 v0.7 UserOperation, ready for bundler submission.
|
|
119
|
-
*/
|
|
120
|
-
interface UserOperation extends PartialUserOperation {
|
|
121
|
-
paymaster: Address;
|
|
122
|
-
paymasterData: Hex;
|
|
123
|
-
paymasterVerificationGasLimit: bigint;
|
|
124
|
-
paymasterPostOpGasLimit: bigint;
|
|
125
|
-
signature: Hex;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Receipt returned by a bundler after a UserOp lands on-chain.
|
|
129
|
-
*/
|
|
130
|
-
interface UserOpReceipt {
|
|
131
|
-
userOpHash: Hex;
|
|
132
|
-
success: boolean;
|
|
133
|
-
txHash: Hex;
|
|
134
|
-
blockNumber: bigint;
|
|
135
|
-
gasUsed: bigint;
|
|
136
|
-
/** Effective gas cost paid (wei). */
|
|
137
|
-
actualGasCost: bigint;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Sentinel operation value used in tests + docs when `Operation.value`
|
|
141
|
-
* is irrelevant (ERC-20 transfers, for example).
|
|
142
|
-
*/
|
|
143
|
-
declare const ZERO_VALUE = 0n;
|
|
144
|
-
|
|
145
77
|
/**
|
|
146
78
|
* Build an ERC-20 `transfer(to, amount)` operation. Used inside a batch
|
|
147
79
|
* to move fee tokens from the user to the fee recipient atomically with
|
|
@@ -343,6 +275,475 @@ interface CheckEthAndBranchParams {
|
|
|
343
275
|
*/
|
|
344
276
|
declare function checkEthAndBranch(params: CheckEthAndBranchParams): Promise<SubmissionPath>;
|
|
345
277
|
|
|
278
|
+
/**
|
|
279
|
+
* ⚠️ MOCK — Relayer v2 `mint()` ABI for the v1.4 sponsored flow.
|
|
280
|
+
*
|
|
281
|
+
* Signature guess based on stakeholder memo (`REQUIREMENTS_V2.md §3`):
|
|
282
|
+
*
|
|
283
|
+
* mint(
|
|
284
|
+
* MintRequest request, // EIP-712 signed by user + issuer
|
|
285
|
+
* Signature userSig, // v, r, s
|
|
286
|
+
* Signature issuerSig, // v, r, s
|
|
287
|
+
* uint256 feeAmount, // PT units to split off to feeRecipient
|
|
288
|
+
* address feeRecipient // typically operator or fee collector
|
|
289
|
+
* )
|
|
290
|
+
*
|
|
291
|
+
* Behaviour expected:
|
|
292
|
+
* - Verify user + issuer EIP-712 signatures against `request`
|
|
293
|
+
* - Mint `request.amount` PT to `request.to`
|
|
294
|
+
* - Atomic transfer `feeAmount` from `request.to` → `feeRecipient`
|
|
295
|
+
* (net mint = `amount - feeAmount`)
|
|
296
|
+
* - Increment the on-chain nonce to prevent replay
|
|
297
|
+
*
|
|
298
|
+
* When SC team publishes the real ABI, drop it in under
|
|
299
|
+
* `src/contracts/real/relayerV2.abi.ts` and flip the export in
|
|
300
|
+
* `src/contracts/index.ts` — call sites unchanged.
|
|
301
|
+
*
|
|
302
|
+
* See [SC_MOCK_PLAN.md §2.1] for the rationale + swap checklist.
|
|
303
|
+
*/
|
|
304
|
+
declare const MOCK_RELAYER_V2_ABI: readonly [{
|
|
305
|
+
readonly name: "mint";
|
|
306
|
+
readonly type: "function";
|
|
307
|
+
readonly stateMutability: "nonpayable";
|
|
308
|
+
readonly inputs: readonly [{
|
|
309
|
+
readonly type: "tuple";
|
|
310
|
+
readonly components: readonly [{
|
|
311
|
+
readonly type: "address";
|
|
312
|
+
readonly name: "to";
|
|
313
|
+
}, {
|
|
314
|
+
readonly type: "uint256";
|
|
315
|
+
readonly name: "amount";
|
|
316
|
+
}, {
|
|
317
|
+
readonly type: "uint256";
|
|
318
|
+
readonly name: "feeAmount";
|
|
319
|
+
}, {
|
|
320
|
+
readonly type: "address";
|
|
321
|
+
readonly name: "feeRecipient";
|
|
322
|
+
}, {
|
|
323
|
+
readonly type: "uint256";
|
|
324
|
+
readonly name: "nonce";
|
|
325
|
+
}, {
|
|
326
|
+
readonly type: "uint256";
|
|
327
|
+
readonly name: "deadline";
|
|
328
|
+
}, {
|
|
329
|
+
readonly type: "bytes";
|
|
330
|
+
readonly name: "extData";
|
|
331
|
+
}];
|
|
332
|
+
readonly name: "request";
|
|
333
|
+
}, {
|
|
334
|
+
readonly type: "tuple";
|
|
335
|
+
readonly components: readonly [{
|
|
336
|
+
readonly type: "uint8";
|
|
337
|
+
readonly name: "v";
|
|
338
|
+
}, {
|
|
339
|
+
readonly type: "bytes32";
|
|
340
|
+
readonly name: "r";
|
|
341
|
+
}, {
|
|
342
|
+
readonly type: "bytes32";
|
|
343
|
+
readonly name: "s";
|
|
344
|
+
}];
|
|
345
|
+
readonly name: "userSig";
|
|
346
|
+
}, {
|
|
347
|
+
readonly type: "tuple";
|
|
348
|
+
readonly components: readonly [{
|
|
349
|
+
readonly type: "uint8";
|
|
350
|
+
readonly name: "v";
|
|
351
|
+
}, {
|
|
352
|
+
readonly type: "bytes32";
|
|
353
|
+
readonly name: "r";
|
|
354
|
+
}, {
|
|
355
|
+
readonly type: "bytes32";
|
|
356
|
+
readonly name: "s";
|
|
357
|
+
}];
|
|
358
|
+
readonly name: "issuerSig";
|
|
359
|
+
}];
|
|
360
|
+
readonly outputs: readonly [];
|
|
361
|
+
}, {
|
|
362
|
+
readonly name: "mintRequestNonce";
|
|
363
|
+
readonly type: "function";
|
|
364
|
+
readonly stateMutability: "view";
|
|
365
|
+
readonly inputs: readonly [{
|
|
366
|
+
readonly type: "address";
|
|
367
|
+
readonly name: "user";
|
|
368
|
+
}];
|
|
369
|
+
readonly outputs: readonly [{
|
|
370
|
+
readonly type: "uint256";
|
|
371
|
+
}];
|
|
372
|
+
}, {
|
|
373
|
+
readonly name: "Minted";
|
|
374
|
+
readonly type: "event";
|
|
375
|
+
readonly inputs: readonly [{
|
|
376
|
+
readonly type: "address";
|
|
377
|
+
readonly name: "user";
|
|
378
|
+
readonly indexed: true;
|
|
379
|
+
}, {
|
|
380
|
+
readonly type: "uint256";
|
|
381
|
+
readonly name: "amount";
|
|
382
|
+
}, {
|
|
383
|
+
readonly type: "uint256";
|
|
384
|
+
readonly name: "feeAmount";
|
|
385
|
+
}, {
|
|
386
|
+
readonly type: "address";
|
|
387
|
+
readonly name: "feeRecipient";
|
|
388
|
+
readonly indexed: true;
|
|
389
|
+
}, {
|
|
390
|
+
readonly type: "bytes32";
|
|
391
|
+
readonly name: "requestHash";
|
|
392
|
+
}];
|
|
393
|
+
}];
|
|
394
|
+
/**
|
|
395
|
+
* Calldata function selector for `mint((...),(...),(...))` as encoded
|
|
396
|
+
* by viem against {@link MOCK_RELAYER_V2_ABI}. Callers compare against
|
|
397
|
+
* this to sanity-check decoded UserOp inner calls.
|
|
398
|
+
*
|
|
399
|
+
* Recompute when the real ABI lands — almost certainly differs.
|
|
400
|
+
*/
|
|
401
|
+
declare const MOCK_RELAYER_V2_MINT_SELECTOR: "0xMOCKED__";
|
|
402
|
+
/**
|
|
403
|
+
* Struct shape that matches {@link MOCK_RELAYER_V2_ABI}. Exported so
|
|
404
|
+
* builders can accept a typed input without `as const` gymnastics.
|
|
405
|
+
*/
|
|
406
|
+
interface MockMintRequestV2 {
|
|
407
|
+
to: Address;
|
|
408
|
+
amount: bigint;
|
|
409
|
+
feeAmount: bigint;
|
|
410
|
+
feeRecipient: Address;
|
|
411
|
+
nonce: bigint;
|
|
412
|
+
deadline: bigint;
|
|
413
|
+
extData: `0x${string}`;
|
|
414
|
+
}
|
|
415
|
+
interface MockSignatureStruct {
|
|
416
|
+
v: number;
|
|
417
|
+
r: `0x${string}`;
|
|
418
|
+
s: `0x${string}`;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* ⚠️ MOCK — `PointToken` v1.4 burn surface.
|
|
423
|
+
*
|
|
424
|
+
* Two variants mocked — SC team will pick ONE before stable; the other
|
|
425
|
+
* gets deleted during Phase B swap.
|
|
426
|
+
*
|
|
427
|
+
* Variant A (simpler, most likely):
|
|
428
|
+
* burn(uint256 amount)
|
|
429
|
+
* - burns from `msg.sender`
|
|
430
|
+
* - caller handles authorization (the user is `msg.sender` via
|
|
431
|
+
* EIP-7702 delegation, so `msg.sender == user`)
|
|
432
|
+
*
|
|
433
|
+
* Variant B (signature-based, if SC prefers explicit consent on-chain):
|
|
434
|
+
* burnWithSig(BurnConsent consent, Signature sig)
|
|
435
|
+
* - verifies EIP-712 signature before burning
|
|
436
|
+
* - used when the caller isn't the user (e.g. a relayer burns on
|
|
437
|
+
* behalf of the user)
|
|
438
|
+
*
|
|
439
|
+
* Either way the ERC-20 emits `Transfer(from, address(0), amount)` so
|
|
440
|
+
* `BurnIndexer` semantics don't change.
|
|
441
|
+
*/
|
|
442
|
+
declare const MOCK_POINT_TOKEN_V2_ABI: readonly [{
|
|
443
|
+
readonly name: "burn";
|
|
444
|
+
readonly type: "function";
|
|
445
|
+
readonly stateMutability: "nonpayable";
|
|
446
|
+
readonly inputs: readonly [{
|
|
447
|
+
readonly type: "uint256";
|
|
448
|
+
readonly name: "amount";
|
|
449
|
+
}];
|
|
450
|
+
readonly outputs: readonly [];
|
|
451
|
+
}, {
|
|
452
|
+
readonly name: "burnWithSig";
|
|
453
|
+
readonly type: "function";
|
|
454
|
+
readonly stateMutability: "nonpayable";
|
|
455
|
+
readonly inputs: readonly [{
|
|
456
|
+
readonly type: "tuple";
|
|
457
|
+
readonly components: readonly [{
|
|
458
|
+
readonly type: "address";
|
|
459
|
+
readonly name: "user";
|
|
460
|
+
}, {
|
|
461
|
+
readonly type: "address";
|
|
462
|
+
readonly name: "pointToken";
|
|
463
|
+
}, {
|
|
464
|
+
readonly type: "uint256";
|
|
465
|
+
readonly name: "amount";
|
|
466
|
+
}, {
|
|
467
|
+
readonly type: "uint256";
|
|
468
|
+
readonly name: "nonce";
|
|
469
|
+
}, {
|
|
470
|
+
readonly type: "uint256";
|
|
471
|
+
readonly name: "deadline";
|
|
472
|
+
}];
|
|
473
|
+
readonly name: "consent";
|
|
474
|
+
}, {
|
|
475
|
+
readonly type: "tuple";
|
|
476
|
+
readonly components: readonly [{
|
|
477
|
+
readonly type: "uint8";
|
|
478
|
+
readonly name: "v";
|
|
479
|
+
}, {
|
|
480
|
+
readonly type: "bytes32";
|
|
481
|
+
readonly name: "r";
|
|
482
|
+
}, {
|
|
483
|
+
readonly type: "bytes32";
|
|
484
|
+
readonly name: "s";
|
|
485
|
+
}];
|
|
486
|
+
readonly name: "sig";
|
|
487
|
+
}];
|
|
488
|
+
readonly outputs: readonly [];
|
|
489
|
+
}, {
|
|
490
|
+
readonly name: "balanceOf";
|
|
491
|
+
readonly type: "function";
|
|
492
|
+
readonly stateMutability: "view";
|
|
493
|
+
readonly inputs: readonly [{
|
|
494
|
+
readonly type: "address";
|
|
495
|
+
readonly name: "user";
|
|
496
|
+
}];
|
|
497
|
+
readonly outputs: readonly [{
|
|
498
|
+
readonly type: "uint256";
|
|
499
|
+
}];
|
|
500
|
+
}, {
|
|
501
|
+
readonly name: "burnNonce";
|
|
502
|
+
readonly type: "function";
|
|
503
|
+
readonly stateMutability: "view";
|
|
504
|
+
readonly inputs: readonly [{
|
|
505
|
+
readonly type: "address";
|
|
506
|
+
readonly name: "user";
|
|
507
|
+
}];
|
|
508
|
+
readonly outputs: readonly [{
|
|
509
|
+
readonly type: "uint256";
|
|
510
|
+
}];
|
|
511
|
+
}, {
|
|
512
|
+
readonly name: "Transfer";
|
|
513
|
+
readonly type: "event";
|
|
514
|
+
readonly inputs: readonly [{
|
|
515
|
+
readonly type: "address";
|
|
516
|
+
readonly name: "from";
|
|
517
|
+
readonly indexed: true;
|
|
518
|
+
}, {
|
|
519
|
+
readonly type: "address";
|
|
520
|
+
readonly name: "to";
|
|
521
|
+
readonly indexed: true;
|
|
522
|
+
}, {
|
|
523
|
+
readonly type: "uint256";
|
|
524
|
+
readonly name: "value";
|
|
525
|
+
}];
|
|
526
|
+
}];
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* ⚠️ MOCK — placeholder BatchExecutor address.
|
|
530
|
+
*
|
|
531
|
+
* Real deployment:
|
|
532
|
+
* - Coinbase may pre-deploy a canonical BatchExecutor that we target
|
|
533
|
+
* via EIP-7702 delegation (see blocker B2 in V1.4_V1.5_READINESS.md)
|
|
534
|
+
* - Otherwise PAFI deploys a minimal one and publishes the address
|
|
535
|
+
*
|
|
536
|
+
* The ABI itself (`execute(Call[])`) is stable and lives under
|
|
537
|
+
* `../../userop/batchExecute.ts` — that's the real one, unchanged
|
|
538
|
+
* by the mock swap. Only the **address** is mocked here.
|
|
539
|
+
*
|
|
540
|
+
* Pattern: checksum address with hex "DEAD0001" suffix per chain so
|
|
541
|
+
* it's obvious in logs which chain is using a mock.
|
|
542
|
+
*/
|
|
543
|
+
declare const MOCK_BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA: Address;
|
|
544
|
+
declare const MOCK_BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: Address;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* ⚠️ MOCK — per-chain contract addresses for the v1.4 sponsored flow.
|
|
548
|
+
*
|
|
549
|
+
* Real addresses come from SC team once they deploy Relayer v2 and
|
|
550
|
+
* pick a BatchExecutor. Until then we use placeholders so the SDK
|
|
551
|
+
* code path compiles + tests execute end-to-end.
|
|
552
|
+
*
|
|
553
|
+
* **Intentionally not merge-safe to mainnet** — callers that resolve
|
|
554
|
+
* a mainnet address here get a `0x...DEAD` placeholder which will
|
|
555
|
+
* revert at contract-level. That's the point: prod refuses to run
|
|
556
|
+
* on mocks.
|
|
557
|
+
*
|
|
558
|
+
* Chain id map:
|
|
559
|
+
* - 8453 Base mainnet
|
|
560
|
+
* - 84532 Base Sepolia
|
|
561
|
+
*
|
|
562
|
+
* Swap workflow when SC delivers:
|
|
563
|
+
* 1. Rename this file → `addresses.ts` under `src/contracts/real/`
|
|
564
|
+
* 2. Fill real addresses per chain
|
|
565
|
+
* 3. Update `src/contracts/index.ts` re-export
|
|
566
|
+
* 4. Delete MOCK_* named exports
|
|
567
|
+
*/
|
|
568
|
+
interface ContractAddresses {
|
|
569
|
+
relayerV2: Address;
|
|
570
|
+
pointToken: Address;
|
|
571
|
+
batchExecutor: Address;
|
|
572
|
+
usdt: Address;
|
|
573
|
+
issuerRegistry: Address;
|
|
574
|
+
mintingOracle: Address;
|
|
575
|
+
}
|
|
576
|
+
declare const MOCK_ADDRESSES: Record<number, ContractAddresses>;
|
|
577
|
+
/**
|
|
578
|
+
* Lookup helper — throws if the chain isn't in the map so callers fail
|
|
579
|
+
* loudly on misconfiguration instead of silently using `undefined`.
|
|
580
|
+
*/
|
|
581
|
+
declare function getMockAddresses(chainId: number): ContractAddresses;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* ⚠️ MOCK — `MintRequest` v2 EIP-712 types.
|
|
585
|
+
*
|
|
586
|
+
* Extends v0.2.x `MintRequest` (4 fields) with three new fields needed
|
|
587
|
+
* for the v1.4 sponsored flow:
|
|
588
|
+
*
|
|
589
|
+
* + feeAmount PT units taken from the mint for the operator
|
|
590
|
+
* + feeRecipient where the fee goes (operator or treasury)
|
|
591
|
+
* + extData arbitrary bytes for future extensions (swap path, etc.)
|
|
592
|
+
*
|
|
593
|
+
* When SC team confirms the real struct, drop this file's content into
|
|
594
|
+
* the real builder and remove the MOCK_ prefix. The function signatures
|
|
595
|
+
* below stay stable — only `MOCK_MINT_REQUEST_V2_TYPES` changes.
|
|
596
|
+
*/
|
|
597
|
+
declare const MOCK_MINT_REQUEST_V2_TYPES: {
|
|
598
|
+
readonly MintRequest: readonly [{
|
|
599
|
+
readonly name: "to";
|
|
600
|
+
readonly type: "address";
|
|
601
|
+
}, {
|
|
602
|
+
readonly name: "amount";
|
|
603
|
+
readonly type: "uint256";
|
|
604
|
+
}, {
|
|
605
|
+
readonly name: "feeAmount";
|
|
606
|
+
readonly type: "uint256";
|
|
607
|
+
}, {
|
|
608
|
+
readonly name: "feeRecipient";
|
|
609
|
+
readonly type: "address";
|
|
610
|
+
}, {
|
|
611
|
+
readonly name: "nonce";
|
|
612
|
+
readonly type: "uint256";
|
|
613
|
+
}, {
|
|
614
|
+
readonly name: "deadline";
|
|
615
|
+
readonly type: "uint256";
|
|
616
|
+
}, {
|
|
617
|
+
readonly name: "extData";
|
|
618
|
+
readonly type: "bytes";
|
|
619
|
+
}];
|
|
620
|
+
};
|
|
621
|
+
/**
|
|
622
|
+
* Build the typed-data envelope that any EIP-712 signer (viem, ethers,
|
|
623
|
+
* Privy) can consume. Callers typically pass the result to
|
|
624
|
+
* `walletClient.signTypedData()` or `privy.signTypedData()`.
|
|
625
|
+
*/
|
|
626
|
+
declare function buildMockMintRequestV2TypedData(domain: PointTokenDomainConfig, message: MockMintRequestV2): {
|
|
627
|
+
domain: {
|
|
628
|
+
name: string;
|
|
629
|
+
version: "1";
|
|
630
|
+
chainId: number;
|
|
631
|
+
verifyingContract: `0x${string}`;
|
|
632
|
+
};
|
|
633
|
+
types: {
|
|
634
|
+
readonly MintRequest: readonly [{
|
|
635
|
+
readonly name: "to";
|
|
636
|
+
readonly type: "address";
|
|
637
|
+
}, {
|
|
638
|
+
readonly name: "amount";
|
|
639
|
+
readonly type: "uint256";
|
|
640
|
+
}, {
|
|
641
|
+
readonly name: "feeAmount";
|
|
642
|
+
readonly type: "uint256";
|
|
643
|
+
}, {
|
|
644
|
+
readonly name: "feeRecipient";
|
|
645
|
+
readonly type: "address";
|
|
646
|
+
}, {
|
|
647
|
+
readonly name: "nonce";
|
|
648
|
+
readonly type: "uint256";
|
|
649
|
+
}, {
|
|
650
|
+
readonly name: "deadline";
|
|
651
|
+
readonly type: "uint256";
|
|
652
|
+
}, {
|
|
653
|
+
readonly name: "extData";
|
|
654
|
+
readonly type: "bytes";
|
|
655
|
+
}];
|
|
656
|
+
};
|
|
657
|
+
primaryType: "MintRequest";
|
|
658
|
+
message: MockMintRequestV2;
|
|
659
|
+
};
|
|
660
|
+
/**
|
|
661
|
+
* Sign a `MintRequest` v2 with a viem WalletClient — server-side flow
|
|
662
|
+
* where the issuer holds the private key directly (KMS-backed signer
|
|
663
|
+
* is the production path; see `@pafi-dev/issuer` KMSSignerAdapter).
|
|
664
|
+
*/
|
|
665
|
+
declare function signMockMintRequestV2(walletClient: WalletClient, domain: PointTokenDomainConfig, message: MockMintRequestV2): Promise<EIP712Signature>;
|
|
666
|
+
/**
|
|
667
|
+
* Verify a `MintRequest` v2 signature and check it came from the
|
|
668
|
+
* expected signer (either user or issuer depending on which side is
|
|
669
|
+
* being verified).
|
|
670
|
+
*/
|
|
671
|
+
declare function verifyMockMintRequestV2(domain: PointTokenDomainConfig, message: MockMintRequestV2, signature: Hex, expectedSigner: Address): Promise<SignatureVerification>;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* ⚠️ MOCK — `BurnConsent` EIP-712 type for the v1.4 reverse flow.
|
|
675
|
+
*
|
|
676
|
+
* New type entirely — v0.2.x had no burn-for-credit flow.
|
|
677
|
+
*
|
|
678
|
+
* User signs `BurnConsent` to authorize burning `amount` PT from their
|
|
679
|
+
* wallet in exchange for an off-chain credit of (amount - gasFee).
|
|
680
|
+
* Signature is consumed either by:
|
|
681
|
+
* - A relayer calling `PointToken.burnWithSig(...)` (Variant B)
|
|
682
|
+
* - The paymaster-proxy-sponsored UserOp calling `PointToken.burn(...)`
|
|
683
|
+
* with msg.sender = user via EIP-7702 (Variant A)
|
|
684
|
+
*
|
|
685
|
+
* Either way the tx emits `Transfer(user → 0x0)` which the issuer's
|
|
686
|
+
* `BurnIndexer` watches for and uses to credit the off-chain ledger.
|
|
687
|
+
*
|
|
688
|
+
* Field list is a best-guess — SC team may add fields (e.g. `feeAmount`
|
|
689
|
+
* explicit, `extData`). Update this mock when they freeze the spec.
|
|
690
|
+
*/
|
|
691
|
+
interface MockBurnConsent {
|
|
692
|
+
user: Address;
|
|
693
|
+
pointToken: Address;
|
|
694
|
+
amount: bigint;
|
|
695
|
+
nonce: bigint;
|
|
696
|
+
deadline: bigint;
|
|
697
|
+
}
|
|
698
|
+
declare const MOCK_BURN_CONSENT_TYPES: {
|
|
699
|
+
readonly BurnConsent: readonly [{
|
|
700
|
+
readonly name: "user";
|
|
701
|
+
readonly type: "address";
|
|
702
|
+
}, {
|
|
703
|
+
readonly name: "pointToken";
|
|
704
|
+
readonly type: "address";
|
|
705
|
+
}, {
|
|
706
|
+
readonly name: "amount";
|
|
707
|
+
readonly type: "uint256";
|
|
708
|
+
}, {
|
|
709
|
+
readonly name: "nonce";
|
|
710
|
+
readonly type: "uint256";
|
|
711
|
+
}, {
|
|
712
|
+
readonly name: "deadline";
|
|
713
|
+
readonly type: "uint256";
|
|
714
|
+
}];
|
|
715
|
+
};
|
|
716
|
+
declare function buildMockBurnConsentTypedData(domain: PointTokenDomainConfig, message: MockBurnConsent): {
|
|
717
|
+
domain: {
|
|
718
|
+
name: string;
|
|
719
|
+
version: "1";
|
|
720
|
+
chainId: number;
|
|
721
|
+
verifyingContract: `0x${string}`;
|
|
722
|
+
};
|
|
723
|
+
types: {
|
|
724
|
+
readonly BurnConsent: readonly [{
|
|
725
|
+
readonly name: "user";
|
|
726
|
+
readonly type: "address";
|
|
727
|
+
}, {
|
|
728
|
+
readonly name: "pointToken";
|
|
729
|
+
readonly type: "address";
|
|
730
|
+
}, {
|
|
731
|
+
readonly name: "amount";
|
|
732
|
+
readonly type: "uint256";
|
|
733
|
+
}, {
|
|
734
|
+
readonly name: "nonce";
|
|
735
|
+
readonly type: "uint256";
|
|
736
|
+
}, {
|
|
737
|
+
readonly name: "deadline";
|
|
738
|
+
readonly type: "uint256";
|
|
739
|
+
}];
|
|
740
|
+
};
|
|
741
|
+
primaryType: "BurnConsent";
|
|
742
|
+
message: MockBurnConsent;
|
|
743
|
+
};
|
|
744
|
+
declare function signMockBurnConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: MockBurnConsent): Promise<EIP712Signature>;
|
|
745
|
+
declare function verifyMockBurnConsent(domain: PointTokenDomainConfig, message: MockBurnConsent, signature: Hex, expectedUser: Address): Promise<SignatureVerification>;
|
|
746
|
+
|
|
346
747
|
declare class PafiSDK {
|
|
347
748
|
private _pointTokenAddress?;
|
|
348
749
|
private _relayContractAddress?;
|
|
@@ -505,4 +906,4 @@ declare class PafiSDK {
|
|
|
505
906
|
signLoginMessage(message: string): Promise<Hex>;
|
|
506
907
|
}
|
|
507
908
|
|
|
508
|
-
export { ApiError, BATCH_EXECUTOR_ABI, BestQuote, type BuildPartialUserOpParams, COMMON_POOLS, COMMON_TOKENS, ChainConfig, type CheckEthAndBranchParams, ConfigurationError,
|
|
909
|
+
export { ApiError, BATCH_EXECUTOR_ABI, MOCK_BATCH_EXECUTOR_ADDRESS_BASE_MAINNET as BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, MOCK_BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA as BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, MOCK_BURN_CONSENT_TYPES as BURN_CONSENT_TYPES, BestQuote, type BuildPartialUserOpParams, type MockBurnConsent as BurnConsent, COMMON_POOLS, COMMON_TOKENS, MOCK_ADDRESSES as CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, EIP712Signature, LoginMessageParams, MOCK_MINT_REQUEST_V2_TYPES as MINT_REQUEST_V2_TYPES, MintParams, MintRequest, type MockMintRequestV2 as MintRequestV2, Operation, POINT_TOKEN_POOLS, MOCK_POINT_TOKEN_V2_ABI as POINT_TOKEN_V2_ABI, PafiSDK, PafiSDKConfig, PafiSDKError, PartialUserOperation, PathKey, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, MOCK_RELAYER_V2_ABI as RELAYER_V2_ABI, MOCK_RELAYER_V2_MINT_SELECTOR as RELAYER_V2_MINT_SELECTOR, ReceiverConsent, SUPPORTED_CHAINS, type MockSignatureStruct as SignatureStruct, SignatureVerification, SigningError, SimulationError, SimulationResult, type SponsorshipScenario, type SubmissionPath, SwapParams, SwapSimulationResult, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, _resetPaymasterConfigForTests, assembleUserOperation, buildMockBurnConsentTypedData as buildBurnConsentTypedData, buildMockMintRequestV2TypedData as buildMintRequestV2TypedData, buildPartialUserOperation, checkEthAndBranch, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, getMockAddresses as getContractAddresses, getPaymasterConfig, isPaymasterConfigured, mintRequestTypes, rawCallOp, receiverConsentTypes, setPaymasterConfig, signMockBurnConsent as signBurnConsent, signMockMintRequestV2 as signMintRequestV2, verifyMockBurnConsent as verifyBurnConsent, verifyMockMintRequestV2 as verifyMintRequestV2 };
|