diff --git a/src/api.ts b/src/api.ts index 58dd3f63..c288dbe3 100644 --- a/src/api.ts +++ b/src/api.ts @@ -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') { diff --git a/src/common/connection.ts b/src/common/connection.ts index ac3ebca7..6c1ba647 100644 --- a/src/common/connection.ts +++ b/src/common/connection.ts @@ -13,7 +13,7 @@ function isStreamMessageType(type) { type === 'path_find' } -interface ConnectionOptions { +export interface ConnectionOptions { trace?: boolean, proxy?: string proxyAuthorization?: string diff --git a/src/common/types/commands/account_info.ts b/src/common/types/commands/account_info.ts index 17f43904..cd4bf0e7 100644 --- a/src/common/types/commands/account_info.ts +++ b/src/common/types/commands/account_info.ts @@ -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, diff --git a/src/common/types/commands/book_offers.ts b/src/common/types/commands/book_offers.ts index 94504e63..30e1c9e2 100644 --- a/src/common/types/commands/book_offers.ts +++ b/src/common/types/commands/book_offers.ts @@ -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, diff --git a/src/ledger/accountinfo.ts b/src/ledger/accountinfo.ts index a987ef94..778de005 100644 --- a/src/ledger/accountinfo.ts +++ b/src/ledger/accountinfo.ts @@ -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, diff --git a/src/ledger/balance-sheet.ts b/src/ledger/balance-sheet.ts index 9eb90527..9f53f9d8 100644 --- a/src/ledger/balance-sheet.ts +++ b/src/ledger/balance-sheet.ts @@ -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, ledgerVersion?: number } -type GetBalanceSheet = { +export type GetBalanceSheet = { balances?: Array, assets?: Array, obligations?: Array<{ diff --git a/src/ledger/balances.ts b/src/ledger/balances.ts index 4c55929f..5b8e3680 100644 --- a/src/ledger/balances.ts +++ b/src/ledger/balances.ts @@ -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 +export type GetBalances = Array function getTrustlineBalanceAmount(trustline: FormattedTrustline) { return { diff --git a/src/ledger/ledger.ts b/src/ledger/ledger.ts index 8170be80..9fc1322b 100644 --- a/src/ledger/ledger.ts +++ b/src/ledger/ledger.ts @@ -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, diff --git a/src/ledger/orderbook.ts b/src/ledger/orderbook.ts index d4abafae..c14d3095 100644 --- a/src/ledger/orderbook.ts +++ b/src/ledger/orderbook.ts @@ -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 +export type OrderbookOrders = Array -type GetOrderbook = { +export type GetOrderbook = { bids: OrderbookOrders, asks: OrderbookOrders } diff --git a/src/ledger/parse/payment-channel.ts b/src/ledger/parse/payment-channel.ts index 5656226b..59641ded 100644 --- a/src/ledger/parse/payment-channel.ts +++ b/src/ledger/parse/payment-channel.ts @@ -29,7 +29,7 @@ export type LedgerEntryResponse = { validated: boolean } -type PaymentChannelResponse = { +export type PaymentChannelResponse = { account: string, balance: string, publicKey: string, diff --git a/src/ledger/settings.ts b/src/ledger/settings.ts index ac7602d4..ce2362e4 100644 --- a/src/ledger/settings.ts +++ b/src/ledger/settings.ts @@ -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, diff --git a/src/ledger/transaction-types.ts b/src/ledger/transaction-types.ts index 244638d7..10caba57 100644 --- a/src/ledger/transaction-types.ts +++ b/src/ledger/transaction-types.ts @@ -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, diff --git a/src/ledger/transactions.ts b/src/ledger/transactions.ts index 1929ad6d..9c7e7930 100644 --- a/src/ledger/transactions.ts +++ b/src/ledger/transactions.ts @@ -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 +export type GetTransactionsResponse = Array function parseBinaryTransaction(transaction) { const tx = binary.decode(transaction.tx_blob) diff --git a/src/ledger/utils.ts b/src/ledger/utils.ts index b453ea5b..85f26614 100644 --- a/src/ledger/utils.ts +++ b/src/ledger/utils.ts @@ -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 } -type Getter = (marker?: string, limit?: number) => Promise +export type Getter = (marker?: string, limit?: number) => Promise function clamp(value: number, min: number, max: number): number { assert(min <= max, 'Illegal clamp bounds') @@ -59,7 +59,7 @@ function renameCounterpartyToIssuer( 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) diff --git a/src/transaction/escrow-cancellation.ts b/src/transaction/escrow-cancellation.ts index 1b9006a1..bc5dd4c0 100644 --- a/src/transaction/escrow-cancellation.ts +++ b/src/transaction/escrow-cancellation.ts @@ -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 diff --git a/src/transaction/escrow-creation.ts b/src/transaction/escrow-creation.ts index dd0b8b53..16edb1bc 100644 --- a/src/transaction/escrow-creation.ts +++ b/src/transaction/escrow-creation.ts @@ -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, diff --git a/src/transaction/escrow-execution.ts b/src/transaction/escrow-execution.ts index ff010233..261fa2d1 100644 --- a/src/transaction/escrow-execution.ts +++ b/src/transaction/escrow-execution.ts @@ -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, diff --git a/src/transaction/payment-channel-claim.ts b/src/transaction/payment-channel-claim.ts index 18a46b16..55025a6a 100644 --- a/src/transaction/payment-channel-claim.ts +++ b/src/transaction/payment-channel-claim.ts @@ -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, diff --git a/src/transaction/payment-channel-create.ts b/src/transaction/payment-channel-create.ts index bf301169..508391f3 100644 --- a/src/transaction/payment-channel-create.ts +++ b/src/transaction/payment-channel-create.ts @@ -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, diff --git a/src/transaction/payment-channel-fund.ts b/src/transaction/payment-channel-fund.ts index 21c6fd73..d74320eb 100644 --- a/src/transaction/payment-channel-fund.ts +++ b/src/transaction/payment-channel-fund.ts @@ -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 diff --git a/src/transaction/payment.ts b/src/transaction/payment.ts index 06bfd921..37051d5b 100644 --- a/src/transaction/payment.ts +++ b/src/transaction/payment.ts @@ -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, diff --git a/src/transaction/settings.ts b/src/transaction/settings.ts index 9e061038..f5a9c890 100644 --- a/src/transaction/settings.ts +++ b/src/transaction/settings.ts @@ -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,