@pafi-dev/core 0.9.6 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +146 -188
- package/dist/abi/index.cjs +2 -2
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.cts +58 -106
- package/dist/abi/index.d.ts +58 -106
- package/dist/abi/index.js +3 -3
- package/dist/{chunk-Y5EYH2SQ.js → chunk-H3X3FYUU.js} +1 -10
- package/dist/chunk-H3X3FYUU.js.map +1 -0
- package/dist/{chunk-5NEAI2BH.cjs → chunk-NT2ZPF72.cjs} +50 -72
- package/dist/chunk-NT2ZPF72.cjs.map +1 -0
- package/dist/{chunk-BNO5SM25.cjs → chunk-TRYGIC2I.cjs} +2 -11
- package/dist/chunk-TRYGIC2I.cjs.map +1 -0
- package/dist/{chunk-HJYHGCMT.js → chunk-UEO4YN6T.js} +53 -75
- package/dist/chunk-UEO4YN6T.js.map +1 -0
- package/dist/{chunk-MIQA46E3.cjs → chunk-XXLIIWIF.cjs} +45 -53
- package/dist/chunk-XXLIIWIF.cjs.map +1 -0
- package/dist/{chunk-CWH4KOUW.js → chunk-ZJXXCG5P.js} +45 -53
- package/dist/chunk-ZJXXCG5P.js.map +1 -0
- package/dist/contract/index.cjs +2 -4
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +5 -15
- package/dist/contract/index.d.ts +5 -15
- package/dist/contract/index.js +1 -3
- package/dist/eip712/index.cjs +2 -8
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.d.cts +29 -43
- package/dist/eip712/index.d.ts +29 -43
- package/dist/eip712/index.js +3 -9
- package/dist/index.cjs +141 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -182
- package/dist/index.d.ts +201 -182
- package/dist/index.js +135 -152
- package/dist/index.js.map +1 -1
- package/dist/{types-DWLZNgcw.d.cts → types-C17pznGz.d.cts} +72 -30
- package/dist/{types-DWLZNgcw.d.ts → types-C17pznGz.d.ts} +72 -30
- package/package.json +15 -5
- package/dist/chunk-5NEAI2BH.cjs.map +0 -1
- package/dist/chunk-BNO5SM25.cjs.map +0 -1
- package/dist/chunk-CWH4KOUW.js.map +0 -1
- package/dist/chunk-HJYHGCMT.js.map +0 -1
- package/dist/chunk-MIQA46E3.cjs.map +0 -1
- package/dist/chunk-Y5EYH2SQ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
erc20Abi,
|
|
3
|
-
permit2Abi,
|
|
4
|
-
pointTokenFactoryAbi,
|
|
5
|
-
universalRouterAbi,
|
|
6
|
-
v4QuoterAbi
|
|
7
|
-
} from "./chunk-CWH4KOUW.js";
|
|
8
1
|
import {
|
|
9
2
|
SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET,
|
|
10
3
|
SPONSOR_AUTH_DOMAIN_NAME,
|
|
@@ -21,6 +14,13 @@ import {
|
|
|
21
14
|
verifyLoginMessage,
|
|
22
15
|
verifySponsorAuth
|
|
23
16
|
} from "./chunk-4EGXLYMM.js";
|
|
17
|
+
import {
|
|
18
|
+
erc20Abi,
|
|
19
|
+
permit2Abi,
|
|
20
|
+
pointTokenFactoryAbi,
|
|
21
|
+
universalRouterAbi,
|
|
22
|
+
v3QuoterV2Abi
|
|
23
|
+
} from "./chunk-ZJXXCG5P.js";
|
|
24
24
|
import {
|
|
25
25
|
getBurnRequestNonce,
|
|
26
26
|
getIssuer,
|
|
@@ -30,14 +30,13 @@ import {
|
|
|
30
30
|
getMintRequestNonce,
|
|
31
31
|
getPointTokenBalance,
|
|
32
32
|
getPointTokenIssuer,
|
|
33
|
-
getReceiverConsentNonce,
|
|
34
33
|
getTokenCap,
|
|
35
34
|
getTokenName,
|
|
36
35
|
isActiveIssuer,
|
|
37
36
|
isMinter,
|
|
38
37
|
issuerRegistryGetIssuerFlatAbi,
|
|
39
38
|
verifyMintCap
|
|
40
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-H3X3FYUU.js";
|
|
41
40
|
import {
|
|
42
41
|
issuerRegistryAbi,
|
|
43
42
|
mintFeeWrapperAbi,
|
|
@@ -51,24 +50,23 @@ import {
|
|
|
51
50
|
Eip712DomainMismatchError,
|
|
52
51
|
PERMIT2_ADDRESS,
|
|
53
52
|
POINT_TOKEN_POOLS,
|
|
53
|
+
QUOTER_V2_ADDRESSES,
|
|
54
54
|
SUPPORTED_CHAINS,
|
|
55
55
|
UNIVERSAL_ROUTER_ADDRESSES,
|
|
56
|
-
|
|
56
|
+
V3_FACTORY_ADDRESSES,
|
|
57
|
+
V3_POOL_INIT_CODE_HASH,
|
|
58
|
+
V3_SWAP_ROUTER_ADDRESSES,
|
|
57
59
|
assertDomainMatchesContract,
|
|
58
60
|
buildBurnRequestTypedData,
|
|
59
61
|
buildDomain,
|
|
60
62
|
buildMintRequestTypedData,
|
|
61
|
-
buildReceiverConsentTypedData,
|
|
62
63
|
burnRequestTypes,
|
|
63
64
|
mintRequestTypes,
|
|
64
|
-
receiverConsentTypes,
|
|
65
65
|
signBurnRequest,
|
|
66
66
|
signMintRequest,
|
|
67
|
-
signReceiverConsent,
|
|
68
67
|
verifyBurnRequest,
|
|
69
|
-
verifyMintRequest
|
|
70
|
-
|
|
71
|
-
} from "./chunk-HJYHGCMT.js";
|
|
68
|
+
verifyMintRequest
|
|
69
|
+
} from "./chunk-UEO4YN6T.js";
|
|
72
70
|
import {
|
|
73
71
|
pointTokenAbi
|
|
74
72
|
} from "./chunk-UCO5DXD6.js";
|
|
@@ -124,41 +122,43 @@ var PafiSdkError = class extends Error {
|
|
|
124
122
|
this.name = new.target.name;
|
|
125
123
|
}
|
|
126
124
|
};
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var ConfigurationError = class extends PafiSDKError {
|
|
125
|
+
var ConfigurationError = class extends PafiSdkError {
|
|
126
|
+
httpStatus = "service_unavailable";
|
|
127
|
+
code = "CONFIGURATION_ERROR";
|
|
128
|
+
type = "server_error";
|
|
134
129
|
constructor(message) {
|
|
135
130
|
super(message);
|
|
136
|
-
this.name = "ConfigurationError";
|
|
137
131
|
}
|
|
138
132
|
};
|
|
139
|
-
var SigningError = class extends
|
|
133
|
+
var SigningError = class extends PafiSdkError {
|
|
134
|
+
httpStatus = "service_unavailable";
|
|
135
|
+
code = "SIGNING_FAILED";
|
|
136
|
+
type = "server_error";
|
|
140
137
|
constructor(message) {
|
|
141
138
|
super(message);
|
|
142
|
-
this.name = "SigningError";
|
|
143
139
|
}
|
|
144
140
|
};
|
|
145
|
-
var SimulationError = class extends
|
|
141
|
+
var SimulationError = class extends PafiSdkError {
|
|
142
|
+
httpStatus = "unprocessable";
|
|
143
|
+
code = "SIMULATION_FAILED";
|
|
144
|
+
type = "business_logic_error";
|
|
145
|
+
operation;
|
|
146
|
+
reason;
|
|
146
147
|
constructor(operation, reason) {
|
|
147
148
|
super(`Simulation failed for ${operation}: ${reason}`);
|
|
148
149
|
this.operation = operation;
|
|
149
150
|
this.reason = reason;
|
|
150
|
-
this.name = "SimulationError";
|
|
151
151
|
}
|
|
152
|
-
operation;
|
|
153
|
-
reason;
|
|
154
152
|
};
|
|
155
|
-
var ApiError = class extends
|
|
156
|
-
|
|
153
|
+
var ApiError = class extends PafiSdkError {
|
|
154
|
+
httpStatus = "service_unavailable";
|
|
155
|
+
code = "API_ERROR";
|
|
156
|
+
type = "service_unavailable_error";
|
|
157
|
+
upstreamStatus;
|
|
158
|
+
constructor(message, upstreamStatus) {
|
|
157
159
|
super(message);
|
|
158
|
-
this.
|
|
159
|
-
this.name = "ApiError";
|
|
160
|
+
this.upstreamStatus = upstreamStatus;
|
|
160
161
|
}
|
|
161
|
-
status;
|
|
162
162
|
};
|
|
163
163
|
var OracleStaleError = class extends PafiSdkError {
|
|
164
164
|
httpStatus = "service_unavailable";
|
|
@@ -630,48 +630,6 @@ function getDummySignatureFor7702(impl) {
|
|
|
630
630
|
return DUMMY_SIGNATURE_V07;
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
-
// src/paymaster/config.ts
|
|
634
|
-
var _config = null;
|
|
635
|
-
var _deprecationWarned = false;
|
|
636
|
-
function warnDeprecated(fn) {
|
|
637
|
-
if (_deprecationWarned) return;
|
|
638
|
-
_deprecationWarned = true;
|
|
639
|
-
console.warn(
|
|
640
|
-
`[PAFI] DEPRECATION (v0.7.1+): \`${fn}\` from @pafi-dev/core/paymaster is deprecated and will be removed in v0.8. Use \`PafiBackendClient\` from @pafi-dev/issuer/pafi-backend instead.`
|
|
641
|
-
);
|
|
642
|
-
}
|
|
643
|
-
function setPaymasterConfig(config) {
|
|
644
|
-
warnDeprecated("setPaymasterConfig");
|
|
645
|
-
if (!config.pafiBackendUrl) {
|
|
646
|
-
throw new Error("setPaymasterConfig: pafiBackendUrl is required");
|
|
647
|
-
}
|
|
648
|
-
if (!config.issuerId) {
|
|
649
|
-
throw new Error("setPaymasterConfig: issuerId is required");
|
|
650
|
-
}
|
|
651
|
-
if (!config.apiKey) {
|
|
652
|
-
throw new Error("setPaymasterConfig: apiKey is required");
|
|
653
|
-
}
|
|
654
|
-
if (!config.feeRecipient) {
|
|
655
|
-
throw new Error("setPaymasterConfig: feeRecipient is required");
|
|
656
|
-
}
|
|
657
|
-
_config = { ...config };
|
|
658
|
-
}
|
|
659
|
-
function getPaymasterConfig() {
|
|
660
|
-
warnDeprecated("getPaymasterConfig");
|
|
661
|
-
if (!_config) {
|
|
662
|
-
throw new Error(
|
|
663
|
-
"PaymasterConfig not initialized \u2014 call setPaymasterConfig() at application boot before invoking any batch builder"
|
|
664
|
-
);
|
|
665
|
-
}
|
|
666
|
-
return _config;
|
|
667
|
-
}
|
|
668
|
-
function _resetPaymasterConfigForTests() {
|
|
669
|
-
_config = null;
|
|
670
|
-
}
|
|
671
|
-
function isPaymasterConfigured() {
|
|
672
|
-
return _config !== null;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
633
|
// src/utils/checkEthAndBranch.ts
|
|
676
634
|
var DEFAULT_MARGIN_BPS = 11e3;
|
|
677
635
|
async function checkEthAndBranch(params) {
|
|
@@ -683,6 +641,70 @@ async function checkEthAndBranch(params) {
|
|
|
683
641
|
return balance >= required ? "normal" : "paymaster";
|
|
684
642
|
}
|
|
685
643
|
|
|
644
|
+
// src/utils/v3Path.ts
|
|
645
|
+
import { concatHex, getAddress as getAddress2, getContractAddress, keccak256 as keccak2562, pad as pad2, toHex as toHex2 } from "viem";
|
|
646
|
+
function encodeV3Path(path) {
|
|
647
|
+
const { tokens, fees } = path;
|
|
648
|
+
if (tokens.length < 2) {
|
|
649
|
+
throw new Error(
|
|
650
|
+
`encodeV3Path: tokens must contain at least 2 addresses, got ${tokens.length}`
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
if (tokens.length !== fees.length + 1) {
|
|
654
|
+
throw new Error(
|
|
655
|
+
`encodeV3Path: tokens.length must equal fees.length + 1, got tokens=${tokens.length} fees=${fees.length}`
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
const parts = [];
|
|
659
|
+
for (let i = 0; i < fees.length; i++) {
|
|
660
|
+
parts.push(tokens[i].toLowerCase());
|
|
661
|
+
const fee = fees[i];
|
|
662
|
+
if (!Number.isInteger(fee) || fee < 0 || fee > 16777215) {
|
|
663
|
+
throw new Error(
|
|
664
|
+
`encodeV3Path: fees[${i}] must be a uint24 (0..16777215), got ${fee}`
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
parts.push(pad2(toHex2(fee), { size: 3 }));
|
|
668
|
+
}
|
|
669
|
+
parts.push(tokens[tokens.length - 1].toLowerCase());
|
|
670
|
+
return concatHex(parts);
|
|
671
|
+
}
|
|
672
|
+
function encodeV3PathReversed(path) {
|
|
673
|
+
return encodeV3Path({
|
|
674
|
+
tokens: [...path.tokens].reverse(),
|
|
675
|
+
fees: [...path.fees].reverse()
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function computeV3PoolAddress(params) {
|
|
679
|
+
const { factory, tokenA, tokenB, fee, initCodeHash } = params;
|
|
680
|
+
if (!Number.isInteger(fee) || fee < 0 || fee > 16777215) {
|
|
681
|
+
throw new Error(
|
|
682
|
+
`computeV3PoolAddress: fee must be a uint24, got ${fee}`
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
const a = getAddress2(tokenA).toLowerCase();
|
|
686
|
+
const b = getAddress2(tokenB).toLowerCase();
|
|
687
|
+
if (a === b) {
|
|
688
|
+
throw new Error(
|
|
689
|
+
`computeV3PoolAddress: tokenA and tokenB must differ, got ${a}`
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
const [token0, token1] = a < b ? [tokenA, tokenB] : [tokenB, tokenA];
|
|
693
|
+
const salt = keccak2562(
|
|
694
|
+
concatHex([
|
|
695
|
+
pad2(getAddress2(token0), { size: 32 }),
|
|
696
|
+
pad2(getAddress2(token1), { size: 32 }),
|
|
697
|
+
pad2(toHex2(fee), { size: 32 })
|
|
698
|
+
])
|
|
699
|
+
);
|
|
700
|
+
return getContractAddress({
|
|
701
|
+
opcode: "CREATE2",
|
|
702
|
+
from: factory,
|
|
703
|
+
bytecodeHash: initCodeHash,
|
|
704
|
+
salt
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
|
|
686
708
|
// src/delegation/checkDelegation.ts
|
|
687
709
|
var EIP7702_MAGIC = "0xef0100";
|
|
688
710
|
function parseEip7702DelegatedAddress(code) {
|
|
@@ -748,14 +770,14 @@ async function getAaNonce(client, userAddress) {
|
|
|
748
770
|
}
|
|
749
771
|
|
|
750
772
|
// src/delegation/computeAuthorizationHash.ts
|
|
751
|
-
import { concat as concat2, keccak256 as
|
|
773
|
+
import { concat as concat2, keccak256 as keccak2563, toRlp } from "viem";
|
|
752
774
|
function computeAuthorizationHash(chainId, address, nonce) {
|
|
753
775
|
const rlpEncoded = toRlp([
|
|
754
776
|
toMinimalHex(BigInt(chainId)),
|
|
755
777
|
address,
|
|
756
778
|
toMinimalHex(nonce)
|
|
757
779
|
]);
|
|
758
|
-
return
|
|
780
|
+
return keccak2563(concat2(["0x05", rlpEncoded]));
|
|
759
781
|
}
|
|
760
782
|
function isDelegatedToTarget(code, target) {
|
|
761
783
|
if (!code || code === "0x") return false;
|
|
@@ -802,31 +824,13 @@ function buildEip7702Authorization(params) {
|
|
|
802
824
|
// src/contracts/real/addresses.ts
|
|
803
825
|
var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
|
|
804
826
|
var CONTRACT_ADDRESSES = {
|
|
805
|
-
// Base mainnet —
|
|
806
|
-
// registry: IssuerRegistry 0xAB1d1e117c41636f30bb10194Fe6B774B6Da9E01
|
|
807
|
-
// factory: PointTokenFactory 0xA08274458b43E7D6F4ff61ddFe8A9852c6531085
|
|
808
|
-
// oracle: MintingOracle 0x2f4cf8C5F8b41efC970c5b46a5d905CeA1f871a0
|
|
809
|
-
// tokenImpl: PointToken (impl) 0xc41c3F8A0380c7760Ee1209d6d19C4b81dE994e4
|
|
810
|
-
// mintFeeWrapper: MintFeeWrapper 0xD324EE2e3220B23d1b1BfbB85f5bC1EF2E917B93
|
|
811
|
-
// mockUsdt: MockERC20 0x3F7e71B150e97316Bb9f363A32c19CcD36ac2382
|
|
812
|
-
// batchExecutor: Pimlico Simple7702 0xe6Cae83BdE06E4c305530e199D7217f42808555B (unchanged from v1.5)
|
|
813
|
-
//
|
|
814
|
-
// pointToken: PER-ISSUER, not chain-level. Each issuer deploys their
|
|
815
|
-
// own clone via PointTokenFactory.createToken() and tracks the address
|
|
816
|
-
// separately (env var, DB, or factory readout). This field is a
|
|
817
|
-
// historical leftover from v1.4 single-issuer days and has no SDK
|
|
818
|
-
// consumer — kept as dead-zero so any code that mistakenly reads it
|
|
819
|
-
// fails loudly instead of silently routing to a stale token.
|
|
820
|
-
// Known clones (informational, NOT to be used as a default):
|
|
821
|
-
// gg56 (Test Point / TPT) — 0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22
|
|
827
|
+
// Base mainnet — live deployment
|
|
822
828
|
8453: {
|
|
823
|
-
pointToken: PLACEHOLDER_DEAD("dead"),
|
|
824
829
|
batchExecutor: "0xe6Cae83BdE06E4c305530e199D7217f42808555B",
|
|
825
830
|
usdt: "0x3F7e71B150e97316Bb9f363A32c19CcD36ac2382",
|
|
826
831
|
issuerRegistry: "0xAB1d1e117c41636f30bb10194Fe6B774B6Da9E01",
|
|
827
832
|
mintingOracle: "0x2f4cf8C5F8b41efC970c5b46a5d905CeA1f871a0",
|
|
828
833
|
mintFeeWrapper: "0xD324EE2e3220B23d1b1BfbB85f5bC1EF2E917B93",
|
|
829
|
-
pafiHook: PLACEHOLDER_DEAD("dead"),
|
|
830
834
|
chainlinkEthUsd: "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70",
|
|
831
835
|
orderlyRelay: "0xDA082DAce1522c185aeB5A713FcA6fa6B6E99e7f",
|
|
832
836
|
pafiFeeRecipient: "0xa3F71eadEd101513a0151007590020dCFD7C495e",
|
|
@@ -835,13 +839,11 @@ var CONTRACT_ADDRESSES = {
|
|
|
835
839
|
// Base Sepolia — not in active use; placeholders kept so the map
|
|
836
840
|
// compiles for tooling that enumerates chains.
|
|
837
841
|
84532: {
|
|
838
|
-
pointToken: PLACEHOLDER_DEAD("dead"),
|
|
839
842
|
batchExecutor: PLACEHOLDER_DEAD("de01"),
|
|
840
843
|
usdt: PLACEHOLDER_DEAD("dead"),
|
|
841
844
|
issuerRegistry: PLACEHOLDER_DEAD("dead"),
|
|
842
845
|
mintingOracle: PLACEHOLDER_DEAD("dead"),
|
|
843
846
|
mintFeeWrapper: PLACEHOLDER_DEAD("dead"),
|
|
844
|
-
pafiHook: PLACEHOLDER_DEAD("dead"),
|
|
845
847
|
chainlinkEthUsd: PLACEHOLDER_DEAD("de02"),
|
|
846
848
|
orderlyRelay: PLACEHOLDER_DEAD("de03"),
|
|
847
849
|
pafiFeeRecipient: PLACEHOLDER_DEAD("de04"),
|
|
@@ -1009,7 +1011,7 @@ import { parseAbi as parseAbi3 } from "viem";
|
|
|
1009
1011
|
|
|
1010
1012
|
// src/subgraph/pools.ts
|
|
1011
1013
|
import { isAddress } from "viem";
|
|
1012
|
-
var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-
|
|
1014
|
+
var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v4";
|
|
1013
1015
|
var POOL_QUERY = `
|
|
1014
1016
|
query GetPoolForPointToken($id: ID!) {
|
|
1015
1017
|
pafiToken(id: $id) {
|
|
@@ -1017,15 +1019,13 @@ var POOL_QUERY = `
|
|
|
1017
1019
|
pool {
|
|
1018
1020
|
id
|
|
1019
1021
|
feeTier
|
|
1020
|
-
tickSpacing
|
|
1021
|
-
hooks
|
|
1022
1022
|
token0 { id }
|
|
1023
1023
|
token1 { id }
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
`;
|
|
1028
|
-
function
|
|
1028
|
+
function sortTokens(a, b) {
|
|
1029
1029
|
return a.toLowerCase() < b.toLowerCase() ? [a, b] : [b, a];
|
|
1030
1030
|
}
|
|
1031
1031
|
async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SUBGRAPH_URL) {
|
|
@@ -1047,7 +1047,16 @@ async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SU
|
|
|
1047
1047
|
console.warn(`[fetchPafiPools] subgraph returned ${response.status}`);
|
|
1048
1048
|
return [];
|
|
1049
1049
|
}
|
|
1050
|
-
|
|
1050
|
+
let json;
|
|
1051
|
+
try {
|
|
1052
|
+
json = await response.json();
|
|
1053
|
+
} catch (err) {
|
|
1054
|
+
console.warn(
|
|
1055
|
+
"[fetchPafiPools] subgraph returned non-JSON:",
|
|
1056
|
+
err.message
|
|
1057
|
+
);
|
|
1058
|
+
return [];
|
|
1059
|
+
}
|
|
1051
1060
|
if (json.errors && json.errors.length > 0) {
|
|
1052
1061
|
console.warn(
|
|
1053
1062
|
"[fetchPafiPools] subgraph errors:",
|
|
@@ -1057,20 +1066,18 @@ async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SU
|
|
|
1057
1066
|
}
|
|
1058
1067
|
const pool = json.data?.pafiToken?.pool;
|
|
1059
1068
|
if (!pool) return [];
|
|
1060
|
-
if (!isAddress(pool.
|
|
1069
|
+
if (!isAddress(pool.token0.id) || !isAddress(pool.token1.id) || !Number.isFinite(Number(pool.feeTier))) {
|
|
1061
1070
|
console.error("[fetchPafiPools] invalid pool data in subgraph response \u2014 skipping");
|
|
1062
1071
|
return [];
|
|
1063
1072
|
}
|
|
1064
|
-
const [
|
|
1073
|
+
const [token0, token1] = sortTokens(
|
|
1065
1074
|
pool.token0.id,
|
|
1066
1075
|
pool.token1.id
|
|
1067
1076
|
);
|
|
1068
1077
|
return [{
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
fee: Number(pool.feeTier)
|
|
1072
|
-
tickSpacing: Number(pool.tickSpacing),
|
|
1073
|
-
hooks: pool.hooks
|
|
1078
|
+
token0,
|
|
1079
|
+
token1,
|
|
1080
|
+
fee: Number(pool.feeTier)
|
|
1074
1081
|
}];
|
|
1075
1082
|
}
|
|
1076
1083
|
|
|
@@ -1421,7 +1428,6 @@ var PafiSDK = class {
|
|
|
1421
1428
|
// lives in the flat methods below so both access styles work.
|
|
1422
1429
|
// -------------------------------------------------------------------------
|
|
1423
1430
|
mint;
|
|
1424
|
-
consent;
|
|
1425
1431
|
auth;
|
|
1426
1432
|
constructor(config) {
|
|
1427
1433
|
this._pointTokenAddress = config.pointTokenAddress;
|
|
@@ -1440,12 +1446,6 @@ var PafiSDK = class {
|
|
|
1440
1446
|
verify: this.verifyMintRequest.bind(this),
|
|
1441
1447
|
getNonce: this.getMintRequestNonce.bind(this)
|
|
1442
1448
|
};
|
|
1443
|
-
this.consent = {
|
|
1444
|
-
buildTypedData: this.buildReceiverConsentTypedData.bind(this),
|
|
1445
|
-
sign: this.signReceiverConsent.bind(this),
|
|
1446
|
-
verify: this.verifyReceiverConsent.bind(this),
|
|
1447
|
-
getNonce: this.getReceiverConsentNonce.bind(this)
|
|
1448
|
-
};
|
|
1449
1449
|
this.auth = {
|
|
1450
1450
|
createLoginMessage: this.createLoginMessage.bind(this),
|
|
1451
1451
|
signMessage: this.signLoginMessage.bind(this)
|
|
@@ -1507,25 +1507,19 @@ var PafiSDK = class {
|
|
|
1507
1507
|
const domain = await this.getDomain();
|
|
1508
1508
|
return buildMintRequestTypedData(domain, message);
|
|
1509
1509
|
}
|
|
1510
|
-
async buildReceiverConsentTypedData(message) {
|
|
1511
|
-
const domain = await this.getDomain();
|
|
1512
|
-
return buildReceiverConsentTypedData(domain, message);
|
|
1513
|
-
}
|
|
1514
1510
|
async signMintRequest(message) {
|
|
1515
1511
|
const domain = await this.getDomain();
|
|
1516
1512
|
return signMintRequest(this.requireSigner(), domain, message);
|
|
1517
1513
|
}
|
|
1518
|
-
async verifyMintRequest(message, signature, expectedMinter) {
|
|
1514
|
+
async verifyMintRequest(message, signature, expectedMinter, options) {
|
|
1519
1515
|
const domain = await this.getDomain();
|
|
1520
|
-
return verifyMintRequest(
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
const domain = await this.getDomain();
|
|
1528
|
-
return verifyReceiverConsent(domain, message, signature, expectedReceiver);
|
|
1516
|
+
return verifyMintRequest(
|
|
1517
|
+
domain,
|
|
1518
|
+
message,
|
|
1519
|
+
signature,
|
|
1520
|
+
expectedMinter,
|
|
1521
|
+
options
|
|
1522
|
+
);
|
|
1529
1523
|
}
|
|
1530
1524
|
// -------------------------------------------------------------------------
|
|
1531
1525
|
// Contract reads
|
|
@@ -1537,13 +1531,6 @@ var PafiSDK = class {
|
|
|
1537
1531
|
receiver
|
|
1538
1532
|
);
|
|
1539
1533
|
}
|
|
1540
|
-
async getReceiverConsentNonce(receiver) {
|
|
1541
|
-
return getReceiverConsentNonce(
|
|
1542
|
-
this.requireProvider(),
|
|
1543
|
-
this.requirePointToken(),
|
|
1544
|
-
receiver
|
|
1545
|
-
);
|
|
1546
|
-
}
|
|
1547
1534
|
// -------------------------------------------------------------------------
|
|
1548
1535
|
// Auth — EIP-4361 login helpers (offline, stateless)
|
|
1549
1536
|
// -------------------------------------------------------------------------
|
|
@@ -1594,8 +1581,8 @@ export {
|
|
|
1594
1581
|
POINT_TOKEN_POOLS,
|
|
1595
1582
|
pointTokenAbi as POINT_TOKEN_V2_ABI,
|
|
1596
1583
|
PafiSDK,
|
|
1597
|
-
PafiSDKError,
|
|
1598
1584
|
PafiSdkError,
|
|
1585
|
+
QUOTER_V2_ADDRESSES,
|
|
1599
1586
|
SDK_ERROR_HTTP_STATUS_CODE,
|
|
1600
1587
|
SIMPLE_7702_IMPL_BASE_MAINNET,
|
|
1601
1588
|
SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET,
|
|
@@ -1606,10 +1593,11 @@ export {
|
|
|
1606
1593
|
SimulationError,
|
|
1607
1594
|
TOKEN_HASHES,
|
|
1608
1595
|
UNIVERSAL_ROUTER_ADDRESSES,
|
|
1609
|
-
|
|
1596
|
+
V3_FACTORY_ADDRESSES,
|
|
1597
|
+
V3_POOL_INIT_CODE_HASH,
|
|
1598
|
+
V3_SWAP_ROUTER_ADDRESSES,
|
|
1610
1599
|
ValidationError,
|
|
1611
1600
|
ZERO_VALUE,
|
|
1612
|
-
_resetPaymasterConfigForTests,
|
|
1613
1601
|
assembleUserOperation,
|
|
1614
1602
|
assertDomainMatchesContract,
|
|
1615
1603
|
buildAndSignSponsorAuth,
|
|
@@ -1621,7 +1609,6 @@ export {
|
|
|
1621
1609
|
buildPartialUserOperation,
|
|
1622
1610
|
buildPerpDepositViaRelay,
|
|
1623
1611
|
buildPerpDepositWithGasDeduction,
|
|
1624
|
-
buildReceiverConsentTypedData,
|
|
1625
1612
|
buildSponsorAuthDomain,
|
|
1626
1613
|
buildSponsorAuthTypedData,
|
|
1627
1614
|
buildUserOpTypedData,
|
|
@@ -1632,6 +1619,7 @@ export {
|
|
|
1632
1619
|
computeAuthorizationHash,
|
|
1633
1620
|
computeCallDataHash,
|
|
1634
1621
|
computeUserOpHash,
|
|
1622
|
+
computeV3PoolAddress,
|
|
1635
1623
|
createLoginMessage,
|
|
1636
1624
|
createPafiProxyTransport,
|
|
1637
1625
|
decodeBatchExecuteCalls,
|
|
@@ -1639,6 +1627,8 @@ export {
|
|
|
1639
1627
|
delegateDirect,
|
|
1640
1628
|
detectDelegateImpl,
|
|
1641
1629
|
encodeBatchExecute,
|
|
1630
|
+
encodeV3Path,
|
|
1631
|
+
encodeV3PathReversed,
|
|
1642
1632
|
erc20Abi,
|
|
1643
1633
|
erc20ApproveOp,
|
|
1644
1634
|
erc20BurnOp,
|
|
@@ -1655,11 +1645,9 @@ export {
|
|
|
1655
1645
|
getMintRequestNonce,
|
|
1656
1646
|
getPafiServiceUrls,
|
|
1657
1647
|
getPafiWebModalAdapter,
|
|
1658
|
-
getPaymasterConfig,
|
|
1659
1648
|
getPointTokenBalance,
|
|
1660
1649
|
getPointTokenIssuer,
|
|
1661
1650
|
getIssuer as getPointTokenIssuerAddress,
|
|
1662
|
-
getReceiverConsentNonce,
|
|
1663
1651
|
getSponsorAuthDomainAnchor,
|
|
1664
1652
|
getTokenCap,
|
|
1665
1653
|
getTokenName,
|
|
@@ -1667,7 +1655,6 @@ export {
|
|
|
1667
1655
|
isDelegatedTo,
|
|
1668
1656
|
isDelegatedToTarget,
|
|
1669
1657
|
isMinter,
|
|
1670
|
-
isPaymasterConfigured,
|
|
1671
1658
|
isPaymasterError,
|
|
1672
1659
|
issuerRegistryAbi,
|
|
1673
1660
|
issuerRegistryGetIssuerFlatAbi,
|
|
@@ -1684,23 +1671,19 @@ export {
|
|
|
1684
1671
|
quoteOperatorFeePt,
|
|
1685
1672
|
quoteOperatorFeeUsdt,
|
|
1686
1673
|
rawCallOp,
|
|
1687
|
-
receiverConsentTypes,
|
|
1688
1674
|
sendWithPaymasterFallback,
|
|
1689
1675
|
serializeUserOpToJsonRpc,
|
|
1690
1676
|
setPafiWebModalAdapter,
|
|
1691
|
-
setPaymasterConfig,
|
|
1692
1677
|
signBurnRequest,
|
|
1693
1678
|
signMintRequest,
|
|
1694
|
-
signReceiverConsent,
|
|
1695
1679
|
signSponsorAuth,
|
|
1696
1680
|
splitAuthorizationSig,
|
|
1697
1681
|
universalRouterAbi,
|
|
1698
|
-
|
|
1682
|
+
v3QuoterV2Abi,
|
|
1699
1683
|
verifyBurnRequest,
|
|
1700
1684
|
verifyLoginMessage,
|
|
1701
1685
|
verifyMintCap,
|
|
1702
1686
|
verifyMintRequest,
|
|
1703
|
-
verifyReceiverConsent,
|
|
1704
1687
|
verifySponsorAuth,
|
|
1705
1688
|
webPopupAdapter
|
|
1706
1689
|
};
|