@pafi-dev/core 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2EBPG75P.cjs → chunk-BNO5SM25.cjs} +18 -9
- package/dist/chunk-BNO5SM25.cjs.map +1 -0
- package/dist/{chunk-RFKS5BHE.js → chunk-Y5EYH2SQ.js} +17 -8
- package/dist/chunk-Y5EYH2SQ.js.map +1 -0
- package/dist/contract/index.cjs +4 -2
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +16 -7
- package/dist/contract/index.d.ts +16 -7
- package/dist/contract/index.js +3 -1
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2EBPG75P.cjs.map +0 -1
- package/dist/chunk-RFKS5BHE.js.map +0 -1
|
@@ -74,8 +74,6 @@ var GET_ISSUER_FLAT_ABI = [
|
|
|
74
74
|
{ name: "signerAddress", type: "address" },
|
|
75
75
|
{ name: "name", type: "string" },
|
|
76
76
|
{ name: "symbol", type: "string" },
|
|
77
|
-
{ name: "declaredTotalSupply", type: "uint256" },
|
|
78
|
-
{ name: "capBasisPoints", type: "uint16" },
|
|
79
77
|
{ name: "active", type: "bool" },
|
|
80
78
|
{ name: "pointToken", type: "address" },
|
|
81
79
|
{ name: "mintingOracle", type: "address" }
|
|
@@ -95,11 +93,9 @@ async function getIssuer2(client, registryAddress, issuer) {
|
|
|
95
93
|
signerAddress: result[1],
|
|
96
94
|
name: result[2],
|
|
97
95
|
symbol: result[3],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
pointToken: result[7],
|
|
102
|
-
mintingOracle: result[8]
|
|
96
|
+
active: result[4],
|
|
97
|
+
pointToken: result[5],
|
|
98
|
+
mintingOracle: result[6]
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
101
|
var issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;
|
|
@@ -129,6 +125,18 @@ async function getPointTokenIssuer(client, oracleAddress, pointToken) {
|
|
|
129
125
|
args: [pointToken]
|
|
130
126
|
});
|
|
131
127
|
}
|
|
128
|
+
async function getTokenCap(client, oracleAddress, pointToken) {
|
|
129
|
+
const cap = await client.readContract({
|
|
130
|
+
address: oracleAddress,
|
|
131
|
+
abi: _chunkC7VB6WTLcjs.mintingOracleAbi,
|
|
132
|
+
functionName: "tokenCaps",
|
|
133
|
+
args: [pointToken]
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
declaredTotalSupply: cap.declaredTotalSupply,
|
|
137
|
+
capBasisPoints: Number(cap.capBasisPoints)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
132
140
|
|
|
133
141
|
// src/contract/mintFeeWrapper.ts
|
|
134
142
|
async function getMintFeeBps(client, wrapperAddress, pointToken) {
|
|
@@ -168,5 +176,6 @@ async function getMintFeeRecipients(client, wrapperAddress, pointToken) {
|
|
|
168
176
|
|
|
169
177
|
|
|
170
178
|
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
|
|
180
|
+
exports.getMintRequestNonce = getMintRequestNonce; exports.getReceiverConsentNonce = getReceiverConsentNonce; exports.isMinter = isMinter; exports.getTokenName = getTokenName; exports.getIssuer = getIssuer; exports.getPointTokenBalance = getPointTokenBalance; exports.getBurnRequestNonce = getBurnRequestNonce; exports.getIssuer2 = getIssuer2; exports.issuerRegistryGetIssuerFlatAbi = issuerRegistryGetIssuerFlatAbi; exports.isActiveIssuer = isActiveIssuer; exports.verifyMintCap = verifyMintCap; exports.getPointTokenIssuer = getPointTokenIssuer; exports.getTokenCap = getTokenCap; exports.getMintFeeBps = getMintFeeBps; exports.getMintFeeRecipients = getMintFeeRecipients;
|
|
181
|
+
//# sourceMappingURL=chunk-BNO5SM25.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNO5SM25.cjs","../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/contract/mintingOracle.ts","../src/contract/mintFeeWrapper.ts"],"names":["getIssuer"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACNA,MAAA,SAAsB,mBAAA,CACpB,MAAA,EACA,UAAA,EACA,QAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc,mBAAA;AAAA,IACd,IAAA,EAAM,CAAC,QAAQ;AAAA,EACjB,CAAC,CAAA;AACH;AAUA,MAAA,SAAsB,uBAAA,CACpB,MAAA,EACA,UAAA,EACA,QAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc,QAAA;AAAA,IACd,IAAA,EAAM,CAAC,QAAQ;AAAA,EACjB,CAAC,CAAA;AACH;AAEA,MAAA,SAAsB,QAAA,CACpB,MAAA,EACA,UAAA,EACA,OAAA,EACkB;AAClB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc,SAAA;AAAA,IACd,IAAA,EAAM,CAAC,OAAO;AAAA,EAChB,CAAC,CAAA;AACH;AAEA,MAAA,SAAsB,YAAA,CACpB,MAAA,EACA,UAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc;AA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AC,UAAU;AAAA,EACnB,CAAC,CAAA;AACD,EAAA,OAAO,MAAA,CAAO,GAAG,CAAA;AACnB;AAOA,MAAA,SAAsB,oBAAA,CACpB,MAAA,EACA,cAAA,EACA,UAAA,EAC+D;AAC/D,EAAA,MAAM,WAAA,EAAa,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IAC3C,OAAA,EAAS,cAAA;AAAA,IACT,GAAA,EAAK,mCAAA;AAAA,IACL,YAAA,EAAc,eAAA;AAAA,IACd,IAAA,EAAM,CAAC,UAAU;AAAA,EACnB,CAAC,CAAA;AACD,EAAA,OAAO,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,EAAA,GAAA,CAAO;AAAA,IAC5B,OAAA,EAAS,CAAA,CAAE,OAAA;AAAA,IACX,WAAA,EAAa,MAAA,CAAO,CAAA,CAAE,WAAW;AAAA,EACnC,CAAA,CAAE,CAAA;AACJ;AJqHA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,kqBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNO5SM25.cjs","sourcesContent":[null,"import type { Address, PublicClient } from \"viem\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\nexport async function getMintRequestNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"mintRequestNonces\",\n args: [receiver],\n });\n}\n\n/**\n * Read the receiver consent nonce for EIP-712 `ReceiverConsent` signing.\n *\n * NOTE: `receiverConsentNonces` was removed from the deployed ABI in the\n * latest Foundry build. Pending SC confirmation on whether `nonces(owner)`\n * is the replacement or if a separate mapping will be re-added.\n * Using `nonces` as a fallback until confirmed.\n */\nexport async function getReceiverConsentNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"nonces\",\n args: [receiver],\n });\n}\n\nexport async function isMinter(\n client: PublicClient,\n pointToken: Address,\n account: Address,\n): Promise<boolean> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"minters\",\n args: [account],\n });\n}\n\nexport async function getTokenName(\n client: PublicClient,\n pointToken: Address,\n): Promise<string> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"name\",\n });\n}\n\nexport async function getIssuer(\n client: PublicClient,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"issuer\",\n });\n}\n\n/**\n * Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal\n * base units. Use alongside the issuer's off-chain ledger balance to render\n * a combined \"total balance\" in the app UI.\n */\nexport async function getPointTokenBalance(\n client: PublicClient,\n pointToken: Address,\n holder: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"balanceOf\",\n args: [holder],\n });\n}\n\nexport async function getBurnRequestNonce(\n client: PublicClient,\n pointToken: Address,\n from: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"burnRequestNonces\",\n args: [from],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { issuerRegistryAbi } from \"../abi/issuerRegistry\";\nimport type { Issuer } from \"../types\";\n\n/**\n * Flat-output ABI for `getIssuer` — workaround for a viem decoding bug\n * (≤ 2.48.x) where `outputs: [{ type: 'tuple', components: [...] }]` with\n * mixed static + dynamic fields throws `IntegerOutOfRangeError` because\n * viem expects an outer offset that the actual on-chain return doesn't\n * carry (Solidity inlines `returns (Struct)` at the wire level).\n *\n * Using flat outputs (one entry per struct field) matches the on-chain\n * encoding and decodes correctly. We rebuild the named struct from the\n * resulting array.\n */\nconst GET_ISSUER_FLAT_ABI = [\n {\n type: \"function\",\n name: \"getIssuer\",\n inputs: [{ name: \"issuer\", type: \"address\" }],\n outputs: [\n { name: \"issuerAddress\", type: \"address\" },\n { name: \"signerAddress\", type: \"address\" },\n { name: \"name\", type: \"string\" },\n { name: \"symbol\", type: \"string\" },\n { name: \"active\", type: \"bool\" },\n { name: \"pointToken\", type: \"address\" },\n { name: \"mintingOracle\", type: \"address\" },\n ],\n stateMutability: \"view\",\n },\n] as const;\n\nexport async function getIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<Issuer> {\n const result = (await client.readContract({\n address: registryAddress,\n abi: GET_ISSUER_FLAT_ABI,\n functionName: \"getIssuer\",\n args: [issuer],\n })) as readonly [\n Address,\n Address,\n string,\n string,\n boolean,\n Address,\n Address,\n ];\n return {\n issuerAddress: result[0],\n signerAddress: result[1],\n name: result[2],\n symbol: result[3],\n active: result[4],\n pointToken: result[5],\n mintingOracle: result[6],\n } as Issuer;\n}\n\n/**\n * Re-export the flat ABI so callers using `client.readContract` directly\n * (e.g. inside batched `Promise.all`) can use it instead of the\n * struct-returning entry from `issuerRegistryAbi`.\n */\nexport const issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;\n\nexport async function isActiveIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<boolean> {\n return client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"isActiveIssuer\",\n args: [issuer],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\n\n/**\n * verifyMintCap signature changed in v1.6 (commit cc26f62) — now takes\n * `pointToken` as the first arg so the oracle can look up the per-token\n * cap. Reverts if the cap would be exceeded.\n */\nexport async function verifyMintCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMintCap\",\n args: [pointToken, issuer, amount],\n });\n}\n\nexport async function getPointTokenIssuer(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"pointTokenToIssuer\",\n args: [pointToken],\n });\n}\n\n/**\n * v1.6 — read the per-PointToken cap config from the oracle. Returns\n * `{ declaredTotalSupply, capBasisPoints }`. The on-chain `_mint` path\n * computes `hardCap = declaredTotalSupply * capBasisPoints / 10000` and\n * reverts if `mintedSupply + amount > hardCap`. Issuers replicate this\n * math at pre-validate time to fail fast before the user signs.\n *\n * Returns `{ 0n, 0 }` when the token is not registered with the oracle —\n * caller treats that as \"no cap configured\", which means mints will\n * always revert on-chain (the oracle requires a non-zero cap).\n */\nexport async function getTokenCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<{ declaredTotalSupply: bigint; capBasisPoints: number }> {\n const cap = await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"tokenCaps\",\n args: [pointToken],\n });\n return {\n declaredTotalSupply: cap.declaredTotalSupply,\n capBasisPoints: Number(cap.capBasisPoints),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintFeeWrapperAbi } from \"../abi/mintFeeWrapper\";\n\n/**\n * Read the total fee in basis points (0–10000) for a specific PointToken\n * from the shared `MintFeeWrapper`. Each PointToken has its own recipient\n * list with per-recipient `basisPoints`; `totalFeeBps` is the sum.\n *\n * Returns 0 when no recipients are registered (mint goes through wrapper\n * with no fee deduction). Reverts only on RPC failure.\n */\nexport async function getMintFeeBps(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<number> {\n const fee = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"totalFeeBps\",\n args: [pointToken],\n });\n return Number(fee);\n}\n\n/**\n * Read the recipient configuration for a PointToken — list of\n * `{ account, basisPoints }`. Useful for /config endpoints that want to\n * surface fee distribution to the frontend.\n */\nexport async function getMintFeeRecipients(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<readonly { account: Address; basisPoints: number }[]> {\n const recipients = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"getRecipients\",\n args: [pointToken],\n });\n return recipients.map((r) => ({\n account: r.account,\n basisPoints: Number(r.basisPoints),\n }));\n}\n"]}
|
|
@@ -74,8 +74,6 @@ var GET_ISSUER_FLAT_ABI = [
|
|
|
74
74
|
{ name: "signerAddress", type: "address" },
|
|
75
75
|
{ name: "name", type: "string" },
|
|
76
76
|
{ name: "symbol", type: "string" },
|
|
77
|
-
{ name: "declaredTotalSupply", type: "uint256" },
|
|
78
|
-
{ name: "capBasisPoints", type: "uint16" },
|
|
79
77
|
{ name: "active", type: "bool" },
|
|
80
78
|
{ name: "pointToken", type: "address" },
|
|
81
79
|
{ name: "mintingOracle", type: "address" }
|
|
@@ -95,11 +93,9 @@ async function getIssuer2(client, registryAddress, issuer) {
|
|
|
95
93
|
signerAddress: result[1],
|
|
96
94
|
name: result[2],
|
|
97
95
|
symbol: result[3],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
pointToken: result[7],
|
|
102
|
-
mintingOracle: result[8]
|
|
96
|
+
active: result[4],
|
|
97
|
+
pointToken: result[5],
|
|
98
|
+
mintingOracle: result[6]
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
101
|
var issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;
|
|
@@ -129,6 +125,18 @@ async function getPointTokenIssuer(client, oracleAddress, pointToken) {
|
|
|
129
125
|
args: [pointToken]
|
|
130
126
|
});
|
|
131
127
|
}
|
|
128
|
+
async function getTokenCap(client, oracleAddress, pointToken) {
|
|
129
|
+
const cap = await client.readContract({
|
|
130
|
+
address: oracleAddress,
|
|
131
|
+
abi: mintingOracleAbi,
|
|
132
|
+
functionName: "tokenCaps",
|
|
133
|
+
args: [pointToken]
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
declaredTotalSupply: cap.declaredTotalSupply,
|
|
137
|
+
capBasisPoints: Number(cap.capBasisPoints)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
132
140
|
|
|
133
141
|
// src/contract/mintFeeWrapper.ts
|
|
134
142
|
async function getMintFeeBps(client, wrapperAddress, pointToken) {
|
|
@@ -166,7 +174,8 @@ export {
|
|
|
166
174
|
isActiveIssuer,
|
|
167
175
|
verifyMintCap,
|
|
168
176
|
getPointTokenIssuer,
|
|
177
|
+
getTokenCap,
|
|
169
178
|
getMintFeeBps,
|
|
170
179
|
getMintFeeRecipients
|
|
171
180
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
181
|
+
//# sourceMappingURL=chunk-Y5EYH2SQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/contract/mintingOracle.ts","../src/contract/mintFeeWrapper.ts"],"sourcesContent":["import type { Address, PublicClient } from \"viem\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\nexport async function getMintRequestNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"mintRequestNonces\",\n args: [receiver],\n });\n}\n\n/**\n * Read the receiver consent nonce for EIP-712 `ReceiverConsent` signing.\n *\n * NOTE: `receiverConsentNonces` was removed from the deployed ABI in the\n * latest Foundry build. Pending SC confirmation on whether `nonces(owner)`\n * is the replacement or if a separate mapping will be re-added.\n * Using `nonces` as a fallback until confirmed.\n */\nexport async function getReceiverConsentNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"nonces\",\n args: [receiver],\n });\n}\n\nexport async function isMinter(\n client: PublicClient,\n pointToken: Address,\n account: Address,\n): Promise<boolean> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"minters\",\n args: [account],\n });\n}\n\nexport async function getTokenName(\n client: PublicClient,\n pointToken: Address,\n): Promise<string> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"name\",\n });\n}\n\nexport async function getIssuer(\n client: PublicClient,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"issuer\",\n });\n}\n\n/**\n * Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal\n * base units. Use alongside the issuer's off-chain ledger balance to render\n * a combined \"total balance\" in the app UI.\n */\nexport async function getPointTokenBalance(\n client: PublicClient,\n pointToken: Address,\n holder: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"balanceOf\",\n args: [holder],\n });\n}\n\nexport async function getBurnRequestNonce(\n client: PublicClient,\n pointToken: Address,\n from: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"burnRequestNonces\",\n args: [from],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { issuerRegistryAbi } from \"../abi/issuerRegistry\";\nimport type { Issuer } from \"../types\";\n\n/**\n * Flat-output ABI for `getIssuer` — workaround for a viem decoding bug\n * (≤ 2.48.x) where `outputs: [{ type: 'tuple', components: [...] }]` with\n * mixed static + dynamic fields throws `IntegerOutOfRangeError` because\n * viem expects an outer offset that the actual on-chain return doesn't\n * carry (Solidity inlines `returns (Struct)` at the wire level).\n *\n * Using flat outputs (one entry per struct field) matches the on-chain\n * encoding and decodes correctly. We rebuild the named struct from the\n * resulting array.\n */\nconst GET_ISSUER_FLAT_ABI = [\n {\n type: \"function\",\n name: \"getIssuer\",\n inputs: [{ name: \"issuer\", type: \"address\" }],\n outputs: [\n { name: \"issuerAddress\", type: \"address\" },\n { name: \"signerAddress\", type: \"address\" },\n { name: \"name\", type: \"string\" },\n { name: \"symbol\", type: \"string\" },\n { name: \"active\", type: \"bool\" },\n { name: \"pointToken\", type: \"address\" },\n { name: \"mintingOracle\", type: \"address\" },\n ],\n stateMutability: \"view\",\n },\n] as const;\n\nexport async function getIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<Issuer> {\n const result = (await client.readContract({\n address: registryAddress,\n abi: GET_ISSUER_FLAT_ABI,\n functionName: \"getIssuer\",\n args: [issuer],\n })) as readonly [\n Address,\n Address,\n string,\n string,\n boolean,\n Address,\n Address,\n ];\n return {\n issuerAddress: result[0],\n signerAddress: result[1],\n name: result[2],\n symbol: result[3],\n active: result[4],\n pointToken: result[5],\n mintingOracle: result[6],\n } as Issuer;\n}\n\n/**\n * Re-export the flat ABI so callers using `client.readContract` directly\n * (e.g. inside batched `Promise.all`) can use it instead of the\n * struct-returning entry from `issuerRegistryAbi`.\n */\nexport const issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;\n\nexport async function isActiveIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<boolean> {\n return client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"isActiveIssuer\",\n args: [issuer],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\n\n/**\n * verifyMintCap signature changed in v1.6 (commit cc26f62) — now takes\n * `pointToken` as the first arg so the oracle can look up the per-token\n * cap. Reverts if the cap would be exceeded.\n */\nexport async function verifyMintCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMintCap\",\n args: [pointToken, issuer, amount],\n });\n}\n\nexport async function getPointTokenIssuer(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"pointTokenToIssuer\",\n args: [pointToken],\n });\n}\n\n/**\n * v1.6 — read the per-PointToken cap config from the oracle. Returns\n * `{ declaredTotalSupply, capBasisPoints }`. The on-chain `_mint` path\n * computes `hardCap = declaredTotalSupply * capBasisPoints / 10000` and\n * reverts if `mintedSupply + amount > hardCap`. Issuers replicate this\n * math at pre-validate time to fail fast before the user signs.\n *\n * Returns `{ 0n, 0 }` when the token is not registered with the oracle —\n * caller treats that as \"no cap configured\", which means mints will\n * always revert on-chain (the oracle requires a non-zero cap).\n */\nexport async function getTokenCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<{ declaredTotalSupply: bigint; capBasisPoints: number }> {\n const cap = await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"tokenCaps\",\n args: [pointToken],\n });\n return {\n declaredTotalSupply: cap.declaredTotalSupply,\n capBasisPoints: Number(cap.capBasisPoints),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintFeeWrapperAbi } from \"../abi/mintFeeWrapper\";\n\n/**\n * Read the total fee in basis points (0–10000) for a specific PointToken\n * from the shared `MintFeeWrapper`. Each PointToken has its own recipient\n * list with per-recipient `basisPoints`; `totalFeeBps` is the sum.\n *\n * Returns 0 when no recipients are registered (mint goes through wrapper\n * with no fee deduction). Reverts only on RPC failure.\n */\nexport async function getMintFeeBps(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<number> {\n const fee = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"totalFeeBps\",\n args: [pointToken],\n });\n return Number(fee);\n}\n\n/**\n * Read the recipient configuration for a PointToken — list of\n * `{ account, basisPoints }`. Useful for /config endpoints that want to\n * surface fee distribution to the frontend.\n */\nexport async function getMintFeeRecipients(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<readonly { account: Address; basisPoints: number }[]> {\n const recipients = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"getRecipients\",\n args: [pointToken],\n });\n return recipients.map((r) => ({\n account: r.account,\n basisPoints: Number(r.basisPoints),\n }));\n}\n"],"mappings":";;;;;;;;;;AAGA,eAAsB,oBACpB,QACA,YACA,UACiB;AACjB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,QAAQ;AAAA,EACjB,CAAC;AACH;AAUA,eAAsB,wBACpB,QACA,YACA,UACiB;AACjB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,QAAQ;AAAA,EACjB,CAAC;AACH;AAEA,eAAsB,SACpB,QACA,YACA,SACkB;AAClB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,OAAO;AAAA,EAChB,CAAC;AACH;AAEA,eAAsB,aACpB,QACA,YACiB;AACjB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AACH;AAEA,eAAsB,UACpB,QACA,YACkB;AAClB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AACH;AAOA,eAAsB,qBACpB,QACA,YACA,QACiB;AACjB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,MAAM;AAAA,EACf,CAAC;AACH;AAEA,eAAsB,oBACpB,QACA,YACA,MACiB;AACjB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,IAAI;AAAA,EACb,CAAC;AACH;;;ACtFA,IAAM,sBAAsB;AAAA,EAC1B;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAA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B;AAClB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU;AAAA,EACnB,CAAC;AACH;AAaA,eAAsB,YACpB,QACA,eACA,YACkE;AAClE,QAAM,MAAM,MAAM,OAAO,aAAa;AAAA,IACpC,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU;AAAA,EACnB,CAAC;AACD,SAAO;AAAA,IACL,qBAAqB,IAAI;AAAA,IACzB,gBAAgB,OAAO,IAAI,cAAc;AAAA,EAC3C;AACF;;;ACnDA,eAAsB,cACpB,QACA,gBACA,YACiB;AACjB,QAAM,MAAM,MAAM,OAAO,aAAa;AAAA,IACpC,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU;AAAA,EACnB,CAAC;AACD,SAAO,OAAO,GAAG;AACnB;AAOA,eAAsB,qBACpB,QACA,gBACA,YAC+D;AAC/D,QAAM,aAAa,MAAM,OAAO,aAAa;AAAA,IAC3C,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU;AAAA,EACnB,CAAC;AACD,SAAO,WAAW,IAAI,CAAC,OAAO;AAAA,IAC5B,SAAS,EAAE;AAAA,IACX,aAAa,OAAO,EAAE,WAAW;AAAA,EACnC,EAAE;AACJ;","names":["getIssuer"]}
|
package/dist/contract/index.cjs
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _chunkBNO5SM25cjs = require('../chunk-BNO5SM25.cjs');
|
|
17
18
|
require('../chunk-C7VB6WTL.cjs');
|
|
18
19
|
require('../chunk-KRHGFUDI.cjs');
|
|
19
20
|
require('../chunk-JEQ2X3Z6.cjs');
|
|
@@ -32,5 +33,6 @@ require('../chunk-JEQ2X3Z6.cjs');
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
exports.getBurnRequestNonce = _chunkBNO5SM25cjs.getBurnRequestNonce; exports.getIssuer = _chunkBNO5SM25cjs.getIssuer2; exports.getMintFeeBps = _chunkBNO5SM25cjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkBNO5SM25cjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkBNO5SM25cjs.getMintRequestNonce; exports.getPointTokenBalance = _chunkBNO5SM25cjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkBNO5SM25cjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkBNO5SM25cjs.getIssuer; exports.getReceiverConsentNonce = _chunkBNO5SM25cjs.getReceiverConsentNonce; exports.getTokenCap = _chunkBNO5SM25cjs.getTokenCap; exports.getTokenName = _chunkBNO5SM25cjs.getTokenName; exports.isActiveIssuer = _chunkBNO5SM25cjs.isActiveIssuer; exports.isMinter = _chunkBNO5SM25cjs.isMinter; exports.issuerRegistryGetIssuerFlatAbi = _chunkBNO5SM25cjs.issuerRegistryGetIssuerFlatAbi; exports.verifyMintCap = _chunkBNO5SM25cjs.verifyMintCap;
|
|
36
38
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/contract/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/contract/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,g8BAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/contract/index.cjs"}
|
|
@@ -47,12 +47,6 @@ declare const issuerRegistryGetIssuerFlatAbi: readonly [{
|
|
|
47
47
|
}, {
|
|
48
48
|
readonly name: "symbol";
|
|
49
49
|
readonly type: "string";
|
|
50
|
-
}, {
|
|
51
|
-
readonly name: "declaredTotalSupply";
|
|
52
|
-
readonly type: "uint256";
|
|
53
|
-
}, {
|
|
54
|
-
readonly name: "capBasisPoints";
|
|
55
|
-
readonly type: "uint16";
|
|
56
50
|
}, {
|
|
57
51
|
readonly name: "active";
|
|
58
52
|
readonly type: "bool";
|
|
@@ -74,6 +68,21 @@ declare function isActiveIssuer(client: PublicClient, registryAddress: Address,
|
|
|
74
68
|
*/
|
|
75
69
|
declare function verifyMintCap(client: PublicClient, oracleAddress: Address, pointToken: Address, issuer: Address, amount: bigint): Promise<void>;
|
|
76
70
|
declare function getPointTokenIssuer(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<Address>;
|
|
71
|
+
/**
|
|
72
|
+
* v1.6 — read the per-PointToken cap config from the oracle. Returns
|
|
73
|
+
* `{ declaredTotalSupply, capBasisPoints }`. The on-chain `_mint` path
|
|
74
|
+
* computes `hardCap = declaredTotalSupply * capBasisPoints / 10000` and
|
|
75
|
+
* reverts if `mintedSupply + amount > hardCap`. Issuers replicate this
|
|
76
|
+
* math at pre-validate time to fail fast before the user signs.
|
|
77
|
+
*
|
|
78
|
+
* Returns `{ 0n, 0 }` when the token is not registered with the oracle —
|
|
79
|
+
* caller treats that as "no cap configured", which means mints will
|
|
80
|
+
* always revert on-chain (the oracle requires a non-zero cap).
|
|
81
|
+
*/
|
|
82
|
+
declare function getTokenCap(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<{
|
|
83
|
+
declaredTotalSupply: bigint;
|
|
84
|
+
capBasisPoints: number;
|
|
85
|
+
}>;
|
|
77
86
|
|
|
78
87
|
/**
|
|
79
88
|
* Read the total fee in basis points (0–10000) for a specific PointToken
|
|
@@ -94,4 +103,4 @@ declare function getMintFeeRecipients(client: PublicClient, wrapperAddress: Addr
|
|
|
94
103
|
basisPoints: number;
|
|
95
104
|
}[]>;
|
|
96
105
|
|
|
97
|
-
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
|
|
106
|
+
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -47,12 +47,6 @@ declare const issuerRegistryGetIssuerFlatAbi: readonly [{
|
|
|
47
47
|
}, {
|
|
48
48
|
readonly name: "symbol";
|
|
49
49
|
readonly type: "string";
|
|
50
|
-
}, {
|
|
51
|
-
readonly name: "declaredTotalSupply";
|
|
52
|
-
readonly type: "uint256";
|
|
53
|
-
}, {
|
|
54
|
-
readonly name: "capBasisPoints";
|
|
55
|
-
readonly type: "uint16";
|
|
56
50
|
}, {
|
|
57
51
|
readonly name: "active";
|
|
58
52
|
readonly type: "bool";
|
|
@@ -74,6 +68,21 @@ declare function isActiveIssuer(client: PublicClient, registryAddress: Address,
|
|
|
74
68
|
*/
|
|
75
69
|
declare function verifyMintCap(client: PublicClient, oracleAddress: Address, pointToken: Address, issuer: Address, amount: bigint): Promise<void>;
|
|
76
70
|
declare function getPointTokenIssuer(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<Address>;
|
|
71
|
+
/**
|
|
72
|
+
* v1.6 — read the per-PointToken cap config from the oracle. Returns
|
|
73
|
+
* `{ declaredTotalSupply, capBasisPoints }`. The on-chain `_mint` path
|
|
74
|
+
* computes `hardCap = declaredTotalSupply * capBasisPoints / 10000` and
|
|
75
|
+
* reverts if `mintedSupply + amount > hardCap`. Issuers replicate this
|
|
76
|
+
* math at pre-validate time to fail fast before the user signs.
|
|
77
|
+
*
|
|
78
|
+
* Returns `{ 0n, 0 }` when the token is not registered with the oracle —
|
|
79
|
+
* caller treats that as "no cap configured", which means mints will
|
|
80
|
+
* always revert on-chain (the oracle requires a non-zero cap).
|
|
81
|
+
*/
|
|
82
|
+
declare function getTokenCap(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<{
|
|
83
|
+
declaredTotalSupply: bigint;
|
|
84
|
+
capBasisPoints: number;
|
|
85
|
+
}>;
|
|
77
86
|
|
|
78
87
|
/**
|
|
79
88
|
* Read the total fee in basis points (0–10000) for a specific PointToken
|
|
@@ -94,4 +103,4 @@ declare function getMintFeeRecipients(client: PublicClient, wrapperAddress: Addr
|
|
|
94
103
|
basisPoints: number;
|
|
95
104
|
}[]>;
|
|
96
105
|
|
|
97
|
-
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
|
|
106
|
+
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
|
package/dist/contract/index.js
CHANGED
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
getPointTokenBalance,
|
|
9
9
|
getPointTokenIssuer,
|
|
10
10
|
getReceiverConsentNonce,
|
|
11
|
+
getTokenCap,
|
|
11
12
|
getTokenName,
|
|
12
13
|
isActiveIssuer,
|
|
13
14
|
isMinter,
|
|
14
15
|
issuerRegistryGetIssuerFlatAbi,
|
|
15
16
|
verifyMintCap
|
|
16
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-Y5EYH2SQ.js";
|
|
17
18
|
import "../chunk-LF5GIN5P.js";
|
|
18
19
|
import "../chunk-UCO5DXD6.js";
|
|
19
20
|
import "../chunk-DGUM43GV.js";
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
getPointTokenIssuer,
|
|
28
29
|
getIssuer as getPointTokenIssuerAddress,
|
|
29
30
|
getReceiverConsentNonce,
|
|
31
|
+
getTokenCap,
|
|
30
32
|
getTokenName,
|
|
31
33
|
isActiveIssuer,
|
|
32
34
|
isMinter,
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,8 @@ var _chunk75JWR5SAcjs = require('./chunk-75JWR5SA.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
var _chunkBNO5SM25cjs = require('./chunk-BNO5SM25.cjs');
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
|
|
@@ -1008,7 +1009,7 @@ async function sendWithPaymasterFallback(params) {
|
|
|
1008
1009
|
|
|
1009
1010
|
// src/subgraph/pools.ts
|
|
1010
1011
|
|
|
1011
|
-
var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-
|
|
1012
|
+
var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v3";
|
|
1012
1013
|
var POOL_QUERY = `
|
|
1013
1014
|
query GetPoolForPointToken($id: ID!) {
|
|
1014
1015
|
pafiToken(id: $id) {
|
|
@@ -1487,7 +1488,7 @@ var PafiSDK = class {
|
|
|
1487
1488
|
const provider = this.requireProvider();
|
|
1488
1489
|
const pointToken = this.requirePointToken();
|
|
1489
1490
|
const chainId = this.requireChainId();
|
|
1490
|
-
const name = await
|
|
1491
|
+
const name = await _chunkBNO5SM25cjs.getTokenName.call(void 0, provider, pointToken);
|
|
1491
1492
|
return { name, verifyingContract: pointToken, chainId };
|
|
1492
1493
|
}
|
|
1493
1494
|
// -------------------------------------------------------------------------
|
|
@@ -1521,14 +1522,14 @@ var PafiSDK = class {
|
|
|
1521
1522
|
// Contract reads
|
|
1522
1523
|
// -------------------------------------------------------------------------
|
|
1523
1524
|
async getMintRequestNonce(receiver) {
|
|
1524
|
-
return
|
|
1525
|
+
return _chunkBNO5SM25cjs.getMintRequestNonce.call(void 0,
|
|
1525
1526
|
this.requireProvider(),
|
|
1526
1527
|
this.requirePointToken(),
|
|
1527
1528
|
receiver
|
|
1528
1529
|
);
|
|
1529
1530
|
}
|
|
1530
1531
|
async getReceiverConsentNonce(receiver) {
|
|
1531
|
-
return
|
|
1532
|
+
return _chunkBNO5SM25cjs.getReceiverConsentNonce.call(void 0,
|
|
1532
1533
|
this.requireProvider(),
|
|
1533
1534
|
this.requirePointToken(),
|
|
1534
1535
|
receiver
|
|
@@ -1692,5 +1693,6 @@ var PafiSDK = class {
|
|
|
1692
1693
|
|
|
1693
1694
|
|
|
1694
1695
|
|
|
1695
|
-
|
|
1696
|
+
|
|
1697
|
+
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 = _chunkUTG2UT54cjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkUTG2UT54cjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = ConfigurationError; exports.DUMMY_SIGNATURE_V07 = DUMMY_SIGNATURE_V07; exports.ENTRY_POINT_V07 = _chunkUTG2UT54cjs.ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = _chunkUTG2UT54cjs.ENTRY_POINT_V08; exports.Eip712DomainMismatchError = _chunkUTG2UT54cjs.Eip712DomainMismatchError; 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_SERVICE_URLS = PAFI_SERVICE_URLS; exports.PAFI_SUBGRAPH_URL = PAFI_SUBGRAPH_URL; exports.PERMIT2_ADDRESS = _chunkUTG2UT54cjs.PERMIT2_ADDRESS; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkUTG2UT54cjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = _chunkKRHGFUDIcjs.pointTokenAbi; exports.PafiSDK = PafiSDK; exports.PafiSDKError = PafiSDKError; exports.PafiSdkError = PafiSdkError; exports.SDK_ERROR_HTTP_STATUS_CODE = SDK_ERROR_HTTP_STATUS_CODE; exports.SIMPLE_7702_IMPL_BASE_MAINNET = SIMPLE_7702_IMPL_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunk75JWR5SAcjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunkUTG2UT54cjs.SUPPORTED_CHAINS; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkUTG2UT54cjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V4_QUOTER_ADDRESSES = _chunkUTG2UT54cjs.V4_QUOTER_ADDRESSES; exports.ValidationError = ValidationError; exports.ZERO_VALUE = ZERO_VALUE; exports._resetPaymasterConfigForTests = _resetPaymasterConfigForTests; exports.assembleUserOperation = assembleUserOperation; exports.assertDomainMatchesContract = _chunkUTG2UT54cjs.assertDomainMatchesContract; exports.buildAndSignSponsorAuth = _chunk75JWR5SAcjs.buildAndSignSponsorAuth; exports.buildBurnRequestTypedData = _chunkUTG2UT54cjs.buildBurnRequestTypedData; exports.buildDelegationUserOp = buildDelegationUserOp; exports.buildDomain = _chunkUTG2UT54cjs.buildDomain; exports.buildEip7702Authorization = buildEip7702Authorization; exports.buildMintRequestTypedData = _chunkUTG2UT54cjs.buildMintRequestTypedData; exports.buildPartialUserOperation = buildPartialUserOperation; exports.buildPerpDepositViaRelay = buildPerpDepositViaRelay; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildReceiverConsentTypedData = _chunkUTG2UT54cjs.buildReceiverConsentTypedData; exports.buildSponsorAuthDomain = _chunk75JWR5SAcjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunk75JWR5SAcjs.buildSponsorAuthTypedData; exports.buildUserOpTypedData = buildUserOpTypedData; exports.burnRequestTypes = _chunkUTG2UT54cjs.burnRequestTypes; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.computeAccountId = computeAccountId; exports.computeAuthorizationHash = computeAuthorizationHash; exports.computeCallDataHash = _chunk75JWR5SAcjs.computeCallDataHash; exports.computeUserOpHash = computeUserOpHash; exports.createLoginMessage = _chunk75JWR5SAcjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.decodeBatchExecuteCalls = decodeBatchExecuteCalls; exports.defaultErrorTypeForStatus = defaultErrorTypeForStatus; exports.delegateDirect = delegateDirect; exports.detectDelegateImpl = detectDelegateImpl; exports.encodeBatchExecute = encodeBatchExecute; exports.erc20Abi = _chunkMIQA46E3cjs.erc20Abi; exports.erc20ApproveOp = erc20ApproveOp; exports.erc20BurnOp = erc20BurnOp; exports.erc20TransferOp = erc20TransferOp; exports.fetchPafiPools = fetchPafiPools; exports.generateSponsorAuthNonce = _chunk75JWR5SAcjs.generateSponsorAuthNonce; exports.getAaNonce = getAaNonce; exports.getBurnRequestNonce = _chunkBNO5SM25cjs.getBurnRequestNonce; exports.getContractAddresses = getContractAddresses; exports.getDummySignatureFor7702 = getDummySignatureFor7702; exports.getIssuer = _chunkBNO5SM25cjs.getIssuer2; exports.getMintFeeBps = _chunkBNO5SM25cjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkBNO5SM25cjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkBNO5SM25cjs.getMintRequestNonce; exports.getPafiServiceUrls = getPafiServiceUrls; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPaymasterConfig = getPaymasterConfig; exports.getPointTokenBalance = _chunkBNO5SM25cjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkBNO5SM25cjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkBNO5SM25cjs.getIssuer; exports.getReceiverConsentNonce = _chunkBNO5SM25cjs.getReceiverConsentNonce; exports.getSponsorAuthDomainAnchor = _chunk75JWR5SAcjs.getSponsorAuthDomainAnchor; exports.getTokenCap = _chunkBNO5SM25cjs.getTokenCap; exports.getTokenName = _chunkBNO5SM25cjs.getTokenName; exports.isActiveIssuer = _chunkBNO5SM25cjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isDelegatedToTarget = isDelegatedToTarget; exports.isMinter = _chunkBNO5SM25cjs.isMinter; exports.isPaymasterConfigured = isPaymasterConfigured; exports.isPaymasterError = isPaymasterError; exports.issuerRegistryAbi = _chunkC7VB6WTLcjs.issuerRegistryAbi; exports.issuerRegistryGetIssuerFlatAbi = _chunkBNO5SM25cjs.issuerRegistryGetIssuerFlatAbi; exports.mintFeeWrapperAbi = _chunkC7VB6WTLcjs.mintFeeWrapperAbi; exports.mintRequestTypes = _chunkUTG2UT54cjs.mintRequestTypes; exports.mintingOracleAbi = _chunkC7VB6WTLcjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunk75JWR5SAcjs.parseLoginMessage; exports.permit2Abi = _chunkMIQA46E3cjs.permit2Abi; exports.pointTokenAbi = _chunkKRHGFUDIcjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkMIQA46E3cjs.pointTokenFactoryAbi; exports.quoteOperatorFeePt = quoteOperatorFeePt; exports.quoteOperatorFeeUsdt = quoteOperatorFeeUsdt; exports.rawCallOp = rawCallOp; exports.receiverConsentTypes = _chunkUTG2UT54cjs.receiverConsentTypes; exports.sendWithPaymasterFallback = sendWithPaymasterFallback; exports.serializeUserOpToJsonRpc = serializeUserOpToJsonRpc; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.setPaymasterConfig = setPaymasterConfig; exports.signBurnRequest = _chunkUTG2UT54cjs.signBurnRequest; exports.signMintRequest = _chunkUTG2UT54cjs.signMintRequest; exports.signReceiverConsent = _chunkUTG2UT54cjs.signReceiverConsent; exports.signSponsorAuth = _chunk75JWR5SAcjs.signSponsorAuth; exports.splitAuthorizationSig = splitAuthorizationSig; exports.universalRouterAbi = _chunkMIQA46E3cjs.universalRouterAbi; exports.v4QuoterAbi = _chunkMIQA46E3cjs.v4QuoterAbi; exports.verifyBurnRequest = _chunkUTG2UT54cjs.verifyBurnRequest; exports.verifyLoginMessage = _chunk75JWR5SAcjs.verifyLoginMessage; exports.verifyMintCap = _chunkBNO5SM25cjs.verifyMintCap; exports.verifyMintRequest = _chunkUTG2UT54cjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkUTG2UT54cjs.verifyReceiverConsent; exports.verifySponsorAuth = _chunk75JWR5SAcjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
|
|
1696
1698
|
//# sourceMappingURL=index.cjs.map
|