Skip to main content

Class: ExchangeService

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new ExchangeService(_debug, _trpc)

Parameters​

NameType
_debugDebugService
_trpcTrpcService

Properties​

_debug​

• Private _debug: DebugService


_trpc​

• Private _trpc: TrpcService

Methods​

create​

▸ create(params): Promise<{ fromAmount: number ; fromCurrency: string ; id: number ; payoutAddress: string ; toAmount: number ; toCurrency: string ; validUntil: string }>

Parameters​

NameType
paramsObject
params.addressstring
params.fromAmountnumber
params.fromCurrencynumber
params.toCurrencynumber

Returns​

Promise<{ fromAmount: number ; fromCurrency: string ; id: number ; payoutAddress: string ; toAmount: number ; toCurrency: string ; validUntil: string }>


getAllCurrencies​

▸ getAllCurrencies(params): Promise<{ decimals: number ; icon: null | string ; id: number ; name: null | string ; network: string ; poolId: null | string ; ticker: string ; unit: string }[]>

Parameters​

NameType
paramsundefined | { currencies: number[] }

Returns​

Promise<{ decimals: number ; icon: null | string ; id: number ; name: null | string ; network: string ; poolId: null | string ; ticker: string ; unit: string }[]>


getEstimatedAmount​

▸ getEstimatedAmount(params): Promise<{ toCurrency: { name: string | null; id: number; unit: string; network: string; ticker: string; icon: string | null; poolId: string | null; decimals: number; } ; toEstAmount?: number }>

Parameters​

NameType
paramsObject
params.fromAmountnumber
params.fromCurrencynumber
params.toCurrencynumber

Returns​

Promise<{ toCurrency: { name: string | null; id: number; unit: string; network: string; ticker: string; icon: string | null; poolId: string | null; decimals: number; } ; toEstAmount?: number }>


getExchangeBoundaries​

▸ getExchangeBoundaries(params): Promise<{ maxAmount: null | number ; minAmount: null | number }>

Parameters​

NameType
paramsObject
params.flow"fixed-rate" | "standard"
params.fromCurrencynumber
params.toCurrencynumber

Returns​

Promise<{ maxAmount: null | number ; minAmount: null | number }>


getPending​

▸ getPending(params): Promise<{ assets: { quantity: number; collectionId: number; destAddress?: string | undefined; }[] ; exchange: { payinAddress?: string | undefined; payoutAddress: string; validUntil: string | null; from: { currency: { name: string | null; id: number; unit: string; network: string; ticker: string; icon: string | null; poolId: string | null; decimals: number; }; amount: string | null; }; to: { ...; }; steps: { ...; }[]; } ; recipient: null ; recipientAddressMismatch: boolean ; txHash: null }>

Parameters​

NameType
paramsOmit<{ address?: string ; exchangeId: number }, "address">

Returns​

Promise<{ assets: { quantity: number; collectionId: number; destAddress?: string | undefined; }[] ; exchange: { payinAddress?: string | undefined; payoutAddress: string; validUntil: string | null; from: { currency: { name: string | null; id: number; unit: string; network: string; ticker: string; icon: string | null; poolId: string | null; decimals: number; }; amount: string | null; }; to: { ...; }; steps: { ...; }[]; } ; recipient: null ; recipientAddressMismatch: boolean ; txHash: null }>


mint​

▸ mint(params): Promise<{ address: string ; createdAt: string ; currency: string ; exchange: { payinAddress: string; validUntil: string | null; status: "new" | "waiting" | "confirming" | "exchanging" | "sending" | "finished" | "failed" | "refunded" | "verifying"; from: { currency: string; amount: number; }; to: { ...; }; } ; exchangeId: string ; expiredAt: string ; id: number ; keyhash: string ; ownerAddress: string ; recipient?: boolean | { address: string; note: string; } ; tansactionId: null | string }>

Parameters​

NameType
paramsObject
params.assets{ collectionId: number ; destAddress?: string ; quantity: number ; token?: string }[]
params.changeAddressstring
params.fromCurrencystring
params.options?Object
params.options.delegatePool?boolean
params.options.gReCaptchaToken?string
params.options.referral?string
params.recipient?boolean | { address: string ; note: string }

Returns​

Promise<{ address: string ; createdAt: string ; currency: string ; exchange: { payinAddress: string; validUntil: string | null; status: "new" | "waiting" | "confirming" | "exchanging" | "sending" | "finished" | "failed" | "refunded" | "verifying"; from: { currency: string; amount: number; }; to: { ...; }; } ; exchangeId: string ; expiredAt: string ; id: number ; keyhash: string ; ownerAddress: string ; recipient?: boolean | { address: string; note: string; } ; tansactionId: null | string }>