mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Export types used by exported variables (#858)
Fixes TypeScript compile errors due to generating TS declaration files. See #851
This commit is contained in:
@@ -53,7 +53,7 @@ import * as ledgerUtils from './ledger/utils'
|
|||||||
import * as schemaValidator from './common/schema-validator'
|
import * as schemaValidator from './common/schema-validator'
|
||||||
import {clamp} from './ledger/utils'
|
import {clamp} from './ledger/utils'
|
||||||
|
|
||||||
type APIOptions = {
|
export type APIOptions = {
|
||||||
server?: string,
|
server?: string,
|
||||||
feeCushion?: number,
|
feeCushion?: number,
|
||||||
trace?: boolean,
|
trace?: boolean,
|
||||||
@@ -79,7 +79,7 @@ function getCollectKeyFromCommand(command: string): string|undefined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prevent access to non-validated ledger versions
|
// prevent access to non-validated ledger versions
|
||||||
class RestrictedConnection extends Connection {
|
export class RestrictedConnection extends Connection {
|
||||||
request(request: any, timeout?: number) {
|
request(request: any, timeout?: number) {
|
||||||
const ledger_index = request.ledger_index
|
const ledger_index = request.ledger_index
|
||||||
if (ledger_index !== undefined && ledger_index !== 'validated') {
|
if (ledger_index !== undefined && ledger_index !== 'validated') {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function isStreamMessageType(type) {
|
|||||||
type === 'path_find'
|
type === 'path_find'
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ConnectionOptions {
|
export interface ConnectionOptions {
|
||||||
trace?: boolean,
|
trace?: boolean,
|
||||||
proxy?: string
|
proxy?: string
|
||||||
proxyAuthorization?: string
|
proxyAuthorization?: string
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export interface AccountInfoResponse {
|
|||||||
validated?: boolean
|
validated?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QueueData {
|
export interface QueueData {
|
||||||
txn_count: number,
|
txn_count: number,
|
||||||
auth_change_queued?: boolean,
|
auth_change_queued?: boolean,
|
||||||
lowest_sequence?: number,
|
lowest_sequence?: number,
|
||||||
@@ -27,7 +27,7 @@ interface QueueData {
|
|||||||
transactions?: TransactionData[]
|
transactions?: TransactionData[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TransactionData {
|
export interface TransactionData {
|
||||||
auth_change?: boolean,
|
auth_change?: boolean,
|
||||||
fee?: string,
|
fee?: string,
|
||||||
fee_level?: string,
|
fee_level?: string,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface BookOffersResponse {
|
|||||||
marker?: any
|
marker?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderBookOffer extends OfferCreateTransaction {
|
export interface OrderBookOffer extends OfferCreateTransaction {
|
||||||
quality?: number
|
quality?: number
|
||||||
owner_funds?: string,
|
owner_funds?: string,
|
||||||
taker_gets_funded?: RippledAmount,
|
taker_gets_funded?: RippledAmount,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import {validate, removeUndefined, dropsToXrp} from '../common'
|
|||||||
import {RippleAPI} from '../api'
|
import {RippleAPI} from '../api'
|
||||||
import {AccountInfoResponse} from '../common/types/commands/account_info'
|
import {AccountInfoResponse} from '../common/types/commands/account_info'
|
||||||
|
|
||||||
type GetAccountInfoOptions = {
|
export type GetAccountInfoOptions = {
|
||||||
ledgerVersion?: number
|
ledgerVersion?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type FormattedGetAccountInfoResponse = {
|
export type FormattedGetAccountInfoResponse = {
|
||||||
sequence: number,
|
sequence: number,
|
||||||
xrpBalance: string,
|
xrpBalance: string,
|
||||||
ownerCount: number,
|
ownerCount: number,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import {Amount} from '../common/types/objects'
|
|||||||
import {ensureLedgerVersion} from './utils'
|
import {ensureLedgerVersion} from './utils'
|
||||||
import {RippleAPI} from '../api'
|
import {RippleAPI} from '../api'
|
||||||
|
|
||||||
type BalanceSheetOptions = {
|
export type BalanceSheetOptions = {
|
||||||
excludeAddresses?: Array<string>,
|
excludeAddresses?: Array<string>,
|
||||||
ledgerVersion?: number
|
ledgerVersion?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetBalanceSheet = {
|
export type GetBalanceSheet = {
|
||||||
balances?: Array<Amount>,
|
balances?: Array<Amount>,
|
||||||
assets?: Array<Amount>,
|
assets?: Array<Amount>,
|
||||||
obligations?: Array<{
|
obligations?: Array<{
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import {GetTrustlinesOptions} from './trustlines'
|
|||||||
import {FormattedTrustline} from '../common/types/objects/trustlines'
|
import {FormattedTrustline} from '../common/types/objects/trustlines'
|
||||||
|
|
||||||
|
|
||||||
type Balance = {
|
export type Balance = {
|
||||||
value: string,
|
value: string,
|
||||||
currency: string,
|
currency: string,
|
||||||
counterparty?: string
|
counterparty?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetBalances = Array<Balance>
|
export type GetBalances = Array<Balance>
|
||||||
|
|
||||||
function getTrustlineBalanceAmount(trustline: FormattedTrustline) {
|
function getTrustlineBalanceAmount(trustline: FormattedTrustline) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {validate} from '../common'
|
|||||||
import parseLedger from './parse/ledger'
|
import parseLedger from './parse/ledger'
|
||||||
import {GetLedger} from './types'
|
import {GetLedger} from './types'
|
||||||
|
|
||||||
type LedgerOptions = {
|
export type LedgerOptions = {
|
||||||
ledgerVersion?: number,
|
ledgerVersion?: number,
|
||||||
includeAllData?: boolean,
|
includeAllData?: boolean,
|
||||||
includeTransactions?: boolean,
|
includeTransactions?: boolean,
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ export type OrdersOptions = {
|
|||||||
ledgerVersion?: number
|
ledgerVersion?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type Orderbook = {
|
export type Orderbook = {
|
||||||
base: Issue,
|
base: Issue,
|
||||||
counter: Issue
|
counter: Issue
|
||||||
}
|
}
|
||||||
type OrderbookItem = {
|
|
||||||
|
export type OrderbookItem = {
|
||||||
specification: OrderSpecification,
|
specification: OrderSpecification,
|
||||||
properties: {
|
properties: {
|
||||||
maker: string,
|
maker: string,
|
||||||
@@ -29,9 +30,9 @@ type OrderbookItem = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderbookOrders = Array<OrderbookItem>
|
export type OrderbookOrders = Array<OrderbookItem>
|
||||||
|
|
||||||
type GetOrderbook = {
|
export type GetOrderbook = {
|
||||||
bids: OrderbookOrders,
|
bids: OrderbookOrders,
|
||||||
asks: OrderbookOrders
|
asks: OrderbookOrders
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export type LedgerEntryResponse = {
|
|||||||
validated: boolean
|
validated: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type PaymentChannelResponse = {
|
export type PaymentChannelResponse = {
|
||||||
account: string,
|
account: string,
|
||||||
balance: string,
|
balance: string,
|
||||||
publicKey: string,
|
publicKey: string,
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import parseFields from './parse/fields'
|
|||||||
import {validate, constants} from '../common'
|
import {validate, constants} from '../common'
|
||||||
const AccountFlags = constants.AccountFlags
|
const AccountFlags = constants.AccountFlags
|
||||||
|
|
||||||
type SettingsOptions = {
|
export type SettingsOptions = {
|
||||||
ledgerVersion?: number
|
ledgerVersion?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetSettings = {
|
export type GetSettings = {
|
||||||
passwordSpent?: boolean,
|
passwordSpent?: boolean,
|
||||||
requireDestinationTag?: boolean,
|
requireDestinationTag?: boolean,
|
||||||
requireAuthorization?: boolean,
|
requireAuthorization?: boolean,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import {Amount, Memo} from '../common/types/objects'
|
import {Amount, Memo} from '../common/types/objects'
|
||||||
|
|
||||||
type Outcome = {
|
export type Outcome = {
|
||||||
result: string,
|
result: string,
|
||||||
ledgerVersion: number,
|
ledgerVersion: number,
|
||||||
indexInLedger: number,
|
indexInLedger: number,
|
||||||
@@ -17,7 +17,7 @@ type Outcome = {
|
|||||||
timestamp?: string
|
timestamp?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Adjustment = {
|
export type Adjustment = {
|
||||||
address: string,
|
address: string,
|
||||||
amount: {
|
amount: {
|
||||||
currency: string,
|
currency: string,
|
||||||
@@ -27,7 +27,7 @@ type Adjustment = {
|
|||||||
tag?: number
|
tag?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type Trustline = {
|
export type Trustline = {
|
||||||
currency: string,
|
currency: string,
|
||||||
counterparty: string,
|
counterparty: string,
|
||||||
limit: string,
|
limit: string,
|
||||||
@@ -38,7 +38,7 @@ type Trustline = {
|
|||||||
frozen?: boolean
|
frozen?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Settings = {
|
export type Settings = {
|
||||||
passwordSpent?: boolean,
|
passwordSpent?: boolean,
|
||||||
requireDestinationTag?: boolean,
|
requireDestinationTag?: boolean,
|
||||||
requireAuthorization?: boolean,
|
requireAuthorization?: boolean,
|
||||||
@@ -56,11 +56,11 @@ type Settings = {
|
|||||||
regularKey?: string
|
regularKey?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderCancellation = {
|
export type OrderCancellation = {
|
||||||
orderSequence: number
|
orderSequence: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type Payment = {
|
export type Payment = {
|
||||||
source: Adjustment,
|
source: Adjustment,
|
||||||
destination: Adjustment,
|
destination: Adjustment,
|
||||||
paths?: string,
|
paths?: string,
|
||||||
@@ -71,7 +71,7 @@ type Payment = {
|
|||||||
limitQuality?: boolean
|
limitQuality?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type PaymentTransaction = {
|
export type PaymentTransaction = {
|
||||||
type: string,
|
type: string,
|
||||||
specification: Payment,
|
specification: Payment,
|
||||||
outcome: Outcome,
|
outcome: Outcome,
|
||||||
@@ -92,7 +92,7 @@ export type Order = {
|
|||||||
memos?: Memo[]
|
memos?: Memo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderTransaction = {
|
export type OrderTransaction = {
|
||||||
type: string,
|
type: string,
|
||||||
specification: Order,
|
specification: Order,
|
||||||
outcome: Outcome,
|
outcome: Outcome,
|
||||||
@@ -101,7 +101,7 @@ type OrderTransaction = {
|
|||||||
sequence: number
|
sequence: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderCancellationTransaction = {
|
export type OrderCancellationTransaction = {
|
||||||
type: string,
|
type: string,
|
||||||
specification: OrderCancellation,
|
specification: OrderCancellation,
|
||||||
outcome: Outcome,
|
outcome: Outcome,
|
||||||
@@ -110,7 +110,7 @@ type OrderCancellationTransaction = {
|
|||||||
sequence: number
|
sequence: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type TrustlineTransaction = {
|
export type TrustlineTransaction = {
|
||||||
type: string,
|
type: string,
|
||||||
specification: Trustline,
|
specification: Trustline,
|
||||||
outcome: Outcome,
|
outcome: Outcome,
|
||||||
@@ -119,7 +119,7 @@ type TrustlineTransaction = {
|
|||||||
sequence: number
|
sequence: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettingsTransaction = {
|
export type SettingsTransaction = {
|
||||||
type: string,
|
type: string,
|
||||||
specification: Settings,
|
specification: Settings,
|
||||||
outcome: Outcome,
|
outcome: Outcome,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {Connection} from '../common'
|
|||||||
import {TransactionType} from './transaction-types'
|
import {TransactionType} from './transaction-types'
|
||||||
|
|
||||||
|
|
||||||
type TransactionsOptions = {
|
export type TransactionsOptions = {
|
||||||
start?: string,
|
start?: string,
|
||||||
limit?: number,
|
limit?: number,
|
||||||
minLedgerVersion?: number,
|
minLedgerVersion?: number,
|
||||||
@@ -23,7 +23,7 @@ type TransactionsOptions = {
|
|||||||
startTx?: TransactionType
|
startTx?: TransactionType
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetTransactionsResponse = Array<TransactionType>
|
export type GetTransactionsResponse = Array<TransactionType>
|
||||||
|
|
||||||
function parseBinaryTransaction(transaction) {
|
function parseBinaryTransaction(transaction) {
|
||||||
const tx = binary.decode(transaction.tx_blob)
|
const tx = binary.decode(transaction.tx_blob)
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import {Connection} from '../common'
|
|||||||
import {TransactionType} from './transaction-types'
|
import {TransactionType} from './transaction-types'
|
||||||
import {Issue} from '../common/types/objects'
|
import {Issue} from '../common/types/objects'
|
||||||
|
|
||||||
type RecursiveData = {
|
export type RecursiveData = {
|
||||||
marker: string,
|
marker: string,
|
||||||
results: Array<any>
|
results: Array<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
type Getter = (marker?: string, limit?: number) => Promise<RecursiveData>
|
export type Getter = (marker?: string, limit?: number) => Promise<RecursiveData>
|
||||||
|
|
||||||
function clamp(value: number, min: number, max: number): number {
|
function clamp(value: number, min: number, max: number): number {
|
||||||
assert(min <= max, 'Illegal clamp bounds')
|
assert(min <= max, 'Illegal clamp bounds')
|
||||||
@@ -59,7 +59,7 @@ function renameCounterpartyToIssuer<T>(
|
|||||||
return withIssuer
|
return withIssuer
|
||||||
}
|
}
|
||||||
|
|
||||||
type RequestBookOffersArgs = {taker_gets: Issue, taker_pays: Issue}
|
export type RequestBookOffersArgs = {taker_gets: Issue, taker_pays: Issue}
|
||||||
|
|
||||||
function renameCounterpartyToIssuerInOrder(order: RequestBookOffersArgs) {
|
function renameCounterpartyToIssuerInOrder(order: RequestBookOffersArgs) {
|
||||||
const taker_gets = renameCounterpartyToIssuer(order.taker_gets)
|
const taker_gets = renameCounterpartyToIssuer(order.taker_gets)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const validate = utils.common.validate
|
|||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
import {Memo} from '../common/types/objects'
|
import {Memo} from '../common/types/objects'
|
||||||
|
|
||||||
type EscrowCancellation = {
|
export type EscrowCancellation = {
|
||||||
owner: string,
|
owner: string,
|
||||||
escrowSequence: number,
|
escrowSequence: number,
|
||||||
memos?: Array<Memo>
|
memos?: Array<Memo>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const ValidationError = utils.common.errors.ValidationError
|
|||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
import {Memo} from '../common/types/objects'
|
import {Memo} from '../common/types/objects'
|
||||||
|
|
||||||
type EscrowCreation = {
|
export type EscrowCreation = {
|
||||||
amount: string,
|
amount: string,
|
||||||
destination: string,
|
destination: string,
|
||||||
memos?: Array<Memo>,
|
memos?: Array<Memo>,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const ValidationError = utils.common.errors.ValidationError
|
|||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
import {Memo} from '../common/types/objects'
|
import {Memo} from '../common/types/objects'
|
||||||
|
|
||||||
type EscrowExecution = {
|
export type EscrowExecution = {
|
||||||
owner: string,
|
owner: string,
|
||||||
escrowSequence: number,
|
escrowSequence: number,
|
||||||
memos?: Array<Memo>,
|
memos?: Array<Memo>,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const claimFlags = utils.common.txFlags.PaymentChannelClaim
|
|||||||
import {validate, xrpToDrops} from '../common'
|
import {validate, xrpToDrops} from '../common'
|
||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
|
|
||||||
type PaymentChannelClaim = {
|
export type PaymentChannelClaim = {
|
||||||
channel: string,
|
channel: string,
|
||||||
balance?: string,
|
balance?: string,
|
||||||
amount?: string,
|
amount?: string,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as utils from './utils'
|
|||||||
import {validate, iso8601ToRippleTime, xrpToDrops} from '../common'
|
import {validate, iso8601ToRippleTime, xrpToDrops} from '../common'
|
||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
|
|
||||||
type PaymentChannelCreate = {
|
export type PaymentChannelCreate = {
|
||||||
amount: string,
|
amount: string,
|
||||||
destination: string,
|
destination: string,
|
||||||
settleDelay: number,
|
settleDelay: number,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as utils from './utils'
|
|||||||
import {validate, iso8601ToRippleTime, xrpToDrops} from '../common'
|
import {validate, iso8601ToRippleTime, xrpToDrops} from '../common'
|
||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
|
|
||||||
type PaymentChannelFund = {
|
export type PaymentChannelFund = {
|
||||||
channel: string,
|
channel: string,
|
||||||
amount: string,
|
amount: string,
|
||||||
expiration?: string
|
expiration?: string
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {Amount, Adjustment, MaxAdjustment,
|
|||||||
MinAdjustment, Memo} from '../common/types/objects'
|
MinAdjustment, Memo} from '../common/types/objects'
|
||||||
|
|
||||||
|
|
||||||
type Payment = {
|
export type Payment = {
|
||||||
source: Adjustment & MaxAdjustment,
|
source: Adjustment & MaxAdjustment,
|
||||||
destination: Adjustment & MinAdjustment,
|
destination: Adjustment & MinAdjustment,
|
||||||
paths?: string,
|
paths?: string,
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ const AccountFields = utils.common.constants.AccountFields
|
|||||||
import {Instructions, Prepare} from './types'
|
import {Instructions, Prepare} from './types'
|
||||||
import {Memo} from '../common/types/objects'
|
import {Memo} from '../common/types/objects'
|
||||||
|
|
||||||
type WeightedSigner = {address: string, weight: number}
|
export type WeightedSigner = {address: string, weight: number}
|
||||||
type SettingsSigners = {
|
export type SettingsSigners = {
|
||||||
threshold?: number,
|
threshold?: number,
|
||||||
weights: WeightedSigner[]
|
weights: WeightedSigner[]
|
||||||
}
|
}
|
||||||
type Settings = {
|
export type Settings = {
|
||||||
passwordSpent?: boolean,
|
passwordSpent?: boolean,
|
||||||
requireDestinationTag?: boolean,
|
requireDestinationTag?: boolean,
|
||||||
requireAuthorization?: boolean,
|
requireAuthorization?: boolean,
|
||||||
|
|||||||
Reference in New Issue
Block a user