1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * Codec class
- */
- /// <reference types="node" />
- declare class Codec {
- private readonly _sha256;
- private readonly _alphabet;
- private readonly _codec;
- 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;
- /**
- * 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: 'ed25519' | 'secp256k1' | null;
- };
- encodeChecked(buffer: Buffer): string;
- decodeChecked(base58string: string): Buffer;
- private _encodeVersioned;
- private _encodeRaw;
- private _decodeRaw;
- private _verifyCheckSum;
- }
- 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: 'ed25519' | 'secp256k1' | 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 {};
|