UNPKG

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