@pafi-dev/core 0.4.0 → 0.5.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.
Files changed (38) hide show
  1. package/README.md +171 -71
  2. package/dist/{chunk-KJKDLD7N.cjs → chunk-2PY5RNVS.cjs} +11 -11
  3. package/dist/{chunk-KJKDLD7N.cjs.map → chunk-2PY5RNVS.cjs.map} +1 -1
  4. package/dist/{chunk-DMW67WBU.cjs → chunk-52SZJDFT.cjs} +6 -2
  5. package/dist/chunk-52SZJDFT.cjs.map +1 -0
  6. package/dist/{chunk-Z2V525IS.cjs → chunk-ARZSGP5Y.cjs} +6 -6
  7. package/dist/{chunk-Z2V525IS.cjs.map → chunk-ARZSGP5Y.cjs.map} +1 -1
  8. package/dist/{chunk-I2P3TIP7.js → chunk-N5M3BLOV.js} +2 -2
  9. package/dist/{chunk-73CQTNLB.js → chunk-S5CCEO4O.js} +6 -2
  10. package/dist/{chunk-73CQTNLB.js.map → chunk-S5CCEO4O.js.map} +1 -1
  11. package/dist/{chunk-543IPI6E.js → chunk-T6Y32SNK.js} +5 -3
  12. package/dist/chunk-T6Y32SNK.js.map +1 -0
  13. package/dist/{chunk-DUY7Z2AI.js → chunk-WTWG6QXP.js} +2 -2
  14. package/dist/{chunk-TYIEMGMY.cjs → chunk-YU7MFR6Y.cjs} +6 -4
  15. package/dist/chunk-YU7MFR6Y.cjs.map +1 -0
  16. package/dist/eip712/index.cjs +3 -3
  17. package/dist/eip712/index.js +2 -2
  18. package/dist/{index-CzBaRIqs.d.cts → index-BEx-Q1bW.d.cts} +1 -7
  19. package/dist/{index-C1FGQ004.d.ts → index-r4xCdQO7.d.ts} +1 -7
  20. package/dist/index.cjs +90 -35
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +95 -23
  23. package/dist/index.d.ts +95 -23
  24. package/dist/index.js +76 -21
  25. package/dist/index.js.map +1 -1
  26. package/dist/quoting/index.cjs +3 -3
  27. package/dist/quoting/index.js +2 -2
  28. package/dist/swap/index.cjs +3 -2
  29. package/dist/swap/index.cjs.map +1 -1
  30. package/dist/swap/index.d.cts +1 -1
  31. package/dist/swap/index.d.ts +1 -1
  32. package/dist/swap/index.js +2 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-543IPI6E.js.map +0 -1
  35. package/dist/chunk-DMW67WBU.cjs.map +0 -1
  36. package/dist/chunk-TYIEMGMY.cjs.map +0 -1
  37. /package/dist/{chunk-I2P3TIP7.js.map → chunk-N5M3BLOV.js.map} +0 -0
  38. /package/dist/{chunk-DUY7Z2AI.js.map → chunk-WTWG6QXP.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAb
5
5
  export { buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent } from './eip712/index.js';
6
6
  export { getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, verifyMintCap } from './contract/index.js';
7
7
  export { buildAllPaths, combineRoutes, findBestQuote, quoteBestRoute, quoteExactInput, quoteExactInputSingle } from './quoting/index.js';
8
- import { P as PartialUserOperation, O as Operation, U as UserOperation, S as SwapSimulationResult } from './index-C1FGQ004.js';
9
- 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-C1FGQ004.js';
8
+ import { P as PartialUserOperation, O as Operation, U as UserOperation, S as SwapSimulationResult } from './index-r4xCdQO7.js';
9
+ export { B as BuildSwapWithGasDeductionParams, 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-r4xCdQO7.js';
10
10
  import { LoginMessageParams } from './auth/index.js';
11
11
  export { SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.js';
12
12
 
@@ -67,6 +67,10 @@ declare const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address>;
67
67
  declare const COMMON_TOKENS: Record<number, Record<string, Address>>;
68
68
  declare const COMMON_POOLS: Record<number, PoolKey[]>;
69
69
  declare const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>>;
70
+ /** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */
71
+ declare const ENTRY_POINT_V07: Address;
72
+ /** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */
73
+ declare const PERMIT2_ADDRESS: Address;
70
74
 
71
75
  declare class PafiSDKError extends Error {
72
76
  constructor(message: string);
@@ -714,6 +718,69 @@ interface PafiProxyTransportParams {
714
718
  */
715
719
  declare function createPafiProxyTransport(params: PafiProxyTransportParams): HttpTransport;
716
720
 
721
+ /**
722
+ * Minimal interface for any smart-account client capable of submitting
723
+ * transactions. Deliberately duck-typed so the SDK does not need a hard
724
+ * dependency on permissionless — any client with this shape works.
725
+ */
726
+ interface SmartAccountSender {
727
+ sendTransaction(params: Record<string, unknown>): Promise<Hex>;
728
+ }
729
+ /**
730
+ * Returns true when `err` originates from the **paymaster layer** rather
731
+ * than the contract or bundler layer. Covers:
732
+ *
733
+ * - ERC-4337 AA3x validation errors (AA31–AA34)
734
+ * - Pimlico sponsorship rejections (`pm_*` methods, "sponsorship" messages)
735
+ * - PAFI proxy HTTP errors (401, 403, 429, 503)
736
+ * - Generic "rate limit" / "unauthorized" strings
737
+ *
738
+ * Use this to decide whether retrying without a paymaster makes sense.
739
+ * Contract reverts (AA23, AA24, AA25) and bundler errors are NOT matched.
740
+ */
741
+ declare function isPaymasterError(err: unknown): boolean;
742
+ interface SendWithPaymasterFallbackParams {
743
+ /** Smart-account client with paymaster configured — tried first. */
744
+ primaryClient: SmartAccountSender;
745
+ /**
746
+ * Smart-account client without paymaster — used when `primaryClient`
747
+ * throws a paymaster error. User pays gas from their ETH balance.
748
+ * Pass `null` or `undefined` to disable fallback (error re-thrown as-is).
749
+ */
750
+ fallbackClient: SmartAccountSender | null | undefined;
751
+ /** Transaction params forwarded verbatim to `sendTransaction`. */
752
+ txParams: Record<string, unknown>;
753
+ /**
754
+ * Called just before the fallback attempt so the caller can log or
755
+ * update UI. Receives the error message from the failed primary attempt.
756
+ */
757
+ onFallback?: (errorMessage: string) => void;
758
+ }
759
+ /**
760
+ * Submit a UserOp with paymaster sponsorship, falling back to user-paid gas
761
+ * if the paymaster refuses.
762
+ *
763
+ * Flow:
764
+ * 1. Call `primaryClient.sendTransaction(txParams)`.
765
+ * 2. If it throws and `isPaymasterError` returns true, call `onFallback` then
766
+ * retry with `fallbackClient` (no paymaster — user pays gas).
767
+ * 3. All other errors (contract revert, bundler rejection, network) are
768
+ * re-thrown immediately without a retry.
769
+ *
770
+ * @example
771
+ * ```ts
772
+ * import { sendWithPaymasterFallback } from '@pafi-dev/core';
773
+ *
774
+ * const txHash = await sendWithPaymasterFallback({
775
+ * primaryClient: smartClientWithPaymaster,
776
+ * fallbackClient: smartClientNoPaymaster,
777
+ * txParams: { calls, paymasterContext: { sponsorshipPolicyId } },
778
+ * onFallback: (msg) => addLog(`Paymaster refused (${msg}) — you will pay gas.`),
779
+ * });
780
+ * ```
781
+ */
782
+ declare function sendWithPaymasterFallback(params: SendWithPaymasterFallbackParams): Promise<Hex>;
783
+
717
784
  /**
718
785
  * Real `PointToken` ABI — matches the contract deployed on Base mainnet
719
786
  * (POINT at `0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e`). Sourced from
@@ -1052,26 +1119,8 @@ declare const POINT_TOKEN_ABI: readonly [{
1052
1119
  }];
1053
1120
  }];
1054
1121
 
1055
- /**
1056
- * BatchExecutor delegation target addresses.
1057
- *
1058
- * ## Status
1059
- *
1060
- * Base mainnet: points at **Coinbase Smart Wallet v2**
1061
- * (`0x7702cb554e6bFb442cb743A7dF23154544a7176C`). Coinbase publishes
1062
- * this as the canonical EIP-7702 delegation target on Base — every
1063
- * user that wants gas sponsorship via Coinbase Paymaster delegates to
1064
- * this single contract. One contract, all issuers.
1065
- *
1066
- * Base Sepolia: placeholder; Sepolia is not in active use for PAFI.
1067
- *
1068
- * The ABI (`execute(Call[])`) is exported from
1069
- * `../../userop/batchExecute.ts` and works against the Coinbase
1070
- * contract without change — Coinbase Smart Wallet v2 implements the
1071
- * same call-array signature we already use.
1072
- */
1073
- declare const BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA: Address;
1074
- declare const BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: Address;
1122
+ declare const BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: `0x${string}`;
1123
+ declare const BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA: `0x${string}`;
1075
1124
 
1076
1125
  /**
1077
1126
  * Per-chain deployed contract addresses — v1.4 flow.
@@ -1362,6 +1411,29 @@ declare class PafiSDK {
1362
1411
  private _signer?;
1363
1412
  private _provider?;
1364
1413
  private _chainId?;
1414
+ readonly mint: {
1415
+ buildTypedData: PafiSDK["buildMintRequestTypedData"];
1416
+ sign: PafiSDK["signMintRequest"];
1417
+ verify: PafiSDK["verifyMintRequest"];
1418
+ getNonce: PafiSDK["getMintRequestNonce"];
1419
+ };
1420
+ readonly consent: {
1421
+ buildTypedData: PafiSDK["buildReceiverConsentTypedData"];
1422
+ sign: PafiSDK["signReceiverConsent"];
1423
+ verify: PafiSDK["verifyReceiverConsent"];
1424
+ getNonce: PafiSDK["getReceiverConsentNonce"];
1425
+ };
1426
+ readonly swap: {
1427
+ buildFromQuote: PafiSDK["buildSwapFromQuote"];
1428
+ simulate: PafiSDK["simulateSwap"];
1429
+ };
1430
+ readonly quote: {
1431
+ findBest: PafiSDK["findBestQuote"];
1432
+ };
1433
+ readonly auth: {
1434
+ createLoginMessage: PafiSDK["createLoginMessage"];
1435
+ signMessage: PafiSDK["signLoginMessage"];
1436
+ };
1365
1437
  constructor(config: PafiSDKConfig);
1366
1438
  setPointTokenAddress(address: Address): void;
1367
1439
  setSigner(signer: WalletClient): void;
@@ -1469,4 +1541,4 @@ declare class PafiSDK {
1469
1541
  signLoginMessage(message: string): Promise<Hex>;
1470
1542
  }
1471
1543
 
1472
- export { ApiError, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, BestQuote, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, EIP712Signature, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, Operation, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, POINT_TOKEN_ABI as POINT_TOKEN_V2_ABI, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, PartialUserOperation, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, ReceiverConsent, SUPPORTED_CHAINS, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SponsorshipScenario, type SubmissionPath, SwapSimulationResult, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, createPafiProxyTransport, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, getAaNonce, getContractAddresses, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isPaymasterConfigured, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, rawCallOp, receiverConsentTypes, setPafiWebModalAdapter, setPaymasterConfig, webPopupAdapter };
1544
+ export { ApiError, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, BestQuote, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, EIP712Signature, ENTRY_POINT_V07, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, Operation, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, POINT_TOKEN_ABI as POINT_TOKEN_V2_ABI, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, PartialUserOperation, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, ReceiverConsent, SUPPORTED_CHAINS, type SendWithPaymasterFallbackParams, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, SwapSimulationResult, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, createPafiProxyTransport, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, getAaNonce, getContractAddresses, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, setPafiWebModalAdapter, setPaymasterConfig, webPopupAdapter };
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  verifyBurnRequest,
42
42
  verifyMintRequest,
43
43
  verifyReceiverConsent
44
- } from "./chunk-DUY7Z2AI.js";
44
+ } from "./chunk-WTWG6QXP.js";
45
45
  import {
46
46
  buildAllPaths,
47
47
  combineRoutes,
@@ -49,21 +49,10 @@ import {
49
49
  quoteBestRoute,
50
50
  quoteExactInput,
51
51
  quoteExactInputSingle
52
- } from "./chunk-I2P3TIP7.js";
52
+ } from "./chunk-N5M3BLOV.js";
53
53
  import {
54
54
  v4QuoterAbi
55
55
  } from "./chunk-KFWZRL7I.js";
56
- import {
57
- COMMON_POOLS,
58
- COMMON_TOKENS,
59
- POINT_TOKEN_POOLS,
60
- SUPPORTED_CHAINS,
61
- UNIVERSAL_ROUTER_ADDRESSES,
62
- V4_QUOTER_ADDRESSES,
63
- burnRequestTypes,
64
- mintRequestTypes,
65
- receiverConsentTypes
66
- } from "./chunk-73CQTNLB.js";
67
56
  import {
68
57
  ApiError,
69
58
  BATCH_EXECUTOR_ABI,
@@ -90,12 +79,25 @@ import {
90
79
  erc20TransferOp,
91
80
  rawCallOp,
92
81
  simulateSwap
93
- } from "./chunk-543IPI6E.js";
82
+ } from "./chunk-T6Y32SNK.js";
94
83
  import {
95
84
  erc20Abi,
96
85
  permit2Abi,
97
86
  universalRouterAbi
98
87
  } from "./chunk-2PIXFXA2.js";
88
+ import {
89
+ COMMON_POOLS,
90
+ COMMON_TOKENS,
91
+ ENTRY_POINT_V07,
92
+ PERMIT2_ADDRESS,
93
+ POINT_TOKEN_POOLS,
94
+ SUPPORTED_CHAINS,
95
+ UNIVERSAL_ROUTER_ADDRESSES,
96
+ V4_QUOTER_ADDRESSES,
97
+ burnRequestTypes,
98
+ mintRequestTypes,
99
+ receiverConsentTypes
100
+ } from "./chunk-S5CCEO4O.js";
99
101
 
100
102
  // src/index.ts
101
103
  import { createPublicClient, http as http2 } from "viem";
@@ -241,7 +243,6 @@ function buildPerpDepositWithGasDeduction(params) {
241
243
  }
242
244
 
243
245
  // src/userop/types.ts
244
- var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
245
246
  var ZERO_VALUE = 0n;
246
247
 
247
248
  // src/paymaster/config.ts
@@ -333,7 +334,6 @@ function buildDelegationUserOp(params) {
333
334
  });
334
335
  }
335
336
  async function getAaNonce(client, userAddress) {
336
- const ENTRY_POINT = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
337
337
  const NONCE_ABI = [
338
338
  {
339
339
  inputs: [
@@ -347,7 +347,7 @@ async function getAaNonce(client, userAddress) {
347
347
  }
348
348
  ];
349
349
  return client.readContract({
350
- address: ENTRY_POINT,
350
+ address: ENTRY_POINT_V07,
351
351
  abi: NONCE_ABI,
352
352
  functionName: "getNonce",
353
353
  args: [userAddress, 0n]
@@ -374,6 +374,25 @@ function createPafiProxyTransport(params) {
374
374
  });
375
375
  }
376
376
 
377
+ // src/transport/paymasterFallback.ts
378
+ function isPaymasterError(err) {
379
+ const msg = (err?.message ?? String(err)).toLowerCase();
380
+ return msg.includes("paymaster") || msg.includes("sponsorship") || msg.includes("aa31") || msg.includes("aa32") || msg.includes("aa33") || msg.includes("aa34") || msg.includes("pm_") || msg.includes("rate limit") || msg.includes("unauthorized") || msg.includes("403") || msg.includes("429") || msg.includes("503");
381
+ }
382
+ async function sendWithPaymasterFallback(params) {
383
+ const { primaryClient, fallbackClient, txParams, onFallback } = params;
384
+ try {
385
+ return await primaryClient.sendTransaction(txParams);
386
+ } catch (err) {
387
+ if (isPaymasterError(err) && fallbackClient) {
388
+ const msg = err?.message ?? String(err);
389
+ onFallback?.(msg);
390
+ return await fallbackClient.sendTransaction(txParams);
391
+ }
392
+ throw err;
393
+ }
394
+ }
395
+
377
396
  // src/contracts/real/pointToken.ts
378
397
  import { parseAbi } from "viem";
379
398
  var POINT_TOKEN_ABI = parseAbi([
@@ -419,10 +438,6 @@ var POINT_TOKEN_ABI = parseAbi([
419
438
  "event MintingOracleUpdated(address indexed mintingOracle)"
420
439
  ]);
421
440
 
422
- // src/contracts/real/batchExecutor.ts
423
- var BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = "0x000000000000000000000000000000000000DE01";
424
- var BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = "0x7702cb554e6bFb442cb743A7dF23154544a7176C";
425
-
426
441
  // src/contracts/real/addresses.ts
427
442
  var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
428
443
  var CONTRACT_ADDRESSES = {
@@ -472,6 +487,10 @@ function getContractAddresses(chainId) {
472
487
  return addrs;
473
488
  }
474
489
 
490
+ // src/contracts/real/batchExecutor.ts
491
+ var BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = getContractAddresses(8453).batchExecutor;
492
+ var BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = getContractAddresses(84532).batchExecutor;
493
+
475
494
  // src/web-handoff/webPopup.ts
476
495
  var DEFAULT_WIDTH = 900;
477
496
  var DEFAULT_HEIGHT = 700;
@@ -599,6 +618,16 @@ var PafiSDK = class {
599
618
  _signer;
600
619
  _provider;
601
620
  _chainId;
621
+ // -------------------------------------------------------------------------
622
+ // Domain namespaces — grouped by concern for better IDE autocomplete.
623
+ // Each property is a plain object of bound methods; the underlying logic
624
+ // lives in the flat methods below so both access styles work.
625
+ // -------------------------------------------------------------------------
626
+ mint;
627
+ consent;
628
+ swap;
629
+ quote;
630
+ auth;
602
631
  constructor(config) {
603
632
  this._pointTokenAddress = config.pointTokenAddress;
604
633
  this._signer = config.signer;
@@ -610,6 +639,29 @@ var PafiSDK = class {
610
639
  transport: http2(config.rpcUrl)
611
640
  });
612
641
  }
642
+ this.mint = {
643
+ buildTypedData: this.buildMintRequestTypedData.bind(this),
644
+ sign: this.signMintRequest.bind(this),
645
+ verify: this.verifyMintRequest.bind(this),
646
+ getNonce: this.getMintRequestNonce.bind(this)
647
+ };
648
+ this.consent = {
649
+ buildTypedData: this.buildReceiverConsentTypedData.bind(this),
650
+ sign: this.signReceiverConsent.bind(this),
651
+ verify: this.verifyReceiverConsent.bind(this),
652
+ getNonce: this.getReceiverConsentNonce.bind(this)
653
+ };
654
+ this.swap = {
655
+ buildFromQuote: this.buildSwapFromQuote.bind(this),
656
+ simulate: this.simulateSwap.bind(this)
657
+ };
658
+ this.quote = {
659
+ findBest: this.findBestQuote.bind(this)
660
+ };
661
+ this.auth = {
662
+ createLoginMessage: this.createLoginMessage.bind(this),
663
+ signMessage: this.signLoginMessage.bind(this)
664
+ };
613
665
  }
614
666
  // -------------------------------------------------------------------------
615
667
  // Setters
@@ -793,6 +845,7 @@ export {
793
845
  ORDERLY_VAULT_ABI,
794
846
  ORDERLY_VAULT_ADDRESSES,
795
847
  ORDERLY_VAULT_BASE_MAINNET,
848
+ PERMIT2_ADDRESS,
796
849
  POINT_TOKEN_FACTORY_ADDRESSES,
797
850
  POINT_TOKEN_IMPL_ADDRESSES,
798
851
  POINT_TOKEN_POOLS,
@@ -860,6 +913,7 @@ export {
860
913
  isDelegatedTo,
861
914
  isMinter,
862
915
  isPaymasterConfigured,
916
+ isPaymasterError,
863
917
  issuerRegistryAbi,
864
918
  mintRequestTypes,
865
919
  mintingOracleAbi,
@@ -875,6 +929,7 @@ export {
875
929
  quoteExactInputSingle,
876
930
  rawCallOp,
877
931
  receiverConsentTypes,
932
+ sendWithPaymasterFallback,
878
933
  setPafiWebModalAdapter,
879
934
  setPaymasterConfig,
880
935
  signBurnRequest,