Skip to content

PriceParser

Defined in: packages/scheme-qorechain/src/server.ts:24

Price handling shared by both PQ-402 server schemes: $… and … fUSD prices resolve to the network’s default asset, in atomic units.

  • SchemeNetworkServer

new PriceParser(qore): PriceParser

Defined in: packages/scheme-qorechain/src/server.ts:31

QoreNetwork

PriceParser

readonly defaultAssetTransferMethod: "default" = "default"

Defined in: packages/scheme-qorechain/src/server.ts:26

ATM used when requirements.extra.assetTransferMethod is absent. Use "default" only as SDK plumbing when the scheme has no on-wire ATM.

SchemeNetworkServer.defaultAssetTransferMethod


readonly paymentFlows: object

Defined in: packages/scheme-qorechain/src/server.ts:27

Payment flows supported per assetTransferMethod. Every ATM the scheme accepts must appear here.

default: object

default: "authorization"

supported: readonly ["authorization"]

SchemeNetworkServer.paymentFlows


abstract readonly scheme: string

Defined in: packages/scheme-qorechain/src/server.ts:25

SchemeNetworkServer.scheme

abstract enhancePaymentRequirements(requirements, supportedKind, facilitatorExtensions): Promise<PaymentRequirements>

Defined in: packages/scheme-qorechain/src/server.ts:50

Build payment requirements for this scheme/network combination

PaymentRequirements

SupportedKind

The supported kind from facilitator’s /supported endpoint

string[]

Extensions supported by the facilitator

Promise<PaymentRequirements>

Enhanced payment requirements ready to be sent to clients

SchemeNetworkServer.enhancePaymentRequirements


getAssetDecimals(asset, network): number | undefined

Defined in: packages/scheme-qorechain/src/server.ts:44

Optional asset decimals for $… settlement overrides. Core throws when this is missing or returns undefined

string

Asset address or symbol

`${string}:${string}`

Network identifier

number | undefined

Decimal places, or undefined when unknown

SchemeNetworkServer.getAssetDecimals


parsePrice(price, network): Promise<AssetAmount>

Defined in: packages/scheme-qorechain/src/server.ts:33

Convert a user-friendly price to the scheme’s specific amount and asset format Always returns a Promise for consistency

Price

User-friendly price (e.g., “$0.10”, “0.10”, { amount: “100000”, asset: “USDC” })

`${string}:${string}`

The network identifier for context

Promise<AssetAmount>

Promise that resolves to the converted amount, asset identifier, and any extra metadata

// For EVM networks with USDC:
await parsePrice("$0.10", "eip155:8453") => { amount: "100000", asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }
// For custom schemes:
await parsePrice("10 points", "custom:network") => { amount: "10", asset: "points" }

SchemeNetworkServer.parsePrice