Class: ExchangeService
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new ExchangeService(_debug
, _trpc
, _wallet
)
Parameters
Name | Type |
---|---|
_debug | DebugService |
_trpc | TrpcService |
_wallet | WalletService |
Properties
_debug
• Private
_debug: DebugService
_trpc
• Private
_trpc: TrpcService
_wallet
• Private
_wallet: WalletService
Methods
create
▸ create(params
): Promise
<{ fromAmount
: number
; fromCurrency
: string
; id
: number
; payoutAddress
: string
; toAmount
: number
; toCurrency
: string
; validUntil
: string
}>
Parameters
Name | Type |
---|---|
params | Object |
params.address? | string |
params.fromAmount | number |
params.fromCurrency | number |
params.toCurrency | number |
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
Name | Type |
---|---|
params | undefined | { 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
Name | Type |
---|---|
params | Object |
params.fromAmount | number |
params.fromCurrency | number |
params.toCurrency | number |
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
Name | Type |
---|---|
params | Object |
params.flow | "fixed-rate" | "standard" |
params.fromCurrency | number |
params.toCurrency | number |
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
Name | Type |
---|---|
params | Omit <{ 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
Name | Type |
---|---|
params | Object |
params.assets | { collectionId : number ; destAddress? : string ; quantity : number ; token? : string }[] |
params.changeAddress? | string |
params.fromCurrency | string |
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
}>