UNPKG

3.85 kBTypeScriptView Raw
1import { BinaryParser } from './serdes/binary-parser';
2import { AccountID } from './types/account-id';
3import { BinarySerializer, BytesList } from './serdes/binary-serializer';
4import { sha512Half, transactionID } from './hashes';
5import { type XrplDefinitionsBase } from './enums';
6import { JsonObject } from './types/serialized-type';
7import { Buffer } from 'buffer/';
8/**
9 * Construct a BinaryParser
10 *
11 * @param bytes hex-string to construct BinaryParser from
12 * @param definitions rippled definitions used to parse the values of transaction types and such.
13 * Can be customized for sidechains and amendments.
14 * @returns A BinaryParser
15 */
16declare const makeParser: (bytes: string, definitions?: XrplDefinitionsBase) => BinaryParser;
17/**
18 * Parse BinaryParser into JSON
19 *
20 * @param parser BinaryParser object
21 * @param definitions rippled definitions used to parse the values of transaction types and such.
22 * Can be customized for sidechains and amendments.
23 * @returns JSON for the bytes in the BinaryParser
24 */
25declare const readJSON: (parser: BinaryParser, definitions?: XrplDefinitionsBase) => JsonObject;
26/**
27 * Parse a hex-string into its JSON interpretation
28 *
29 * @param bytes hex-string to parse into JSON
30 * @param definitions rippled definitions used to parse the values of transaction types and such.
31 * Can be customized for sidechains and amendments.
32 * @returns JSON
33 */
34declare const binaryToJSON: (bytes: string, definitions?: XrplDefinitionsBase) => JsonObject;
35/**
36 * Interface for passing parameters to SerializeObject
37 *
38 * @field set signingFieldOnly to true if you want to serialize only signing fields
39 */
40interface OptionObject {
41 prefix?: Buffer;
42 suffix?: Buffer;
43 signingFieldsOnly?: boolean;
44 definitions?: XrplDefinitionsBase;
45}
46/**
47 * Function to serialize JSON object representing a transaction
48 *
49 * @param object JSON object to serialize
50 * @param opts options for serializing, including optional prefix, suffix, signingFieldOnly, and definitions
51 * @returns A Buffer containing the serialized object
52 */
53declare function serializeObject(object: JsonObject, opts?: OptionObject): Buffer;
54/**
55 * Serialize an object for signing
56 *
57 * @param transaction Transaction to serialize
58 * @param prefix Prefix bytes to put before the serialized object
59 * @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
60 * @returns A Buffer with the serialized object
61 */
62declare function signingData(transaction: JsonObject, prefix?: Buffer, opts?: {
63 definitions?: XrplDefinitionsBase;
64}): Buffer;
65/**
66 * Interface describing fields required for a Claim
67 */
68interface ClaimObject extends JsonObject {
69 channel: string;
70 amount: string | number;
71}
72/**
73 * Serialize a signingClaim
74 *
75 * @param claim A claim object to serialize
76 * @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
77 * @returns the serialized object with appropriate prefix
78 */
79declare function signingClaimData(claim: ClaimObject): Buffer;
80/**
81 * Serialize a transaction object for multiSigning
82 *
83 * @param transaction transaction to serialize
84 * @param signingAccount Account to sign the transaction with
85 * @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
86 * @returns serialized transaction with appropriate prefix and suffix
87 */
88declare function multiSigningData(transaction: JsonObject, signingAccount: string | AccountID, opts?: {
89 definitions: XrplDefinitionsBase;
90}): Buffer;
91export { BinaryParser, BinarySerializer, BytesList, ClaimObject, makeParser, serializeObject, readJSON, multiSigningData, signingData, signingClaimData, binaryToJSON, sha512Half, transactionID, };