Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. /// <reference types="node" />
  2. import { EventEmitter } from 'events';
  3. import { Connection, errors, validate, xrpToDrops, dropsToXrp, rippleTimeToISO8601, iso8601ToRippleTime } from './common';
  4. import { connect, disconnect, isConnected, getLedgerVersion } from './server/server';
  5. import getTransaction from './ledger/transaction';
  6. import getTransactions from './ledger/transactions';
  7. import getTrustlines from './ledger/trustlines';
  8. import getBalances from './ledger/balances';
  9. import getBalanceSheet from './ledger/balance-sheet';
  10. import getPaths from './ledger/pathfind';
  11. import getOrders from './ledger/orders';
  12. import { getOrderbook, formatBidsAndAsks } from './ledger/orderbook';
  13. import { getSettings, parseAccountFlags } from './ledger/settings';
  14. import getAccountInfo from './ledger/accountinfo';
  15. import getAccountObjects from './ledger/accountobjects';
  16. import getPaymentChannel from './ledger/payment-channel';
  17. import preparePayment from './transaction/payment';
  18. import prepareTrustline from './transaction/trustline';
  19. import prepareOrder from './transaction/order';
  20. import prepareOrderCancellation from './transaction/ordercancellation';
  21. import prepareEscrowCreation from './transaction/escrow-creation';
  22. import prepareEscrowExecution from './transaction/escrow-execution';
  23. import prepareEscrowCancellation from './transaction/escrow-cancellation';
  24. import preparePaymentChannelCreate from './transaction/payment-channel-create';
  25. import preparePaymentChannelFund from './transaction/payment-channel-fund';
  26. import preparePaymentChannelClaim from './transaction/payment-channel-claim';
  27. import prepareCheckCreate from './transaction/check-create';
  28. import prepareCheckCancel from './transaction/check-cancel';
  29. import prepareCheckCash from './transaction/check-cash';
  30. import prepareSettings from './transaction/settings';
  31. import prepareTicketCreate from './transaction/ticket';
  32. import sign from './transaction/sign';
  33. import combine from './transaction/combine';
  34. import submit from './transaction/submit';
  35. import { generateXAddress } from './offline/utils';
  36. import { deriveXAddress } from './offline/derive';
  37. import computeLedgerHash from './offline/ledgerhash';
  38. import signPaymentChannelClaim from './offline/sign-payment-channel-claim';
  39. import verifyPaymentChannelClaim from './offline/verify-payment-channel-claim';
  40. import getLedger from './ledger/ledger';
  41. import { AccountObjectsRequest, AccountObjectsResponse, AccountOffersRequest, AccountOffersResponse, AccountInfoRequest, AccountInfoResponse, AccountLinesRequest, AccountLinesResponse, BookOffersRequest, BookOffersResponse, GatewayBalancesRequest, GatewayBalancesResponse, LedgerRequest, LedgerResponse, LedgerDataRequest, LedgerDataResponse, LedgerEntryRequest, LedgerEntryResponse, ServerInfoRequest, ServerInfoResponse } from './common/types/commands';
  42. import RangeSet from './common/rangeset';
  43. import * as ledgerUtils from './ledger/utils';
  44. import * as schemaValidator from './common/schema-validator';
  45. import { TransactionJSON, Instructions, Prepare } from './transaction/types';
  46. import { ConnectionUserOptions } from './common/connection';
  47. import { classicAddressToXAddress, xAddressToClassicAddress, isValidXAddress, isValidClassicAddress, encodeSeed, decodeSeed, encodeAccountID, decodeAccountID, encodeNodePublic, decodeNodePublic, encodeAccountPublic, decodeAccountPublic, encodeXAddress, decodeXAddress } from 'ripple-address-codec';
  48. import generateFaucetWallet from './wallet/wallet-generation';
  49. export interface APIOptions extends ConnectionUserOptions {
  50. server?: string;
  51. feeCushion?: number;
  52. maxFeeXRP?: string;
  53. proxy?: string;
  54. timeout?: number;
  55. }
  56. declare 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. }
  270. export { RippleAPI };
  271. export 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