UNPKG

13.3 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from 'events';
3import { Connection, errors, validate, xrpToDrops, dropsToXrp, rippleTimeToISO8601, iso8601ToRippleTime } from './common';
4import { connect, disconnect, isConnected, getLedgerVersion } from './server/server';
5import getTransaction from './ledger/transaction';
6import getTransactions from './ledger/transactions';
7import getTrustlines from './ledger/trustlines';
8import getBalances from './ledger/balances';
9import getBalanceSheet from './ledger/balance-sheet';
10import getPaths from './ledger/pathfind';
11import getOrders from './ledger/orders';
12import { getOrderbook, formatBidsAndAsks } from './ledger/orderbook';
13import { getSettings, parseAccountFlags } from './ledger/settings';
14import getAccountInfo from './ledger/accountinfo';
15import getAccountObjects from './ledger/accountobjects';
16import getPaymentChannel from './ledger/payment-channel';
17import preparePayment from './transaction/payment';
18import prepareTrustline from './transaction/trustline';
19import prepareOrder from './transaction/order';
20import prepareOrderCancellation from './transaction/ordercancellation';
21import prepareEscrowCreation from './transaction/escrow-creation';
22import prepareEscrowExecution from './transaction/escrow-execution';
23import prepareEscrowCancellation from './transaction/escrow-cancellation';
24import preparePaymentChannelCreate from './transaction/payment-channel-create';
25import preparePaymentChannelFund from './transaction/payment-channel-fund';
26import preparePaymentChannelClaim from './transaction/payment-channel-claim';
27import prepareCheckCreate from './transaction/check-create';
28import prepareCheckCancel from './transaction/check-cancel';
29import prepareCheckCash from './transaction/check-cash';
30import prepareSettings from './transaction/settings';
31import prepareTicketCreate from './transaction/ticket';
32import sign from './transaction/sign';
33import combine from './transaction/combine';
34import submit from './transaction/submit';
35import { generateXAddress } from './offline/utils';
36import { deriveXAddress } from './offline/derive';
37import computeLedgerHash from './offline/ledgerhash';
38import signPaymentChannelClaim from './offline/sign-payment-channel-claim';
39import verifyPaymentChannelClaim from './offline/verify-payment-channel-claim';
40import getLedger from './ledger/ledger';
41import { AccountObjectsRequest, AccountObjectsResponse, AccountOffersRequest, AccountOffersResponse, AccountInfoRequest, AccountInfoResponse, AccountLinesRequest, AccountLinesResponse, BookOffersRequest, BookOffersResponse, GatewayBalancesRequest, GatewayBalancesResponse, LedgerRequest, LedgerResponse, LedgerDataRequest, LedgerDataResponse, LedgerEntryRequest, LedgerEntryResponse, ServerInfoRequest, ServerInfoResponse } from './common/types/commands';
42import RangeSet from './common/rangeset';
43import * as ledgerUtils from './ledger/utils';
44import * as schemaValidator from './common/schema-validator';
45import { TransactionJSON, Instructions, Prepare } from './transaction/types';
46import { ConnectionUserOptions } from './common/connection';
47import { classicAddressToXAddress, xAddressToClassicAddress, isValidXAddress, isValidClassicAddress, encodeSeed, decodeSeed, encodeAccountID, decodeAccountID, encodeNodePublic, decodeNodePublic, encodeAccountPublic, decodeAccountPublic, encodeXAddress, decodeXAddress } from 'ripple-address-codec';
48import generateFaucetWallet from './wallet/wallet-generation';
49export interface APIOptions extends ConnectionUserOptions {
50 server?: string;
51 feeCushion?: number;
52 maxFeeXRP?: string;
53 proxy?: string;
54 timeout?: number;
55}
56declare class RippleAPI extends EventEmitter {
57 _feeCushion: number;
58 _maxFeeXRP: string;
59 connection: Connection;
60 static _PRIVATE: {
61 validate: typeof validate;
62 RangeSet: typeof RangeSet;
63 ledgerUtils: typeof ledgerUtils;
64 schemaValidator: typeof schemaValidator;
65 };
66 static renameCounterpartyToIssuer: typeof ledgerUtils.renameCounterpartyToIssuer;
67 static formatBidsAndAsks: typeof formatBidsAndAsks;
68 constructor(options?: APIOptions);
69 request(command: 'account_info', params: AccountInfoRequest): Promise<AccountInfoResponse>;
70 request(command: 'account_lines', params: AccountLinesRequest): Promise<AccountLinesResponse>;
71 request(command: 'account_objects', params: AccountObjectsRequest): Promise<AccountObjectsResponse>;
72 request(command: 'account_offers', params: AccountOffersRequest): Promise<AccountOffersResponse>;
73 request(command: 'book_offers', params: BookOffersRequest): Promise<BookOffersResponse>;
74 request(command: 'gateway_balances', params: GatewayBalancesRequest): Promise<GatewayBalancesResponse>;
75 request(command: 'ledger', params: LedgerRequest): Promise<LedgerResponse>;
76 request(command: 'ledger_data', params?: LedgerDataRequest): Promise<LedgerDataResponse>;
77 request(command: 'ledger_entry', params: LedgerEntryRequest): Promise<LedgerEntryResponse>;
78 request(command: 'server_info', params?: ServerInfoRequest): Promise<ServerInfoResponse>;
79 request(command: string, params: any): Promise<any>;
80 hasNextPage<T extends {
81 marker?: string;
82 }>(currentResponse: T): boolean;
83 requestNextPage<T extends {
84 marker?: string;
85 }>(command: string, params: object, currentResponse: T): Promise<T>;
86 prepareTransaction(txJSON: TransactionJSON, instructions?: Instructions): Promise<Prepare>;
87 convertStringToHex(string: string): string;
88 _requestAll(command: 'account_offers', params: AccountOffersRequest): Promise<AccountOffersResponse[]>;
89 _requestAll(command: 'book_offers', params: BookOffersRequest): Promise<BookOffersResponse[]>;
90 _requestAll(command: 'account_lines', params: AccountLinesRequest): Promise<AccountLinesResponse[]>;
91 generateAddress: (options?: import("./offline/generate-address").GenerateAddressOptions) => import("./offline/generate-address").GeneratedAddress;
92 generateXAddress: typeof generateXAddress;
93 connect: typeof connect;
94 disconnect: typeof disconnect;
95 isConnected: typeof isConnected;
96 getServerInfo: typeof ledgerUtils.common.serverInfo.getServerInfo;
97 getFee: typeof ledgerUtils.common.serverInfo.getFee;
98 getLedgerVersion: typeof getLedgerVersion;
99 getTransaction: typeof getTransaction;
100 getTransactions: typeof getTransactions;
101 getTrustlines: typeof getTrustlines;
102 getBalances: typeof getBalances;
103 getBalanceSheet: typeof getBalanceSheet;
104 getPaths: typeof getPaths;
105 getOrderbook: typeof getOrderbook;
106 getOrders: typeof getOrders;
107 getSettings: typeof getSettings;
108 getAccountInfo: typeof getAccountInfo;
109 getAccountObjects: typeof getAccountObjects;
110 getPaymentChannel: typeof getPaymentChannel;
111 getLedger: typeof getLedger;
112 parseAccountFlags: typeof parseAccountFlags;
113 preparePayment: typeof preparePayment;
114 prepareTrustline: typeof prepareTrustline;
115 prepareOrder: typeof prepareOrder;
116 prepareOrderCancellation: typeof prepareOrderCancellation;
117 prepareEscrowCreation: typeof prepareEscrowCreation;
118 prepareEscrowExecution: typeof prepareEscrowExecution;
119 prepareEscrowCancellation: typeof prepareEscrowCancellation;
120 preparePaymentChannelCreate: typeof preparePaymentChannelCreate;
121 preparePaymentChannelFund: typeof preparePaymentChannelFund;
122 preparePaymentChannelClaim: typeof preparePaymentChannelClaim;
123 prepareCheckCreate: typeof prepareCheckCreate;
124 prepareCheckCash: typeof prepareCheckCash;
125 prepareCheckCancel: typeof prepareCheckCancel;
126 prepareTicketCreate: typeof prepareTicketCreate;
127 prepareSettings: typeof prepareSettings;
128 sign: typeof sign;
129 combine: typeof combine;
130 submit: typeof submit;
131 deriveKeypair: (seed: string, options?: object) => {
132 publicKey: string;
133 privateKey: string;
134 };
135 deriveAddress: (publicKey: any) => string;
136 computeLedgerHash: typeof computeLedgerHash;
137 signPaymentChannelClaim: typeof signPaymentChannelClaim;
138 verifyPaymentChannelClaim: typeof verifyPaymentChannelClaim;
139 generateFaucetWallet: typeof generateFaucetWallet;
140 errors: typeof errors;
141 static deriveXAddress: typeof deriveXAddress;
142 static deriveClassicAddress: (publicKey: any) => string;
143 static classicAddressToXAddress: typeof classicAddressToXAddress;
144 static xAddressToClassicAddress: typeof xAddressToClassicAddress;
145 static isValidXAddress: typeof isValidXAddress;
146 static isValidClassicAddress: typeof isValidClassicAddress;
147 static encodeSeed: typeof encodeSeed;
148 static decodeSeed: typeof decodeSeed;
149 static encodeAccountID: typeof encodeAccountID;
150 static decodeAccountID: typeof decodeAccountID;
151 static encodeNodePublic: typeof encodeNodePublic;
152 static decodeNodePublic: typeof decodeNodePublic;
153 static encodeAccountPublic: typeof encodeAccountPublic;
154 static decodeAccountPublic: typeof decodeAccountPublic;
155 static encodeXAddress: typeof encodeXAddress;
156 static decodeXAddress: typeof decodeXAddress;
157 static computeBinaryTransactionHash: (txBlobHex: string) => string;
158 static computeTransactionHash: (txJSON: any) => string;
159 static computeBinaryTransactionSigningHash: (txBlobHex: string) => string;
160 static computeAccountLedgerObjectID: (address: string) => string;
161 static computeSignerListLedgerObjectID: (address: string) => string;
162 static computeOrderID: (address: string, sequence: number) => string;
163 static computeTrustlineHash: (address1: string, address2: string, currency: string) => string;
164 static computeTransactionTreeHash: (transactions: any[]) => string;
165 static computeStateTreeHash: (entries: any[]) => string;
166 static computeLedgerHash: typeof computeLedgerHash;
167 static computeEscrowHash: (address: any, sequence: any) => string;
168 static computePaymentChannelHash: (address: any, dstAddress: any, sequence: any) => string;
169 xrpToDrops: typeof xrpToDrops;
170 dropsToXrp: typeof dropsToXrp;
171 rippleTimeToISO8601: typeof rippleTimeToISO8601;
172 iso8601ToRippleTime: typeof iso8601ToRippleTime;
173 txFlags: {
174 Universal: {
175 FullyCanonicalSig: number;
176 };
177 AccountSet: {
178 RequireDestTag: number;
179 OptionalDestTag: number;
180 RequireAuth: number;
181 OptionalAuth: number;
182 DisallowXRP: number;
183 AllowXRP: number;
184 };
185 TrustSet: {
186 SetAuth: number;
187 NoRipple: number;
188 SetNoRipple: number;
189 ClearNoRipple: number;
190 SetFreeze: number;
191 ClearFreeze: number;
192 };
193 OfferCreate: {
194 Passive: number;
195 ImmediateOrCancel: number;
196 FillOrKill: number;
197 Sell: number;
198 };
199 Payment: {
200 NoRippleDirect: number;
201 PartialPayment: number;
202 LimitQuality: number;
203 };
204 PaymentChannelClaim: {
205 Renew: number;
206 Close: number;
207 };
208 };
209 static txFlags: {
210 Universal: {
211 FullyCanonicalSig: number;
212 };
213 AccountSet: {
214 RequireDestTag: number;
215 OptionalDestTag: number;
216 RequireAuth: number;
217 OptionalAuth: number;
218 DisallowXRP: number;
219 AllowXRP: number;
220 };
221 TrustSet: {
222 SetAuth: number;
223 NoRipple: number;
224 SetNoRipple: number;
225 ClearNoRipple: number;
226 SetFreeze: number;
227 ClearFreeze: number;
228 };
229 OfferCreate: {
230 Passive: number;
231 ImmediateOrCancel: number;
232 FillOrKill: number;
233 Sell: number;
234 };
235 Payment: {
236 NoRippleDirect: number;
237 PartialPayment: number;
238 LimitQuality: number;
239 };
240 PaymentChannelClaim: {
241 Renew: number;
242 Close: number;
243 };
244 };
245 accountSetFlags: {
246 requireDestinationTag: number;
247 requireAuthorization: number;
248 depositAuth: number;
249 disallowIncomingXRP: number;
250 disableMasterKey: number;
251 enableTransactionIDTracking: number;
252 noFreeze: number;
253 globalFreeze: number;
254 defaultRipple: number;
255 };
256 static accountSetFlags: {
257 requireDestinationTag: number;
258 requireAuthorization: number;
259 depositAuth: number;
260 disallowIncomingXRP: number;
261 disableMasterKey: number;
262 enableTransactionIDTracking: number;
263 noFreeze: number;
264 globalFreeze: number;
265 defaultRipple: number;
266 };
267 isValidAddress: typeof schemaValidator.isValidAddress;
268 isValidSecret: typeof schemaValidator.isValidSecret;
269}
270export { RippleAPI };
271export type { AccountObjectsRequest, AccountObjectsResponse, AccountOffersRequest, AccountOffersResponse, AccountInfoRequest, AccountInfoResponse, AccountLinesRequest, AccountLinesResponse, BookOffersRequest, BookOffersResponse, GatewayBalancesRequest, GatewayBalancesResponse, LedgerRequest, LedgerResponse, LedgerDataRequest, LedgerDataResponse, LedgerEntryRequest, LedgerEntryResponse, ServerInfoRequest, ServerInfoResponse };
272//# sourceMappingURL=api.d.ts.map
\No newline at end of file