@pafi-dev/core 0.9.5 → 0.10.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.
@@ -1 +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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AO,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"]}
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BBQLGBOD.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;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,+B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Ac;AAAA,EAC3C,CAAA;AACF;AHqEA;AACA;AIzHA,MAAA,SAAsB,aAAA,CACpB,MAAA,EACA,cAAA,EACA,UAAA,EACiB;AACjB,EAAA,MAAM,IAAA,EAAM,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACpC,OAAA,EAAS,cAAA;AAAA,IACT,GAAA,EAAK,mCAAA;AAAA,IACL,YAAA,EAAc,aAAA;AAAA,IACd,IAAA,EAAM,CAAC,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;AJ6GA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,umBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BBQLGBOD.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\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"]}
@@ -16,14 +16,6 @@ async function getMintRequestNonce(client, pointToken, receiver) {
16
16
  args: [receiver]
17
17
  });
18
18
  }
19
- async function getReceiverConsentNonce(client, pointToken, receiver) {
20
- return client.readContract({
21
- address: pointToken,
22
- abi: pointTokenAbi,
23
- functionName: "nonces",
24
- args: [receiver]
25
- });
26
- }
27
19
  async function isMinter(client, pointToken, account) {
28
20
  return client.readContract({
29
21
  address: pointToken,
@@ -163,7 +155,6 @@ async function getMintFeeRecipients(client, wrapperAddress, pointToken) {
163
155
 
164
156
  export {
165
157
  getMintRequestNonce,
166
- getReceiverConsentNonce,
167
158
  isMinter,
168
159
  getTokenName,
169
160
  getIssuer,
@@ -178,4 +169,4 @@ export {
178
169
  getMintFeeBps,
179
170
  getMintFeeRecipients
180
171
  };
181
- //# sourceMappingURL=chunk-Y5EYH2SQ.js.map
172
+ //# sourceMappingURL=chunk-J7EYOLMI.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\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":";;;;;;;;;;AA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A,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"]}
@@ -79,16 +79,6 @@ var burnRequestTypes = {
79
79
  { name: "deadline", type: "uint256" }
80
80
  ]
81
81
  };
82
- var receiverConsentTypes = {
83
- ReceiverConsent: [
84
- { name: "onBehalfOf", type: "address" },
85
- { name: "originalReceiver", type: "address" },
86
- { name: "amount", type: "uint256" },
87
- { name: "nonce", type: "uint256" },
88
- { name: "deadline", type: "uint256" },
89
- { name: "extData", type: "bytes" }
90
- ]
91
- };
92
82
  var SUPPORTED_CHAINS = {
93
83
  8453: { name: "Base" }
94
84
  };
@@ -210,48 +200,9 @@ async function verifyBurnRequest(domain, message, signature, expectedBurner) {
210
200
  return { isValid, recoveredAddress };
211
201
  }
212
202
 
213
- // src/eip712/receiverConsent.ts
214
- import { getAddress as getAddress3, parseSignature as parseSignature3, recoverTypedDataAddress as recoverTypedDataAddress3 } from "viem";
215
- function buildReceiverConsentTypedData(domain, message) {
216
- return {
217
- domain: buildDomain(domain),
218
- types: receiverConsentTypes,
219
- primaryType: "ReceiverConsent",
220
- message
221
- };
222
- }
223
- async function signReceiverConsent(walletClient, domain, message) {
224
- const serialized = await walletClient.signTypedData({
225
- account: walletClient.account,
226
- domain: buildDomain(domain),
227
- types: receiverConsentTypes,
228
- primaryType: "ReceiverConsent",
229
- message
230
- });
231
- const { v, r, s } = parseSignature3(serialized);
232
- return {
233
- v: Number(v),
234
- r,
235
- s,
236
- serialized
237
- };
238
- }
239
- async function verifyReceiverConsent(domain, message, signature, expectedReceiver) {
240
- const recoveredAddress = await recoverTypedDataAddress3({
241
- domain: buildDomain(domain),
242
- types: receiverConsentTypes,
243
- primaryType: "ReceiverConsent",
244
- message,
245
- signature
246
- });
247
- const isValid = getAddress3(recoveredAddress) === getAddress3(expectedReceiver);
248
- return { isValid, recoveredAddress };
249
- }
250
-
251
203
  export {
252
204
  mintRequestTypes,
253
205
  burnRequestTypes,
254
- receiverConsentTypes,
255
206
  SUPPORTED_CHAINS,
256
207
  V4_QUOTER_ADDRESSES,
257
208
  UNIVERSAL_ROUTER_ADDRESSES,
@@ -269,9 +220,6 @@ export {
269
220
  verifyMintRequest,
270
221
  buildBurnRequestTypedData,
271
222
  signBurnRequest,
272
- verifyBurnRequest,
273
- buildReceiverConsentTypedData,
274
- signReceiverConsent,
275
- verifyReceiverConsent
223
+ verifyBurnRequest
276
224
  };
277
- //# sourceMappingURL=chunk-XNVVZVK6.js.map
225
+ //# sourceMappingURL=chunk-RVSW7I6U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/burnRequest.ts"],"sourcesContent":["import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a v1.6 MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a v1.6 MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\n\n return { isValid, recoveredAddress };\n}\n","import type { Address } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the v1.6 sig-gated mint path.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// `receiverConsentTypes` removed in v0.10 — the deployed PointToken\n// contract never had a `ReceiverConsent` path. What was conceptually\n// a \"sponsored\" mint variant is actually implemented at the relayer\n// layer (sponsor-relayer pays gas for the path-2 `MintForRequest`\n// sig-gated mint); no separate EIP-712 type or on-chain nonce mapping\n// is needed.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\nexport const V4_QUOTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x0d5e0f971ed27fbff6c2837bf31316121532048d\",\n};\n\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x6ff5693b99212da76ad316178a184ab56d299b43\",\n};\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — existing Uniswap V4 pools\n 8453: [\n // WETH/USDC 0.3%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n tickSpacing: 60,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n // WETH/USDC 0.05%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n tickSpacing: 10,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\nexport const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedBurner);\n\n return { isValid, recoveredAddress };\n}\n"],"mappings":";;;;;AAQO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,SAAS,OAAO,WAAW;AAAA,IAC3B,SAAS,OAAO;AAAA,IAChB,mBAAmB,OAAO;AAAA,EAC5B;AACF;AAKO,IAAM,4BAAN,cAAwC,MAAM;AAAA,EACnD,YACkB,OACA,UACA,QAChB;AACA;AAAA,MACE,qCAAqC,KAAK,eAAe,QAAQ,SAAS,MAAM;AAAA,IAGlF;AARgB;AACA;AACA;AAOhB,SAAK,OAAO;AAAA,EACd;AAAA,EAVkB;AAAA,EACA;AAAA,EACA;AASpB;AA4BA,eAAsB,4BACpB,QACA,UACe;AACf,QAAM,UAAW,MAAM,OAAO,aAAa;AAAA,IACzC,SAAS,SAAS;AAAA,IAClB,KAAK;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AAUD,QAAM,CAAC,EAAE,MAAM,SAAS,SAAS,iBAAiB,IAAI;AAEtD,MAAI,SAAS,SAAS,MAAM;AAC1B,UAAM,IAAI,0BAA0B,QAAQ,SAAS,MAAM,IAAI;AAAA,EACjE;AACA,MAAI,YAAY,SAAS,SAAS;AAChC,UAAM,IAAI;AAAA,MACR;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,MAAI,YAAY,OAAO,SAAS,OAAO,GAAG;AACxC,UAAM,IAAI;AAAA,MACR;AAAA,MACA,OAAO,SAAS,OAAO;AAAA,MACvB,QAAQ,SAAS;AAAA,IACnB;AAAA,EACF;AACA,MACE,kBAAkB,YAAY,MA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AAE,GAAG,GAAG,EAAE,IAAIC,gBAAe,UAAU;AAE7C,SAAO;AAAA,IACL,GAAG,OAAO,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,kBACpB,QACA,SACA,WACA,gBACgC;AAChC,QAAM,mBAAmB,MAAMC,yBAAwB;AAAA,IACrD,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,UAAUC,YAAW,gBAAgB,MAAMA,YAAW,cAAc;AAE1E,SAAO,EAAE,SAAS,iBAAiB;AACrC;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}
@@ -13,8 +13,7 @@
13
13
 
14
14
 
15
15
 
16
-
17
- var _chunkBNO5SM25cjs = require('../chunk-BNO5SM25.cjs');
16
+ var _chunkBBQLGBODcjs = require('../chunk-BBQLGBOD.cjs');
18
17
  require('../chunk-C7VB6WTL.cjs');
19
18
  require('../chunk-KRHGFUDI.cjs');
20
19
  require('../chunk-JEQ2X3Z6.cjs');
@@ -33,6 +32,5 @@ require('../chunk-JEQ2X3Z6.cjs');
33
32
 
34
33
 
35
34
 
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;
35
+ exports.getBurnRequestNonce = _chunkBBQLGBODcjs.getBurnRequestNonce; exports.getIssuer = _chunkBBQLGBODcjs.getIssuer2; exports.getMintFeeBps = _chunkBBQLGBODcjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkBBQLGBODcjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkBBQLGBODcjs.getMintRequestNonce; exports.getPointTokenBalance = _chunkBBQLGBODcjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkBBQLGBODcjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkBBQLGBODcjs.getIssuer; exports.getTokenCap = _chunkBBQLGBODcjs.getTokenCap; exports.getTokenName = _chunkBBQLGBODcjs.getTokenName; exports.isActiveIssuer = _chunkBBQLGBODcjs.isActiveIssuer; exports.isMinter = _chunkBBQLGBODcjs.isMinter; exports.issuerRegistryGetIssuerFlatAbi = _chunkBBQLGBODcjs.issuerRegistryGetIssuerFlatAbi; exports.verifyMintCap = _chunkBBQLGBODcjs.verifyMintCap;
38
36
  //# 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;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"}
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,m3BAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/contract/index.cjs"}
@@ -1,16 +1,7 @@
1
1
  import { PublicClient, Address } from 'viem';
2
- import { I as Issuer } from '../types-DWLZNgcw.cjs';
2
+ import { I as Issuer } from '../types-B3UivyQ1.cjs';
3
3
 
4
4
  declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
5
- /**
6
- * Read the receiver consent nonce for EIP-712 `ReceiverConsent` signing.
7
- *
8
- * NOTE: `receiverConsentNonces` was removed from the deployed ABI in the
9
- * latest Foundry build. Pending SC confirmation on whether `nonces(owner)`
10
- * is the replacement or if a separate mapping will be re-added.
11
- * Using `nonces` as a fallback until confirmed.
12
- */
13
- declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
14
5
  declare function isMinter(client: PublicClient, pointToken: Address, account: Address): Promise<boolean>;
15
6
  declare function getTokenName(client: PublicClient, pointToken: Address): Promise<string>;
16
7
  declare function getIssuer$1(client: PublicClient, pointToken: Address): Promise<Address>;
@@ -103,4 +94,4 @@ declare function getMintFeeRecipients(client: PublicClient, wrapperAddress: Addr
103
94
  basisPoints: number;
104
95
  }[]>;
105
96
 
106
- export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
97
+ export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
@@ -1,16 +1,7 @@
1
1
  import { PublicClient, Address } from 'viem';
2
- import { I as Issuer } from '../types-DWLZNgcw.js';
2
+ import { I as Issuer } from '../types-B3UivyQ1.js';
3
3
 
4
4
  declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
5
- /**
6
- * Read the receiver consent nonce for EIP-712 `ReceiverConsent` signing.
7
- *
8
- * NOTE: `receiverConsentNonces` was removed from the deployed ABI in the
9
- * latest Foundry build. Pending SC confirmation on whether `nonces(owner)`
10
- * is the replacement or if a separate mapping will be re-added.
11
- * Using `nonces` as a fallback until confirmed.
12
- */
13
- declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
14
5
  declare function isMinter(client: PublicClient, pointToken: Address, account: Address): Promise<boolean>;
15
6
  declare function getTokenName(client: PublicClient, pointToken: Address): Promise<string>;
16
7
  declare function getIssuer$1(client: PublicClient, pointToken: Address): Promise<Address>;
@@ -103,4 +94,4 @@ declare function getMintFeeRecipients(client: PublicClient, wrapperAddress: Addr
103
94
  basisPoints: number;
104
95
  }[]>;
105
96
 
106
- export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
97
+ export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap };
@@ -7,14 +7,13 @@ import {
7
7
  getMintRequestNonce,
8
8
  getPointTokenBalance,
9
9
  getPointTokenIssuer,
10
- getReceiverConsentNonce,
11
10
  getTokenCap,
12
11
  getTokenName,
13
12
  isActiveIssuer,
14
13
  isMinter,
15
14
  issuerRegistryGetIssuerFlatAbi,
16
15
  verifyMintCap
17
- } from "../chunk-Y5EYH2SQ.js";
16
+ } from "../chunk-J7EYOLMI.js";
18
17
  import "../chunk-LF5GIN5P.js";
19
18
  import "../chunk-UCO5DXD6.js";
20
19
  import "../chunk-DGUM43GV.js";
@@ -27,7 +26,6 @@ export {
27
26
  getPointTokenBalance,
28
27
  getPointTokenIssuer,
29
28
  getIssuer as getPointTokenIssuerAddress,
30
- getReceiverConsentNonce,
31
29
  getTokenCap,
32
30
  getTokenName,
33
31
  isActiveIssuer,
@@ -8,10 +8,7 @@
8
8
 
9
9
 
10
10
 
11
-
12
-
13
-
14
- var _chunkUTG2UT54cjs = require('../chunk-UTG2UT54.cjs');
11
+ var _chunk4NTU7XGPcjs = require('../chunk-4NTU7XGP.cjs');
15
12
  require('../chunk-KRHGFUDI.cjs');
16
13
  require('../chunk-JEQ2X3Z6.cjs');
17
14
 
@@ -24,8 +21,5 @@ require('../chunk-JEQ2X3Z6.cjs');
24
21
 
25
22
 
26
23
 
27
-
28
-
29
-
30
- exports.Eip712DomainMismatchError = _chunkUTG2UT54cjs.Eip712DomainMismatchError; exports.assertDomainMatchesContract = _chunkUTG2UT54cjs.assertDomainMatchesContract; exports.buildBurnRequestTypedData = _chunkUTG2UT54cjs.buildBurnRequestTypedData; exports.buildDomain = _chunkUTG2UT54cjs.buildDomain; exports.buildMintRequestTypedData = _chunkUTG2UT54cjs.buildMintRequestTypedData; exports.buildReceiverConsentTypedData = _chunkUTG2UT54cjs.buildReceiverConsentTypedData; exports.signBurnRequest = _chunkUTG2UT54cjs.signBurnRequest; exports.signMintRequest = _chunkUTG2UT54cjs.signMintRequest; exports.signReceiverConsent = _chunkUTG2UT54cjs.signReceiverConsent; exports.verifyBurnRequest = _chunkUTG2UT54cjs.verifyBurnRequest; exports.verifyMintRequest = _chunkUTG2UT54cjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkUTG2UT54cjs.verifyReceiverConsent;
24
+ exports.Eip712DomainMismatchError = _chunk4NTU7XGPcjs.Eip712DomainMismatchError; exports.assertDomainMatchesContract = _chunk4NTU7XGPcjs.assertDomainMatchesContract; exports.buildBurnRequestTypedData = _chunk4NTU7XGPcjs.buildBurnRequestTypedData; exports.buildDomain = _chunk4NTU7XGPcjs.buildDomain; exports.buildMintRequestTypedData = _chunk4NTU7XGPcjs.buildMintRequestTypedData; exports.signBurnRequest = _chunk4NTU7XGPcjs.signBurnRequest; exports.signMintRequest = _chunk4NTU7XGPcjs.signMintRequest; exports.verifyBurnRequest = _chunk4NTU7XGPcjs.verifyBurnRequest; exports.verifyMintRequest = _chunk4NTU7XGPcjs.verifyMintRequest;
31
25
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/eip712/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+1BAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/eip712/index.cjs"}
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/eip712/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wnBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/eip712/index.cjs"}
@@ -1,5 +1,5 @@
1
1
  import { PublicClient, WalletClient, Hex, Address } from 'viem';
2
- import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, d as BurnRequest, R as ReceiverConsent } from '../types-DWLZNgcw.cjs';
2
+ import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, d as BurnRequest } from '../types-B3UivyQ1.cjs';
3
3
 
4
4
  /**
5
5
  * Build the EIP-712 domain struct from a PointToken config. Uses
@@ -39,7 +39,7 @@ declare class Eip712DomainMismatchError extends Error {
39
39
  * const expected = buildDomain({
40
40
  * name: "PointToken",
41
41
  * chainId: 8453,
42
- * verifyingContract: "0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e",
42
+ * verifyingContract: "0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22",
43
43
  * });
44
44
  *
45
45
  * await assertDomainMatchesContract(publicClient, expected);
@@ -134,43 +134,4 @@ declare function buildBurnRequestTypedData(domain: PointTokenDomainConfig, messa
134
134
  declare function signBurnRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: BurnRequest): Promise<EIP712Signature>;
135
135
  declare function verifyBurnRequest(domain: PointTokenDomainConfig, message: BurnRequest, signature: Hex, expectedBurner: Address): Promise<SignatureVerification>;
136
136
 
137
- /**
138
- * Build the EIP-712 typed data object for a ReceiverConsent.
139
- * Returns the standard `{ domain, types, primaryType, message }` structure
140
- * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.
141
- */
142
- declare function buildReceiverConsentTypedData(domain: PointTokenDomainConfig, message: ReceiverConsent): {
143
- domain: {
144
- name: string;
145
- version: string;
146
- chainId: number;
147
- verifyingContract: `0x${string}`;
148
- };
149
- types: {
150
- readonly ReceiverConsent: readonly [{
151
- readonly name: "onBehalfOf";
152
- readonly type: "address";
153
- }, {
154
- readonly name: "originalReceiver";
155
- readonly type: "address";
156
- }, {
157
- readonly name: "amount";
158
- readonly type: "uint256";
159
- }, {
160
- readonly name: "nonce";
161
- readonly type: "uint256";
162
- }, {
163
- readonly name: "deadline";
164
- readonly type: "uint256";
165
- }, {
166
- readonly name: "extData";
167
- readonly type: "bytes";
168
- }];
169
- };
170
- primaryType: "ReceiverConsent";
171
- message: ReceiverConsent;
172
- };
173
- declare function signReceiverConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: ReceiverConsent): Promise<EIP712Signature>;
174
- declare function verifyReceiverConsent(domain: PointTokenDomainConfig, message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
175
-
176
- export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent };
137
+ export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, signBurnRequest, signMintRequest, verifyBurnRequest, verifyMintRequest };
@@ -1,5 +1,5 @@
1
1
  import { PublicClient, WalletClient, Hex, Address } from 'viem';
