@pafi-dev/core 0.3.0-beta.3 → 0.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-R4L66ZR5.js → chunk-73CQTNLB.js} +10 -1
  2. package/dist/chunk-73CQTNLB.js.map +1 -0
  3. package/dist/{chunk-CWP4PFOP.cjs → chunk-DMW67WBU.cjs} +11 -2
  4. package/dist/chunk-DMW67WBU.cjs.map +1 -0
  5. package/dist/{chunk-C4ZDYG4D.js → chunk-DUY7Z2AI.js} +48 -6
  6. package/dist/chunk-DUY7Z2AI.js.map +1 -0
  7. package/dist/{chunk-FIKTQR7H.js → chunk-I2P3TIP7.js} +2 -2
  8. package/dist/{chunk-BNTVOKYT.cjs → chunk-KJKDLD7N.cjs} +51 -9
  9. package/dist/chunk-KJKDLD7N.cjs.map +1 -0
  10. package/dist/{chunk-CAE2BVKI.cjs → chunk-Z2V525IS.cjs} +6 -6
  11. package/dist/{chunk-CAE2BVKI.cjs.map → chunk-Z2V525IS.cjs.map} +1 -1
  12. package/dist/contract/index.d.cts +1 -1
  13. package/dist/contract/index.d.ts +1 -1
  14. package/dist/eip712/index.cjs +9 -3
  15. package/dist/eip712/index.cjs.map +1 -1
  16. package/dist/eip712/index.d.cts +44 -2
  17. package/dist/eip712/index.d.ts +44 -2
  18. package/dist/eip712/index.js +8 -2
  19. package/dist/{index-BpUYHGu3.d.cts → index-B5OJ9Kcx.d.cts} +1 -1
  20. package/dist/{index-CNALKsH1.d.ts → index-BYL8Nn-n.d.ts} +1 -1
  21. package/dist/index.cjs +78 -86
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +347 -184
  24. package/dist/index.d.ts +347 -184
  25. package/dist/index.js +74 -82
  26. package/dist/index.js.map +1 -1
  27. package/dist/quoting/index.cjs +3 -3
  28. package/dist/quoting/index.d.cts +1 -1
  29. package/dist/quoting/index.d.ts +1 -1
  30. package/dist/quoting/index.js +2 -2
  31. package/dist/relay/index.d.cts +1 -1
  32. package/dist/relay/index.d.ts +1 -1
  33. package/dist/swap/index.d.cts +2 -2
  34. package/dist/swap/index.d.ts +2 -2
  35. package/dist/{types-BDOnH5Le.d.cts → types-DGDlKiDe.d.cts} +8 -1
  36. package/dist/{types-BDOnH5Le.d.ts → types-DGDlKiDe.d.ts} +8 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-BNTVOKYT.cjs.map +0 -1
  39. package/dist/chunk-C4ZDYG4D.js.map +0 -1
  40. package/dist/chunk-CWP4PFOP.cjs.map +0 -1
  41. package/dist/chunk-R4L66ZR5.js.map +0 -1
  42. /package/dist/{chunk-FIKTQR7H.js.map → chunk-I2P3TIP7.js.map} +0 -0
@@ -7,6 +7,14 @@ var mintRequestTypes = {
7
7
  { name: "deadline", type: "uint256" }
8
8
  ]
9
9
  };
