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