2
- import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, d as BurnRequest, R as ReceiverConsent } from '../types-DWLZNgcw.js';
2
+ import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, d as BurnRequest } from '../types-B3UivyQ1.js';
3
3
 
4
4
  /**
5
5
  * Build the EIP-712 domain struct from a PointToken config. Uses
@@ -39,7 +39,7 @@ declare class Eip712DomainMismatchError extends Error {
39
39
  * const expected = buildDomain({
40
40
  * name: "PointToken",
41
41
  * chainId: 8453,
42
- * verifyingContract: "0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e",
42
+ * verifyingContract: "0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22",
43
43
  * });
44
44
  *
45
45
  * await assertDomainMatchesContract(publicClient, expected);
@@ -134,43 +134,4 @@ declare function buildBurnRequestTypedData(domain: PointTokenDomainConfig, messa
134
134
  declare function signBurnRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: BurnRequest): Promise<EIP712Signature>;
135
135
  declare function verifyBurnRequest(domain: PointTokenDomainConfig, message: BurnRequest, signature: Hex, expectedBurner: Address): Promise<SignatureVerification>;
136
136
 
137
- /**
138
- * Build the EIP-712 typed data object for a ReceiverConsent.
139
- * Returns the standard `{ domain, types, primaryType, message }` structure
140
- * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.
141
- */
142
- declare function buildReceiverConsentTypedData(domain: PointTokenDomainConfig, message: ReceiverConsent): {
143
- domain: {
144
- name: string;
145
- version: string;
146
- chainId: number;
147
- verifyingContract: `0x${string}`;
148
- };
149
- types: {
150
- readonly ReceiverConsent: readonly [{
151
- readonly name: "onBehalfOf";
152
- readonly type: "address";
153
- }, {
154
- readonly name: "originalReceiver";
155
- readonly type: "address";
156
- }, {
157
- readonly name: "amount";
158
- readonly type: "uint256";
159
- }, {
160
- readonly name: "nonce";
161
- readonly type: "uint256";
162
- }, {
163
- readonly name: "deadline";
164
- readonly type: "uint256";
165
- }, {
166
- readonly name: "extData";
167
- readonly type: "bytes";
168
- }];
169
- };
170
- primaryType: "ReceiverConsent";
171
- message: ReceiverConsent;
172
- };
173
- declare function signReceiverConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: ReceiverConsent): Promise<EIP712Signature>;
174
- declare function verifyReceiverConsent(domain: PointTokenDomainConfig, message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
175
-
176
- export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent };
137
+ export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, signBurnRequest, signMintRequest, verifyBurnRequest, verifyMintRequest };
@@ -4,14 +4,11 @@ import {
4
4
  buildBurnRequestTypedData,
5
5
  buildDomain,
6
6
  buildMintRequestTypedData,
7
- buildReceiverConsentTypedData,
8
7
  signBurnRequest,
9
8
  signMintRequest,
10
- signReceiverConsent,
11
9
  verifyBurnRequest,
12
- verifyMintRequest,
13
- verifyReceiverConsent
14
- } from "../chunk-XNVVZVK6.js";
10
+ verifyMintRequest
11
+ } from "../chunk-RVSW7I6U.js";
15
12
  import "../chunk-UCO5DXD6.js";
16
13
  import "../chunk-DGUM43GV.js";
17
14
  export {
@@ -20,12 +17,9 @@ export {
20
17
  buildBurnRequestTypedData,
21
18
  buildDomain,
22
19
  buildMintRequestTypedData,
23
- buildReceiverConsentTypedData,
24
20
  signBurnRequest,
25
21
  signMintRequest,
26
- signReceiverConsent,
27
22
  verifyBurnRequest,
28
- verifyMintRequest,
29
- verifyReceiverConsent
23
+ verifyMintRequest
30
24
  };
31
25
  //# sourceMappingURL=index.js.map