@p2pdotme/sdk 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -41
- package/dist/country.cjs +8 -1
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +35 -10
- package/dist/country.d.ts +35 -10
- package/dist/country.mjs +5 -1
- package/dist/country.mjs.map +1 -1
- package/dist/fraud-engine.cjs +52 -48
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +46 -42
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -36
- package/dist/index.d.ts +41 -36
- package/dist/index.mjs +4 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{payload.cjs → orders.cjs} +2357 -253
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +399 -0
- package/dist/orders.d.ts +399 -0
- package/dist/{payload.mjs → orders.mjs} +2340 -237
- package/dist/orders.mjs.map +1 -0
- package/dist/prices.cjs +1008 -0
- package/dist/prices.cjs.map +1 -0
- package/dist/prices.d.cts +109 -0
- package/dist/prices.d.ts +109 -0
- package/dist/prices.mjs +980 -0
- package/dist/prices.mjs.map +1 -0
- package/dist/profile.cjs +475 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +39 -27
- package/dist/profile.d.ts +39 -27
- package/dist/profile.mjs +468 -62
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +6 -6
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +38 -16
- package/dist/qr-parsers.d.ts +38 -16
- package/dist/qr-parsers.mjs +6 -6
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +2531 -1105
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +384 -104
- package/dist/react.d.ts +384 -104
- package/dist/react.mjs +2417 -992
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +405 -24
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.d.cts +14 -9
- package/dist/zkkyc.d.ts +14 -9
- package/dist/zkkyc.mjs +405 -24
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/order-routing.cjs +0 -888
- package/dist/order-routing.cjs.map +0 -1
- package/dist/order-routing.d.cts +0 -68
- package/dist/order-routing.d.ts +0 -68
- package/dist/order-routing.mjs +0 -860
- package/dist/order-routing.mjs.map +0 -1
- package/dist/payload.cjs.map +0 -1
- package/dist/payload.d.cts +0 -147
- package/dist/payload.d.ts +0 -147
- package/dist/payload.mjs.map +0 -1
package/dist/profile.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/profile/index.ts","../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":["// ── Main entry point ────────────────────────────────────────────────────\n\nexport { createProfile, type Profile } from \"./client\";\n\n// ── Types ───────────────────────────────────────────────────────────────\n\nexport type { RpPerUsdtLimit, TxLimits } from \"../contracts/tx-limits\";\nexport type {\n\tBalances,\n\tGetBalancesParams,\n\tPriceConfig,\n\tPriceConfigParams,\n\tProfileConfig,\n\tPublicClientLike,\n\tTxLimitsParams,\n\tUsdcBalanceParams,\n} from \"./types\";\n\n// ── Errors ──────────────────────────────────────────────────────────────\n\nexport { ProfileError, type ProfileErrorCode } from \"./errors\";\n","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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyB;;;ACAlB,IAAM,oBAAoB;AAAA,EAChC;AAAA,IACC,QAAQ;AAAA,MACP,EAAE,cAAc,W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,YACf,cACA,aACA,gBACA,QACsC;AACtC,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA,CAAC,SAAS,OAAO,SAChB,IAAI,aAAa,SAAS;AAAA,MACzB,MAAM;AAAA,MACN;AAAA,MACA,SAAS,EAAE,QAAQ,KAAK;AAAA,IACzB,CAAC;AAAA,EACH,EAAE;AAAA,IAAa,CAAC,cACf,+BAAY,QAAQ;AAAA,MACnB,eAAe,cAAc,aAAa;AAAA,QACzC,SAAS,UAAU;AAAA,MACpB,CAAC;AAAA,MACD,eAAe,cAAc,gBAAgB;AAAA,QAC5C,UAAU,UAAU;AAAA,MACrB,CAAC;AAAA,IACF,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,WAAW,MAAM;AAC/B,YAAM,gBAAgB,WAAO,0BAAY,MAAM,CAAC,CAAC;AACjD,YAAM,qBAAqB,WAAO,0BAAY,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":["import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_neverthrow","import_neverthrow","import_viem"]}
|
|
1
|
+
{"version":3,"sources":["../src/profile/index.ts","../src/contracts/abis/index.ts","../src/contracts/abis/order-flow-facet.ts","../src/contracts/abis/order-processor-facet.ts","../src/contracts/abis/p2p-config-facet.ts","../src/contracts/abis/reputation-manager.ts","../src/contracts/order-flow/index.ts","../src/lib/subgraph.ts","../src/validation/errors.validation.ts","../src/validation/schemas.validation.ts","../src/country/currency.ts","../src/orders/internal/routing/validation.ts","../src/contracts/order-processor/index.ts","../src/contracts/p2p-config/index.ts","../src/prices/errors.ts","../src/prices/validation.ts","../src/contracts/reputation-manager/writes.ts","../src/zkkyc/validation.ts","../src/contracts/tx-limits/index.ts","../src/profile/errors.ts","../src/profile/validation.ts","../src/contracts/usdc/index.ts","../src/profile/contracts/actions.ts","../src/profile/client.ts"],"sourcesContent":["// ── Main entry point ────────────────────────────────────────────────────\n\nexport { createProfile, type Profile } from \"./client\";\n\n// ── Types ───────────────────────────────────────────────────────────────\n\nexport type { TxLimits } from \"../contracts/tx-limits\";\nexport type {\n\tBalances,\n\tGetBalancesParams,\n\tProfileConfig,\n\tPublicClientLike,\n\tTxLimitsParams,\n\tUsdcAllowanceParams,\n\tUsdcBalanceParams,\n} from \"./types\";\n\n// ── Errors ──────────────────────────────────────────────────────────────\n\nexport { ProfileError, type ProfileErrorCode } from \"./errors\";\n","import { erc20Abi } from \"viem\";\nimport { orderFlowFacetAbi } from \"./order-flow-facet\";\nimport { orderProcessorFacetAbi } from \"./order-processor-facet\";\nimport { p2pConfigFacetAbi } from \"./p2p-config-facet\";\nimport { reputationManagerAbi } from \"./reputation-manager\";\n\nconst DIAMOND_ABI = [\n\t...orderFlowFacetAbi,\n\t...orderProcessorFacetAbi,\n\t...p2pConfigFacetAbi,\n] as const;\n\nexport const ABIS = {\n\tDIAMOND: DIAMOND_ABI,\n\tFACETS: {\n\t\tORDER_FLOW: orderFlowFacetAbi,\n\t\tORDER_PROCESSOR: orderProcessorFacetAbi,\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\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"string\", name: \"_pubKey\", type: \"string\" },\n\t\t\t{ internalType: \"uint256\", name: \"_amount\", type: \"uint256\" },\n\t\t\t{ internalType: \"address\", name: \"_recipientAddr\", type: \"address\" },\n\t\t\t{ internalType: \"uint8\", name: \"_orderType\", type: \"uint8\" },\n\t\t\t{ internalType: \"string\", name: \"_userUpi\", type: \"string\" },\n\t\t\t{ internalType: \"string\", name: \"_userPubKey\", type: \"string\" },\n\t\t\t{ internalType: \"bytes32\", name: \"_currency\", type: \"bytes32\" },\n\t\t\t{ internalType: \"uint256\", name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"_circleId\", type: \"uint256\" },\n\t\t\t{ internalType: \"uint256\", name: \"_fiatAmountLimit\", type: \"uint256\" },\n\t\t],\n\t\tname: \"placeOrder\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [{ internalType: \"uint256\", name: \"_orderId\", type: \"uint256\" }],\n\t\tname: \"cancelOrder\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\tinputs: [\n\t\t\t{ internalType: \"uint256\", name: \"_orderId\", type: \"uint256\" },\n\t\t\t{ internalType: \"string\", name: \"_userEncUpi\", type: \"string\" },\n\t\t\t{ internalType: \"uint256\", name: \"_updatedAmount\", type: \"uint256\" },\n\t\t],\n\t\tname: \"setSellOrderUpi\",\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t\ttype: \"function\",\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderPlaced\",\n\t\tanonymous: false,\n\t\tinputs: [\n\t\t\t{ indexed: true, name: \"orderId\", type: \"uint256\" },\n\t\t\t{ indexed: true, name: \"user\", type: \"address\" },\n\t\t\t{ indexed: true, name: \"merchant\", type: \"address\" },\n\t\t\t{ indexed: false, name: \"amount\", type: \"uint256\" },\n\t\t\t{ indexed: false, name: \"orderType\", type: \"uint8\" },\n\t\t\t{ indexed: false, name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t{\n\t\t\t\tindexed: false,\n\t\t\t\tname: \"_order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderAccepted\",\n\t\tanonymous: false,\n\t\tinputs: [\n\t\t\t{ indexed: true, name: \"orderId\", type: \"uint256\" },\n\t\t\t{ indexed: true, name: \"merchant\", type: \"address\" },\n\t\t\t{ indexed: false, name: \"pubKey\", type: \"string\" },\n\t\t\t{\n\t\t\t\tindexed: false,\n\t\t\t\tname: \"_order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"BuyOrderPaid\",\n\t\tanonymous: false,\n\t\tinputs: [\n\t\t\t{ indexed: true, name: \"orderId\", type: \"uint256\" },\n\t\t\t{ indexed: true, name: \"user\", type: \"address\" },\n\t\t\t{\n\t\t\t\tindexed: false,\n\t\t\t\tname: \"_order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderCompleted\",\n\t\tanonymous: false,\n\t\tinputs: [\n\t\t\t{ indexed: true, name: \"orderId\", type: \"uint256\" },\n\t\t\t{ indexed: true, name: \"user\", type: \"address\" },\n\t\t\t{ indexed: false, name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t{\n\t\t\t\tindexed: false,\n\t\t\t\tname: \"_order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"CancelledOrders\",\n\t\tanonymous: false,\n\t\tinputs: [\n\t\t\t{ indexed: true, name: \"orderId\", type: \"uint256\" },\n\t\t\t{\n\t\t\t\tindexed: false,\n\t\t\t\tname: \"_order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n] as const;\n","/**\n * Minimal ABI fragments for reads on OrderProcessor storage via the Diamond.\n * `getOrdersById`, `getAdditionalOrderDetails`, and the per-currency small-order\n * fee config getters (`getSmallOrderThreshold`, `getSmallOrderFixedFee`).\n */\nexport const orderProcessorFacetAbi = [\n\t{\n\t\ttype: \"function\",\n\t\tname: \"getOrdersById\",\n\t\tstateMutability: \"view\",\n\t\tinputs: [{ name: \"orderId\", type: \"uint256\" }],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"amount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"fiatAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"placedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"completedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userCompletedTimestamp\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"acceptedMerchant\", type: \"address\" },\n\t\t\t\t\t{ name: \"user\", type: \"address\" },\n\t\t\t\t\t{ name: \"recipientAddr\", type: \"address\" },\n\t\t\t\t\t{ name: \"pubkey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"userCompleted\", type: \"bool\" },\n\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t{ name: \"orderType\", type: \"uint8\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"disputeInfo\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{ name: \"raisedBy\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"status\", type: \"uint8\" },\n\t\t\t\t\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t\t\t\t\t\t{ name: \"accountNumber\", type: \"uint256\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ name: \"id\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"userPubKey\", type: \"string\" },\n\t\t\t\t\t{ name: \"encMerchantUpi\", type: \"string\" },\n\t\t\t\t\t{ name: \"acceptedAccountNo\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"assignedAccountNos\", type: \"uint256[]\" },\n\t\t\t\t\t{ name: \"currency\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preferredPaymentChannelConfigId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"circleId\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"getAdditionalOrderDetails\",\n\t\tstateMutability: \"view\",\n\t\tinputs: [{ name: \"orderId\", type: \"uint256\" }],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{ name: \"fixedFeePaid\", type: \"uint64\" },\n\t\t\t\t\t{ name: \"tipsPaid\", type: \"uint64\" },\n\t\t\t\t\t{ name: \"acceptedTimestamp\", type: \"uint128\" },\n\t\t\t\t\t{ name: \"paidTimestamp\", type: \"uint128\" },\n\t\t\t\t\t{ name: \"reserved2\", type: \"uint128\" },\n\t\t\t\t\t{ name: \"actualUsdtAmount\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"actualFiatAmount\", type: \"uint256\" },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"getSmallOrderThreshold\",\n\t\tstateMutability: \"view\",\n\t\tinputs: [{ name: \"currency\", type: \"bytes32\" }],\n\t\toutputs: [{ name: \"\", type: \"uint256\" }],\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"getSmallOrderFixedFee\",\n\t\tstateMutability: \"view\",\n\t\tinputs: [{ name: \"currency\", type: \"bytes32\" }],\n\t\toutputs: [{ name: \"\", type: \"uint256\" }],\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"raiseDispute\",\n\t\tstateMutability: \"nonpayable\",\n\t\tinputs: [\n\t\t\t{ name: \"_orderId\", type: \"uint256\" },\n\t\t\t{ name: \"redactTransId\", type: \"uint256\" },\n\t\t],\n\t\toutputs: [],\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"paidBuyOrder\",\n\t\tstateMutability: \"nonpayable\",\n\t\tinputs: [{ name: \"_orderId\", type: \"uint256\" }],\n\t\toutputs: [],\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 \"../../orders/internal/routing/errors\";\nimport type { CheckCircleEligibilityParams, Logger } from \"../../orders/internal/routing/types\";\nimport { ZodCheckCircleEligibilityParamsSchema } from \"../../orders/internal/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","import { ResultAsync } from \"neverthrow\";\nimport { SdkError } from \"../validation\";\nimport { sleep } from \"./sleep\";\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RETRIES = 3;\nconst BACKOFF_MS = 500;\n\nexport type SubgraphErrorCode = \"HTTP_ERROR\" | \"GRAPHQL_ERROR\" | \"NO_DATA\" | \"TRANSPORT_ERROR\";\n\n/** Transport-level error from the shared subgraph client. Consumers remap to their own domain error. */\nexport class SubgraphError extends SdkError<SubgraphErrorCode> {\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: SubgraphErrorCode;\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 = \"SubgraphError\";\n\t}\n}\n\nexport interface SubgraphQueryParams {\n\treadonly query: string;\n\treadonly variables?: Record<string, unknown>;\n\treadonly timeoutMs?: number;\n}\n\nfunction isTransient(error: unknown): boolean {\n\tif (error instanceof SubgraphError) {\n\t\tif (error.code !== \"HTTP_ERROR\") return false;\n\t\tconst status = (error.context as { status?: number } | undefined)?.status;\n\t\treturn typeof status === \"number\" && status >= 500;\n\t}\n\tif (error instanceof DOMException && error.name === \"AbortError\") return true;\n\tif (error instanceof TypeError) return true;\n\treturn false;\n}\n\n/**\n * POSTs a GraphQL query to `url` with retry + timeout. Returns the `data` field on\n * success. All transport and GraphQL-level failures surface as `SubgraphError`.\n */\nexport function querySubgraph(\n\turl: string,\n\tparams: SubgraphQueryParams,\n): ResultAsync<unknown, SubgraphError> {\n\tconst timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n\n\tconst fetchOnce = async () => {\n\t\tconst controller = new AbortController();\n\t\tconst timer = setTimeout(() => controller.abort(), timeoutMs);\n\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tquery: params.query,\n\t\t\t\t\tvariables: params.variables,\n\t\t\t\t}),\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new SubgraphError(`Subgraph request failed (status: ${response.status})`, {\n\t\t\t\t\tcode: \"HTTP_ERROR\",\n\t\t\t\t\tcause: response,\n\t\t\t\t\tcontext: { status: response.status },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst json = await response.json();\n\n\t\t\tif (json.errors?.length > 0) {\n\t\t\t\tthrow new SubgraphError(\"Subgraph returned GraphQL errors\", {\n\t\t\t\t\tcode: \"GRAPHQL_ERROR\",\n\t\t\t\t\tcause: json.errors,\n\t\t\t\t\tcontext: { errors: json.errors },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!json.data) {\n\t\t\t\tthrow new SubgraphError(\"Subgraph returned no data\", {\n\t\t\t\t\tcode: \"NO_DATA\",\n\t\t\t\t\tcause: \"Missing data field in GraphQL response\",\n\t\t\t\t\tcontext: { response: json },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn json.data;\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t};\n\n\tconst fetchWithRetry = async () => {\n\t\tfor (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n\t\t\ttry {\n\t\t\t\treturn await fetchOnce();\n\t\t\t} catch (error) {\n\t\t\t\tconst lastAttempt = attempt === MAX_RETRIES;\n\t\t\t\tif (lastAttempt || !isTransient(error)) throw error;\n\t\t\t\tawait sleep(BACKOFF_MS * (attempt + 1));\n\t\t\t}\n\t\t}\n\t\tthrow new SubgraphError(\"Subgraph query exhausted retries\", { code: \"TRANSPORT_ERROR\" });\n\t};\n\n\treturn ResultAsync.fromPromise(fetchWithRetry(), (error) =>\n\t\terror instanceof SubgraphError\n\t\t\t? error\n\t\t\t: new SubgraphError(\"Subgraph query failed\", {\n\t\t\t\t\tcode: \"TRANSPORT_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t}),\n\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_CODES } from \"../country/currency\";\n\nexport const ZodAddressSchema = z\n\t.string()\n\t.refine((s) => isAddress(s), { message: \"Invalid Ethereum address\" });\n\nexport const ZodCurrencySchema = z.enum(CURRENCY_CODES);\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","/**\n * All supported currency symbols. Single source of truth for the SDK.\n *\n * Lives alongside the country metadata so that adding a currency is a\n * single-folder operation: drop a new file in `currencies/<code>.ts`, add it\n * to this map, and both `COUNTRY_OPTIONS` and `ZodCurrencySchema` pick it up.\n */\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\n/** Union of supported currency codes. */\nexport type CurrencyCode = (typeof CURRENCY)[keyof typeof CURRENCY];\n\n/**\n * Tuple form of the currency codes — used by `z.enum(...)` in the shared\n * validation layer. Narrow tuple type required by Zod.\n */\nexport const CURRENCY_CODES = Object.values(CURRENCY) as [CurrencyCode, ...CurrencyCode[]];\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, type ContractFunctionReturnType, stringToHex } from \"viem\";\nimport type { PublicClientLike } from \"../../types\";\nimport { ABIS } from \"../abis\";\nimport type { orderProcessorFacetAbi } from \"../abis/order-processor-facet\";\n\n/** Return type of the contract `getOrdersById` function, derived from the ABI. */\nexport type RawContractOrder = ContractFunctionReturnType<\n\ttypeof orderProcessorFacetAbi,\n\t\"view\",\n\t\"getOrdersById\"\n>;\n\n/** Return type of the contract `getAdditionalOrderDetails` function, derived from the ABI. */\nexport type RawContractAdditionalDetails = ContractFunctionReturnType<\n\ttypeof orderProcessorFacetAbi,\n\t\"view\",\n\t\"getAdditionalOrderDetails\"\n>;\n\nexport interface RawOrderBundle {\n\torder: RawContractOrder;\n\tdetails: RawContractAdditionalDetails;\n}\n\n/**\n * Reads the core Order struct and AdditionalOrderDetails for `orderId` from the\n * Diamond. Uses viem `multicall` when available (1 RPC) and falls back to two\n * parallel `readContract` calls otherwise.\n */\nexport function readOrderMulticall(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\torderId: bigint,\n): ResultAsync<RawOrderBundle, Error> {\n\tconst calls = [\n\t\t{\n\t\t\taddress: diamondAddress,\n\t\t\tabi: ABIS.FACETS.ORDER_PROCESSOR,\n\t\t\tfunctionName: \"getOrdersById\",\n\t\t\targs: [orderId] as const,\n\t\t},\n\t\t{\n\t\t\taddress: diamondAddress,\n\t\t\tabi: ABIS.FACETS.ORDER_PROCESSOR,\n\t\t\tfunctionName: \"getAdditionalOrderDetails\",\n\t\t\targs: [orderId] as const,\n\t\t},\n\t];\n\n\tconst toError = (error: unknown) => new Error(\"Order contract read failed\", { cause: error });\n\n\tconst exec = async (): Promise<RawOrderBundle> => {\n\t\tif (publicClient.multicall) {\n\t\t\tconst [order, details] = (await publicClient.multicall({\n\t\t\t\tcontracts: calls,\n\t\t\t\tallowFailure: false,\n\t\t\t})) as [RawContractOrder, RawContractAdditionalDetails];\n\t\t\treturn { order, details };\n\t\t}\n\t\tconst [order, details] = (await Promise.all(\n\t\t\tcalls.map((c) => publicClient.readContract(c)),\n\t\t)) as [RawContractOrder, RawContractAdditionalDetails];\n\t\treturn { order, details };\n\t};\n\n\treturn ResultAsync.fromPromise(exec(), toError);\n}\n\nexport interface RawFeeConfig {\n\tsmallOrderThreshold: bigint;\n\tsmallOrderFixedFee: bigint;\n}\n\n/**\n * Reads the per-currency small-order threshold and fixed fee from the Diamond.\n * Uses viem `multicall` when available (1 RPC) and falls back to two parallel\n * `readContract` calls otherwise. Amounts are returned as 6-decimal bigints.\n */\nexport function readFeeConfigMulticall(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tcurrency: string,\n): ResultAsync<RawFeeConfig, Error> {\n\tconst currencyHex = stringToHex(currency, { size: 32 });\n\tconst calls = [\n\t\t{\n\t\t\taddress: diamondAddress,\n\t\t\tabi: ABIS.FACETS.ORDER_PROCESSOR,\n\t\t\tfunctionName: \"getSmallOrderThreshold\",\n\t\t\targs: [currencyHex] as const,\n\t\t},\n\t\t{\n\t\t\taddress: diamondAddress,\n\t\t\tabi: ABIS.FACETS.ORDER_PROCESSOR,\n\t\t\tfunctionName: \"getSmallOrderFixedFee\",\n\t\t\targs: [currencyHex] as const,\n\t\t},\n\t];\n\n\tconst toError = (error: unknown) =>\n\t\tnew Error(\"Fee config contract read failed\", { cause: error });\n\n\tconst exec = async (): Promise<RawFeeConfig> => {\n\t\tif (publicClient.multicall) {\n\t\t\tconst [smallOrderThreshold, smallOrderFixedFee] = (await publicClient.multicall({\n\t\t\t\tcontracts: calls,\n\t\t\t\tallowFailure: false,\n\t\t\t})) as [bigint, bigint];\n\t\t\treturn { smallOrderThreshold, smallOrderFixedFee };\n\t\t}\n\t\tconst [smallOrderThreshold, smallOrderFixedFee] = (await Promise.all(\n\t\t\tcalls.map((c) => publicClient.readContract(c)),\n\t\t)) as [bigint, bigint];\n\t\treturn { smallOrderThreshold, smallOrderFixedFee };\n\t};\n\n\treturn ResultAsync.fromPromise(exec(), toError);\n}\n","import { ResultAsync } from \"neverthrow\";\nimport { type Address, stringToHex } from \"viem\";\nimport { PricesError } from \"../../prices/errors\";\nimport type { PriceConfig, ReputationLimit } from \"../../prices/types\";\nimport type { CurrencyScopedParams } from \"../../prices/validation\";\nimport { ZodCurrencyScopedParamsSchema } from \"../../prices/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: CurrencyScopedParams,\n): ResultAsync<PriceConfig, PricesError> {\n\treturn validate(\n\t\tZodCurrencyScopedParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew PricesError(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 PricesError(\"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\n/**\n * Reads the per-currency USDC transaction limit granted per Reputation Point (RP).\n * Default is 1 RP = 2 USDC everywhere except INR.\n */\nexport function getReputationPerUsdcLimit(\n\tpublicClient: PublicClientLike,\n\tdiamondAddress: Address,\n\tparams: CurrencyScopedParams,\n): ResultAsync<ReputationLimit, PricesError> {\n\treturn validate(\n\t\tZodCurrencyScopedParamsSchema,\n\t\tparams,\n\t\t(message, cause, data) =>\n\t\t\tnew PricesError(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 PricesError(\"Failed to read reputation-per-USDC limit\", {\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 { SdkError } from \"../validation\";\n\nexport type PricesErrorCode = \"VALIDATION_ERROR\" | \"CONTRACT_READ_ERROR\";\n\nexport class PricesError extends SdkError<PricesErrorCode> {\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\tcode: PricesErrorCode;\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 = \"PricesError\";\n\t}\n}\n","import { z } from \"zod\";\nimport { ZodCurrencySchema } from \"../validation/schemas.validation\";\n\n/**\n * Shared param shape for every currency-scoped read in this module\n * (`getPriceConfig`, `getReputationPerUsdcLimit`). All methods take `{ currency }`.\n */\nexport const ZodCurrencyScopedParamsSchema = z.object({\n\tcurrency: ZodCurrencySchema,\n});\n\nexport type CurrencyScopedParams = z.infer<typeof ZodCurrencyScopedParamsSchema>;\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 { TxLimitsParams } from \"../../profile/validation\";\nimport { 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\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","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 ZodUsdcAllowanceParamsSchema = z.object({\n\towner: ZodAddressSchema,\n});\n\nexport type UsdcAllowanceParams = z.infer<typeof ZodUsdcAllowanceParamsSchema>;\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","import { ResultAsync } from \"neverthrow\";\nimport type { Address } from \"viem\";\nimport { erc20Abi } from \"viem\";\nimport { ProfileError } from \"../../profile/errors\";\nimport type { UsdcAllowanceParams, UsdcBalanceParams } from \"../../profile/validation\";\nimport { ZodUsdcAllowanceParamsSchema, 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\n/** Reads the USDC allowance `owner → diamond`. */\nexport function getUsdcAllowance(\n\tpublicClient: PublicClientLike,\n\tusdcAddress: Address,\n\tdiamondAddress: Address,\n\tparams: UsdcAllowanceParams,\n): ResultAsync<bigint, ProfileError> {\n\treturn validate(\n\t\tZodUsdcAllowanceParamsSchema,\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: erc20Abi,\n\t\t\t\tfunctionName: \"allowance\",\n\t\t\t\targs: [validated.owner, diamondAddress],\n\t\t\t}) as Promise<bigint>,\n\t\t\t(error) =>\n\t\t\t\tnew ProfileError(\"Failed to read USDC allowance\", {\n\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\tcause: error,\n\t\t\t\t\tcontext: { owner: validated.owner, usdcAddress, diamondAddress },\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}).mapErr(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew ProfileError(\"Failed to read price config for balance conversion\", {\n\t\t\t\t\t\tcode: \"CONTRACT_READ_ERROR\",\n\t\t\t\t\t\tcause,\n\t\t\t\t\t\tcontext: { currency: validated.currency },\n\t\t\t\t\t}),\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 { getTxLimits, getUsdcAllowance, getUsdcBalance } from \"../contracts\";\nimport type { TxLimits } from \"../contracts/tx-limits\";\nimport { getBalances } from \"./contracts\";\nimport type { ProfileError } from \"./errors\";\nimport type {\n\tBalances,\n\tGetBalancesParams,\n\tProfileConfig,\n\tTxLimitsParams,\n\tUsdcAllowanceParams,\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 the USDC allowance `owner → diamond` (raw bigint, 6 decimals). */\n\tgetUsdcAllowance(params: UsdcAllowanceParams): ResultAsync<bigint, 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\n/** Creates a Profile SDK instance for reading user-scoped balance and limit data. */\nexport function createProfile(config: ProfileConfig): Profile {\n\tconst { publicClient, diamondAddress, usdcAddress } = config;\n\n\treturn {\n\t\tgetUsdcBalance: (params) => getUsdcBalance(publicClient, usdcAddress, params),\n\n\t\tgetUsdcAllowance: (params) =>\n\t\t\tgetUsdcAllowance(publicClient, usdcAddress, diamondAddress, params),\n\n\t\tgetBalances: (params) => getBalances(publicClient, usdcAddress, diamondAddress, params),\n\n\t\tgetTxLimits: (params) => getTxLimits(publicClient, diamondAddress, params),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyB;;;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;AAAA,EACA;AAAA,IACC,QAAQ;AAA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,IAAa,CAAC,cACf,+BAAY,QAAQ;AAAA,MACnB,eAAe,cAAc,aAAa;AAAA,QACzC,SAAS,UAAU;AAAA,MACpB,CAAC;AAAA,MACD,eAAe,cAAc,gBAAgB;AAAA,QAC5C,UAAU,UAAU;AAAA,MACrB,CAAC,EAAE;AAAA,QACF,CAAC,UACA,IAAI,aAAa,sDAAsD;AAAA,UACtE,MAAM;AAAA,UACN;AAAA,UACA,SAAS,EAAE,UAAU,UAAU,SAAS;AAAA,QACzC,CAAC;AAAA,MACH;AAAA,IACD,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,WAAW,MAAM;AAC/B,YAAM,gBAAgB,WAAO,0BAAY,MAAM,CAAC,CAAC;AACjD,YAAM,qBAAqB,WAAO,0BAAY,YAAY,WAAW,CAAC,CAAC;AACvE,aAAO;AAAA,QACN,MAAM;AAAA,QACN,MAAM,gBAAgB;AAAA,QACtB,WAAW;AAAA,MACZ;AAAA,IACD,CAAC;AAAA,EACF;AACD;;;ACpBO,SAAS,cAAc,QAAgC;AAC7D,QAAM,EAAE,cAAc,gBAAgB,YAAY,IAAI;AAEtD,SAAO;AAAA,IACN,gBAAgB,CAAC,WAAW,eAAe,cAAc,aAAa,MAAM;AAAA,IAE5E,kBAAkB,CAAC,WAClB,iBAAiB,cAAc,aAAa,gBAAgB,MAAM;AAAA,IAEnE,aAAa,CAAC,WAAW,YAAY,cAAc,aAAa,gBAAgB,MAAM;AAAA,IAEtF,aAAa,CAAC,WAAW,YAAY,cAAc,gBAAgB,MAAM;AAAA,EAC1E;AACD;","names":["import_neverthrow","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_zod","import_neverthrow","import_viem","import_neverthrow","import_viem"]}
|
package/dist/profile.d.cts
CHANGED
|
@@ -26,30 +26,47 @@ declare const ZodUsdcBalanceParamsSchema: z.ZodObject<{
|
|
|
26
26
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
|
|
29
|
+
declare const ZodUsdcAllowanceParamsSchema: z.ZodObject<{
|
|
30
|
+
owner: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type UsdcAllowanceParams = z.infer<typeof ZodUsdcAllowanceParamsSchema>;
|
|
29
33
|
declare const ZodGetBalancesParamsSchema: z.ZodObject<{
|
|
30
34
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
35
|
currency: z.ZodEnum<{
|
|
32
|
-
|
|
36
|
+
IDR: "IDR";
|
|
37
|
+
INR: "INR";
|
|
38
|
+
BRL: "BRL";
|
|
39
|
+
ARS: "ARS";
|
|
40
|
+
MEX: "MEX";
|
|
41
|
+
VEN: "VEN";
|
|
42
|
+
EUR: "EUR";
|
|
43
|
+
NGN: "NGN";
|
|
44
|
+
USD: "USD";
|
|
45
|
+
COP: "COP";
|
|
33
46
|
}>;
|
|
34
47
|
}, z.core.$strip>;
|
|
35
48
|
type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
|
|
36
49
|
declare const ZodTxLimitsParamsSchema: z.ZodObject<{
|
|
37
50
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
38
51
|
currency: z.ZodEnum<{
|
|
39
|
-
|
|
52
|
+
IDR: "IDR";
|
|
53
|
+
INR: "INR";
|
|
54
|
+
BRL: "BRL";
|
|
55
|
+
ARS: "ARS";
|
|
56
|
+
MEX: "MEX";
|
|
57
|
+
VEN: "VEN";
|
|
58
|
+
EUR: "EUR";
|
|
59
|
+
NGN: "NGN";
|
|
60
|
+
USD: "USD";
|
|
61
|
+
COP: "COP";
|
|
40
62
|
}>;
|
|
41
63
|
}, z.core.$strip>;
|
|
42
64
|
type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
|
|
43
|
-
declare const ZodPriceConfigParamsSchema: z.ZodObject<{
|
|
44
|
-
currency: z.ZodEnum<{
|
|
45
|
-
[x: string]: string;
|
|
46
|
-
}>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;
|
|
49
65
|
|
|
50
66
|
/**
|
|
51
67
|
* Minimal viem PublicClient interface — consumers pass their own client.
|
|
52
|
-
* The SDK
|
|
68
|
+
* The SDK uses `readContract` for single reads and `multicall` where available
|
|
69
|
+
* to batch multiple reads into one RPC round-trip.
|
|
53
70
|
*/
|
|
54
71
|
interface PublicClientLike {
|
|
55
72
|
readContract(args: {
|
|
@@ -58,18 +75,21 @@ interface PublicClientLike {
|
|
|
58
75
|
functionName: string;
|
|
59
76
|
args: readonly unknown[];
|
|
60
77
|
}): Promise<unknown>;
|
|
78
|
+
multicall?(args: {
|
|
79
|
+
contracts: readonly {
|
|
80
|
+
address: Address;
|
|
81
|
+
abi: readonly unknown[];
|
|
82
|
+
functionName: string;
|
|
83
|
+
args?: readonly unknown[];
|
|
84
|
+
}[];
|
|
85
|
+
allowFailure?: boolean;
|
|
86
|
+
}): Promise<readonly unknown[]>;
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
interface TxLimits {
|
|
64
90
|
readonly buyLimit: number;
|
|
65
91
|
readonly sellLimit: number;
|
|
66
92
|
}
|
|
67
|
-
interface RpPerUsdtLimit {
|
|
68
|
-
readonly numerator: bigint;
|
|
69
|
-
readonly denominator: bigint;
|
|
70
|
-
/** The USDC multiplier per RP: denominator / numerator. */
|
|
71
|
-
readonly multiplier: number;
|
|
72
|
-
}
|
|
73
93
|
|
|
74
94
|
interface ProfileConfig {
|
|
75
95
|
readonly publicClient: PublicClientLike;
|
|
@@ -84,26 +104,18 @@ interface Balances {
|
|
|
84
104
|
/** The sell price used for conversion. */
|
|
85
105
|
readonly sellPrice: number;
|
|
86
106
|
}
|
|
87
|
-
interface PriceConfig {
|
|
88
|
-
readonly buyPrice: bigint;
|
|
89
|
-
readonly sellPrice: bigint;
|
|
90
|
-
readonly buyPriceOffset: bigint;
|
|
91
|
-
readonly baseSpread: bigint;
|
|
92
|
-
}
|
|
93
107
|
|
|
94
108
|
interface Profile {
|
|
95
109
|
/** Reads the USDC balance for a given address (raw bigint, 6 decimals). */
|
|
96
110
|
getUsdcBalance(params: UsdcBalanceParams): ResultAsync<bigint, ProfileError>;
|
|
97
|
-
/** Reads
|
|
98
|
-
|
|
111
|
+
/** Reads the USDC allowance `owner → diamond` (raw bigint, 6 decimals). */
|
|
112
|
+
getUsdcAllowance(params: UsdcAllowanceParams): ResultAsync<bigint, ProfileError>;
|
|
99
113
|
/** Fetches USDC and fiat balance in parallel for a given address and currency. */
|
|
100
114
|
getBalances(params: GetBalancesParams): ResultAsync<Balances, ProfileError>;
|
|
101
115
|
/** Reads buy and sell transaction limits for a given address and currency. */
|
|
102
116
|
getTxLimits(params: TxLimitsParams): ResultAsync<TxLimits, ProfileError>;
|
|
103
|
-
/** Reads the RP-to-USDC limit ratio for a given currency. */
|
|
104
|
-
getRpPerUsdtLimitRational(params: PriceConfigParams): ResultAsync<RpPerUsdtLimit, ProfileError>;
|
|
105
117
|
}
|
|
106
|
-
/** Creates a Profile SDK instance for reading
|
|
118
|
+
/** Creates a Profile SDK instance for reading user-scoped balance and limit data. */
|
|
107
119
|
declare function createProfile(config: ProfileConfig): Profile;
|
|
108
120
|
|
|
109
|
-
export { type Balances, type GetBalancesParams, type
|
|
121
|
+
export { type Balances, type GetBalancesParams, type Profile, type ProfileConfig, ProfileError, type ProfileErrorCode, type PublicClientLike, type TxLimits, type TxLimitsParams, type UsdcAllowanceParams, type UsdcBalanceParams, createProfile };
|
package/dist/profile.d.ts
CHANGED
|
@@ -26,30 +26,47 @@ declare const ZodUsdcBalanceParamsSchema: z.ZodObject<{
|
|
|
26
26
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
|
|
29
|
+
declare const ZodUsdcAllowanceParamsSchema: z.ZodObject<{
|
|
30
|
+
owner: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type UsdcAllowanceParams = z.infer<typeof ZodUsdcAllowanceParamsSchema>;
|
|
29
33
|
declare const ZodGetBalancesParamsSchema: z.ZodObject<{
|
|
30
34
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
35
|
currency: z.ZodEnum<{
|
|
32
|
-
|
|
36
|
+
IDR: "IDR";
|
|
37
|
+
INR: "INR";
|
|
38
|
+
BRL: "BRL";
|
|
39
|
+
ARS: "ARS";
|
|
40
|
+
MEX: "MEX";
|
|
41
|
+
VEN: "VEN";
|
|
42
|
+
EUR: "EUR";
|
|
43
|
+
NGN: "NGN";
|
|
44
|
+
USD: "USD";
|
|
45
|
+
COP: "COP";
|
|
33
46
|
}>;
|
|
34
47
|
}, z.core.$strip>;
|
|
35
48
|
type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
|
|
36
49
|
declare const ZodTxLimitsParamsSchema: z.ZodObject<{
|
|
37
50
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
38
51
|
currency: z.ZodEnum<{
|
|
39
|
-
|
|
52
|
+
IDR: "IDR";
|
|
53
|
+
INR: "INR";
|
|
54
|
+
BRL: "BRL";
|
|
55
|
+
ARS: "ARS";
|
|
56
|
+
MEX: "MEX";
|
|
57
|
+
VEN: "VEN";
|
|
58
|
+
EUR: "EUR";
|
|
59
|
+
NGN: "NGN";
|
|
60
|
+
USD: "USD";
|
|
61
|
+
COP: "COP";
|
|
40
62
|
}>;
|
|
41
63
|
}, z.core.$strip>;
|
|
42
64
|
type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
|
|
43
|
-
declare const ZodPriceConfigParamsSchema: z.ZodObject<{
|
|
44
|
-
currency: z.ZodEnum<{
|
|
45
|
-
[x: string]: string;
|
|
46
|
-
}>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;
|
|
49
65
|
|
|
50
66
|
/**
|
|
51
67
|
* Minimal viem PublicClient interface — consumers pass their own client.
|
|
52
|
-
* The SDK
|
|
68
|
+
* The SDK uses `readContract` for single reads and `multicall` where available
|
|
69
|
+
* to batch multiple reads into one RPC round-trip.
|
|
53
70
|
*/
|
|
54
71
|
interface PublicClientLike {
|
|
55
72
|
readContract(args: {
|
|
@@ -58,18 +75,21 @@ interface PublicClientLike {
|
|
|
58
75
|
functionName: string;
|
|
59
76
|
args: readonly unknown[];
|
|
60
77
|
}): Promise<unknown>;
|
|
78
|
+
multicall?(args: {
|
|
79
|
+
contracts: readonly {
|
|
80
|
+
address: Address;
|
|
81
|
+
abi: readonly unknown[];
|
|
82
|
+
functionName: string;
|
|
83
|
+
args?: readonly unknown[];
|
|
84
|
+
}[];
|
|
85
|
+
allowFailure?: boolean;
|
|
86
|
+
}): Promise<readonly unknown[]>;
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
interface TxLimits {
|
|
64
90
|
readonly buyLimit: number;
|
|
65
91
|
readonly sellLimit: number;
|
|
66
92
|
}
|
|
67
|
-
interface RpPerUsdtLimit {
|
|
68
|
-
readonly numerator: bigint;
|
|
69
|
-
readonly denominator: bigint;
|
|
70
|
-
/** The USDC multiplier per RP: denominator / numerator. */
|
|
71
|
-
readonly multiplier: number;
|
|
72
|
-
}
|
|
73
93
|
|
|
74
94
|
interface ProfileConfig {
|
|
75
95
|
readonly publicClient: PublicClientLike;
|
|
@@ -84,26 +104,18 @@ interface Balances {
|
|
|
84
104
|
/** The sell price used for conversion. */
|
|
85
105
|
readonly sellPrice: number;
|
|
86
106
|
}
|
|
87
|
-
interface PriceConfig {
|
|
88
|
-
readonly buyPrice: bigint;
|
|
89
|
-
readonly sellPrice: bigint;
|
|
90
|
-
readonly buyPriceOffset: bigint;
|
|
91
|
-
readonly baseSpread: bigint;
|
|
92
|
-
}
|
|
93
107
|
|
|
94
108
|
interface Profile {
|
|
95
109
|
/** Reads the USDC balance for a given address (raw bigint, 6 decimals). */
|
|
96
110
|
getUsdcBalance(params: UsdcBalanceParams): ResultAsync<bigint, ProfileError>;
|
|
97
|
-
/** Reads
|
|
98
|
-
|
|
111
|
+
/** Reads the USDC allowance `owner → diamond` (raw bigint, 6 decimals). */
|
|
112
|
+
getUsdcAllowance(params: UsdcAllowanceParams): ResultAsync<bigint, ProfileError>;
|
|
99
113
|
/** Fetches USDC and fiat balance in parallel for a given address and currency. */
|
|
100
114
|
getBalances(params: GetBalancesParams): ResultAsync<Balances, ProfileError>;
|
|
101
115
|
/** Reads buy and sell transaction limits for a given address and currency. */
|
|
102
116
|
getTxLimits(params: TxLimitsParams): ResultAsync<TxLimits, ProfileError>;
|
|
103
|
-
/** Reads the RP-to-USDC limit ratio for a given currency. */
|
|
104
|
-
getRpPerUsdtLimitRational(params: PriceConfigParams): ResultAsync<RpPerUsdtLimit, ProfileError>;
|
|
105
117
|
}
|
|
106
|
-
/** Creates a Profile SDK instance for reading
|
|
118
|
+
/** Creates a Profile SDK instance for reading user-scoped balance and limit data. */
|
|
107
119
|
declare function createProfile(config: ProfileConfig): Profile;
|
|
108
120
|
|
|
109
|
-
export { type Balances, type GetBalancesParams, type
|
|
121
|
+
export { type Balances, type GetBalancesParams, type Profile, type ProfileConfig, ProfileError, type ProfileErrorCode, type PublicClientLike, type TxLimits, type TxLimitsParams, type UsdcAllowanceParams, type UsdcBalanceParams, createProfile };
|