@p2pdotme/sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/country.cjs +611 -0
- package/dist/country.cjs.map +1 -0
- package/dist/country.d.cts +106 -0
- package/dist/country.d.ts +106 -0
- package/dist/country.mjs +571 -0
- package/dist/country.mjs.map +1 -0
- package/dist/fraud-engine.cjs +19 -13
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +19 -13
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +24 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -25
- package/dist/index.d.ts +32 -25
- package/dist/index.mjs +23 -16
- package/dist/index.mjs.map +1 -1
- package/dist/order-routing.cjs +19 -13
- package/dist/order-routing.cjs.map +1 -1
- package/dist/order-routing.mjs +19 -13
- package/dist/order-routing.mjs.map +1 -1
- package/dist/payload.cjs +18 -14
- package/dist/payload.cjs.map +1 -1
- package/dist/payload.d.cts +5 -20
- package/dist/payload.d.ts +5 -20
- package/dist/payload.mjs +18 -14
- package/dist/payload.mjs.map +1 -1
- package/dist/profile.cjs +19 -13
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +3 -27
- package/dist/profile.d.ts +3 -27
- package/dist/profile.mjs +19 -13
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +260 -5
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +10 -1
- package/dist/qr-parsers.d.ts +10 -1
- package/dist/qr-parsers.mjs +260 -5
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +26 -20
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +8 -47
- package/dist/react.d.ts +8 -47
- package/dist/react.mjs +26 -20
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +19 -13
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.mjs +19 -13
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +7 -1
package/dist/profile.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contracts/abis/index.ts","../src/contracts/abis/order-flow-facet.ts","../src/contracts/abis/p2p-config-facet.ts","../src/contracts/abis/reputation-manager.ts","../src/contracts/order-flow/index.ts","../src/validation/errors.ts","../src/validation/schemas.ts","../src/order-routing/validation.ts","../src/contracts/p2p-config/index.ts","../src/profile/errors.ts","../src/profile/validation.ts","../src/contracts/reputation-manager/writes.ts","../src/zkkyc/validation.ts","../src/contracts/tx-limits/index.ts","../src/contracts/usdc/index.ts","../src/profile/contracts/actions.ts","../src/profile/client.ts"],"sourcesContent":["import { erc20Abi } from \"viem\";\nimport { orderFlowFacetAbi } from \"./order-flow-facet\";\nimport { p2pConfigFacetAbi } from \"./p2p-config-facet\";\nimport { reputationManagerAbi } from \"./reputation-manager\";\n\nconst DIAMOND_ABI = [...orderFlowFacetAbi, ...p2pConfigFacetAbi] as const;\n\nexport const ABIS = {\n\tDIAMOND: DIAMOND_ABI,\n\tFACETS: {\n\t\tORDER_FLOW: orderFlowFacetAbi,\n\t\tCONFIG: p2pConfigFacetAbi,\n\t},\n\tEXTERNAL: {\n\t\tUSDC: erc20Abi,\n\t\tREPUTATION_MANAGER: reputationManagerAbi,\n\t},\n} as const;\n","export const orderFlowFacetAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"uint256\", name: \"circleId\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"assignUpto\", type: \"uint256\" },\n\t\t\t{ internalType: \"bytes32\", name: \"currency\", type: \"bytes32\" },\n\t\t\t{ internalType: \"address\", name: \"user\", type: \"address\" },\n\t\t\t{ internalType: \"uint256\", name: \"usdtAmount\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t{ internalType: \"int256\", name: \"orderType\", type: \"int256\" },\n\t\t\t{ internalType: \"uint256\", name: \"preferredPCConfigId\", type: \"uint256\" },\n\t\t],\n\t\tname: \"getAssignableMerchantsFromCircle\",\n\t\toutputs: [{ internalType: \"address[]\", name: \"\", type: \"address[]\" }],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"address\", name: \"_user\", type: \"address\" },\n\t\t\t{ internalType: \"bytes32\", name: \"_nativeCurrency\", type: \"bytes32\" },\n\t\t],\n\t\tname: \"userTxLimit\",\n\t\toutputs: [\n\t\t\t{ internalType: \"uint256\", name: \"\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"\", type: \"uint256\" },\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","export const p2pConfigFacetAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\tname: \"_currency\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tname: \"getPriceConfig\",\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"buyPrice\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"sellPrice\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"int256\",\n\t\t\t\t\t\tname: \"buyPriceOffset\",\n\t\t\t\t\t\ttype: \"int256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"baseSpread\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct P2pConfigStorage.PriceConfig\",\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\tname: \"_nativeCurrency\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tname: \"getRpPerUsdtLimitRational\",\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"numerator\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"denominator\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","export const reputationManagerAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"string\",\n\t\t\t\tname: \"_socialName\",\n\t\t\t\ttype: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"provider\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"parameters\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.ClaimInfo\",\n\t\t\t\t\t\tname: \"claimInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tname: \"identifier\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t\t\t\t\t\tname: \"owner\",\n\t\t\t\t\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint32\",\n\t\t\t\t\t\t\t\t\t\tname: \"timestampS\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint32\",\n\t\t\t\t\t\t\t\t\t\tname: \"epoch\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.CompleteClaimData\",\n\t\t\t\t\t\t\t\tname: \"claim\",\n\t\t\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t\tname: \"signatures\",\n\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.SignedClaim\",\n\t\t\t\t\t\tname: \"signedClaim\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct IReclaimSDK.Proof[]\",\n\t\t\t\tname: \"proofs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t},\n\t\t],\n\t\tname: \"socialVerify\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"nullifierSeed\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"nullifier\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"timestamp\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"signal\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256[4]\",\n\t\t\t\tname: \"revealArray\",\n\t\t\t\ttype: \"uint256[4]\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256[8]\",\n\t\t\t\tname: \"groth16Proof\",\n\t\t\t\ttype: \"uint256[8]\",\n\t\t\t},\n\t\t],\n\t\tname: \"submitAnonAadharProof\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\tname: \"version\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\tname: \"vkeyHash\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\tname: \"proof\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes32[]\",\n\t\t\t\t\t\t\t\tname: \"publicInputs\",\n\t\t\t\t\t\t\t\ttype: \"bytes32[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct ProofVerificationData\",\n\t\t\t\t\t\tname: \"proofVerificationData\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\tname: \"committedInputs\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\tname: \"validityPeriodInSeconds\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"domain\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"scope\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t\t\t\tname: \"devMode\",\n\t\t\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct ServiceConfig\",\n\t\t\t\t\t\tname: \"serviceConfig\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct ProofVerificationParams\",\n\t\t\t\tname: \"params\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"bool\",\n\t\t\t\tname: \"isIDCard\",\n\t\t\t\ttype: \"bool\",\n\t\t\t},\n\t\t],\n\t\tname: \"zkPassportRegister\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","import { ResultAsync } from \"neverthrow\";\nimport type { Address } from \"viem\";\nimport { noopLogger } from \"../../lib\";\nimport { OrderRoutingError } from \"../../order-routing/errors\";\nimport type { CheckCircleEligibilityParams, Logger } from \"../../order-routing/types\";\nimport { ZodCheckCircleEligibilityParamsSchema } from \"../../order-routing/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Checks on-chain eligibility for a given circle by reading assignable merchants. */\nexport function checkCircleEligibility(\n\tpublicClient: PublicClientLike,\n\tcontractAddress: Address,\n\tparams: CheckCircleEligibilityParams,\n\tlogger: Logger = noopLogger,\n): ResultAsync<boolean, OrderRoutingError> {\n\treturn validate(\n\t\tZodCheckCircleEligibilityParamsSchema,\n\t\tparams,\n\t\t(message, cause, d) =>\n\t\t\tnew OrderRoutingError(message, { code: \"VALIDATION_ERROR\", cause, context: { data: d } }),\n\t)\n\t\t.asyncAndThen((validated) => {\n\t\t\tlogger.debug(\"checking on-chain eligibility\", {\n\t\t\t\tcircleId: String(validated.circleId),\n\t\t\t\tcontractAddress,\n\t\t\t});\n\n\t\t\treturn ResultAsync.fromPromise(\n\t\t\t\tpublicClient.readContract({\n\t\t\t\t\taddress: contractAddress,\n\t\t\t\t\tabi: ABIS.FACETS.ORDER_FLOW,\n\t\t\t\t\tfunctionName: \"getAssignableMerchantsFromCircle\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated.circleId,\n\t\t\t\t\t\t1n,\n\t\t\t\t\t\tvalidated.currency,\n\t\t\t\t\t\tvalidated.user as Address,\n\t\t\t\t\t\tvalidated.usdtAmount,\n\t\t\t\t\t\tvalidated.fiatAmount,\n\t\t\t\t\t\tvalidated.orderType,\n\t\t\t\t\t\tvalidated.preferredPCConfigId,\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\t(error) =>\n\t\t\t\t\tnew OrderRoutingError(\"Eligibility check failed\", {\n\t\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\t\tcause: error,\n\t\t\t\t\t\tcontext: { circleId: String(params.circleId) },\n\t\t\t\t\t}),\n\t\t\t);\n\t\t})\n\t\t.map((merchants) => {\n\t\t\tconst arr = merchants as readonly Address[];\n\t\t\tconst eligible = arr.length >= 1;\n\t\t\tlogger.debug(\"eligibility check result\", {\n\t\t\t\tcircleId: String(params.circleId),\n\t\t\t\tassignableMerchants: arr.length,\n\t\t\t\teligible,\n\t\t\t});\n\t\t\treturn eligible;\n\t\t});\n}\n","export class SdkError<TCode extends string = string> extends Error {\n\treadonly code: TCode;\n\treadonly cause?: unknown;\n\treadonly context?: Record<string, unknown>;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: TCode;\n\t\t\tcause?: unknown;\n\t\t\tcontext?: Record<string, unknown>;\n\t\t},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"SdkError\";\n\t\tthis.code = options.code;\n\t\tthis.cause = options.cause;\n\t\tthis.context = options.context;\n\t}\n}\n","import { err, ok, type Result } from \"neverthrow\";\nimport { isAddress } from \"viem\";\nimport { z } from \"zod\";\n\nexport const ZodAddressSchema = z\n\t.string()\n\t.refine((s) => isAddress(s), { message: \"Invalid Ethereum address\" });\n\nexport const ZodCurrencySchema = z.enum([\n\t\"IDR\",\n\t\"INR\",\n\t\"BRL\",\n\t\"ARS\",\n\t\"MEX\",\n\t\"VEN\",\n\t\"EUR\",\n\t\"NGN\",\n\t\"USD\",\n]);\n\nexport type CurrencyType = z.infer<typeof ZodCurrencySchema>;\n\nexport function validate<S extends z.ZodType, E>(\n\tschema: S,\n\tdata: unknown,\n\ttoError: (message: string, cause: unknown, data: unknown) => E,\n): Result<z.infer<S>, E> {\n\tconst result = schema.safeParse(data);\n\tif (result.success) {\n\t\treturn ok(result.data as z.infer<S>);\n\t}\n\treturn err(toError(z.prettifyError(result.error), result.error, data));\n}\n","import { z } from \"zod\";\nimport { ZodAddressSchema } from \"../validation/schemas\";\n\n// ── Circle schemas ──────────────────────────────────────────────────────\n\nexport const ZodCircleScoreStateSchema = z.object({\n\tactiveMerchantsCount: z.coerce.number(),\n});\n\nexport const ZodCircleMetricsForRoutingSchema = z.object({\n\tcircleScore: z.coerce.number(),\n\tcircleStatus: z.string(),\n\tscoreState: ZodCircleScoreStateSchema,\n});\n\nexport const ZodCircleForRoutingSchema = z.object({\n\tcircleId: z.string(),\n\tcurrency: z.string(),\n\tmetrics: ZodCircleMetricsForRoutingSchema,\n});\n\nexport const ZodCirclesForRoutingResponseSchema = z.object({\n\tcircles: z.array(ZodCircleForRoutingSchema),\n});\n\n// ── Eligibility check schema ────────────────────────────────────────────\n\nexport const ZodCheckCircleEligibilityParamsSchema = z.object({\n\tcircleId: z.bigint(),\n\tcurrency: z.string(),\n\tuser: ZodAddressSchema,\n\tusdtAmount: z.bigint(),\n\tfiatAmount: z.bigint(),\n\torderType: z.bigint(),\n\tpreferredPCConfigId: z.bigint(),\n});\n\n// ── Select circle schema ────────────────────────────────────────────────\n\nexport const ZodSelectCircleParamsSchema = z.object({\n\tcurrency: z.string().min(1),\n\tuser: ZodAddressSchema,\n\tusdtAmount: z.bigint(),\n\tfiatAmount: z.bigint(),\n\torderType: z.bigint(),\n\tpreferredPCConfigId: z.bigint(),\n});\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, stringToHex } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { PriceConfig } from \"../../profile/types\";\nimport type { PriceConfigParams } from \"../../profile/validation\";\nimport { ZodPriceConfigParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Reads the price config (buy/sell prices) for a given currency. */\nexport function getPriceConfig(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: PriceConfigParams,\n): ResultAsync<PriceConfig, ProfileError> {\n\treturn validate(\n\t\tZodPriceConfigParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.FACETS.CONFIG,\n\t\t\t\tfunctionName: \"getPriceConfig\",\n\t\t\t\targs: [stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<PriceConfig>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read price config\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t),\n\t);\n}\n","import { SdkError } from \"../validation\";\n\nexport type ProfileErrorCode = \"VALIDATION_ERROR\" | \"CONTRACT_READ_ERROR\";\n\nexport class ProfileError extends SdkError<ProfileErrorCode> {\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: ProfileErrorCode;\n\t\t\tcause?: unknown;\n\t\t\tcontext?: Record<string, unknown>;\n\t\t},\n\t) {\n\t\tsuper(message, options);\n\t\tthis.name = \"ProfileError\";\n\t}\n}\n","import { z } from \"zod\";\nimport { ZodAddressSchema, ZodCurrencySchema } from \"../validation/schemas\";\n\nexport const ZodUsdcBalanceParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n});\n\nexport type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;\n\nexport const ZodGetBalancesParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;\n\nexport const ZodTxLimitsParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;\n\nexport const ZodPriceConfigParamsSchema = z.object({\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;\n","import { Result } from \"neverthrow\";\nimport { type Address, encodeFunctionData } from \"viem\";\nimport { validate } from \"../../validation\";\nimport { ZkkycError } from \"../../zkkyc/errors\";\nimport type {\n\tAnonAadharProofParams,\n\tSocialVerifyParams,\n\tZkPassportRegisterParams,\n} from \"../../zkkyc/validation\";\nimport {\n\tZodAnonAadharProofParamsSchema,\n\tZodSocialVerifyParamsSchema,\n\tZodZkPassportRegisterParamsSchema,\n} from \"../../zkkyc/validation\";\nimport { ABIS } from \"../abis\";\n\n/** Prepares a social verification transaction. */\nexport function prepareSocialVerify(\n\treputationManagerAddress: Address,\n\tparams: SocialVerifyParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodSocialVerifyParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => ({\n\t\t\t\tto: reputationManagerAddress,\n\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\tfunctionName: \"socialVerify\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated._socialName,\n\t\t\t\t\t\tvalidated.proofs.map((proof) => ({\n\t\t\t\t\t\t\t...proof,\n\t\t\t\t\t\t\tsignedClaim: {\n\t\t\t\t\t\t\t\t...proof.signedClaim,\n\t\t\t\t\t\t\t\tclaim: {\n\t\t\t\t\t\t\t\t\t...proof.signedClaim.claim,\n\t\t\t\t\t\t\t\t\tidentifier: proof.signedClaim.claim.identifier as `0x${string}`,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsignatures: proof.signedClaim.signatures as readonly `0x${string}`[],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t}),\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode socialVerify\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n\n/** Prepares a submit anon Aadhaar proof transaction. */\nexport function prepareSubmitAnonAadharProof(\n\treputationManagerAddress: Address,\n\tparams: AnonAadharProofParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodAnonAadharProofParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => ({\n\t\t\t\tto: reputationManagerAddress,\n\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\tfunctionName: \"submitAnonAadharProof\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated.nullifierSeed,\n\t\t\t\t\t\tvalidated.nullifier,\n\t\t\t\t\t\tvalidated.timestamp,\n\t\t\t\t\t\tvalidated.signal,\n\t\t\t\t\t\tvalidated.revealArray,\n\t\t\t\t\t\tvalidated.packedGroth16Proof,\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t}),\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode submitAnonAadharProof\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n\n/** Prepares a zkPassport registration transaction. */\nexport function prepareZkPassportRegister(\n\treputationManagerAddress: Address,\n\tparams: ZkPassportRegisterParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodZkPassportRegisterParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => {\n\t\t\t\tconst { proofVerificationData, serviceConfig, committedInputs, version } = validated.params;\n\n\t\t\t\tconst proofVerificationParams = {\n\t\t\t\t\tversion: version as `0x${string}`,\n\t\t\t\t\tproofVerificationData: {\n\t\t\t\t\t\tvkeyHash: proofVerificationData.vkeyHash as `0x${string}`,\n\t\t\t\t\t\tproof: proofVerificationData.proof as `0x${string}`,\n\t\t\t\t\t\tpublicInputs: proofVerificationData.publicInputs as `0x${string}`[],\n\t\t\t\t\t},\n\t\t\t\t\tcommittedInputs: committedInputs as `0x${string}`,\n\t\t\t\t\tserviceConfig: {\n\t\t\t\t\t\tvalidityPeriodInSeconds: BigInt(serviceConfig.validityPeriodInSeconds),\n\t\t\t\t\t\tdomain: serviceConfig.domain,\n\t\t\t\t\t\tscope: serviceConfig.scope,\n\t\t\t\t\t\tdevMode: serviceConfig.devMode,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tto: reputationManagerAddress,\n\t\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\t\tfunctionName: \"zkPassportRegister\",\n\t\t\t\t\t\targs: [proofVerificationParams, validated.isIDCard],\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\t},\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode zkPassportRegister\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n","import { z } from \"zod\";\nimport { ZodAddressSchema } from \"../validation\";\n\n// ── Write param schemas ──────────────────────────────────────────────────────\n\nexport const ZodAnonAadharProofParamsSchema = z.object({\n\tnullifierSeed: z.bigint(),\n\tnullifier: z.bigint(),\n\ttimestamp: z.bigint(),\n\tsignal: z.bigint(),\n\trevealArray: z.tuple([z.bigint(), z.bigint(), z.bigint(), z.bigint()]),\n\tpackedGroth16Proof: z.tuple([\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t]),\n});\n\nexport type AnonAadharProofParams = z.infer<typeof ZodAnonAadharProofParamsSchema>;\n\nexport const ZodSocialVerifyParamsSchema = z.object({\n\t_socialName: z.string(),\n\tproofs: z.array(\n\t\tz.object({\n\t\t\tclaimInfo: z.object({\n\t\t\t\tprovider: z.string(),\n\t\t\t\tparameters: z.string(),\n\t\t\t\tcontext: z.string(),\n\t\t\t}),\n\t\t\tsignedClaim: z.object({\n\t\t\t\tclaim: z.object({\n\t\t\t\t\tidentifier: z.string(),\n\t\t\t\t\towner: ZodAddressSchema,\n\t\t\t\t\ttimestampS: z.number(),\n\t\t\t\t\tepoch: z.number(),\n\t\t\t\t}),\n\t\t\t\tsignatures: z.array(z.string()),\n\t\t\t}),\n\t\t}),\n\t),\n});\n\nexport type SocialVerifyParams = z.infer<typeof ZodSocialVerifyParamsSchema>;\n\n// Schema matching SolidityVerifierParameters from @zkpassport/sdk (structural definition)\nexport const ZodSolidityVerifierParametersSchema = z.object({\n\tversion: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\tmessage: \"Version must be a hex string\",\n\t}),\n\tproofVerificationData: z.object({\n\t\tvkeyHash: z.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {\n\t\t\tmessage: \"Invalid bytes32 hex string\",\n\t\t}),\n\t\tproof: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\t\tmessage: \"Proof must be a hex string\",\n\t\t}),\n\t\tpublicInputs: z.array(\n\t\t\tz.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {\n\t\t\t\tmessage: \"Each public input must be a valid bytes32 hex string\",\n\t\t\t}),\n\t\t),\n\t}),\n\tcommittedInputs: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\tmessage: \"Committed inputs must be a hex string\",\n\t}),\n\tserviceConfig: z.object({\n\t\tvalidityPeriodInSeconds: z.number().int().nonnegative(),\n\t\tdomain: z.string(),\n\t\tscope: z.string(),\n\t\tdevMode: z.boolean(),\n\t}),\n});\n\nexport type SolidityVerifierParameters = z.infer<typeof ZodSolidityVerifierParametersSchema>;\n\nexport const ZodZkPassportRegisterParamsSchema = z.object({\n\tparams: ZodSolidityVerifierParametersSchema,\n\tisIDCard: z.boolean(),\n});\n\nexport type ZkPassportRegisterParams = z.infer<typeof ZodZkPassportRegisterParamsSchema>;\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, formatUnits, stringToHex } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { PriceConfigParams, TxLimitsParams } from \"../../profile/validation\";\nimport { ZodPriceConfigParamsSchema, ZodTxLimitsParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\nexport interface TxLimits {\n\treadonly buyLimit: number;\n\treadonly sellLimit: number;\n}\n\nexport interface RpPerUsdtLimit {\n\treadonly numerator: bigint;\n\treadonly denominator: bigint;\n\t/** The USDC multiplier per RP: denominator / numerator. */\n\treadonly multiplier: number;\n}\n\n/** Reads the buy and sell transaction limits for a given address and currency. */\nexport function getTxLimits(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: TxLimitsParams,\n): ResultAsync<TxLimits, ProfileError> {\n\treturn validate(\n\t\tZodTxLimitsParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.FACETS.ORDER_FLOW,\n\t\t\t\tfunctionName: \"userTxLimit\",\n\t\t\t\targs: [validated.address, stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<readonly [bigint, bigint]>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read tx limits\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { address: validated.address, currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t).map(([buyLimit, sellLimit]) => ({\n\t\t\tbuyLimit: Number(formatUnits(buyLimit, 6)),\n\t\t\tsellLimit: Number(formatUnits(sellLimit, 6)),\n\t\t})),\n\t);\n}\n/** Reads the RP-to-USDC limit ratio for a given currency from the Diamond contract. */\nexport function getRpPerUsdtLimitRational(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: PriceConfigParams,\n): ResultAsync<RpPerUsdtLimit, ProfileError> {\n\treturn validate(\n\t\tZodPriceConfigParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.DIAMOND,\n\t\t\t\tfunctionName: \"getRpPerUsdtLimitRational\",\n\t\t\t\targs: [stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<readonly [bigint, bigint]>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read RP per USDT limit rational\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t).map(([numerator, denominator]) => ({\n\t\t\tnumerator,\n\t\t\tdenominator,\n\t\t\tmultiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0,\n\t\t})),\n\t);\n}\n","import { ResultAsync } from \"neverthrow\";\nimport type { Address } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { UsdcBalanceParams } from \"../../profile/validation\";\nimport { ZodUsdcBalanceParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Reads the USDC balance for a given address. */\nexport function getUsdcBalance(\n\tpublicClient: PublicClientLike,\n\tusdcAddress: Address,\n\tparams: UsdcBalanceParams,\n): ResultAsync<bigint, ProfileError> {\n\treturn validate(\n\t\tZodUsdcBalanceParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: usdcAddress,\n\t\t\t\tabi: ABIS.EXTERNAL.USDC,\n\t\t\t\tfunctionName: \"balanceOf\",\n\t\t\t\targs: [validated.address],\n\t\t\t}) as Promise<bigint>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read USDC balance\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { address: validated.address, usdcAddress },\n\t\t\t\t}),\n\t\t),\n\t);\n}\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, formatUnits } from \"viem\";\nimport { getPriceConfig, getUsdcBalance } from \"../../contracts\";\nimport { validate } from \"../../validation\";\nimport { ProfileError } from \"../errors\";\nimport type { Balances, GetBalancesParams, PublicClientLike } from \"../types\";\nimport { ZodGetBalancesParamsSchema } from \"../validation\";\n\n/** Fetches USDC balance and fiat equivalent in parallel for a given address and currency. */\nexport function getBalances(\n\tpublicClient: PublicClientLike,\n\tusdcAddress: Address,\n\tdiamondAddress: Address,\n\tparams: GetBalancesParams,\n): ResultAsync<Balances, ProfileError> {\n\treturn validate(\n\t\tZodGetBalancesParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.combine([\n\t\t\tgetUsdcBalance(publicClient, usdcAddress, {\n\t\t\t\taddress: validated.address,\n\t\t\t}),\n\t\t\tgetPriceConfig(publicClient, diamondAddress, {\n\t\t\t\tcurrency: validated.currency,\n\t\t\t}),\n\t\t]).map(([usdc, priceConfig]) => {\n\t\t\tconst usdcFormatted = Number(formatUnits(usdc, 6));\n\t\t\tconst sellPriceFormatted = Number(formatUnits(priceConfig.sellPrice, 6));\n\t\t\treturn {\n\t\t\t\tusdc: usdcFormatted,\n\t\t\t\tfiat: usdcFormatted * sellPriceFormatted,\n\t\t\t\tsellPrice: sellPriceFormatted,\n\t\t\t};\n\t\t}),\n\t);\n}\n","import type { ResultAsync } from \"neverthrow\";\nimport {\n\tgetPriceConfig,\n\tgetRpPerUsdtLimitRational,\n\tgetTxLimits,\n\tgetUsdcBalance,\n} from \"../contracts\";\nimport type { RpPerUsdtLimit, TxLimits } from \"../contracts/tx-limits\";\nimport { getBalances } from \"./contracts\";\nimport type { ProfileError } from \"./errors\";\nimport type {\n\tBalances,\n\tGetBalancesParams,\n\tPriceConfig,\n\tPriceConfigParams,\n\tProfileConfig,\n\tTxLimitsParams,\n\tUsdcBalanceParams,\n} from \"./types\";\n\nexport interface Profile {\n\t/** Reads the USDC balance for a given address (raw bigint, 6 decimals). */\n\tgetUsdcBalance(params: UsdcBalanceParams): ResultAsync<bigint, ProfileError>;\n\n\t/** Reads buy/sell price config for a given currency (raw bigint, 6 decimals). */\n\tgetPriceConfig(params: PriceConfigParams): ResultAsync<PriceConfig, ProfileError>;\n\n\t/** Fetches USDC and fiat balance in parallel for a given address and currency. */\n\tgetBalances(params: GetBalancesParams): ResultAsync<Balances, ProfileError>;\n\n\t/** Reads buy and sell transaction limits for a given address and currency. */\n\tgetTxLimits(params: TxLimitsParams): ResultAsync<TxLimits, ProfileError>;\n\n\t/** Reads the RP-to-USDC limit ratio for a given currency. */\n\tgetRpPerUsdtLimitRational(params: PriceConfigParams): ResultAsync<RpPerUsdtLimit, ProfileError>;\n}\n\n/** Creates a Profile SDK instance for reading account balance and price data. */\nexport function createProfile(config: ProfileConfig): Profile {\n\tconst { publicClient, diamondAddress, usdcAddress } = config;\n\n\treturn {\n\t\tgetUsdcBalance: (params: UsdcBalanceParams) =>\n\t\t\tgetUsdcBalance(publicClient, usdcAddress, params),\n\n\t\tgetPriceConfig: (params: PriceConfigParams) =>\n\t\t\tgetPriceConfig(publicClient, diamondAddress, params),\n\n\t\tgetBalances: (params: GetBalancesParams) =>\n\t\t\tgetBalances(publicClient, usdcAddress, diamondAddress, params),\n\n\t\tgetTxLimits: (params: TxLimitsParams) => getTxLimits(publicClient, diamondAddress, params),\n\n\t\tgetRpPerUsdtLimitRational: (params: PriceConfigParams) =>\n\t\t\tgetRpPerUsdtLimitRational(publicClient, diamondAddress, params),\n\t};\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;;;ACAlB,IAAM,oBAAoB;AAAA,EAChC;AAAA,IACC,QAAQ;AAAA,MACP,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,MAC7D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,MAC7D,EAAE,cAAc,WAAW,MAAM,QAAQ,MAAM,UAAU;AAAA,MACzD,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,UAAU,MAAM,aAAa,MAAM,SAAS;AAAA,MAC5D,EAAE,cAAc,WAAW,MAAM,uBAAuB,MAAM,UAAU;AAAA,IACzE;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,cAAc,aAAa,MAAM,IAAI,MAAM,YAAY,CAAC;AAAA,IACpE,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,QAAQ;AAAA,MACP,EAAE,cAAc,WAAW,MAAM,SAAS,MAAM,UAAU;AAAA,MAC1D,EAAE,cAAc,WAAW,MAAM,mBAAmB,MAAM,UAAU;AAAA,IACrE;AAAA,IACA,MAAM;AAAA,IACN,SAAS;AAAA,MACR,EAAE,cAAc,WAAW,MAAM,IAAI,MAAM,UAAU;AAAA,MACrD,EAAE,cAAc,WAAW,MAAM,IAAI,MAAM,UAAU;AAAA,IACtD;AAAA,IACA,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACP;AACD;;;AC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aAAa,CAAC,WACb,YAAY,cAAc,aAAa,gBAAgB,MAAM;AAAA,IAE9D,aAAa,CAAC,WAA2B,YAAY,cAAc,gBAAgB,MAAM;AAAA,IAEzF,2BAA2B,CAAC,WAC3B,0BAA0B,cAAc,gBAAgB,MAAM;AAAA,EAChE;AACD;","names":["z","z","ResultAsync","z","z","ResultAsync","z","z","ResultAsync","stringToHex","ResultAsync","stringToHex","ResultAsync","ResultAsync","ResultAsync","formatUnits","ResultAsync","formatUnits"]}
|
|
1
|
+
{"version":3,"sources":["../src/contracts/abis/index.ts","../src/contracts/abis/order-flow-facet.ts","../src/contracts/abis/p2p-config-facet.ts","../src/contracts/abis/reputation-manager.ts","../src/contracts/order-flow/index.ts","../src/validation/errors.validation.ts","../src/validation/schemas.validation.ts","../src/constants/currencies.constant.ts","../src/order-routing/validation.ts","../src/contracts/p2p-config/index.ts","../src/profile/errors.ts","../src/profile/validation.ts","../src/contracts/reputation-manager/writes.ts","../src/zkkyc/validation.ts","../src/contracts/tx-limits/index.ts","../src/contracts/usdc/index.ts","../src/profile/contracts/actions.ts","../src/profile/client.ts"],"sourcesContent":["import { erc20Abi } from \"viem\";\nimport { orderFlowFacetAbi } from \"./order-flow-facet\";\nimport { p2pConfigFacetAbi } from \"./p2p-config-facet\";\nimport { reputationManagerAbi } from \"./reputation-manager\";\n\nconst DIAMOND_ABI = [...orderFlowFacetAbi, ...p2pConfigFacetAbi] as const;\n\nexport const ABIS = {\n\tDIAMOND: DIAMOND_ABI,\n\tFACETS: {\n\t\tORDER_FLOW: orderFlowFacetAbi,\n\t\tCONFIG: p2pConfigFacetAbi,\n\t},\n\tEXTERNAL: {\n\t\tUSDC: erc20Abi,\n\t\tREPUTATION_MANAGER: reputationManagerAbi,\n\t},\n} as const;\n","export const orderFlowFacetAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"uint256\", name: \"circleId\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"assignUpto\", type: \"uint256\" },\n\t\t\t{ internalType: \"bytes32\", name: \"currency\", type: \"bytes32\" },\n\t\t\t{ internalType: \"address\", name: \"user\", type: \"address\" },\n\t\t\t{ internalType: \"uint256\", name: \"usdtAmount\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t{ internalType: \"int256\", name: \"orderType\", type: \"int256\" },\n\t\t\t{ internalType: \"uint256\", name: \"preferredPCConfigId\", type: \"uint256\" },\n\t\t],\n\t\tname: \"getAssignableMerchantsFromCircle\",\n\t\toutputs: [{ internalType: \"address[]\", name: \"\", type: \"address[]\" }],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"address\", name: \"_user\", type: \"address\" },\n\t\t\t{ internalType: \"bytes32\", name: \"_nativeCurrency\", type: \"bytes32\" },\n\t\t],\n\t\tname: \"userTxLimit\",\n\t\toutputs: [\n\t\t\t{ internalType: \"uint256\", name: \"\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"\", type: \"uint256\" },\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","export const p2pConfigFacetAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\tname: \"_currency\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tname: \"getPriceConfig\",\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"buyPrice\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"sellPrice\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"int256\",\n\t\t\t\t\t\tname: \"buyPriceOffset\",\n\t\t\t\t\t\ttype: \"int256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\tname: \"baseSpread\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct P2pConfigStorage.PriceConfig\",\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\tname: \"_nativeCurrency\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tname: \"getRpPerUsdtLimitRational\",\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"numerator\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"denominator\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","export const reputationManagerAbi = [\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"string\",\n\t\t\t\tname: \"_socialName\",\n\t\t\t\ttype: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"provider\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"parameters\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.ClaimInfo\",\n\t\t\t\t\t\tname: \"claimInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tname: \"identifier\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t\t\t\t\t\tname: \"owner\",\n\t\t\t\t\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint32\",\n\t\t\t\t\t\t\t\t\t\tname: \"timestampS\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint32\",\n\t\t\t\t\t\t\t\t\t\tname: \"epoch\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.CompleteClaimData\",\n\t\t\t\t\t\t\t\tname: \"claim\",\n\t\t\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t\tname: \"signatures\",\n\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct IReclaimSDK.SignedClaim\",\n\t\t\t\t\t\tname: \"signedClaim\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct IReclaimSDK.Proof[]\",\n\t\t\t\tname: \"proofs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t},\n\t\t],\n\t\tname: \"socialVerify\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"nullifierSeed\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"nullifier\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"timestamp\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t\tname: \"signal\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256[4]\",\n\t\t\t\tname: \"revealArray\",\n\t\t\t\ttype: \"uint256[4]\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"uint256[8]\",\n\t\t\t\tname: \"groth16Proof\",\n\t\t\t\ttype: \"uint256[8]\",\n\t\t\t},\n\t\t],\n\t\tname: \"submitAnonAadharProof\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\tname: \"version\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\tname: \"vkeyHash\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\tname: \"proof\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bytes32[]\",\n\t\t\t\t\t\t\t\tname: \"publicInputs\",\n\t\t\t\t\t\t\t\ttype: \"bytes32[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct ProofVerificationData\",\n\t\t\t\t\t\tname: \"proofVerificationData\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\tname: \"committedInputs\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\tname: \"validityPeriodInSeconds\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"domain\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"string\",\n\t\t\t\t\t\t\t\tname: \"scope\",\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t\t\t\tname: \"devMode\",\n\t\t\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tinternalType: \"struct ServiceConfig\",\n\t\t\t\t\t\tname: \"serviceConfig\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tinternalType: \"struct ProofVerificationParams\",\n\t\t\t\tname: \"params\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tinternalType: \"bool\",\n\t\t\t\tname: \"isIDCard\",\n\t\t\t\ttype: \"bool\",\n\t\t\t},\n\t\t],\n\t\tname: \"zkPassportRegister\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n] as const;\n","import { ResultAsync } from \"neverthrow\";\nimport type { Address } from \"viem\";\nimport { noopLogger } from \"../../lib\";\nimport { OrderRoutingError } from \"../../order-routing/errors\";\nimport type { CheckCircleEligibilityParams, Logger } from \"../../order-routing/types\";\nimport { ZodCheckCircleEligibilityParamsSchema } from \"../../order-routing/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Checks on-chain eligibility for a given circle by reading assignable merchants. */\nexport function checkCircleEligibility(\n\tpublicClient: PublicClientLike,\n\tcontractAddress: Address,\n\tparams: CheckCircleEligibilityParams,\n\tlogger: Logger = noopLogger,\n): ResultAsync<boolean, OrderRoutingError> {\n\treturn validate(\n\t\tZodCheckCircleEligibilityParamsSchema,\n\t\tparams,\n\t\t(message, cause, d) =>\n\t\t\tnew OrderRoutingError(message, { code: \"VALIDATION_ERROR\", cause, context: { data: d } }),\n\t)\n\t\t.asyncAndThen((validated) => {\n\t\t\tlogger.debug(\"checking on-chain eligibility\", {\n\t\t\t\tcircleId: String(validated.circleId),\n\t\t\t\tcontractAddress,\n\t\t\t});\n\n\t\t\treturn ResultAsync.fromPromise(\n\t\t\t\tpublicClient.readContract({\n\t\t\t\t\taddress: contractAddress,\n\t\t\t\t\tabi: ABIS.FACETS.ORDER_FLOW,\n\t\t\t\t\tfunctionName: \"getAssignableMerchantsFromCircle\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated.circleId,\n\t\t\t\t\t\t1n,\n\t\t\t\t\t\tvalidated.currency,\n\t\t\t\t\t\tvalidated.user as Address,\n\t\t\t\t\t\tvalidated.usdtAmount,\n\t\t\t\t\t\tvalidated.fiatAmount,\n\t\t\t\t\t\tvalidated.orderType,\n\t\t\t\t\t\tvalidated.preferredPCConfigId,\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\t(error) =>\n\t\t\t\t\tnew OrderRoutingError(\"Eligibility check failed\", {\n\t\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\t\tcause: error,\n\t\t\t\t\t\tcontext: { circleId: String(params.circleId) },\n\t\t\t\t\t}),\n\t\t\t);\n\t\t})\n\t\t.map((merchants) => {\n\t\t\tconst arr = merchants as readonly Address[];\n\t\t\tconst eligible = arr.length >= 1;\n\t\t\tlogger.debug(\"eligibility check result\", {\n\t\t\t\tcircleId: String(params.circleId),\n\t\t\t\tassignableMerchants: arr.length,\n\t\t\t\teligible,\n\t\t\t});\n\t\t\treturn eligible;\n\t\t});\n}\n","export class SdkError<TCode extends string = string> extends Error {\n\treadonly code: TCode;\n\treadonly cause?: unknown;\n\treadonly context?: Record<string, unknown>;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: TCode;\n\t\t\tcause?: unknown;\n\t\t\tcontext?: Record<string, unknown>;\n\t\t},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"SdkError\";\n\t\tthis.code = options.code;\n\t\tthis.cause = options.cause;\n\t\tthis.context = options.context;\n\t}\n}\n","import { err, ok, type Result } from \"neverthrow\";\nimport { isAddress } from \"viem\";\nimport { z } from \"zod\";\nimport { CURRENCY } from \"../constants\";\n\nexport const ZodAddressSchema = z\n\t.string()\n\t.refine((s) => isAddress(s), { message: \"Invalid Ethereum address\" });\n\nexport const ZodCurrencySchema = z.enum(Object.values(CURRENCY) as [string, ...string[]]);\n\nexport function validate<S extends z.ZodType, E>(\n\tschema: S,\n\tdata: unknown,\n\ttoError: (message: string, cause: unknown, data: unknown) => E,\n): Result<z.infer<S>, E> {\n\tconst result = schema.safeParse(data);\n\tif (result.success) {\n\t\treturn ok(result.data as z.infer<S>);\n\t}\n\treturn err(toError(z.prettifyError(result.error), result.error, data));\n}\n","/** All supported currency symbols. Single source of truth for the SDK. */\nexport const CURRENCY = {\n\tIDR: \"IDR\",\n\tINR: \"INR\",\n\tBRL: \"BRL\",\n\tARS: \"ARS\",\n\tMEX: \"MEX\",\n\tVEN: \"VEN\",\n\tEUR: \"EUR\",\n\tNGN: \"NGN\",\n\tUSD: \"USD\",\n\tCOP: \"COP\",\n} as const;\n","import { z } from \"zod\";\nimport { ZodAddressSchema } from \"../validation/schemas.validation\";\n\n// ── Circle schemas ──────────────────────────────────────────────────────\n\nexport const ZodCircleScoreStateSchema = z.object({\n\tactiveMerchantsCount: z.coerce.number(),\n});\n\nexport const ZodCircleMetricsForRoutingSchema = z.object({\n\tcircleScore: z.coerce.number(),\n\tcircleStatus: z.string(),\n\tscoreState: ZodCircleScoreStateSchema,\n});\n\nexport const ZodCircleForRoutingSchema = z.object({\n\tcircleId: z.string(),\n\tcurrency: z.string(),\n\tmetrics: ZodCircleMetricsForRoutingSchema,\n});\n\nexport const ZodCirclesForRoutingResponseSchema = z.object({\n\tcircles: z.array(ZodCircleForRoutingSchema),\n});\n\n// ── Eligibility check schema ────────────────────────────────────────────\n\nexport const ZodCheckCircleEligibilityParamsSchema = z.object({\n\tcircleId: z.bigint(),\n\tcurrency: z.string(),\n\tuser: ZodAddressSchema,\n\tusdtAmount: z.bigint(),\n\tfiatAmount: z.bigint(),\n\torderType: z.bigint(),\n\tpreferredPCConfigId: z.bigint(),\n});\n\n// ── Select circle schema ────────────────────────────────────────────────\n\nexport const ZodSelectCircleParamsSchema = z.object({\n\tcurrency: z.string().min(1),\n\tuser: ZodAddressSchema,\n\tusdtAmount: z.bigint(),\n\tfiatAmount: z.bigint(),\n\torderType: z.bigint(),\n\tpreferredPCConfigId: z.bigint(),\n});\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, stringToHex } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { PriceConfig } from \"../../profile/types\";\nimport type { PriceConfigParams } from \"../../profile/validation\";\nimport { ZodPriceConfigParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Reads the price config (buy/sell prices) for a given currency. */\nexport function getPriceConfig(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: PriceConfigParams,\n): ResultAsync<PriceConfig, ProfileError> {\n\treturn validate(\n\t\tZodPriceConfigParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.FACETS.CONFIG,\n\t\t\t\tfunctionName: \"getPriceConfig\",\n\t\t\t\targs: [stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<PriceConfig>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read price config\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t),\n\t);\n}\n","import { SdkError } from \"../validation\";\n\nexport type ProfileErrorCode = \"VALIDATION_ERROR\" | \"CONTRACT_READ_ERROR\";\n\nexport class ProfileError extends SdkError<ProfileErrorCode> {\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: ProfileErrorCode;\n\t\t\tcause?: unknown;\n\t\t\tcontext?: Record<string, unknown>;\n\t\t},\n\t) {\n\t\tsuper(message, options);\n\t\tthis.name = \"ProfileError\";\n\t}\n}\n","import { z } from \"zod\";\nimport { ZodAddressSchema, ZodCurrencySchema } from \"../validation/schemas.validation\";\n\nexport const ZodUsdcBalanceParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n});\n\nexport type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;\n\nexport const ZodGetBalancesParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;\n\nexport const ZodTxLimitsParamsSchema = z.object({\n\taddress: ZodAddressSchema,\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;\n\nexport const ZodPriceConfigParamsSchema = z.object({\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;\n","import { Result } from \"neverthrow\";\nimport { type Address, encodeFunctionData } from \"viem\";\nimport { validate } from \"../../validation\";\nimport { ZkkycError } from \"../../zkkyc/errors\";\nimport type {\n\tAnonAadharProofParams,\n\tSocialVerifyParams,\n\tZkPassportRegisterParams,\n} from \"../../zkkyc/validation\";\nimport {\n\tZodAnonAadharProofParamsSchema,\n\tZodSocialVerifyParamsSchema,\n\tZodZkPassportRegisterParamsSchema,\n} from \"../../zkkyc/validation\";\nimport { ABIS } from \"../abis\";\n\n/** Prepares a social verification transaction. */\nexport function prepareSocialVerify(\n\treputationManagerAddress: Address,\n\tparams: SocialVerifyParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodSocialVerifyParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => ({\n\t\t\t\tto: reputationManagerAddress,\n\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\tfunctionName: \"socialVerify\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated._socialName,\n\t\t\t\t\t\tvalidated.proofs.map((proof) => ({\n\t\t\t\t\t\t\t...proof,\n\t\t\t\t\t\t\tsignedClaim: {\n\t\t\t\t\t\t\t\t...proof.signedClaim,\n\t\t\t\t\t\t\t\tclaim: {\n\t\t\t\t\t\t\t\t\t...proof.signedClaim.claim,\n\t\t\t\t\t\t\t\t\tidentifier: proof.signedClaim.claim.identifier as `0x${string}`,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsignatures: proof.signedClaim.signatures as readonly `0x${string}`[],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t}),\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode socialVerify\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n\n/** Prepares a submit anon Aadhaar proof transaction. */\nexport function prepareSubmitAnonAadharProof(\n\treputationManagerAddress: Address,\n\tparams: AnonAadharProofParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodAnonAadharProofParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => ({\n\t\t\t\tto: reputationManagerAddress,\n\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\tfunctionName: \"submitAnonAadharProof\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\tvalidated.nullifierSeed,\n\t\t\t\t\t\tvalidated.nullifier,\n\t\t\t\t\t\tvalidated.timestamp,\n\t\t\t\t\t\tvalidated.signal,\n\t\t\t\t\t\tvalidated.revealArray,\n\t\t\t\t\t\tvalidated.packedGroth16Proof,\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t}),\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode submitAnonAadharProof\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n\n/** Prepares a zkPassport registration transaction. */\nexport function prepareZkPassportRegister(\n\treputationManagerAddress: Address,\n\tparams: ZkPassportRegisterParams,\n): Result<{ to: Address; data: `0x${string}` }, ZkkycError> {\n\treturn validate(\n\t\tZodZkPassportRegisterParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ZkkycError(message, { code: \"VALIDATION_ERROR\", cause, context: { params: data } }),\n\t).andThen((validated) =>\n\t\tResult.fromThrowable(\n\t\t\t() => {\n\t\t\t\tconst { proofVerificationData, serviceConfig, committedInputs, version } = validated.params;\n\n\t\t\t\tconst proofVerificationParams = {\n\t\t\t\t\tversion: version as `0x${string}`,\n\t\t\t\t\tproofVerificationData: {\n\t\t\t\t\t\tvkeyHash: proofVerificationData.vkeyHash as `0x${string}`,\n\t\t\t\t\t\tproof: proofVerificationData.proof as `0x${string}`,\n\t\t\t\t\t\tpublicInputs: proofVerificationData.publicInputs as `0x${string}`[],\n\t\t\t\t\t},\n\t\t\t\t\tcommittedInputs: committedInputs as `0x${string}`,\n\t\t\t\t\tserviceConfig: {\n\t\t\t\t\t\tvalidityPeriodInSeconds: BigInt(serviceConfig.validityPeriodInSeconds),\n\t\t\t\t\t\tdomain: serviceConfig.domain,\n\t\t\t\t\t\tscope: serviceConfig.scope,\n\t\t\t\t\t\tdevMode: serviceConfig.devMode,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tto: reputationManagerAddress,\n\t\t\t\t\tdata: encodeFunctionData({\n\t\t\t\t\t\tabi: ABIS.EXTERNAL.REPUTATION_MANAGER,\n\t\t\t\t\t\tfunctionName: \"zkPassportRegister\",\n\t\t\t\t\t\targs: [proofVerificationParams, validated.isIDCard],\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\t},\n\t\t\t(error) =>\n\t\t\t\tnew ZkkycError(\"Failed to encode zkPassportRegister\", {\n\t\t\t\t\tcode: \"ENCODE_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\t\t)(),\n\t);\n}\n","import { z } from \"zod\";\nimport { ZodAddressSchema } from \"../validation\";\n\n// ── Write param schemas ──────────────────────────────────────────────────────\n\nexport const ZodAnonAadharProofParamsSchema = z.object({\n\tnullifierSeed: z.bigint(),\n\tnullifier: z.bigint(),\n\ttimestamp: z.bigint(),\n\tsignal: z.bigint(),\n\trevealArray: z.tuple([z.bigint(), z.bigint(), z.bigint(), z.bigint()]),\n\tpackedGroth16Proof: z.tuple([\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t\tz.bigint(),\n\t]),\n});\n\nexport type AnonAadharProofParams = z.infer<typeof ZodAnonAadharProofParamsSchema>;\n\nexport const ZodSocialVerifyParamsSchema = z.object({\n\t_socialName: z.string(),\n\tproofs: z.array(\n\t\tz.object({\n\t\t\tclaimInfo: z.object({\n\t\t\t\tprovider: z.string(),\n\t\t\t\tparameters: z.string(),\n\t\t\t\tcontext: z.string(),\n\t\t\t}),\n\t\t\tsignedClaim: z.object({\n\t\t\t\tclaim: z.object({\n\t\t\t\t\tidentifier: z.string(),\n\t\t\t\t\towner: ZodAddressSchema,\n\t\t\t\t\ttimestampS: z.number(),\n\t\t\t\t\tepoch: z.number(),\n\t\t\t\t}),\n\t\t\t\tsignatures: z.array(z.string()),\n\t\t\t}),\n\t\t}),\n\t),\n});\n\nexport type SocialVerifyParams = z.infer<typeof ZodSocialVerifyParamsSchema>;\n\n// Schema matching SolidityVerifierParameters from @zkpassport/sdk (structural definition)\nexport const ZodSolidityVerifierParametersSchema = z.object({\n\tversion: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\tmessage: \"Version must be a hex string\",\n\t}),\n\tproofVerificationData: z.object({\n\t\tvkeyHash: z.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {\n\t\t\tmessage: \"Invalid bytes32 hex string\",\n\t\t}),\n\t\tproof: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\t\tmessage: \"Proof must be a hex string\",\n\t\t}),\n\t\tpublicInputs: z.array(\n\t\t\tz.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {\n\t\t\t\tmessage: \"Each public input must be a valid bytes32 hex string\",\n\t\t\t}),\n\t\t),\n\t}),\n\tcommittedInputs: z.string().refine((val) => val.startsWith(\"0x\"), {\n\t\tmessage: \"Committed inputs must be a hex string\",\n\t}),\n\tserviceConfig: z.object({\n\t\tvalidityPeriodInSeconds: z.number().int().nonnegative(),\n\t\tdomain: z.string(),\n\t\tscope: z.string(),\n\t\tdevMode: z.boolean(),\n\t}),\n});\n\nexport type SolidityVerifierParameters = z.infer<typeof ZodSolidityVerifierParametersSchema>;\n\nexport const ZodZkPassportRegisterParamsSchema = z.object({\n\tparams: ZodSolidityVerifierParametersSchema,\n\tisIDCard: z.boolean(),\n});\n\nexport type ZkPassportRegisterParams = z.infer<typeof ZodZkPassportRegisterParamsSchema>;\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, formatUnits, stringToHex } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { PriceConfigParams, TxLimitsParams } from \"../../profile/validation\";\nimport { ZodPriceConfigParamsSchema, ZodTxLimitsParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\nexport interface TxLimits {\n\treadonly buyLimit: number;\n\treadonly sellLimit: number;\n}\n\nexport interface RpPerUsdtLimit {\n\treadonly numerator: bigint;\n\treadonly denominator: bigint;\n\t/** The USDC multiplier per RP: denominator / numerator. */\n\treadonly multiplier: number;\n}\n\n/** Reads the buy and sell transaction limits for a given address and currency. */\nexport function getTxLimits(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: TxLimitsParams,\n): ResultAsync<TxLimits, ProfileError> {\n\treturn validate(\n\t\tZodTxLimitsParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.FACETS.ORDER_FLOW,\n\t\t\t\tfunctionName: \"userTxLimit\",\n\t\t\t\targs: [validated.address, stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<readonly [bigint, bigint]>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read tx limits\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { address: validated.address, currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t).map(([buyLimit, sellLimit]) => ({\n\t\t\tbuyLimit: Number(formatUnits(buyLimit, 6)),\n\t\t\tsellLimit: Number(formatUnits(sellLimit, 6)),\n\t\t})),\n\t);\n}\n/** Reads the RP-to-USDC limit ratio for a given currency from the Diamond contract. */\nexport function getRpPerUsdtLimitRational(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: PriceConfigParams,\n): ResultAsync<RpPerUsdtLimit, ProfileError> {\n\treturn validate(\n\t\tZodPriceConfigParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: diamondAddress,\n\t\t\t\tabi: ABIS.DIAMOND,\n\t\t\t\tfunctionName: \"getRpPerUsdtLimitRational\",\n\t\t\t\targs: [stringToHex(validated.currency, { size: 32 })],\n\t\t\t}) as Promise<readonly [bigint, bigint]>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read RP per USDT limit rational\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { currency: validated.currency, diamondAddress },\n\t\t\t\t}),\n\t\t).map(([numerator, denominator]) => ({\n\t\t\tnumerator,\n\t\t\tdenominator,\n\t\t\tmultiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0,\n\t\t})),\n\t);\n}\n","import { ResultAsync } from \"neverthrow\";\nimport type { Address } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { UsdcBalanceParams } from \"../../profile/validation\";\nimport { ZodUsdcBalanceParamsSchema } from \"../../profile/validation\";\nimport type { PublicClientLike } from \"../../types\";\nimport { validate } from \"../../validation\";\nimport { ABIS } from \"../abis\";\n\n/** Reads the USDC balance for a given address. */\nexport function getUsdcBalance(\n\tpublicClient: PublicClientLike,\n\tusdcAddress: Address,\n\tparams: UsdcBalanceParams,\n): ResultAsync<bigint, ProfileError> {\n\treturn validate(\n\t\tZodUsdcBalanceParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.fromPromise(\n\t\t\tpublicClient.readContract({\n\t\t\t\taddress: usdcAddress,\n\t\t\t\tabi: ABIS.EXTERNAL.USDC,\n\t\t\t\tfunctionName: \"balanceOf\",\n\t\t\t\targs: [validated.address],\n\t\t\t}) as Promise<bigint>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read USDC balance\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { address: validated.address, usdcAddress },\n\t\t\t\t}),\n\t\t),\n\t);\n}\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, formatUnits } from \"viem\";\nimport { getPriceConfig, getUsdcBalance } from \"../../contracts\";\nimport { validate } from \"../../validation\";\nimport { ProfileError } from \"../errors\";\nimport type { Balances, GetBalancesParams, PublicClientLike } from \"../types\";\nimport { ZodGetBalancesParamsSchema } from \"../validation\";\n\n/** Fetches USDC balance and fiat equivalent in parallel for a given address and currency. */\nexport function getBalances(\n\tpublicClient: PublicClientLike,\n\tusdcAddress: Address,\n\tdiamondAddress: Address,\n\tparams: GetBalancesParams,\n): ResultAsync<Balances, ProfileError> {\n\treturn validate(\n\t\tZodGetBalancesParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew ProfileError(message, {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tcause,\n\t\t\t\tcontext: { params: data },\n\t\t\t}),\n\t).asyncAndThen((validated) =>\n\t\tResultAsync.combine([\n\t\t\tgetUsdcBalance(publicClient, usdcAddress, {\n\t\t\t\taddress: validated.address,\n\t\t\t}),\n\t\t\tgetPriceConfig(publicClient, diamondAddress, {\n\t\t\t\tcurrency: validated.currency,\n\t\t\t}),\n\t\t]).map(([usdc, priceConfig]) => {\n\t\t\tconst usdcFormatted = Number(formatUnits(usdc, 6));\n\t\t\tconst sellPriceFormatted = Number(formatUnits(priceConfig.sellPrice, 6));\n\t\t\treturn {\n\t\t\t\tusdc: usdcFormatted,\n\t\t\t\tfiat: usdcFormatted * sellPriceFormatted,\n\t\t\t\tsellPrice: sellPriceFormatted,\n\t\t\t};\n\t\t}),\n\t);\n}\n","import type { ResultAsync } from \"neverthrow\";\nimport {\n\tgetPriceConfig,\n\tgetRpPerUsdtLimitRational,\n\tgetTxLimits,\n\tgetUsdcBalance,\n} from \"../contracts\";\nimport type { RpPerUsdtLimit, TxLimits } from \"../contracts/tx-limits\";\nimport { getBalances } from \"./contracts\";\nimport type { ProfileError } from \"./errors\";\nimport type {\n\tBalances,\n\tGetBalancesParams,\n\tPriceConfig,\n\tPriceConfigParams,\n\tProfileConfig,\n\tTxLimitsParams,\n\tUsdcBalanceParams,\n} from \"./types\";\n\nexport interface Profile {\n\t/** Reads the USDC balance for a given address (raw bigint, 6 decimals). */\n\tgetUsdcBalance(params: UsdcBalanceParams): ResultAsync<bigint, ProfileError>;\n\n\t/** Reads buy/sell price config for a given currency (raw bigint, 6 decimals). */\n\tgetPriceConfig(params: PriceConfigParams): ResultAsync<PriceConfig, ProfileError>;\n\n\t/** Fetches USDC and fiat balance in parallel for a given address and currency. */\n\tgetBalances(params: GetBalancesParams): ResultAsync<Balances, ProfileError>;\n\n\t/** Reads buy and sell transaction limits for a given address and currency. */\n\tgetTxLimits(params: TxLimitsParams): ResultAsync<TxLimits, ProfileError>;\n\n\t/** Reads the RP-to-USDC limit ratio for a given currency. */\n\tgetRpPerUsdtLimitRational(params: PriceConfigParams): ResultAsync<RpPerUsdtLimit, ProfileError>;\n}\n\n/** Creates a Profile SDK instance for reading account balance and price data. */\nexport function createProfile(config: ProfileConfig): Profile {\n\tconst { publicClient, diamondAddress, usdcAddress } = config;\n\n\treturn {\n\t\tgetUsdcBalance: (params: UsdcBalanceParams) =>\n\t\t\tgetUsdcBalance(publicClient, usdcAddress, params),\n\n\t\tgetPriceConfig: (params: PriceConfigParams) =>\n\t\t\tgetPriceConfig(publicClient, diamondAddress, params),\n\n\t\tgetBalances: (params: GetBalancesParams) =>\n\t\t\tgetBalances(publicClient, usdcAddress, diamondAddress, params),\n\n\t\tgetTxLimits: (params: TxLimitsParams) => getTxLimits(publicClient, diamondAddress, params),\n\n\t\tgetRpPerUsdtLimitRational: (params: PriceConfigParams) =>\n\t\t\tgetRpPerUsdtLimitRational(publicClient, diamondAddress, params),\n\t};\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;;;ACAlB,IAAM,oBAAoB;AAAA,EAChC;AAAA,IACC,QAAQ;AAAA,MACP,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,MAC7D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,MAC7D,EAAE,cAAc,WAAW,MAAM,QAAQ,MAAM,UAAU;AAAA,MACzD,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,MAC/D,EAAE,cAAc,UAAU,MAAM,aAAa,MAAM,SAAS;AAAA,MAC5D,EAAE,cAAc,WAAW,MAAM,uBAAuB,MAAM,UAAU;AAAA,IACzE;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,cAAc,aAAa,MAAM,IAAI,MAAM,YAAY,CAAC;AAAA,IACpE,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACP;AAA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,CAAC,CAAC,MAAM,WAAW,MAAM;AAC/B,YAAM,gBAAgB,OAAOC,aAAY,MAAM,CAAC,CAAC;AACjD,YAAM,qBAAqB,OAAOA,aAAY,YAAY,WAAW,CAAC,CAAC;AACvE,aAAO;AAAA,QACN,MAAM;AAAA,QACN,MAAM,gBAAgB;AAAA,QACtB,WAAW;AAAA,MACZ;AAAA,IACD,CAAC;AAAA,EACF;AACD;;;ACJO,SAAS,cAAc,QAAgC;AAC7D,QAAM,EAAE,cAAc,gBAAgB,YAAY,IAAI;AAEtD,SAAO;AAAA,IACN,gBAAgB,CAAC,WAChB,eAAe,cAAc,aAAa,MAAM;AAAA,IAEjD,gBAAgB,CAAC,WAChB,eAAe,cAAc,gBAAgB,MAAM;AAAA,IAEpD,aAAa,CAAC,WACb,YAAY,cAAc,aAAa,gBAAgB,MAAM;AAAA,IAE9D,aAAa,CAAC,WAA2B,YAAY,cAAc,gBAAgB,MAAM;AAAA,IAEzF,2BAA2B,CAAC,WAC3B,0BAA0B,cAAc,gBAAgB,MAAM;AAAA,EAChE;AACD;","names":["z","z","ResultAsync","z","z","ResultAsync","z","z","ResultAsync","stringToHex","ResultAsync","stringToHex","ResultAsync","ResultAsync","ResultAsync","formatUnits","ResultAsync","formatUnits"]}
|
package/dist/qr-parsers.cjs
CHANGED
|
@@ -39,8 +39,263 @@ var QRParserError = class extends Error {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
// src/constants/currencies.constant.ts
|
|
43
|
+
var CURRENCY = {
|
|
44
|
+
IDR: "IDR",
|
|
45
|
+
INR: "INR",
|
|
46
|
+
BRL: "BRL",
|
|
47
|
+
ARS: "ARS",
|
|
48
|
+
MEX: "MEX",
|
|
49
|
+
VEN: "VEN",
|
|
50
|
+
EUR: "EUR",
|
|
51
|
+
NGN: "NGN",
|
|
52
|
+
USD: "USD",
|
|
53
|
+
COP: "COP"
|
|
54
|
+
};
|
|
55
|
+
|
|
42
56
|
// src/qr-parsers/types.ts
|
|
43
57
|
var import_neverthrow = require("neverthrow");
|
|
58
|
+
|
|
59
|
+
// src/country/currencies/ars.ts
|
|
60
|
+
var ARS_COUNTRY_OPTION = {
|
|
61
|
+
country: "Argentina",
|
|
62
|
+
currency: CURRENCY.ARS,
|
|
63
|
+
symbolNative: "$",
|
|
64
|
+
locale: "es-AR",
|
|
65
|
+
paymentMethod: "ALIAS",
|
|
66
|
+
paymentAddressName: "ALIAS_ID",
|
|
67
|
+
timezone: "America/Argentina/Buenos_Aires",
|
|
68
|
+
timezone_name: "ART",
|
|
69
|
+
flag: "\u{1F1E6}\u{1F1F7}",
|
|
70
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1e6-1f1f7.png",
|
|
71
|
+
phoneCode: "+54",
|
|
72
|
+
telegramSupportChannel: "https://t.me/p2pmeargentina",
|
|
73
|
+
twitterUsername: "p2pmeargentina",
|
|
74
|
+
smsCountryCodes: ["AR"],
|
|
75
|
+
precision: 2,
|
|
76
|
+
isAlpha: false,
|
|
77
|
+
disabled: false,
|
|
78
|
+
disabledPaymentTypes: []
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/country/currencies/brl.ts
|
|
82
|
+
var BRL_COUNTRY_OPTION = {
|
|
83
|
+
country: "Brazil",
|
|
84
|
+
currency: CURRENCY.BRL,
|
|
85
|
+
symbolNative: "R$",
|
|
86
|
+
locale: "pt-BR",
|
|
87
|
+
paymentMethod: "PIX",
|
|
88
|
+
paymentAddressName: "PIX_ID",
|
|
89
|
+
timezone: "America/Sao_Paulo",
|
|
90
|
+
timezone_name: "BRT",
|
|
91
|
+
flag: "\u{1F1E7}\u{1F1F7}",
|
|
92
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1e7-1f1f7.png",
|
|
93
|
+
phoneCode: "+55",
|
|
94
|
+
telegramSupportChannel: "https://t.me/p2pmebrasil",
|
|
95
|
+
twitterUsername: "p2pmebrasil",
|
|
96
|
+
smsCountryCodes: ["BR"],
|
|
97
|
+
precision: 2,
|
|
98
|
+
isAlpha: false,
|
|
99
|
+
disabled: false,
|
|
100
|
+
disabledPaymentTypes: []
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/country/currencies/cop.ts
|
|
104
|
+
var COP_COUNTRY_OPTION = {
|
|
105
|
+
country: "Colombia",
|
|
106
|
+
currency: CURRENCY.COP,
|
|
107
|
+
symbolNative: "$",
|
|
108
|
+
locale: "es-CO",
|
|
109
|
+
paymentMethod: "TRANSFERENCIA",
|
|
110
|
+
paymentAddressName: "ALIAS_TRANSFERENCIA",
|
|
111
|
+
timezone: "America/Bogota",
|
|
112
|
+
timezone_name: "COT",
|
|
113
|
+
flag: "\u{1F1E8}\u{1F1F4}",
|
|
114
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1e8-1f1f4.png",
|
|
115
|
+
phoneCode: "+57",
|
|
116
|
+
telegramSupportChannel: "https://t.me/p2pmeColombia",
|
|
117
|
+
twitterUsername: "p2pmeColombia",
|
|
118
|
+
smsCountryCodes: ["CO"],
|
|
119
|
+
precision: 2,
|
|
120
|
+
isAlpha: true,
|
|
121
|
+
disabled: true,
|
|
122
|
+
disabledPaymentTypes: ["PAY"]
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/country/currencies/eur.ts
|
|
126
|
+
var EUR_COUNTRY_OPTION = {
|
|
127
|
+
country: "Revolut EUR",
|
|
128
|
+
currency: CURRENCY.EUR,
|
|
129
|
+
symbolNative: "\u20AC",
|
|
130
|
+
locale: "de-DE",
|
|
131
|
+
paymentMethod: "REVOLUT",
|
|
132
|
+
paymentAddressName: "REVOLUT_ID",
|
|
133
|
+
timezone: "Europe/Berlin",
|
|
134
|
+
timezone_name: "CET",
|
|
135
|
+
flag: "",
|
|
136
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f310.png",
|
|
137
|
+
phoneCode: "",
|
|
138
|
+
telegramSupportChannel: "https://t.me/P2Pdotme",
|
|
139
|
+
twitterUsername: "P2Pdotme",
|
|
140
|
+
smsCountryCodes: [],
|
|
141
|
+
precision: 2,
|
|
142
|
+
isAlpha: true,
|
|
143
|
+
disabled: false,
|
|
144
|
+
disabledPaymentTypes: ["PAY"]
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/country/currencies/idr.ts
|
|
148
|
+
var IDR_COUNTRY_OPTION = {
|
|
149
|
+
country: "Indonesia",
|
|
150
|
+
currency: CURRENCY.IDR,
|
|
151
|
+
symbolNative: "Rp",
|
|
152
|
+
locale: "id-ID",
|
|
153
|
+
paymentMethod: "QRIS",
|
|
154
|
+
paymentAddressName: "PHONE_NUMBER",
|
|
155
|
+
timezone: "Asia/Jakarta",
|
|
156
|
+
timezone_name: "WIB",
|
|
157
|
+
flag: "\u{1F1EE}\u{1F1E9}",
|
|
158
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1ee-1f1e9.png",
|
|
159
|
+
phoneCode: "+62",
|
|
160
|
+
telegramSupportChannel: "https://t.me/p2pmeindonesia",
|
|
161
|
+
twitterUsername: "p2pdotmeID",
|
|
162
|
+
smsCountryCodes: [],
|
|
163
|
+
precision: 0,
|
|
164
|
+
isAlpha: false,
|
|
165
|
+
disabled: false,
|
|
166
|
+
disabledPaymentTypes: []
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// src/country/currencies/inr.ts
|
|
170
|
+
var INR_COUNTRY_OPTION = {
|
|
171
|
+
country: "India",
|
|
172
|
+
currency: CURRENCY.INR,
|
|
173
|
+
symbolNative: "\u20B9",
|
|
174
|
+
locale: "en-IN",
|
|
175
|
+
paymentMethod: "UPI",
|
|
176
|
+
paymentAddressName: "UPI_ID",
|
|
177
|
+
timezone: "Asia/Kolkata",
|
|
178
|
+
timezone_name: "IST",
|
|
179
|
+
flag: "\u{1F1EE}\u{1F1F3}",
|
|
180
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1ee-1f1f3.png",
|
|
181
|
+
phoneCode: "+91",
|
|
182
|
+
telegramSupportChannel: "https://t.me/P2Pdotme",
|
|
183
|
+
twitterUsername: "P2Pdotme",
|
|
184
|
+
smsCountryCodes: ["IN"],
|
|
185
|
+
precision: 2,
|
|
186
|
+
isAlpha: false,
|
|
187
|
+
disabled: false,
|
|
188
|
+
disabledPaymentTypes: []
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// src/country/currencies/mex.ts
|
|
192
|
+
var MEX_COUNTRY_OPTION = {
|
|
193
|
+
country: "Mexico",
|
|
194
|
+
currency: CURRENCY.MEX,
|
|
195
|
+
internationalFormat: "MXN",
|
|
196
|
+
symbolNative: "Mx",
|
|
197
|
+
locale: "es-MX",
|
|
198
|
+
paymentMethod: "SPEI",
|
|
199
|
+
paymentAddressName: "CLABE_ID",
|
|
200
|
+
timezone: "America/Mexico_City",
|
|
201
|
+
timezone_name: "CST",
|
|
202
|
+
flag: "\u{1F1F2}\u{1F1FD}",
|
|
203
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1f2-1f1fd.png",
|
|
204
|
+
phoneCode: "+52",
|
|
205
|
+
telegramSupportChannel: "https://t.me/p2pmemexico",
|
|
206
|
+
twitterUsername: "p2pmemexico",
|
|
207
|
+
smsCountryCodes: ["MX"],
|
|
208
|
+
precision: 2,
|
|
209
|
+
isAlpha: true,
|
|
210
|
+
disabled: false,
|
|
211
|
+
disabledPaymentTypes: ["PAY"]
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// src/country/currencies/ngn.ts
|
|
215
|
+
var NGN_COUNTRY_OPTION = {
|
|
216
|
+
country: "Nigeria",
|
|
217
|
+
currency: CURRENCY.NGN,
|
|
218
|
+
symbolNative: "\u20A6",
|
|
219
|
+
locale: "en-NG",
|
|
220
|
+
paymentMethod: "NIP",
|
|
221
|
+
paymentAddressName: "ACCOUNT_NUMBER",
|
|
222
|
+
timezone: "Africa/Lagos",
|
|
223
|
+
timezone_name: "WAT",
|
|
224
|
+
flag: "\u{1F1F3}\u{1F1EC}",
|
|
225
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1f3-1f1ec.png",
|
|
226
|
+
phoneCode: "+234",
|
|
227
|
+
telegramSupportChannel: "https://t.me/p2pmeNigeria",
|
|
228
|
+
twitterUsername: "p2pmeNigeria",
|
|
229
|
+
smsCountryCodes: ["NG"],
|
|
230
|
+
precision: 2,
|
|
231
|
+
isAlpha: true,
|
|
232
|
+
disabled: false,
|
|
233
|
+
disabledPaymentTypes: ["PAY"]
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// src/country/currencies/usd.ts
|
|
237
|
+
var USD_COUNTRY_OPTION = {
|
|
238
|
+
country: "Revolut USD",
|
|
239
|
+
currency: CURRENCY.USD,
|
|
240
|
+
symbolNative: "$",
|
|
241
|
+
locale: "en-US",
|
|
242
|
+
paymentMethod: "REVOLUT",
|
|
243
|
+
paymentAddressName: "REVOLUT_ID",
|
|
244
|
+
timezone: "America/New_York",
|
|
245
|
+
timezone_name: "EST",
|
|
246
|
+
flag: "",
|
|
247
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f310.png",
|
|
248
|
+
phoneCode: "+1",
|
|
249
|
+
telegramSupportChannel: "https://t.me/P2Pdotme",
|
|
250
|
+
twitterUsername: "P2Pdotme",
|
|
251
|
+
smsCountryCodes: ["US"],
|
|
252
|
+
precision: 2,
|
|
253
|
+
isAlpha: true,
|
|
254
|
+
disabled: false,
|
|
255
|
+
disabledPaymentTypes: ["PAY"]
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/country/currencies/ven.ts
|
|
259
|
+
var VEN_COUNTRY_OPTION = {
|
|
260
|
+
country: "Venezuela",
|
|
261
|
+
currency: CURRENCY.VEN,
|
|
262
|
+
internationalFormat: "VES",
|
|
263
|
+
symbolNative: "Bs",
|
|
264
|
+
locale: "es-VE",
|
|
265
|
+
paymentMethod: "PAGO_MOVIL",
|
|
266
|
+
paymentAddressName: "PAGO_MOVIL_DETAILS",
|
|
267
|
+
timezone: "America/Caracas",
|
|
268
|
+
timezone_name: "VET",
|
|
269
|
+
flag: "\u{1F1FB}\u{1F1EA}",
|
|
270
|
+
flagUrl: "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f1fb-1f1ea.png",
|
|
271
|
+
phoneCode: "+58",
|
|
272
|
+
telegramSupportChannel: "https://t.me/p2pmevenezuela",
|
|
273
|
+
twitterUsername: "p2pmevenezuela",
|
|
274
|
+
smsCountryCodes: ["VE"],
|
|
275
|
+
precision: 2,
|
|
276
|
+
isAlpha: true,
|
|
277
|
+
disabled: false,
|
|
278
|
+
disabledPaymentTypes: []
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// src/country/countries.ts
|
|
282
|
+
var COUNTRY_OPTIONS = [
|
|
283
|
+
INR_COUNTRY_OPTION,
|
|
284
|
+
IDR_COUNTRY_OPTION,
|
|
285
|
+
BRL_COUNTRY_OPTION,
|
|
286
|
+
ARS_COUNTRY_OPTION,
|
|
287
|
+
MEX_COUNTRY_OPTION,
|
|
288
|
+
VEN_COUNTRY_OPTION,
|
|
289
|
+
NGN_COUNTRY_OPTION,
|
|
290
|
+
COP_COUNTRY_OPTION,
|
|
291
|
+
EUR_COUNTRY_OPTION,
|
|
292
|
+
USD_COUNTRY_OPTION
|
|
293
|
+
];
|
|
294
|
+
|
|
295
|
+
// src/qr-parsers/types.ts
|
|
296
|
+
var SUPPORTED_QR_CURRENCIES = COUNTRY_OPTIONS.filter(
|
|
297
|
+
(c) => !c.disabledPaymentTypes.includes("PAY")
|
|
298
|
+
).map((c) => c.currency);
|
|
44
299
|
function success(data) {
|
|
45
300
|
return (0, import_neverthrow.ok)(data);
|
|
46
301
|
}
|
|
@@ -344,15 +599,15 @@ async function parseQR(qrData, currency, sellPrice, config) {
|
|
|
344
599
|
return failure("INVALID_QR", "QR data is empty or invalid");
|
|
345
600
|
}
|
|
346
601
|
switch (currency) {
|
|
347
|
-
case
|
|
602
|
+
case CURRENCY.INR:
|
|
348
603
|
return parseUPI(qrData, sellPrice);
|
|
349
|
-
case
|
|
604
|
+
case CURRENCY.IDR:
|
|
350
605
|
return parseQRIS(qrData, sellPrice);
|
|
351
|
-
case
|
|
606
|
+
case CURRENCY.BRL:
|
|
352
607
|
return parsePIX(qrData, sellPrice, config ?? {});
|
|
353
|
-
case
|
|
608
|
+
case CURRENCY.ARS:
|
|
354
609
|
return parseMercadoPago(qrData, sellPrice);
|
|
355
|
-
case
|
|
610
|
+
case CURRENCY.VEN:
|
|
356
611
|
return parsePagoMovil(qrData, sellPrice);
|
|
357
612
|
default:
|
|
358
613
|
return failure("INVALID_CURRENCY", `Currency "${currency}" is not supported`);
|