Skip to content

Commit

Permalink
Export types used by exported variables (#858)
Browse files Browse the repository at this point in the history
Fixes TypeScript compile errors due to generating TS declaration files.

See #851
  • Loading branch information
intelliot authored Mar 2, 2018
1 parent c53db48 commit 144be08
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion src/common/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function isStreamMessageType(type) {
type === 'path_find'
}

interface ConnectionOptions {
export interface ConnectionOptions {
trace?: boolean,
proxy?: string
proxyAuthorization?: string
Expand Down
4 changes: 2 additions & 2 deletions src/common/types/commands/account_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface AccountInfoResponse {
validated?: boolean
}

interface QueueData {
export interface QueueData {
txn_count: number,
auth_change_queued?: boolean,
lowest_sequence?: number,
Expand All @@ -27,7 +27,7 @@ interface QueueData {
transactions?: TransactionData[]
}

interface TransactionData {
export interface TransactionData {
auth_change?: boolean,
fee?: string,
fee_level?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/common/types/commands/book_offers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/accountinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/balance-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions src/ledger/orderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,9 +30,9 @@ type OrderbookItem = {
}
}

type OrderbookOrders = Array<OrderbookItem>
export type OrderbookOrders = Array<OrderbookItem>

type GetOrderbook = {
export type GetOrderbook = {
bids: OrderbookOrders,
asks: OrderbookOrders
}
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/parse/payment-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type LedgerEntryResponse = {
validated: boolean
}

type PaymentChannelResponse = {
export type PaymentChannelResponse = {
account: string,
balance: string,
publicKey: string,
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/ledger/transaction-types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import {Amount, Memo} from '../common/types/objects'

type Outcome = {
export type Outcome = {
result: string,
ledgerVersion: number,
indexInLedger: number,
Expand All @@ -17,7 +17,7 @@ type Outcome = {
timestamp?: string
}

type Adjustment = {
export type Adjustment = {
address: string,
amount: {
currency: string,
Expand All @@ -27,7 +27,7 @@ type Adjustment = {
tag?: number
}

type Trustline = {
export type Trustline = {
currency: string,
counterparty: string,
limit: string,
Expand All @@ -38,7 +38,7 @@ type Trustline = {
frozen?: boolean
}

type Settings = {
export type Settings = {
passwordSpent?: boolean,
requireDestinationTag?: boolean,
requireAuthorization?: boolean,
Expand All @@ -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,
Expand All @@ -71,7 +71,7 @@ type Payment = {
limitQuality?: boolean
}

type PaymentTransaction = {
export type PaymentTransaction = {
type: string,
specification: Payment,
outcome: Outcome,
Expand All @@ -92,7 +92,7 @@ export type Order = {
memos?: Memo[]
}

type OrderTransaction = {
export type OrderTransaction = {
type: string,
specification: Order,
outcome: Outcome,
Expand All @@ -101,7 +101,7 @@ type OrderTransaction = {
sequence: number
}

type OrderCancellationTransaction = {
export type OrderCancellationTransaction = {
type: string,
specification: OrderCancellation,
outcome: Outcome,
Expand All @@ -110,7 +110,7 @@ type OrderCancellationTransaction = {
sequence: number
}

type TrustlineTransaction = {
export type TrustlineTransaction = {
type: string,
specification: Trustline,
outcome: Outcome,
Expand All @@ -119,7 +119,7 @@ type TrustlineTransaction = {
sequence: number
}

type SettingsTransaction = {
export type SettingsTransaction = {
type: string,
specification: Settings,
outcome: Outcome,
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Connection} from '../common'
import {TransactionType} from './transaction-types'


type TransactionsOptions = {
export type TransactionsOptions = {
start?: string,
limit?: number,
minLedgerVersion?: number,
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/ledger/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/escrow-cancellation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/escrow-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/escrow-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/payment-channel-claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/payment-channel-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/payment-channel-fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/transaction/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 144be08

Please sign in to comment.