12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /**
- * Codec class
- */
- /// <reference types="node" />
- import * as baseCodec from 'base-x';
- declare class Codec {
- sha256: (bytes: Uint8Array) => Buffer;
- alphabet: string;
- codec: baseCodec.BaseConverter;
- base: number;
- constructor(options: {
- sha256: (bytes: Uint8Array) => Buffer;
- alphabet: string;
- });
- /**
- * Encoder.
- *
- * @param bytes - Buffer of data to encode.
- * @param opts - Options object including the version bytes and the expected length of the data to encode.
- */
- encode(bytes: Buffer, opts: {
- versions: number[];
- expectedLength: number;
- }): string;
- encodeVersioned(bytes: Buffer, versions: number[], expectedLength: number): string;
- encodeChecked(buffer: Buffer): string;
- encodeRaw(bytes: Buffer): string;
- /**
- * Decoder.
- *
- * @param base58string - Base58Check-encoded string to decode.
- * @param opts - Options object including the version byte(s) and the expected length of the data after decoding.
- */
- decode(base58string: string, opts: {
- versions: Array<number | number[]>;
- expectedLength?: number;
- versionTypes?: ['ed25519', 'secp256k1'];
- }): {
- version: number[];
- bytes: Buffer;
- type: string | null;
- };
- decodeChecked(base58string: string): Buffer;
- decodeRaw(base58string: string): Buffer;
- verifyCheckSum(bytes: Buffer): boolean;
- }
- export declare const codec: Codec;
- export declare function encodeSeed(entropy: Buffer, type: 'ed25519' | 'secp256k1'): string;
- export declare function decodeSeed(seed: string, opts?: {
- versionTypes: ['ed25519', 'secp256k1'];
- versions: Array<number | number[]>;
- expectedLength: number;
- }): {
- version: number[];
- bytes: Buffer;
- type: string | null;
- };
- export declare function encodeAccountID(bytes: Buffer): string;
- export declare const encodeAddress: typeof encodeAccountID;
- export declare function decodeAccountID(accountId: string): Buffer;
- export declare const decodeAddress: typeof decodeAccountID;
- export declare function decodeNodePublic(base58string: string): Buffer;
- export declare function encodeNodePublic(bytes: Buffer): string;
- export declare function encodeAccountPublic(bytes: Buffer): string;
- export declare function decodeAccountPublic(base58string: string): Buffer;
- export declare function isValidClassicAddress(address: string): boolean;
- export {};
|