@pafi-dev/core 0.3.0-beta.2 → 0.3.0-beta.3

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/index.d.cts CHANGED
@@ -276,90 +276,44 @@ interface CheckEthAndBranchParams {
276
276
  declare function checkEthAndBranch(params: CheckEthAndBranchParams): Promise<SubmissionPath>;
277
277
 
278
278
  /**
279
- * ⚠️ MOCK — Relayer v2 `mint()` ABI for the v1.4 sponsored flow.
279
+ * ⚠️ MOCK — `PointToken` v1.4 surface (mint + burn).
280
280
  *
281
- * Signature guess based on stakeholder memo (`REQUIREMENTS_V2.md §3`):
281
+ * ## Mint (NEW direct flow no Relayer)
282
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
- * )
283
+ * In v1.4 the user calls `PointToken.mint()` directly via an EIP-7702
284
+ * delegated UserOp `msg.sender == user`. The contract checks the
285
+ * caller is on its authorized minter allowlist. **No Relayer contract,
286
+ * no MintRequest EIP-712 signature.** Backend (gg56) only validates
287
+ * off-chain (balance, policy, KYC) before returning the unsigned UserOp.
290
288
  *
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
289
+ * The mock signature `mint(uint256 amount)` mints to `msg.sender`.
290
+ * SC team confirmation pending they may pick `mint(address to,
291
+ * uint256 amount)` instead. Either is a 1-line ABI change here.
297
292
  *
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.
293
+ * ## Burn two variants mocked
301
294
  *
302
- * See [SC_MOCK_PLAN.md §2.1] for the rationale + swap checklist.
295
+ * Variant A (simpler, most likely):
296
+ * burn(uint256 amount)
297
+ * - burns from `msg.sender` (user via EIP-7702)
298
+ *
299
+ * Variant B (signature-based, if SC prefers explicit on-chain consent):
300
+ * burnWithSig(BurnConsent consent, Signature sig)
301
+ * - verifies EIP-712 signature before burning
302
+ *
303
+ * Either way the ERC-20 emits `Transfer(from, address(0), amount)` so
304
+ * `BurnIndexer` semantics don't change.
303
305
  */
304
- declare const MOCK_RELAYER_V2_ABI: readonly [{
306
+ declare const MOCK_POINT_TOKEN_V2_ABI: readonly [{
305
307
  readonly name: "mint";
306
308
  readonly type: "function";
307
309
  readonly stateMutability: "nonpayable";
308
310
  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";
311
+ readonly type: "uint256";
312
+ readonly name: "amount";
359
313
  }];
360
314
  readonly outputs: readonly [];
361
315
  }, {
362
- readonly name: "mintRequestNonce";
316
+ readonly name: "minters";
363
317
  readonly type: "function";
364
318
  readonly stateMutability: "view";
365
319
  readonly inputs: readonly [{
@@ -367,79 +321,9 @@ declare const MOCK_RELAYER_V2_ABI: readonly [{
367
321
  readonly name: "user";
368
322
  }];
369
323
  readonly outputs: readonly [{
370
- readonly type: "uint256";
324
+ readonly type: "bool";
371
325
  }];
372
326
  }, {
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
327
  readonly name: "burn";
444
328
  readonly type: "function";
445
329
  readonly stateMutability: "nonpayable";
@@ -565,8 +449,14 @@ declare const MOCK_BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: Address;
565
449
  * 3. Update `src/contracts/index.ts` re-export
566
450
  * 4. Delete MOCK_* named exports
567
451
  */
452
+ /**
453
+ * Per-chain contract addresses.
454
+ *
455
+ * v1.4 update: `relayerV2` field dropped — flow now calls
456
+ * `PointToken.mint()` directly via EIP-7702 delegation. No Relayer
457
+ * contract sits between user and PointToken.
458
+ */
568
459
  interface ContractAddresses {
569
- relayerV2: Address;
570
460
  pointToken: Address;
571
461
  batchExecutor: Address;
572
462
  usdt: Address;
@@ -580,96 +470,6 @@ declare const MOCK_ADDRESSES: Record<number, ContractAddresses>;
580
470
  */
581
471
  declare function getMockAddresses(chainId: number): ContractAddresses;
582
472
 
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
473
  /**
674
474
  * ⚠️ MOCK — `BurnConsent` EIP-712 type for the v1.4 reverse flow.
675
475
  *
@@ -744,6 +544,47 @@ declare function buildMockBurnConsentTypedData(domain: PointTokenDomainConfig, m
744
544
  declare function signMockBurnConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: MockBurnConsent): Promise<EIP712Signature>;
745
545
  declare function verifyMockBurnConsent(domain: PointTokenDomainConfig, message: MockBurnConsent, signature: Hex, expectedUser: Address): Promise<SignatureVerification>;
746
546
 
547
+ /**
548
+ * Public contract surface for `@pafi-dev/core/contracts`.
549
+ *
550
+ * Consumers import contract ABIs + addresses + EIP-712 builders from
551
+ * this module. The re-exports below dispatch to either `./mocks/*`
552
+ * (current) or `./real/*` (once SC team delivers real ABIs).
553
+ *
554
+ * ## v1.4 update — Relayer removed
555
+ *
556
+ * The flow no longer routes mint through a Relayer contract. Users
557
+ * call `PointToken.mint()` directly via an EIP-7702 delegated UserOp
558
+ * (`msg.sender == user`). PointToken checks `minters[user]` for
559
+ * authorization. No on-chain MintRequest signature, no dual-sig
560
+ * verification.
561
+ *
562
+ * Exports kept:
563
+ * - `POINT_TOKEN_V2_ABI` — mint + burn surface
564
+ * - `BATCH_EXECUTOR_*` — EIP-7702 delegation target
565
+ * - `CONTRACT_ADDRESSES` — per-chain map (pointToken, batchExecutor, etc.)
566
+ * - `BURN_CONSENT_*` — EIP-712 for Scenario 2 if `burnWithSig` variant
567
+ *
568
+ * Exports removed (vs beta.2):
569
+ * - `RELAYER_V2_ABI`, `RELAYER_V2_MINT_SELECTOR`, `MintRequestV2`,
570
+ * `SignatureStruct` — Relayer contract dropped from flow
571
+ * - `MINT_REQUEST_V2_TYPES`, `buildMintRequestV2TypedData`,
572
+ * `signMintRequestV2`, `verifyMintRequestV2` — no MintRequest sig
573
+ *
574
+ * Status: MOCKS active. See `./mocks/README.md` for deletion checklist.
575
+ */
576
+
577
+ /**
578
+ * Signature struct shared by `burnWithSig` (and any future EIP-712
579
+ * verifier on-chain). Exported here so consumers don't need to
580
+ * redefine it locally.
581
+ */
582
+ interface SignatureStruct {
583
+ v: number;
584
+ r: `0x${string}`;
585
+ s: `0x${string}`;
586
+ }
587
+
747
588
  /**
748
589
  * Options for opening a PAFI Web modal — passed through by all adapters.
749
590
  * Web-only fields (width/height/windowName) are ignored by mobile
@@ -1088,4 +929,4 @@ declare class PafiSDK {
1088
929
  signLoginMessage(message: string): Promise<Hex>;
1089
930
  }
1090
931
 
1091
- 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, type ModalOpenOptions, Operation, POINT_TOKEN_POOLS, MOCK_POINT_TOKEN_V2_ABI as POINT_TOKEN_V2_ABI, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, 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, getPafiWebModalAdapter, getPaymasterConfig, isPaymasterConfigured, mintRequestTypes, openPafiWebModal, openWebPopup, rawCallOp, receiverConsentTypes, setPafiWebModalAdapter, setPaymasterConfig, signMockBurnConsent as signBurnConsent, signMockMintRequestV2 as signMintRequestV2, verifyMockBurnConsent as verifyBurnConsent, verifyMockMintRequestV2 as verifyMintRequestV2, webPopupAdapter };
932
+ 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, MintParams, MintRequest, type ModalOpenOptions, Operation, POINT_TOKEN_POOLS, MOCK_POINT_TOKEN_V2_ABI as POINT_TOKEN_V2_ABI, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, PartialUserOperation, PathKey, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, ReceiverConsent, SUPPORTED_CHAINS, type SignatureStruct, SignatureVerification, SigningError, SimulationError, SimulationResult, type SponsorshipScenario, type SubmissionPath, SwapParams, SwapSimulationResult, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, _resetPaymasterConfigForTests, assembleUserOperation, buildMockBurnConsentTypedData as buildBurnConsentTypedData, buildPartialUserOperation, checkEthAndBranch, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, getMockAddresses as getContractAddresses, getPafiWebModalAdapter, getPaymasterConfig, isPaymasterConfigured, mintRequestTypes, openPafiWebModal, openWebPopup, rawCallOp, receiverConsentTypes, setPafiWebModalAdapter, setPaymasterConfig, signMockBurnConsent as signBurnConsent, verifyMockBurnConsent as verifyBurnConsent, webPopupAdapter };