10
+ var burnRequestTypes = {
11
+ BurnRequest: [
12
+ { name: "from", type: "address" },
13
+ { name: "amount", type: "uint256" },
14
+ { name: "nonce", type: "uint256" },
15
+ { name: "deadline", type: "uint256" }
16
+ ]
17
+ };
10
18
  var receiverConsentTypes = {
11
19
  ReceiverConsent: [
12
20
  { name: "onBehalfOf", type: "address" },
@@ -61,6 +69,7 @@ var POINT_TOKEN_POOLS = {
61
69
 
62
70
  export {
63
71
  mintRequestTypes,
72
+ burnRequestTypes,
64
73
  receiverConsentTypes,
65
74
  SUPPORTED_CHAINS,
66
75
  V4_QUOTER_ADDRESSES,
@@ -69,4 +78,4 @@ export {
69
78
  COMMON_POOLS,
70
79
  POINT_TOKEN_POOLS
71
80
  };
72
- //# sourceMappingURL=chunk-R4L66ZR5.js.map
81
+ //# sourceMappingURL=chunk-73CQTNLB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\nexport const mintRequestTypes = {\n MintRequest: [\n { name: \"to\", 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\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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"],"mappings":";AAOO,IAAM,mBAAmB;AAAA,EAC9B,aAAa;AAAA,IACX,EAAE,MAAM,MAAM,MAAM,UAAU;AAAA,IAC9B,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,IAAM,mBAAmB;AAAA,EAC9B,aAAa;AAAA,IACX,EAAE,MAAM,QAAQ,MAAM,UAAU;AAAA,IAChC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,IAAM,uBAAuB;AAAA,EAClC,iBAAiB;AAAA,IACf,EAAE,MAAM,cAAc,MAAM,UAAU;AAAA,IACtC,EAAE,MAAM,oBAAoB,MAAM,UAAU;AAAA,IAC5C,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,IACpC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,EACnC;AACF;AAMO,IAAM,mBAAgD;AAAA,EAC3D,MAAM,EAAE,MAAM,OAAO;AACvB;AAEO,IAAM,sBAA+C;AAAA,EAC1D,MAAM;AACR;AAEO,IAAM,6BAAsD;AAAA,EACjE,MAAM;AACR;AAEO,IAAM,gBAAyD;AAAA;AAAA,EAEpE,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEO,IAAM,eAA0C;AAAA;AAAA,EAErD,MAAM;AAAA;AAAA,IAEJ;AAAA,MACE,WAAW;AAAA,MACX,WAAW;AAAA,MACX,KAAK;AAAA,MACL,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA;AAAA,IAEA;AAAA,MACE,WAAW;AAAA,MACX,WAAW;AAAA,MACX,KAAK;AAAA,MACL,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,IAAM,oBAAgE;AAAA;AAE7E;","names":[]}
@@ -7,6 +7,14 @@ var mintRequestTypes = {
7
7
  { name: "deadline", type: "uint256" }
8
8
  ]
9
9
  };
10
+ var burnRequestTypes = {
11
+ BurnRequest: [
12
+ { name: "from", type: "address" },
13
+ { name: "amount", type: "uint256" },
14
+ { name: "nonce", type: "uint256" },
15
+ { name: "deadline", type: "uint256" }
16
+ ]
17
+ };
10
18
  var receiverConsentTypes = {
11
19
  ReceiverConsent: [
12
20
  { name: "onBehalfOf", type: "address" },
@@ -68,5 +76,6 @@ var POINT_TOKEN_POOLS = {
68
76
 
69
77
 
70
78
 
71
- exports.mintRequestTypes = mintRequestTypes; exports.receiverConsentTypes = receiverConsentTypes; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.V4_QUOTER_ADDRESSES = V4_QUOTER_ADDRESSES; exports.UNIVERSAL_ROUTER_ADDRESSES = UNIVERSAL_ROUTER_ADDRESSES; exports.COMMON_TOKENS = COMMON_TOKENS; exports.COMMON_POOLS = COMMON_POOLS; exports.POINT_TOKEN_POOLS = POINT_TOKEN_POOLS;
72
- //# sourceMappingURL=chunk-CWP4PFOP.cjs.map
79
+
80
+ exports.mintRequestTypes = mintRequestTypes; exports.burnRequestTypes = burnRequestTypes; exports.receiverConsentTypes = receiverConsentTypes; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.V4_QUOTER_ADDRESSES = V4_QUOTER_ADDRESSES; exports.UNIVERSAL_ROUTER_ADDRESSES = UNIVERSAL_ROUTER_ADDRESSES; exports.COMMON_TOKENS = COMMON_TOKENS; exports.COMMON_POOLS = COMMON_POOLS; exports.POINT_TOKEN_POOLS = POINT_TOKEN_POOLS;
81
+ //# sourceMappingURL=chunk-DMW67WBU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-DMW67WBU.cjs","../src/constants.ts"],"names":[],"mappings":"AAAA;ACOO,IAAM,iBAAA,EAAmB;AAAA,EAC9B,WAAA,EAAa;AAAA,IACX,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,UAAU,CAAA;AAAA,IAC9B,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,UAAU,CAAA;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,UAAU,CAAA;AAAA,IACjC,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAU;AAAA,EACtC;AACF,CAAA;AAEO,IAAM,iBAAA,EAAmB;AAAA,EAC9B,WAAA,EAAa;AAAA,IACX,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,UAAU,CAAA;AAAA,IAChC,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,UAAU,CAAA;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,UAAU,CAAA;AAAA,IACjC,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAU;AAAA,EACtC;AACF,CAAA;AAEO,IAAM,qBAAA,EAAuB;AAAA,EAClC,eAAA,EAAiB;AAAA,IACf,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,UAAU,CAAA;AAAA,IACtC,EAAE,IAAA,EAAM,kBAAA,EAAoB,IAAA,EAAM,UAAU,CAAA;AAAA,IAC5C,EAAE,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DMW67WBU.cjs","sourcesContent":[null,"import type { Address } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\nexport const mintRequestTypes = {\n MintRequest: [\n { name: \"to\", 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\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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"]}
@@ -1,7 +1,8 @@
1
1
  import {
2
+ burnRequestTypes,
2
3
  mintRequestTypes,
3
4
  receiverConsentTypes
4
- } from "./chunk-R4L66ZR5.js";
5
+ } from "./chunk-73CQTNLB.js";
5
6
 
6
7
  // src/eip712/domain.ts
7
8
  function buildDomain(config) {
@@ -51,8 +52,46 @@ async function verifyMintRequest(domain, message, signature, expectedMinter) {
51
52
  return { isValid, recoveredAddress };
52
53
  }
53
54
 
54
- // src/eip712/receiverConsent.ts
55
+ // src/eip712/burnRequest.ts
55
56
  import { getAddress as getAddress2, parseSignature as parseSignature2, recoverTypedDataAddress as recoverTypedDataAddress2 } from "viem";
57
+ function buildBurnRequestTypedData(domain, message) {
58
+ return {
59
+ domain: buildDomain(domain),
60
+ types: burnRequestTypes,
61
+ primaryType: "BurnRequest",
62
+ message
63
+ };
64
+ }
65
+ async function signBurnRequest(walletClient, domain, message) {
66
+ const serialized = await walletClient.signTypedData({
67
+ account: walletClient.account,
68
+ domain: buildDomain(domain),
69
+ types: burnRequestTypes,
70
+ primaryType: "BurnRequest",
71
+ message
72
+ });
73
+ const { v, r, s } = parseSignature2(serialized);
74
+ return {
75
+ v: Number(v),
76
+ r,
77
+ s,
78
+ serialized
79
+ };
80
+ }
81
+ async function verifyBurnRequest(domain, message, signature, expectedBurner) {
82
+ const recoveredAddress = await recoverTypedDataAddress2({
83
+ domain: buildDomain(domain),
84
+ types: burnRequestTypes,
85
+ primaryType: "BurnRequest",
86
+ message,
87
+ signature
88
+ });
89
+ const isValid = getAddress2(recoveredAddress) === getAddress2(expectedBurner);
90
+ return { isValid, recoveredAddress };
91
+ }
92
+
93
+ // src/eip712/receiverConsent.ts
94
+ import { getAddress as getAddress3, parseSignature as parseSignature3, recoverTypedDataAddress as recoverTypedDataAddress3 } from "viem";
56
95
  function buildReceiverConsentTypedData(domain, message) {
57
96
  return {
58
97
  domain: buildDomain(domain),
@@ -69,7 +108,7 @@ async function signReceiverConsent(walletClient, domain, message) {
69
108
  primaryType: "ReceiverConsent",
70
109
  message
71
110
  });
72
- const { v, r, s } = parseSignature2(serialized);
111
+ const { v, r, s } = parseSignature3(serialized);
73
112
  return {
74
113
  v: Number(v),
75
114
  r,
@@ -78,14 +117,14 @@ async function signReceiverConsent(walletClient, domain, message) {
78
117
  };
79
118
  }
80
119
  async function verifyReceiverConsent(domain, message, signature, expectedReceiver) {
81
- const recoveredAddress = await recoverTypedDataAddress2({
120
+ const recoveredAddress = await recoverTypedDataAddress3({
82
121
  domain: buildDomain(domain),
83
122
  types: receiverConsentTypes,
84
123
  primaryType: "ReceiverConsent",
85
124
  message,
86
125
  signature
87
126
  });
88
- const isValid = getAddress2(recoveredAddress) === getAddress2(expectedReceiver);
127
+ const isValid = getAddress3(recoveredAddress) === getAddress3(expectedReceiver);
89
128
  return { isValid, recoveredAddress };
90
129
  }
91
130
 
@@ -94,8 +133,11 @@ export {
94
133
  buildMintRequestTypedData,
95
134
  signMintRequest,
96
135
  verifyMintRequest,
136
+ buildBurnRequestTypedData,
137
+ signBurnRequest,
138
+ verifyBurnRequest,
97
139
  buildReceiverConsentTypedData,
98
140
  signReceiverConsent,
99
141
  verifyReceiverConsent
100
142
  };
101
- //# sourceMappingURL=chunk-C4ZDYG4D.js.map
143
+ //# sourceMappingURL=chunk-DUY7Z2AI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/eip712/burnRequest.ts","../src/eip712/receiverConsent.ts"],"sourcesContent":["import type { PointTokenDomainConfig } from \"../types\";\n\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: \"1\" as const,\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type { EIP712Signature, MintRequest, PointTokenDomainConfig, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a MintRequest.\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: \"MintRequest\" as const,\n message,\n };\n}\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: \"MintRequest\",\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: \"MintRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\n\n return { isValid, recoveredAddress };\n}\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","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { receiverConsentTypes } from \"../constants\";\nimport type { EIP712Signature, PointTokenDomainConfig, ReceiverConsent, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a ReceiverConsent.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildReceiverConsentTypedData(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n) {\n return {\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\" as const,\n message,\n };\n}\n\nexport async function signReceiverConsent(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\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 verifyReceiverConsent(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n signature: Hex,\n expectedReceiver: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedReceiver);\n\n return { isValid, recoveredAddress };\n}\n"],"mappings":";;;;;;;AAEO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,SAAS;AAAA,IACT,SAAS,OAAO;AAAA,IAChB,mBAAmB,OAAO;AAAA,EAC5B;AACF;;;ACTA,SAAS,YAAY,gBAAgB,+BAA+B;AAW7D,SAAS,0BACd,QACA,SACA;AACA,SAAO;AAAA,IACL,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEA,eAAsB,gBACpB,cACA,QACA,SAC0B;AAC1B,QAAM,aAAa,MAAM,aAAa,cAAc;A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ACA;AAAA,EACF,CAAC;AAED,QAAM,UAAUC,YAAW,gBAAgB,MAAMA,YAAW,cAAc;AAE1E,SAAO,EAAE,SAAS,iBAAiB;AACrC;;;AC7EA,SAAS,cAAAC,aAAY,kBAAAC,iBAAgB,2BAAAC,gCAA+B;AAW7D,SAAS,8BACd,QACA,SACA;AACA,SAAO;AAAA,IACL,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEA,eAAsB,oBACpB,cACA,QACA,SAC0B;AAC1B,QAAM,aAAa,MAAM,aAAa,cAAc;AAAA,IAClD,SAAS,aAAa;AAAA,IACtB,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AAED,QAAM,EAAE,GAAG,GAAG,EAAE,IAAIC,gBAAe,UAAU;AAE7C,SAAO;AAAA,IACL,GAAG,OAAO,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,sBACpB,QACA,SACA,WACA,kBACgC;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,gBAAgB;AAE5E,SAAO,EAAE,SAAS,iBAAiB;AACrC;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress","getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}
@@ -5,7 +5,7 @@ import {
5
5
  COMMON_POOLS,
6
6
  POINT_TOKEN_POOLS,
7
7
  V4_QUOTER_ADDRESSES
8
- } from "./chunk-R4L66ZR5.js";
8
+ } from "./chunk-73CQTNLB.js";
9
9
 
10
10
  // src/quoting/routes.ts
11
11
  var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
@@ -133,4 +133,4 @@ export {
133
133
  quoteBestRoute,
134
134
  findBestQuote
135
135
  };
136
- //# sourceMappingURL=chunk-FIKTQR7H.js.map
136
+ //# sourceMappingURL=chunk-I2P3TIP7.js.map
@@ -1,7 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkCWP4PFOPcjs = require('./chunk-CWP4PFOP.cjs');
4
+
5
+ var _chunkDMW67WBUcjs = require('./chunk-DMW67WBU.cjs');
5
6
 
6
7
  // src/eip712/domain.ts
7
8
  function buildDomain(config) {
@@ -18,7 +19,7 @@ var _viem = require('viem');
18
19
  function buildMintRequestTypedData(domain, message) {
19
20
  return {
20
21
  domain: buildDomain(domain),
21
- types: _chunkCWP4PFOPcjs.mintRequestTypes,
22
+ types: _chunkDMW67WBUcjs.mintRequestTypes,
22
23
  primaryType: "MintRequest",
23
24
  message
24
25
  };
@@ -27,7 +28,7 @@ async function signMintRequest(walletClient, domain, message) {
27
28
  const serialized = await walletClient.signTypedData({
28
29
  account: walletClient.account,
29
30
  domain: buildDomain(domain),
30
- types: _chunkCWP4PFOPcjs.mintRequestTypes,
31
+ types: _chunkDMW67WBUcjs.mintRequestTypes,
31
32
  primaryType: "MintRequest",
32
33
  message
33
34
  });
@@ -42,7 +43,7 @@ async function signMintRequest(walletClient, domain, message) {
42
43
  async function verifyMintRequest(domain, message, signature, expectedMinter) {
43
44
  const recoveredAddress = await _viem.recoverTypedDataAddress.call(void 0, {
44
45
  domain: buildDomain(domain),
45
- types: _chunkCWP4PFOPcjs.mintRequestTypes,
46
+ types: _chunkDMW67WBUcjs.mintRequestTypes,
46
47
  primaryType: "MintRequest",
47
48
  message,
48
49
  signature
@@ -51,12 +52,50 @@ async function verifyMintRequest(domain, message, signature, expectedMinter) {
51
52
  return { isValid, recoveredAddress };
52
53
  }
53
54
 
55
+ // src/eip712/burnRequest.ts
56
+
57
+ function buildBurnRequestTypedData(domain, message) {
58
+ return {
59
+ domain: buildDomain(domain),
60
+ types: _chunkDMW67WBUcjs.burnRequestTypes,
61
+ primaryType: "BurnRequest",
62
+ message
63
+ };
64
+ }
65
+ async function signBurnRequest(walletClient, domain, message) {
66
+ const serialized = await walletClient.signTypedData({
67
+ account: walletClient.account,
68
+ domain: buildDomain(domain),
69
+ types: _chunkDMW67WBUcjs.burnRequestTypes,
70
+ primaryType: "BurnRequest",
71
+ message
72
+ });
73
+ const { v, r, s } = _viem.parseSignature.call(void 0, serialized);
74
+ return {
75
+ v: Number(v),
76
+ r,
77
+ s,
78
+ serialized
79
+ };
80
+ }
81
+ async function verifyBurnRequest(domain, message, signature, expectedBurner) {
82
+ const recoveredAddress = await _viem.recoverTypedDataAddress.call(void 0, {
83
+ domain: buildDomain(domain),
84
+ types: _chunkDMW67WBUcjs.burnRequestTypes,
85
+ primaryType: "BurnRequest",
86
+ message,
87
+ signature
88
+ });
89
+ const isValid = _viem.getAddress.call(void 0, recoveredAddress) === _viem.getAddress.call(void 0, expectedBurner);
90
+ return { isValid, recoveredAddress };
91
+ }
92
+
54
93
  // src/eip712/receiverConsent.ts
55
94
 
56
95
  function buildReceiverConsentTypedData(domain, message) {
57
96
  return {
58
97
  domain: buildDomain(domain),
59
- types: _chunkCWP4PFOPcjs.receiverConsentTypes,
98
+ types: _chunkDMW67WBUcjs.receiverConsentTypes,
60
99
  primaryType: "ReceiverConsent",
61
100
  message
62
101
  };
@@ -65,7 +104,7 @@ async function signReceiverConsent(walletClient, domain, message) {
65
104
  const serialized = await walletClient.signTypedData({
66
105
  account: walletClient.account,
67
106
  domain: buildDomain(domain),
68
- types: _chunkCWP4PFOPcjs.receiverConsentTypes,
107
+ types: _chunkDMW67WBUcjs.receiverConsentTypes,
69
108
  primaryType: "ReceiverConsent",
70
109
  message
71
110
  });
@@ -80,7 +119,7 @@ async function signReceiverConsent(walletClient, domain, message) {
80
119
  async function verifyReceiverConsent(domain, message, signature, expectedReceiver) {
81
120
  const recoveredAddress = await _viem.recoverTypedDataAddress.call(void 0, {
82
121
  domain: buildDomain(domain),
83
- types: _chunkCWP4PFOPcjs.receiverConsentTypes,
122
+ types: _chunkDMW67WBUcjs.receiverConsentTypes,
84
123
  primaryType: "ReceiverConsent",
85
124
  message,
86
125
  signature
@@ -97,5 +136,8 @@ async function verifyReceiverConsent(domain, message, signature, expectedReceive
97
136
 
98
137
 
99
138
 
100
- exports.buildDomain = buildDomain; exports.buildMintRequestTypedData = buildMintRequestTypedData; exports.signMintRequest = signMintRequest; exports.verifyMintRequest = verifyMintRequest; exports.buildReceiverConsentTypedData = buildReceiverConsentTypedData; exports.signReceiverConsent = signReceiverConsent; exports.verifyReceiverConsent = verifyReceiverConsent;
101
- //# sourceMappingURL=chunk-BNTVOKYT.cjs.map
139
+
140
+
141
+
142
+ exports.buildDomain = buildDomain; exports.buildMintRequestTypedData = buildMintRequestTypedData; exports.signMintRequest = signMintRequest; exports.verifyMintRequest = verifyMintRequest; exports.buildBurnRequestTypedData = buildBurnRequestTypedData; exports.signBurnRequest = signBurnRequest; exports.verifyBurnRequest = verifyBurnRequest; exports.buildReceiverConsentTypedData = buildReceiverConsentTypedData; exports.signReceiverConsent = signReceiverConsent; exports.verifyReceiverConsent = verifyReceiverConsent;
143
+ //# sourceMappingURL=chunk-KJKDLD7N.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-KJKDLD7N.cjs","../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/eip712/burnRequest.ts","../src/eip712/receiverConsent.ts"],"names":["parseSignature","recoverTypedDataAddress","getAddress"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACJO,SAAS,WAAA,CAAY,MAAA,EAAgC;AAC1D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA,CAAO,IAAA;AAAA,IACb,OAAA,EAAS,GAAA;AAAA,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A;AACA;AACA;AACA;AACA;AACF,qgBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-KJKDLD7N.cjs","sourcesContent":[null,"import type { PointTokenDomainConfig } from \"../types\";\n\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: \"1\" as const,\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type { EIP712Signature, MintRequest, PointTokenDomainConfig, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a MintRequest.\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: \"MintRequest\" as const,\n message,\n };\n}\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: \"MintRequest\",\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: \"MintRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\n\n return { isValid, recoveredAddress };\n}\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","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { receiverConsentTypes } from \"../constants\";\nimport type { EIP712Signature, PointTokenDomainConfig, ReceiverConsent, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a ReceiverConsent.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildReceiverConsentTypedData(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n) {\n return {\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\" as const,\n message,\n };\n}\n\nexport async function signReceiverConsent(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\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 verifyReceiverConsent(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n signature: Hex,\n expectedReceiver: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedReceiver);\n\n return { isValid, recoveredAddress };\n}\n"]}
@@ -5,13 +5,13 @@ var _chunkCL3QSI4Ocjs = require('./chunk-CL3QSI4O.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkCWP4PFOPcjs = require('./chunk-CWP4PFOP.cjs');
8
+ var _chunkDMW67WBUcjs = require('./chunk-DMW67WBU.cjs');
9
9
 
10
10
  // src/quoting/routes.ts
11
11
  var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
12
12
  function combineRoutes(chainId, pointTokenAddress) {
13
- const commonPools = _nullishCoalesce(_chunkCWP4PFOPcjs.COMMON_POOLS[chainId], () => ( []));
14
- const pointPools = _nullishCoalesce(_optionalChain([_chunkCWP4PFOPcjs.POINT_TOKEN_POOLS, 'access', _ => _[chainId], 'optionalAccess', _2 => _2[pointTokenAddress]]), () => ( []));
13
+ const commonPools = _nullishCoalesce(_chunkDMW67WBUcjs.COMMON_POOLS[chainId], () => ( []));
14
+ const pointPools = _nullishCoalesce(_optionalChain([_chunkDMW67WBUcjs.POINT_TOKEN_POOLS, 'access', _ => _[chainId], 'optionalAccess', _2 => _2[pointTokenAddress]]), () => ( []));
15
15
  return [...pointPools, ...commonPools];
16
16
  }
17
17
  function buildAllPaths(pools, tokenIn, tokenOut, maxHops = 3) {
@@ -112,11 +112,11 @@ async function quoteBestRoute(client, quoterAddress, exactCurrency, routes, exac
112
112
  return { bestRoute, allRoutes };
113
113
  }
114
114
  async function findBestQuote(client, chainId, tokenIn, tokenOut, exactAmount, pools = [], quoterAddress, maxHops = 3) {
115
- const quoter = _nullishCoalesce(quoterAddress, () => ( _chunkCWP4PFOPcjs.V4_QUOTER_ADDRESSES[chainId]));
115
+ const quoter = _nullishCoalesce(quoterAddress, () => ( _chunkDMW67WBUcjs.V4_QUOTER_ADDRESSES[chainId]));
116
116
  if (!quoter) {
117
117
  throw new Error(`No V4 Quoter address configured for chain ${chainId}`);
118
118
  }
119
- const commonPools = _nullishCoalesce(_chunkCWP4PFOPcjs.COMMON_POOLS[chainId], () => ( []));
119
+ const commonPools = _nullishCoalesce(_chunkDMW67WBUcjs.COMMON_POOLS[chainId], () => ( []));
120
120
  const allPools = [...pools, ...commonPools];
121
121
  const paths = buildAllPaths(allPools, tokenIn, tokenOut, maxHops);
122
122
  if (paths.length === 0) {
@@ -133,4 +133,4 @@ async function findBestQuote(client, chainId, tokenIn, tokenOut, exactAmount, po
133
133
 
134
134
 
135
135
  exports.combineRoutes = combineRoutes; exports.buildAllPaths = buildAllPaths; exports.quoteExactInput = quoteExactInput; exports.quoteExactInputSingle = quoteExactInputSingle; exports.quoteBestRoute = quoteBestRoute; exports.findBestQuote = findBestQuote;
136
- //# sourceMappingURL=chunk-CAE2BVKI.cjs.map
136
+ //# sourceMappingURL=chunk-Z2V525IS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-CAE2BVKI.cjs","../src/quoting/routes.ts","../src/quoting/quote.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,IAAM,aAAA,EAAe,4CAAA;AAMd,SAAS,aAAA,CACd,OAAA,EACA,iBAAA,EACW;AACX,EAAA,MAAM,YAAA,mBAAc,8BAAA,CAAa,OAAO,CAAA,UAAK,CAAC,GAAA;AAC9C,EAAA,MAAM,WAAA,mCAAa,mCAAA,mBAAkB,OAAO,CAAA,4BAAA,CAAI,iBAAiB,GAAA,UAAK,CAAC,GAAA;AACvE,EAAA,OAAO,CAAC,GAAG,UAAA,EAAY,GAAG,WAAW,CAAA;AACvC;AAcO,SAAS,aAAA,CACd,KAAA,EACA,OAAA,EACA,QAAA,EACA,QAAA,EAAU,CAAA,EACG;AACb,EAAA,MAAM,QAAA,EAAuB,CAAC,CAAA;AAE9B,EAAA,SAAS,GAAA,CACP,YAAA,EACA,WAAA,EACA,eAAA,EACA;AACA,IAAA,GAAA,CAAI,WAAA,CAAY,OAAA,EAAS,OAAA,EAAS,MAAA;AAGlC,IAAA,GAAA,CACE,WAAA,CAAY,OAAA,EAAS,EAAA,GACrB,YAAA,CAAa,WAAA,CAAY,EAAA,IAAM,QAAA,CAAS,WAAA,CAAY,CAAA,EACpD;AACA,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,GAAG,WAAW,CAAC,CAAA;AAC7B,MAAA,MAAA;AAAA,IACF;AAEA,IAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,KAAA,CAAM,MAAA,EAAQ,CAAA,EAAA,EAAK;AACrC,MAAA,GAAA,CAAI,eAAA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A,EACU;AACpB,EAAA,MAAM,OAAA,mBAAS,aAAA,UAAiB,qCAAA,CAAoB,OAAO,GAAA;AAC3D,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0CAAA,EAA6C,OAAO,CAAA,CAAA;AACtE,EAAA;AAE8C,EAAA;AACJ,EAAA;AACsB,EAAA;AAExC,EAAA;AACyC,IAAA;AACjE,EAAA;AAEiE,EAAA;AACnE;AFjByE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-CAE2BVKI.cjs","sourcesContent":[null,"import type { Address } from \"viem\";\nimport type { PathKey, PoolKey } from \"../types\";\nimport { COMMON_POOLS, POINT_TOKEN_POOLS } from \"../constants\";\n\nconst ZERO_ADDRESS = \"0x0000000000000000000000000000000000000000\" as Address;\n\n/**\n * Combine point-token-specific pools and common pools for a given chain.\n * Point token pools are listed first so callers can prioritise them.\n */\nexport function combineRoutes(\n chainId: number,\n pointTokenAddress: Address,\n): PoolKey[] {\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const pointPools = POINT_TOKEN_POOLS[chainId]?.[pointTokenAddress] ?? [];\n return [...pointPools, ...commonPools];\n}\n\n/**\n * Build all possible swap paths from `tokenIn` to `tokenOut` using the given\n * pools. Returns an array of PathKey[] routes (each up to `maxHops` hops).\n *\n * Supports both direct single-hop routes and multi-hop routes through\n * intermediate tokens. Each pool is used at most once per path.\n *\n * @param pools - Available pools to route through\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param maxHops - Maximum number of hops (default 3)\n */\nexport function buildAllPaths(\n pools: PoolKey[],\n tokenIn: Address,\n tokenOut: Address,\n maxHops = 3,\n): PathKey[][] {\n const results: PathKey[][] = [];\n\n function dfs(\n currentToken: Address,\n currentPath: PathKey[],\n usedPoolIndices: Set<number>,\n ) {\n if (currentPath.length > maxHops) return;\n\n // Check if we've reached the destination\n if (\n currentPath.length > 0 &&\n currentToken.toLowerCase() === tokenOut.toLowerCase()\n ) {\n results.push([...currentPath]);\n return;\n }\n\n for (let i = 0; i < pools.length; i++) {\n if (usedPoolIndices.has(i)) continue;\n\n const pool = pools[i]!;\n const c0 = pool.currency0.toLowerCase();\n const c1 = pool.currency1.toLowerCase();\n const curr = currentToken.toLowerCase();\n\n let nextToken: Address | null = null;\n if (curr === c0) {\n nextToken = pool.currency1 as Address;\n } else if (curr === c1) {\n nextToken = pool.currency0 as Address;\n }\n\n if (!nextToken) continue;\n\n const hop: PathKey = {\n intermediateCurrency: nextToken,\n fee: pool.fee,\n tickSpacing: pool.tickSpacing,\n hooks: pool.hooks ?? ZERO_ADDRESS,\n hookData: \"0x\",\n };\n\n usedPoolIndices.add(i);\n currentPath.push(hop);\n dfs(nextToken, currentPath, usedPoolIndices);\n currentPath.pop();\n usedPoolIndices.delete(i);\n }\n }\n\n dfs(tokenIn, [], new Set());\n return results;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport type { BestQuote, PathKey, PoolKey, QuoteResult } from \"../types\";\nimport { v4QuoterAbi } from \"../abi/v4Quoter\";\nimport { buildAllPaths } from \"./routes\";\nimport { COMMON_POOLS, V4_QUOTER_ADDRESSES } from \"../constants\";\n\n/**\n * Quote exact-input for a multi-hop path.\n */\nexport async function quoteExactInput(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n path: PathKey[],\n exactAmount: bigint,\n): Promise<QuoteResult> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\",\n args: [{ exactCurrency, path, exactAmount: BigInt(exactAmount) as unknown as number }],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate, path };\n}\n\n/**\n * Quote exact-input for a single-hop swap, given an explicit PoolKey and direction.\n */\nexport async function quoteExactInputSingle(\n client: PublicClient,\n quoterAddress: Address,\n poolKey: PoolKey,\n zeroForOne: boolean,\n exactAmount: bigint,\n hookData: `0x${string}`,\n): Promise<{ amountOut: bigint; gasEstimate: bigint }> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInputSingle\",\n args: [\n {\n poolKey,\n zeroForOne,\n exactAmount: BigInt(exactAmount) as unknown as number,\n hookData,\n },\n ],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate };\n}\n\n/**\n * Try multiple PathKey[] routes and return the best quote plus all results.\n * Routes that fail (e.g. pool does not exist) are silently skipped.\n *\n * Uses viem multicall to batch all quotes into a single RPC call for speed.\n */\nexport async function quoteBestRoute(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n routes: PathKey[][],\n exactAmount: bigint,\n): Promise<BestQuote> {\n const results = await client.multicall({\n contracts: routes.map((path) => ({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\" as const,\n args: [\n {\n exactCurrency,\n path,\n exactAmount: BigInt(exactAmount) as unknown as number,\n },\n ],\n })),\n allowFailure: true,\n });\n\n const allRoutes: QuoteResult[] = [];\n for (let i = 0; i < results.length; i++) {\n const r = results[i]!;\n if (r.status === \"success\") {\n const [amountOut, gasEstimate] = r.result as unknown as [bigint, bigint];\n allRoutes.push({ amountOut, gasEstimate, path: routes[i]! });\n }\n }\n\n if (allRoutes.length === 0) {\n throw new Error(\"No valid routes found\");\n }\n\n const bestRoute = allRoutes.reduce((best, current) =>\n current.amountOut > best.amountOut ? current : best,\n );\n\n return { bestRoute, allRoutes };\n}\n\n/**\n * Find and quote the best swap route from `tokenIn` to `tokenOut`.\n *\n * Combines the caller's `pools` with `COMMON_POOLS[chainId]`, builds all\n * possible paths (up to `maxHops`), then quotes them all via a single\n * multicall and returns the best result.\n *\n * @param client - viem PublicClient\n * @param chainId - Chain ID (used to look up COMMON_POOLS and V4_QUOTER_ADDRESSES)\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param exactAmount - Exact input amount\n * @param pools - Additional pools to consider (e.g. point-token-specific)\n * @param quoterAddress - Override the default V4 Quoter address for this chain\n * @param maxHops - Maximum number of hops per path (default 3)\n */\nexport async function findBestQuote(\n client: PublicClient,\n chainId: number,\n tokenIn: Address,\n tokenOut: Address,\n exactAmount: bigint,\n pools: PoolKey[] = [],\n quoterAddress?: Address,\n maxHops = 3,\n): Promise<BestQuote> {\n const quoter = quoterAddress ?? V4_QUOTER_ADDRESSES[chainId];\n if (!quoter) {\n throw new Error(`No V4 Quoter address configured for chain ${chainId}`);\n }\n\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const allPools = [...pools, ...commonPools];\n const paths = buildAllPaths(allPools, tokenIn, tokenOut, maxHops);\n\n if (paths.length === 0) {\n throw new Error(`No paths found from ${tokenIn} to ${tokenOut}`);\n }\n\n return quoteBestRoute(client, quoter, tokenIn, paths, exactAmount);\n}\n"]}
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-Z2V525IS.cjs","../src/quoting/routes.ts","../src/quoting/quote.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,IAAM,aAAA,EAAe,4CAAA;AAMd,SAAS,aAAA,CACd,OAAA,EACA,iBAAA,EACW;AACX,EAAA,MAAM,YAAA,mBAAc,8BAAA,CAAa,OAAO,CAAA,UAAK,CAAC,GAAA;AAC9C,EAAA,MAAM,WAAA,mCAAa,mCAAA,mBAAkB,OAAO,CAAA,4BAAA,CAAI,iBAAiB,GAAA,UAAK,CAAC,GAAA;AACvE,EAAA,OAAO,CAAC,GAAG,UAAA,EAAY,GAAG,WAAW,CAAA;AACvC;AAcO,SAAS,aAAA,CACd,KAAA,EACA,OAAA,EACA,QAAA,EACA,QAAA,EAAU,CAAA,EACG;AACb,EAAA,MAAM,QAAA,EAAuB,CAAC,CAAA;AAE9B,EAAA,SAAS,GAAA,CAC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AAU,OAAA,IAAW,CAAA,EAAG;AAC1B,IAAA,MAAM,IAAI,KAAA,CAAM,uBAAuB,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAA,EAAY,SAAA,CAAU,MAAA;AAAA,IAAO,CAAC,IAAA,EAAM,OAAA,EAAA,GACxC,OAAA,CAAQ,UAAA,EAAY,IAAA,CAAK,UAAA,EAAY,QAAA,EAAU;AAAA,EACjD,CAAA;AAEA,EAAA,OAAO,EAAE,SAAA,EAAW,UAAU,CAAA;AAChC;AAkBA,MAAA,SAAsB,aAAA,CACpB,MAAA,EACA,OAAA,EACA,OAAA,EACA,QAAA,EACA,WAAA,EACA,MAAA,EAAmB,CAAC,CAAA,EACpB,aAAA,EACA,QAAA,EAAU,CAAA,EACU;AACpB,EAAA,MAAM,OAAA,mBAAS,aAAA,UAAiB,qCAAA,CAAoB,OAAO,GAAA;AAC3D,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0CAAA,EAA6C,OAAO,CAAA,CAAA;AACtE,EAAA;AAE8C,EAAA;AACJ,EAAA;AACsB,EAAA;AAExC,EAAA;AACyC,IAAA;AACjE,EAAA;AAEiE,EAAA;AACnE;AFjByE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-Z2V525IS.cjs","sourcesContent":[null,"import type { Address } from \"viem\";\nimport type { PathKey, PoolKey } from \"../types\";\nimport { COMMON_POOLS, POINT_TOKEN_POOLS } from \"../constants\";\n\nconst ZERO_ADDRESS = \"0x0000000000000000000000000000000000000000\" as Address;\n\n/**\n * Combine point-token-specific pools and common pools for a given chain.\n * Point token pools are listed first so callers can prioritise them.\n */\nexport function combineRoutes(\n chainId: number,\n pointTokenAddress: Address,\n): PoolKey[] {\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const pointPools = POINT_TOKEN_POOLS[chainId]?.[pointTokenAddress] ?? [];\n return [...pointPools, ...commonPools];\n}\n\n/**\n * Build all possible swap paths from `tokenIn` to `tokenOut` using the given\n * pools. Returns an array of PathKey[] routes (each up to `maxHops` hops).\n *\n * Supports both direct single-hop routes and multi-hop routes through\n * intermediate tokens. Each pool is used at most once per path.\n *\n * @param pools - Available pools to route through\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param maxHops - Maximum number of hops (default 3)\n */\nexport function buildAllPaths(\n pools: PoolKey[],\n tokenIn: Address,\n tokenOut: Address,\n maxHops = 3,\n): PathKey[][] {\n const results: PathKey[][] = [];\n\n function dfs(\n currentToken: Address,\n currentPath: PathKey[],\n usedPoolIndices: Set<number>,\n ) {\n if (currentPath.length > maxHops) return;\n\n // Check if we've reached the destination\n if (\n currentPath.length > 0 &&\n currentToken.toLowerCase() === tokenOut.toLowerCase()\n ) {\n results.push([...currentPath]);\n return;\n }\n\n for (let i = 0; i < pools.length; i++) {\n if (usedPoolIndices.has(i)) continue;\n\n const pool = pools[i]!;\n const c0 = pool.currency0.toLowerCase();\n const c1 = pool.currency1.toLowerCase();\n const curr = currentToken.toLowerCase();\n\n let nextToken: Address | null = null;\n if (curr === c0) {\n nextToken = pool.currency1 as Address;\n } else if (curr === c1) {\n nextToken = pool.currency0 as Address;\n }\n\n if (!nextToken) continue;\n\n const hop: PathKey = {\n intermediateCurrency: nextToken,\n fee: pool.fee,\n tickSpacing: pool.tickSpacing,\n hooks: pool.hooks ?? ZERO_ADDRESS,\n hookData: \"0x\",\n };\n\n usedPoolIndices.add(i);\n currentPath.push(hop);\n dfs(nextToken, currentPath, usedPoolIndices);\n currentPath.pop();\n usedPoolIndices.delete(i);\n }\n }\n\n dfs(tokenIn, [], new Set());\n return results;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport type { BestQuote, PathKey, PoolKey, QuoteResult } from \"../types\";\nimport { v4QuoterAbi } from \"../abi/v4Quoter\";\nimport { buildAllPaths } from \"./routes\";\nimport { COMMON_POOLS, V4_QUOTER_ADDRESSES } from \"../constants\";\n\n/**\n * Quote exact-input for a multi-hop path.\n */\nexport async function quoteExactInput(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n path: PathKey[],\n exactAmount: bigint,\n): Promise<QuoteResult> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\",\n args: [{ exactCurrency, path, exactAmount: BigInt(exactAmount) as unknown as number }],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate, path };\n}\n\n/**\n * Quote exact-input for a single-hop swap, given an explicit PoolKey and direction.\n */\nexport async function quoteExactInputSingle(\n client: PublicClient,\n quoterAddress: Address,\n poolKey: PoolKey,\n zeroForOne: boolean,\n exactAmount: bigint,\n hookData: `0x${string}`,\n): Promise<{ amountOut: bigint; gasEstimate: bigint }> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInputSingle\",\n args: [\n {\n poolKey,\n zeroForOne,\n exactAmount: BigInt(exactAmount) as unknown as number,\n hookData,\n },\n ],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate };\n}\n\n/**\n * Try multiple PathKey[] routes and return the best quote plus all results.\n * Routes that fail (e.g. pool does not exist) are silently skipped.\n *\n * Uses viem multicall to batch all quotes into a single RPC call for speed.\n */\nexport async function quoteBestRoute(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n routes: PathKey[][],\n exactAmount: bigint,\n): Promise<BestQuote> {\n const results = await client.multicall({\n contracts: routes.map((path) => ({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\" as const,\n args: [\n {\n exactCurrency,\n path,\n exactAmount: BigInt(exactAmount) as unknown as number,\n },\n ],\n })),\n allowFailure: true,\n });\n\n const allRoutes: QuoteResult[] = [];\n for (let i = 0; i < results.length; i++) {\n const r = results[i]!;\n if (r.status === \"success\") {\n const [amountOut, gasEstimate] = r.result as unknown as [bigint, bigint];\n allRoutes.push({ amountOut, gasEstimate, path: routes[i]! });\n }\n }\n\n if (allRoutes.length === 0) {\n throw new Error(\"No valid routes found\");\n }\n\n const bestRoute = allRoutes.reduce((best, current) =>\n current.amountOut > best.amountOut ? current : best,\n );\n\n return { bestRoute, allRoutes };\n}\n\n/**\n * Find and quote the best swap route from `tokenIn` to `tokenOut`.\n *\n * Combines the caller's `pools` with `COMMON_POOLS[chainId]`, builds all\n * possible paths (up to `maxHops`), then quotes them all via a single\n * multicall and returns the best result.\n *\n * @param client - viem PublicClient\n * @param chainId - Chain ID (used to look up COMMON_POOLS and V4_QUOTER_ADDRESSES)\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param exactAmount - Exact input amount\n * @param pools - Additional pools to consider (e.g. point-token-specific)\n * @param quoterAddress - Override the default V4 Quoter address for this chain\n * @param maxHops - Maximum number of hops per path (default 3)\n */\nexport async function findBestQuote(\n client: PublicClient,\n chainId: number,\n tokenIn: Address,\n tokenOut: Address,\n exactAmount: bigint,\n pools: PoolKey[] = [],\n quoterAddress?: Address,\n maxHops = 3,\n): Promise<BestQuote> {\n const quoter = quoterAddress ?? V4_QUOTER_ADDRESSES[chainId];\n if (!quoter) {\n throw new Error(`No V4 Quoter address configured for chain ${chainId}`);\n }\n\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const allPools = [...pools, ...commonPools];\n const paths = buildAllPaths(allPools, tokenIn, tokenOut, maxHops);\n\n if (paths.length === 0) {\n throw new Error(`No paths found from ${tokenIn} to ${tokenOut}`);\n }\n\n return quoteBestRoute(client, quoter, tokenIn, paths, exactAmount);\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { PublicClient, Address } from 'viem';
2
- import { I as Issuer } from '../types-BDOnH5Le.cjs';
2
+ import { I as Issuer } from '../types-DGDlKiDe.cjs';
3
3
 
4
4
  declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
5
5
  declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
@@ -1,5 +1,5 @@
1
1
  import { PublicClient, Address } from 'viem';
2
- import { I as Issuer } from '../types-BDOnH5Le.js';
2
+ import { I as Issuer } from '../types-DGDlKiDe.js';
3
3
 
4
4
  declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
5
5
  declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
@@ -6,15 +6,21 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkBNTVOKYTcjs = require('../chunk-BNTVOKYT.cjs');
10
- require('../chunk-CWP4PFOP.cjs');
11
9
 
12
10
 
13
11
 
12
+ var _chunkKJKDLD7Ncjs = require('../chunk-KJKDLD7N.cjs');
13
+ require('../chunk-DMW67WBU.cjs');
14
14
 
15
15
 
16
16
 
17
17
 
18
18
 
19
- exports.buildDomain = _chunkBNTVOKYTcjs.buildDomain; exports.buildMintRequestTypedData = _chunkBNTVOKYTcjs.buildMintRequestTypedData; exports.buildReceiverConsentTypedData = _chunkBNTVOKYTcjs.buildReceiverConsentTypedData; exports.signMintRequest = _chunkBNTVOKYTcjs.signMintRequest; exports.signReceiverConsent = _chunkBNTVOKYTcjs.signReceiverConsent; exports.verifyMintRequest = _chunkBNTVOKYTcjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkBNTVOKYTcjs.verifyReceiverConsent;
19
+
20
+
21
+
22
+
23
+
24
+
25
+ exports.buildBurnRequestTypedData = _chunkKJKDLD7Ncjs.buildBurnRequestTypedData; exports.buildDomain = _chunkKJKDLD7Ncjs.buildDomain; exports.buildMintRequestTypedData = _chunkKJKDLD7Ncjs.buildMintRequestTypedData; exports.buildReceiverConsentTypedData = _chunkKJKDLD7Ncjs.buildReceiverConsentTypedData; exports.signBurnRequest = _chunkKJKDLD7Ncjs.signBurnRequest; exports.signMintRequest = _chunkKJKDLD7Ncjs.signMintRequest; exports.signReceiverConsent = _chunkKJKDLD7Ncjs.signReceiverConsent; exports.verifyBurnRequest = _chunkKJKDLD7Ncjs.verifyBurnRequest; exports.verifyMintRequest = _chunkKJKDLD7Ncjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkKJKDLD7Ncjs.verifyReceiverConsent;
20
26
  //# 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;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0eAAC","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;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yrBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/eip712/index.cjs"}
@@ -1,4 +1,4 @@
1
- import { a as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, R as ReceiverConsent } from '../types-BDOnH5Le.cjs';
1
+ import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, f as BurnRequest, R as ReceiverConsent } from '../types-DGDlKiDe.cjs';
2
2
  import { WalletClient, Hex, Address } from 'viem';
3
3
 
4
4
  declare function buildDomain(config: PointTokenDomainConfig): {
@@ -41,6 +41,48 @@ declare function buildMintRequestTypedData(domain: PointTokenDomainConfig, messa
41
41
  declare function signMintRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: MintRequest): Promise<EIP712Signature>;
42
42
  declare function verifyMintRequest(domain: PointTokenDomainConfig, message: MintRequest, signature: Hex, expectedMinter: Address): Promise<SignatureVerification>;
43
43
 
44
+ /**
45
+ * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn
46
+ * path on `PointToken`:
47
+ *
48
+ * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)
49
+ *
50
+ * Solidity type hash:
51
+ * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)
52
+ *
53
+ * Issuer backend signs with its burner signer (HSM/KMS). On-chain
54
+ * `msg.sender` must equal `from`, and the recovered signer must be in
55
+ * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is
56
+ * auto-incremented on success.
57
+ */
58
+ declare function buildBurnRequestTypedData(domain: PointTokenDomainConfig, message: BurnRequest): {
59
+ domain: {
60
+ name: string;
61
+ version: "1";
62
+ chainId: number;
63
+ verifyingContract: `0x${string}`;
64
+ };
65
+ types: {
66
+ readonly BurnRequest: readonly [{
67
+ readonly name: "from";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly name: "amount";
71
+ readonly type: "uint256";
72
+ }, {
73
+ readonly name: "nonce";
74
+ readonly type: "uint256";
75
+ }, {
76
+ readonly name: "deadline";
77
+ readonly type: "uint256";
78
+ }];
79
+ };
80
+ primaryType: "BurnRequest";
81
+ message: BurnRequest;
82
+ };
83
+ declare function signBurnRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: BurnRequest): Promise<EIP712Signature>;
84
+ declare function verifyBurnRequest(domain: PointTokenDomainConfig, message: BurnRequest, signature: Hex, expectedBurner: Address): Promise<SignatureVerification>;
85
+
44
86
  /**
45
87
  * Build the EIP-712 typed data object for a ReceiverConsent.
46
88
  * Returns the standard `{ domain, types, primaryType, message }` structure
@@ -80,4 +122,4 @@ declare function buildReceiverConsentTypedData(domain: PointTokenDomainConfig, m
80
122
  declare function signReceiverConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: ReceiverConsent): Promise<EIP712Signature>;
81
123
  declare function verifyReceiverConsent(domain: PointTokenDomainConfig, message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
82
124
 
83
- export { buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signMintRequest, signReceiverConsent, verifyMintRequest, verifyReceiverConsent };
125
+ export { buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent };
@@ -1,4 +1,4 @@
1
- import { a as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, R as ReceiverConsent } from '../types-BDOnH5Le.js';
1
+ import { b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerification, f as BurnRequest, R as ReceiverConsent } from '../types-DGDlKiDe.js';
2
2
  import { WalletClient, Hex, Address } from 'viem';
3
3
 
4
4
  declare function buildDomain(config: PointTokenDomainConfig): {
@@ -41,6 +41,48 @@ declare function buildMintRequestTypedData(domain: PointTokenDomainConfig, messa
41
41
  declare function signMintRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: MintRequest): Promise<EIP712Signature>;
42
42
  declare function verifyMintRequest(domain: PointTokenDomainConfig, message: MintRequest, signature: Hex, expectedMinter: Address): Promise<SignatureVerification>;
43
43
 
44
+ /**
45
+ * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn
46
+ * path on `PointToken`:
47
+ *
48
+ * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)
49
+ *
50
+ * Solidity type hash:
51
+ * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)
52
+ *
53
+ * Issuer backend signs with its burner signer (HSM/KMS). On-chain
54
+ * `msg.sender` must equal `from`, and the recovered signer must be in
55
+ * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is
56
+ * auto-incremented on success.
57
+ */
58
+ declare function buildBurnRequestTypedData(domain: PointTokenDomainConfig, message: BurnRequest): {
59
+ domain: {
60
+ name: string;
61
+ version: "1";
62
+ chainId: number;
63
+ verifyingContract: `0x${string}`;
64
+ };
65
+ types: {
66
+ readonly BurnRequest: readonly [{
67
+ readonly name: "from";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly name: "amount";
71
+ readonly type: "uint256";
72
+ }, {
73
+ readonly name: "nonce";
74
+ readonly type: "uint256";
75
+ }, {
76
+ readonly name: "deadline";
77
+ readonly type: "uint256";
78
+ }];
79
+ };
80
+ primaryType: "BurnRequest";
81
+ message: BurnRequest;
82
+ };
83
+ declare function signBurnRequest(walletClient: WalletClient, domain: PointTokenDomainConfig, message: BurnRequest): Promise<EIP712Signature>;
84
+ declare function verifyBurnRequest(domain: PointTokenDomainConfig, message: BurnRequest, signature: Hex, expectedBurner: Address): Promise<SignatureVerification>;
85
+
44
86
  /**
45
87
  * Build the EIP-712 typed data object for a ReceiverConsent.
46
88
  * Returns the standard `{ domain, types, primaryType, message }` structure
@@ -80,4 +122,4 @@ declare function buildReceiverConsentTypedData(domain: PointTokenDomainConfig, m
80
122
  declare function signReceiverConsent(walletClient: WalletClient, domain: PointTokenDomainConfig, message: ReceiverConsent): Promise<EIP712Signature>;
81
123
  declare function verifyReceiverConsent(domain: PointTokenDomainConfig, message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
82
124
 
83
- export { buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signMintRequest, signReceiverConsent, verifyMintRequest, verifyReceiverConsent };
125
+ export { buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent };