@pafi-dev/core 0.7.4 → 0.7.6
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 +84 -0
- package/dist/index.cjs +161 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +153 -2
- package/dist/index.d.ts +153 -2
- package/dist/index.js +150 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,10 @@ in sibling packages:
|
|
|
49
49
|
> **0.6.1 (2026-04-27):** added `quoteOperatorFeeUsdt` so FE can
|
|
50
50
|
> compute USDT-denominated gas fee without round-tripping the issuer
|
|
51
51
|
> backend (`/gas-fee` is now optional).
|
|
52
|
+
>
|
|
53
|
+
> **0.7.5 (2026-04-28):** added `delegateDirect()` — FE one-shot EIP-7702
|
|
54
|
+
> delegation that user pays gas for. Bypasses the AA + sponsor-relayer
|
|
55
|
+
> stack entirely. See [section below](#delegatedirect--fe-one-shot-delegation-no-aa--no-sponsor).
|
|
52
56
|
|
|
53
57
|
---
|
|
54
58
|
|
|
@@ -65,6 +69,7 @@ in sibling packages:
|
|
|
65
69
|
| `encodeBatchExecute`, `decodeBatchExecuteCalls` | BatchExecutor (Coinbase SW v2) calldata |
|
|
66
70
|
| `buildDelegationUserOp`, `computeAuthorizationHash`, `parseEip7702DelegatedAddress` | EIP-7702 helpers |
|
|
67
71
|
| `splitAuthorizationSig`, `buildEip7702Authorization` | Split user's authSig + assemble bundler tuple |
|
|
72
|
+
| `delegateDirect` | One-shot FE-direct EIP-7702 delegation (user pays gas, no AA) |
|
|
68
73
|
| `buildPerpDepositViaRelay`, `buildPerpDepositWithGasDeduction`, `ORDERLY_RELAY_ABI`, `ORDERLY_VAULT_ABI`, `BROKER_HASHES`, `TOKEN_HASHES`, `computeAccountId` | Orderly perp deposit calldata + types |
|
|
69
74
|
| `quoteOperatorFeePt`, `quoteOperatorFeeUsdt` | Off-issuer fee quoter (Chainlink + V4 subgraph) |
|
|
70
75
|
| `fetchPafiPools`, `PAFI_SUBGRAPH_URL` | Pool discovery via PAFI subgraph |
|
|
@@ -186,6 +191,85 @@ const authorization = buildEip7702Authorization({
|
|
|
186
191
|
|
|
187
192
|
---
|
|
188
193
|
|
|
194
|
+
## `delegateDirect` — FE one-shot delegation, no AA / no sponsor
|
|
195
|
+
|
|
196
|
+
For the **FE-direct** path where the user pays gas in ETH and you don't
|
|
197
|
+
want a dependency on `permissionless` / Pimlico bundlers / PAFI
|
|
198
|
+
sponsor-relayer:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { useSign7702Authorization, useWallets } from "@privy-io/react-auth";
|
|
202
|
+
import { delegateDirect } from "@pafi-dev/core";
|
|
203
|
+
import { createWalletClient, custom, createPublicClient, http } from "viem";
|
|
204
|
+
import { base } from "viem/chains";
|
|
205
|
+
|
|
206
|
+
const publicClient = createPublicClient({ chain: base, transport: http() });
|
|
207
|
+
|
|
208
|
+
function DelegateButton() {
|
|
209
|
+
const { wallets } = useWallets();
|
|
210
|
+
const { signAuthorization } = useSign7702Authorization();
|
|
211
|
+
|
|
212
|
+
// Privy ALWAYS signs EIP-7702 with the embedded wallet — pick that
|
|
213
|
+
// one as the smart-account owner regardless of how user logged in.
|
|
214
|
+
const wallet = wallets.find((w) => w.walletClientType === "privy");
|
|
215
|
+
|
|
216
|
+
async function handleClick() {
|
|
217
|
+
if (!wallet) return;
|
|
218
|
+
const provider = await wallet.getEthereumProvider();
|
|
219
|
+
const walletClient = createWalletClient({
|
|
220
|
+
account: wallet.address as `0x${string}`,
|
|
221
|
+
chain: base,
|
|
222
|
+
transport: custom(provider),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const result = await delegateDirect({
|
|
226
|
+
userAddress: wallet.address as `0x${string}`,
|
|
227
|
+
chainId: 8453,
|
|
228
|
+
publicClient,
|
|
229
|
+
walletClient,
|
|
230
|
+
signAuthorization,
|
|
231
|
+
// optional: skipIfAlreadyDelegated (default true), waitForReceipt (default true)
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if (result.status === "already-delegated") {
|
|
235
|
+
console.log("Already delegated to", result.delegatedTo);
|
|
236
|
+
} else {
|
|
237
|
+
console.log("Delegated! tx:", result.txHash);
|
|
238
|
+
// result.receipt — full TransactionReceipt when waitForReceipt=true
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return <button onClick={handleClick}>Delegate</button>;
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**What happens internally:**
|
|
247
|
+
|
|
248
|
+
1. `getCode(userAddress)` → if already delegated to expected impl, return early.
|
|
249
|
+
2. `getTransactionCount(userAddress, 'pending')` → tx nonce.
|
|
250
|
+
3. `signAuthorization({ contractAddress, chainId, nonce })` — Privy hook signs with embedded wallet (raw `secp256k1_sign`, no EIP-191 prefix).
|
|
251
|
+
4. `walletClient.sendTransaction({ to: userAddress, data: '0x', authorizationList: [auth] })` — viem encodes a type-4 EIP-7702 transaction.
|
|
252
|
+
5. `waitForTransactionReceipt(txHash)` (optional).
|
|
253
|
+
|
|
254
|
+
**Requirements:**
|
|
255
|
+
|
|
256
|
+
- Privy embedded wallet (external wallets like MetaMask **cannot**
|
|
257
|
+
sign EIP-7702 — only Privy's embedded wallet exposes raw
|
|
258
|
+
`secp256k1_sign`).
|
|
259
|
+
- A few cents of ETH on Base for gas (~$0.01–0.10).
|
|
260
|
+
|
|
261
|
+
**vs. AA path:** `delegateDirect` produces 1 native L1 tx instead of an
|
|
262
|
+
ERC-4337 UserOp. Cheaper, simpler, no bundler / paymaster involvement —
|
|
263
|
+
but the user pays gas. Use the AA path (via `permissionless` +
|
|
264
|
+
sponsor-relayer) when you want gas-free UX.
|
|
265
|
+
|
|
266
|
+
**vs. mobile gg56 flow:** mobile delegate flow goes through gg56's
|
|
267
|
+
`/delegate/{prepare,submit}` + sponsor-relayer for the gas sponsorship.
|
|
268
|
+
`delegateDirect` is the FE-only counterpart that bypasses that
|
|
269
|
+
infrastructure entirely.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
189
273
|
## Operator fee quoter
|
|
190
274
|
|
|
191
275
|
Two helpers for FE direct-mode usage (no backend round-trip):
|
package/dist/index.cjs
CHANGED
|
@@ -739,6 +739,155 @@ function buildEip7702Authorization(params) {
|
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
741
|
|
|
742
|
+
// src/contracts/real/addresses.ts
|
|
743
|
+
var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
|
|
744
|
+
var CONTRACT_ADDRESSES = {
|
|
745
|
+
// Base mainnet — SC-delivered (2026-04-21, 2026-04-22)
|
|
746
|
+
// registry: IssuerRegistry 0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31
|
|
747
|
+
// factory: PointTokenFactory 0x36c0BAb2faBE45EfA6d13001143e43A266Af673B
|
|
748
|
+
// oracle: MintingOracle 0xD85165939C700E51c8a45099316C6482634C2Ab9
|
|
749
|
+
// tokenImpl: PointToken (impl) 0x2e6FB1B0C1A51abb83eC974890126a64eC02E995
|
|
750
|
+
// mockUsdt: MockERC20 0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd
|
|
751
|
+
// POINT: PointToken instance 0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e
|
|
752
|
+
// batchExecutor: Pimlico Simple7702 0xe6Cae83BdE06E4c305530e199D7217f42808555B
|
|
753
|
+
// (v0.7.6 — switched from Coinbase SW v2
|
|
754
|
+
// `0x7702cb...7176C`; CSW v2 uses SignatureWrapper
|
|
755
|
+
// format that Pimlico's `pm_sponsorUserOperation`
|
|
756
|
+
// cannot produce a working dummy sig for, leading
|
|
757
|
+
// to AA23 `0x3c10b94e` reverts on the simulator.
|
|
758
|
+
// Pimlico's `Simple7702Account` accepts standard
|
|
759
|
+
// v0.7 ECDSA dummy and matches what the web FE +
|
|
760
|
+
// permissionless `to7702SimpleSmartAccount` already
|
|
761
|
+
// used in production.)
|
|
762
|
+
// pafiHook: PAFIHook (V4, 10%) 0x870cAF9882d3160602AaC1769C2B264A2d8EC044
|
|
763
|
+
8453: {
|
|
764
|
+
pointToken: "0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e",
|
|
765
|
+
batchExecutor: "0xe6Cae83BdE06E4c305530e199D7217f42808555B",
|
|
766
|
+
usdt: "0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd",
|
|
767
|
+
issuerRegistry: "0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31",
|
|
768
|
+
mintingOracle: "0xD85165939C700E51c8a45099316C6482634C2Ab9",
|
|
769
|
+
pafiHook: "0x870cAF9882d3160602AaC1769C2B264A2d8EC044",
|
|
770
|
+
chainlinkEthUsd: "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70",
|
|
771
|
+
orderlyRelay: "0xDA082DAce1522c185aeB5A713FcA6fa6B6E99e7f",
|
|
772
|
+
pafiFeeRecipient: "0xa3F71eadEd101513a0151007590020dCFD7C495e",
|
|
773
|
+
universalRouter: "0x6fF5693b99212Da76ad316178A184AB56D299b43"
|
|
774
|
+
},
|
|
775
|
+
// Base Sepolia — not in active use; placeholders kept so the map
|
|
776
|
+
// compiles for tooling that enumerates chains.
|
|
777
|
+
84532: {
|
|
778
|
+
pointToken: PLACEHOLDER_DEAD("dead"),
|
|
779
|
+
batchExecutor: PLACEHOLDER_DEAD("de01"),
|
|
780
|
+
usdt: PLACEHOLDER_DEAD("dead"),
|
|
781
|
+
issuerRegistry: PLACEHOLDER_DEAD("dead"),
|
|
782
|
+
mintingOracle: PLACEHOLDER_DEAD("dead"),
|
|
783
|
+
pafiHook: PLACEHOLDER_DEAD("dead"),
|
|
784
|
+
chainlinkEthUsd: PLACEHOLDER_DEAD("de02"),
|
|
785
|
+
orderlyRelay: PLACEHOLDER_DEAD("de03"),
|
|
786
|
+
pafiFeeRecipient: PLACEHOLDER_DEAD("de04"),
|
|
787
|
+
universalRouter: PLACEHOLDER_DEAD("de05")
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
var POINT_TOKEN_FACTORY_ADDRESSES = {
|
|
791
|
+
8453: "0x36c0BAb2faBE45EfA6d13001143e43A266Af673B",
|
|
792
|
+
84532: PLACEHOLDER_DEAD("dead")
|
|
793
|
+
};
|
|
794
|
+
var POINT_TOKEN_IMPL_ADDRESSES = {
|
|
795
|
+
8453: "0x2e6FB1B0C1A51abb83eC974890126a64eC02E995",
|
|
796
|
+
84532: PLACEHOLDER_DEAD("dead")
|
|
797
|
+
};
|
|
798
|
+
function getContractAddresses(chainId) {
|
|
799
|
+
const addrs = CONTRACT_ADDRESSES[chainId];
|
|
800
|
+
if (!addrs) {
|
|
801
|
+
throw new Error(
|
|
802
|
+
`getContractAddresses: no addresses for chainId ${chainId}. Supported: ${Object.keys(CONTRACT_ADDRESSES).join(", ")}`
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
return addrs;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/delegation/delegateDirect.ts
|
|
809
|
+
async function delegateDirect(params) {
|
|
810
|
+
const target = _nullishCoalesce(params.contractAddress, () => ( getContractAddresses(params.chainId).batchExecutor));
|
|
811
|
+
if (params.skipIfAlreadyDelegated !== false) {
|
|
812
|
+
const code = await params.publicClient.getCode({
|
|
813
|
+
address: params.userAddress
|
|
814
|
+
});
|
|
815
|
+
const current = parseEip7702DelegatedAddress(code);
|
|
816
|
+
if (current && current.toLowerCase() === target.toLowerCase()) {
|
|
817
|
+
return {
|
|
818
|
+
status: "already-delegated",
|
|
819
|
+
delegatedTo: current,
|
|
820
|
+
authorization: {
|
|
821
|
+
contractAddress: target,
|
|
822
|
+
chainId: params.chainId,
|
|
823
|
+
nonce: 0,
|
|
824
|
+
r: "0x",
|
|
825
|
+
s: "0x",
|
|
826
|
+
yParity: 0
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
const nonce = await params.publicClient.getTransactionCount({
|
|
832
|
+
address: params.userAddress,
|
|
833
|
+
blockTag: "pending"
|
|
834
|
+
});
|
|
835
|
+
const raw = await params.signAuthorization({
|
|
836
|
+
contractAddress: target,
|
|
837
|
+
chainId: params.chainId,
|
|
838
|
+
nonce
|
|
839
|
+
});
|
|
840
|
+
const yParityRaw = raw.yParity;
|
|
841
|
+
const yParity = typeof yParityRaw === "number" ? yParityRaw : String(yParityRaw) === "1" || String(yParityRaw) === "0x1" ? 1 : 0;
|
|
842
|
+
const authorization = {
|
|
843
|
+
contractAddress: target,
|
|
844
|
+
chainId: params.chainId,
|
|
845
|
+
nonce,
|
|
846
|
+
r: normalizeHex32(raw.r),
|
|
847
|
+
s: normalizeHex32(raw.s),
|
|
848
|
+
yParity
|
|
849
|
+
};
|
|
850
|
+
const account = params.walletClient.account;
|
|
851
|
+
if (!account) {
|
|
852
|
+
throw new Error(
|
|
853
|
+
"delegateDirect: walletClient has no account attached \u2014 cannot send tx"
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
const txHash = await params.walletClient.sendTransaction({
|
|
857
|
+
account,
|
|
858
|
+
chain: params.walletClient.chain,
|
|
859
|
+
to: params.userAddress,
|
|
860
|
+
value: 0n,
|
|
861
|
+
data: "0x",
|
|
862
|
+
authorizationList: [authorization]
|
|
863
|
+
});
|
|
864
|
+
const waitForReceipt = params.waitForReceipt !== false;
|
|
865
|
+
let receipt;
|
|
866
|
+
if (waitForReceipt) {
|
|
867
|
+
try {
|
|
868
|
+
receipt = await params.publicClient.waitForTransactionReceipt({
|
|
869
|
+
hash: txHash
|
|
870
|
+
});
|
|
871
|
+
} catch (err) {
|
|
872
|
+
_optionalChain([params, 'access', _29 => _29.onWarning, 'optionalCall', _30 => _30(
|
|
873
|
+
`delegateDirect: tx ${txHash} sent but receipt fetch failed: ${err instanceof Error ? err.message : String(err)}`
|
|
874
|
+
)]);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return {
|
|
878
|
+
status: "sent",
|
|
879
|
+
txHash,
|
|
880
|
+
receipt,
|
|
881
|
+
authorization,
|
|
882
|
+
delegatedTo: target
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function normalizeHex32(value) {
|
|
886
|
+
if (!value) return "0x";
|
|
887
|
+
const stripped = value.replace(/^0x/i, "");
|
|
888
|
+
return "0x" + stripped.padStart(64, "0");
|
|
889
|
+
}
|
|
890
|
+
|
|
742
891
|
// src/transport/proxyTransport.ts
|
|
743
892
|
|
|
744
893
|
function createPafiProxyTransport(params) {
|
|
@@ -748,7 +897,7 @@ function createPafiProxyTransport(params) {
|
|
|
748
897
|
// fetchFn intercepts every fetch call the viem http transport makes,
|
|
749
898
|
// injecting the auth headers before the request leaves the browser.
|
|
750
899
|
fetchFn: (input, init) => {
|
|
751
|
-
const headers = new Headers(_optionalChain([init, 'optionalAccess',
|
|
900
|
+
const headers = new Headers(_optionalChain([init, 'optionalAccess', _31 => _31.headers]));
|
|
752
901
|
const token = getIdentityToken();
|
|
753
902
|
if (token) {
|
|
754
903
|
headers.set("authorization", `Bearer ${token}`);
|
|
@@ -772,7 +921,7 @@ var PAYMASTER_PATTERNS = [
|
|
|
772
921
|
function isPaymasterError(err) {
|
|
773
922
|
if (err == null || typeof err !== "object") return false;
|
|
774
923
|
const e = err;
|
|
775
|
-
const status = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.status, () => ( e.statusCode)), () => ( _optionalChain([e, 'access',
|
|
924
|
+
const status = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.status, () => ( e.statusCode)), () => ( _optionalChain([e, 'access', _32 => _32.response, 'optionalAccess', _33 => _33.status]))), () => ( _optionalChain([e, 'access', _34 => _34.cause, 'optionalAccess', _35 => _35.status])));
|
|
776
925
|
if (typeof status === "number" && PAYMASTER_HTTP_STATUSES.has(status)) {
|
|
777
926
|
return true;
|
|
778
927
|
}
|
|
@@ -785,8 +934,8 @@ async function sendWithPaymasterFallback(params) {
|
|
|
785
934
|
return await primaryClient.sendTransaction(txParams);
|
|
786
935
|
} catch (err) {
|
|
787
936
|
if (isPaymasterError(err) && fallbackClient) {
|
|
788
|
-
const msg = _nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
789
|
-
_optionalChain([onFallback, 'optionalCall',
|
|
937
|
+
const msg = _nullishCoalesce(_optionalChain([err, 'optionalAccess', _36 => _36.message]), () => ( String(err)));
|
|
938
|
+
_optionalChain([onFallback, 'optionalCall', _37 => _37(msg)]);
|
|
790
939
|
return await fallbackClient.sendTransaction(_nullishCoalesce(txParamsFallback, () => ( txParams)));
|
|
791
940
|
}
|
|
792
941
|
throw err;
|
|
@@ -844,7 +993,7 @@ async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SU
|
|
|
844
993
|
);
|
|
845
994
|
return [];
|
|
846
995
|
}
|
|
847
|
-
const pool = _optionalChain([json, 'access',
|
|
996
|
+
const pool = _optionalChain([json, 'access', _38 => _38.data, 'optionalAccess', _39 => _39.pafiToken, 'optionalAccess', _40 => _40.pool]);
|
|
848
997
|
if (!pool) return [];
|
|
849
998
|
if (!_viem.isAddress.call(void 0, pool.hooks) || !_viem.isAddress.call(void 0, pool.token0.id) || !_viem.isAddress.call(void 0, pool.token1.id) || !Number.isFinite(Number(pool.feeTier)) || !Number.isFinite(Number(pool.tickSpacing))) {
|
|
850
999
|
console.error("[fetchPafiPools] invalid pool data in subgraph response \u2014 skipping");
|
|
@@ -863,72 +1012,6 @@ async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SU
|
|
|
863
1012
|
}];
|
|
864
1013
|
}
|
|
865
1014
|
|
|
866
|
-
// src/contracts/real/addresses.ts
|
|
867
|
-
var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
|
|
868
|
-
var CONTRACT_ADDRESSES = {
|
|
869
|
-
// Base mainnet — SC-delivered (2026-04-21, 2026-04-22)
|
|
870
|
-
// registry: IssuerRegistry 0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31
|
|
871
|
-
// factory: PointTokenFactory 0x36c0BAb2faBE45EfA6d13001143e43A266Af673B
|
|
872
|
-
// oracle: MintingOracle 0xD85165939C700E51c8a45099316C6482634C2Ab9
|
|
873
|
-
// tokenImpl: PointToken (impl) 0x2e6FB1B0C1A51abb83eC974890126a64eC02E995
|
|
874
|
-
// mockUsdt: MockERC20 0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd
|
|
875
|
-
// POINT: PointToken instance 0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e
|
|
876
|
-
// batchExecutor: Pimlico Simple7702 0xe6Cae83BdE06E4c305530e199D7217f42808555B
|
|
877
|
-
// (v0.7.6 — switched from Coinbase SW v2
|
|
878
|
-
// `0x7702cb...7176C`; CSW v2 uses SignatureWrapper
|
|
879
|
-
// format that Pimlico's `pm_sponsorUserOperation`
|
|
880
|
-
// cannot produce a working dummy sig for, leading
|
|
881
|
-
// to AA23 `0x3c10b94e` reverts on the simulator.
|
|
882
|
-
// Pimlico's `Simple7702Account` accepts standard
|
|
883
|
-
// v0.7 ECDSA dummy and matches what the web FE +
|
|
884
|
-
// permissionless `to7702SimpleSmartAccount` already
|
|
885
|
-
// used in production.)
|
|
886
|
-
// pafiHook: PAFIHook (V4, 10%) 0x870cAF9882d3160602AaC1769C2B264A2d8EC044
|
|
887
|
-
8453: {
|
|
888
|
-
pointToken: "0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e",
|
|
889
|
-
batchExecutor: "0xe6Cae83BdE06E4c305530e199D7217f42808555B",
|
|
890
|
-
usdt: "0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd",
|
|
891
|
-
issuerRegistry: "0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31",
|
|
892
|
-
mintingOracle: "0xD85165939C700E51c8a45099316C6482634C2Ab9",
|
|
893
|
-
pafiHook: "0x870cAF9882d3160602AaC1769C2B264A2d8EC044",
|
|
894
|
-
chainlinkEthUsd: "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70",
|
|
895
|
-
orderlyRelay: "0xDA082DAce1522c185aeB5A713FcA6fa6B6E99e7f",
|
|
896
|
-
pafiFeeRecipient: "0xa3F71eadEd101513a0151007590020dCFD7C495e",
|
|
897
|
-
universalRouter: "0x6fF5693b99212Da76ad316178A184AB56D299b43"
|
|
898
|
-
},
|
|
899
|
-
// Base Sepolia — not in active use; placeholders kept so the map
|
|
900
|
-
// compiles for tooling that enumerates chains.
|
|
901
|
-
84532: {
|
|
902
|
-
pointToken: PLACEHOLDER_DEAD("dead"),
|
|
903
|
-
batchExecutor: PLACEHOLDER_DEAD("de01"),
|
|
904
|
-
usdt: PLACEHOLDER_DEAD("dead"),
|
|
905
|
-
issuerRegistry: PLACEHOLDER_DEAD("dead"),
|
|
906
|
-
mintingOracle: PLACEHOLDER_DEAD("dead"),
|
|
907
|
-
pafiHook: PLACEHOLDER_DEAD("dead"),
|
|
908
|
-
chainlinkEthUsd: PLACEHOLDER_DEAD("de02"),
|
|
909
|
-
orderlyRelay: PLACEHOLDER_DEAD("de03"),
|
|
910
|
-
pafiFeeRecipient: PLACEHOLDER_DEAD("de04"),
|
|
911
|
-
universalRouter: PLACEHOLDER_DEAD("de05")
|
|
912
|
-
}
|
|
913
|
-
};
|
|
914
|
-
var POINT_TOKEN_FACTORY_ADDRESSES = {
|
|
915
|
-
8453: "0x36c0BAb2faBE45EfA6d13001143e43A266Af673B",
|
|
916
|
-
84532: PLACEHOLDER_DEAD("dead")
|
|
917
|
-
};
|
|
918
|
-
var POINT_TOKEN_IMPL_ADDRESSES = {
|
|
919
|
-
8453: "0x2e6FB1B0C1A51abb83eC974890126a64eC02E995",
|
|
920
|
-
84532: PLACEHOLDER_DEAD("dead")
|
|
921
|
-
};
|
|
922
|
-
function getContractAddresses(chainId) {
|
|
923
|
-
const addrs = CONTRACT_ADDRESSES[chainId];
|
|
924
|
-
if (!addrs) {
|
|
925
|
-
throw new Error(
|
|
926
|
-
`getContractAddresses: no addresses for chainId ${chainId}. Supported: ${Object.keys(CONTRACT_ADDRESSES).join(", ")}`
|
|
927
|
-
);
|
|
928
|
-
}
|
|
929
|
-
return addrs;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
1015
|
// src/fee/operatorFeeQuoter.ts
|
|
933
1016
|
var CHAINLINK_ABI = _viem.parseAbi.call(void 0, [
|
|
934
1017
|
"function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80)"
|
|
@@ -1052,10 +1135,10 @@ async function getPtPerUsdt18dec(fetchImpl, subgraphUrl, pointTokenAddress, fall
|
|
|
1052
1135
|
});
|
|
1053
1136
|
if (!response.ok) throw new Error(`subgraph HTTP ${response.status}`);
|
|
1054
1137
|
const json = await response.json();
|
|
1055
|
-
if (_optionalChain([json, 'access',
|
|
1138
|
+
if (_optionalChain([json, 'access', _41 => _41.errors, 'optionalAccess', _42 => _42.length])) {
|
|
1056
1139
|
throw new Error(json.errors.map((e) => e.message).join("; "));
|
|
1057
1140
|
}
|
|
1058
|
-
const pool = _optionalChain([json, 'access',
|
|
1141
|
+
const pool = _optionalChain([json, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.pafiToken, 'optionalAccess', _45 => _45.pool]);
|
|
1059
1142
|
if (!pool) throw new Error("pafiToken or pool not found");
|
|
1060
1143
|
const isPtToken0 = pool.token0.id.toLowerCase() === pointTokenAddress.toLowerCase();
|
|
1061
1144
|
const priceStr = isPtToken0 ? pool.token0Price : pool.token1Price;
|
|
@@ -1104,8 +1187,8 @@ function openWebPopup(url, options = {}) {
|
|
|
1104
1187
|
const width = _nullishCoalesce(options.width, () => ( DEFAULT_WIDTH));
|
|
1105
1188
|
const height = _nullishCoalesce(options.height, () => ( DEFAULT_HEIGHT));
|
|
1106
1189
|
const name = _nullishCoalesce(options.windowName, () => ( DEFAULT_NAME));
|
|
1107
|
-
const screenW = _nullishCoalesce(_optionalChain([window, 'access',
|
|
1108
|
-
const screenH = _nullishCoalesce(_optionalChain([window, 'access',
|
|
1190
|
+
const screenW = _nullishCoalesce(_optionalChain([window, 'access', _46 => _46.screen, 'optionalAccess', _47 => _47.availWidth]), () => ( window.innerWidth));
|
|
1191
|
+
const screenH = _nullishCoalesce(_optionalChain([window, 'access', _48 => _48.screen, 'optionalAccess', _49 => _49.availHeight]), () => ( window.innerHeight));
|
|
1109
1192
|
const left = Math.max(0, Math.floor((screenW - width) / 2));
|
|
1110
1193
|
const top = Math.max(0, Math.floor((screenH - height) / 2));
|
|
1111
1194
|
const features = [
|
|
@@ -1138,7 +1221,7 @@ function openWebPopup(url, options = {}) {
|
|
|
1138
1221
|
window.removeEventListener("message", messageListener);
|
|
1139
1222
|
messageListener = null;
|
|
1140
1223
|
}
|
|
1141
|
-
_optionalChain([options, 'access',
|
|
1224
|
+
_optionalChain([options, 'access', _50 => _50.onClose, 'optionalCall', _51 => _51()]);
|
|
1142
1225
|
};
|
|
1143
1226
|
pollId = setInterval(() => {
|
|
1144
1227
|
if (popup.closed) {
|
|
@@ -1493,5 +1576,6 @@ var PafiSDK = class {
|
|
|
1493
1576
|
|
|
1494
1577
|
|
|
1495
1578
|
|
|
1496
|
-
|
|
1579
|
+
|
|
1580
|
+
exports.ApiError = ApiError; exports.BATCH_EXECUTOR_7702_IMPL = BATCH_EXECUTOR_7702_IMPL; exports.BATCH_EXECUTOR_ABI = BATCH_EXECUTOR_ABI; exports.BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = BATCH_EXECUTOR_ADDRESS_BASE_MAINNET; exports.BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA; exports.BROKER_HASHES = BROKER_HASHES; exports.COMMON_POOLS = _chunkM5ULOZ3Acjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkM5ULOZ3Acjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = ConfigurationError; exports.DUMMY_SIGNATURE_V07 = DUMMY_SIGNATURE_V07; exports.ENTRY_POINT_V07 = _chunkM5ULOZ3Acjs.ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = _chunkM5ULOZ3Acjs.ENTRY_POINT_V08; exports.ORDERLY_RELAY_ABI = ORDERLY_RELAY_ABI; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.OracleStaleError = OracleStaleError; exports.PAFI_SUBGRAPH_URL = PAFI_SUBGRAPH_URL; exports.PERMIT2_ADDRESS = _chunkM5ULOZ3Acjs.PERMIT2_ADDRESS; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkM5ULOZ3Acjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = _chunkLRHY7GORcjs.pointTokenAbi; exports.PafiSDK = PafiSDK; exports.PafiSDKError = PafiSDKError; exports.PafiSdkError = PafiSdkError; exports.SIMPLE_7702_IMPL_BASE_MAINNET = SIMPLE_7702_IMPL_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunk5254AG3Zcjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunk5254AG3Zcjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunkM5ULOZ3Acjs.SUPPORTED_CHAINS; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkM5ULOZ3Acjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V4_QUOTER_ADDRESSES = _chunkM5ULOZ3Acjs.V4_QUOTER_ADDRESSES; exports.ValidationError = ValidationError; exports.ZERO_VALUE = ZERO_VALUE; exports._resetPaymasterConfigForTests = _resetPaymasterConfigForTests; exports.assembleUserOperation = assembleUserOperation; exports.buildAndSignSponsorAuth = _chunk5254AG3Zcjs.buildAndSignSponsorAuth; exports.buildBurnRequestTypedData = _chunkM5ULOZ3Acjs.buildBurnRequestTypedData; exports.buildDelegationUserOp = buildDelegationUserOp; exports.buildDomain = _chunkM5ULOZ3Acjs.buildDomain; exports.buildEip7702Authorization = buildEip7702Authorization; exports.buildMintRequestTypedData = _chunkM5ULOZ3Acjs.buildMintRequestTypedData; exports.buildPartialUserOperation = buildPartialUserOperation; exports.buildPerpDepositViaRelay = buildPerpDepositViaRelay; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildReceiverConsentTypedData = _chunkM5ULOZ3Acjs.buildReceiverConsentTypedData; exports.buildSponsorAuthDomain = _chunk5254AG3Zcjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunk5254AG3Zcjs.buildSponsorAuthTypedData; exports.buildUserOpTypedData = buildUserOpTypedData; exports.burnRequestTypes = _chunkM5ULOZ3Acjs.burnRequestTypes; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.computeAccountId = computeAccountId; exports.computeAuthorizationHash = computeAuthorizationHash; exports.computeCallDataHash = _chunk5254AG3Zcjs.computeCallDataHash; exports.computeUserOpHash = computeUserOpHash; exports.createLoginMessage = _chunk5254AG3Zcjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.decodeBatchExecuteCalls = decodeBatchExecuteCalls; exports.delegateDirect = delegateDirect; exports.detectDelegateImpl = detectDelegateImpl; exports.encodeBatchExecute = encodeBatchExecute; exports.erc20Abi = _chunkQ6WCDZXIcjs.erc20Abi; exports.erc20ApproveOp = erc20ApproveOp; exports.erc20BurnOp = erc20BurnOp; exports.erc20TransferOp = erc20TransferOp; exports.fetchPafiPools = fetchPafiPools; exports.generateSponsorAuthNonce = _chunk5254AG3Zcjs.generateSponsorAuthNonce; exports.getAaNonce = getAaNonce; exports.getBurnRequestNonce = _chunkCLPRSQT2cjs.getBurnRequestNonce; exports.getContractAddresses = getContractAddresses; exports.getDummySignatureFor7702 = getDummySignatureFor7702; exports.getIssuer = _chunkCLPRSQT2cjs.getIssuer2; exports.getMintRequestNonce = _chunkCLPRSQT2cjs.getMintRequestNonce; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPaymasterConfig = getPaymasterConfig; exports.getPointTokenBalance = _chunkCLPRSQT2cjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkCLPRSQT2cjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkCLPRSQT2cjs.getIssuer; exports.getReceiverConsentNonce = _chunkCLPRSQT2cjs.getReceiverConsentNonce; exports.getTokenName = _chunkCLPRSQT2cjs.getTokenName; exports.isActiveIssuer = _chunkCLPRSQT2cjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isDelegatedToTarget = isDelegatedToTarget; exports.isMinter = _chunkCLPRSQT2cjs.isMinter; exports.isPaymasterConfigured = isPaymasterConfigured; exports.isPaymasterError = isPaymasterError; exports.issuerRegistryAbi = _chunkLRHY7GORcjs.issuerRegistryAbi; exports.issuerRegistryGetIssuerFlatAbi = _chunkCLPRSQT2cjs.issuerRegistryGetIssuerFlatAbi; exports.mintRequestTypes = _chunkM5ULOZ3Acjs.mintRequestTypes; exports.mintingOracleAbi = _chunkLRHY7GORcjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunk5254AG3Zcjs.parseLoginMessage; exports.permit2Abi = _chunkQ6WCDZXIcjs.permit2Abi; exports.pointTokenAbi = _chunkLRHY7GORcjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkQ6WCDZXIcjs.pointTokenFactoryAbi; exports.quoteOperatorFeePt = quoteOperatorFeePt; exports.quoteOperatorFeeUsdt = quoteOperatorFeeUsdt; exports.rawCallOp = rawCallOp; exports.receiverConsentTypes = _chunkM5ULOZ3Acjs.receiverConsentTypes; exports.sendWithPaymasterFallback = sendWithPaymasterFallback; exports.serializeUserOpToJsonRpc = serializeUserOpToJsonRpc; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.setPaymasterConfig = setPaymasterConfig; exports.signBurnRequest = _chunkM5ULOZ3Acjs.signBurnRequest; exports.signMintRequest = _chunkM5ULOZ3Acjs.signMintRequest; exports.signReceiverConsent = _chunkM5ULOZ3Acjs.signReceiverConsent; exports.signSponsorAuth = _chunk5254AG3Zcjs.signSponsorAuth; exports.splitAuthorizationSig = splitAuthorizationSig; exports.universalRouterAbi = _chunkQ6WCDZXIcjs.universalRouterAbi; exports.v4QuoterAbi = _chunkQ6WCDZXIcjs.v4QuoterAbi; exports.verifyBurnRequest = _chunkM5ULOZ3Acjs.verifyBurnRequest; exports.verifyLoginMessage = _chunk5254AG3Zcjs.verifyLoginMessage; exports.verifyMintCap = _chunkCLPRSQT2cjs.verifyMintCap; exports.verifyMintRequest = _chunkM5ULOZ3Acjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkM5ULOZ3Acjs.verifyReceiverConsent; exports.verifySponsorAuth = _chunk5254AG3Zcjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
|
|
1497
1581
|
//# sourceMappingURL=index.cjs.map
|