@okxweb3/coin-ethereum
Version:
An Ethereum SDK for building Web3 wallets and applications.
37 lines (36 loc) • 1.36 kB
TypeScript
/// <reference types="bn.js" />
/// <reference types="node" />
import { BN } from '@okxweb3/crypto-lib';
import { Address } from './address';
import { ToBufferInputTypes } from './bytes';
export type BNLike = BN | PrefixedHexString | number | Buffer;
export type BufferLike = Buffer | Uint8Array | number[] | number | BN | TransformableToBuffer | PrefixedHexString;
export type PrefixedHexString = string;
export type AddressLike = Address | Buffer | PrefixedHexString;
export interface TransformableToArray {
toArray(): Uint8Array;
toBuffer?(): Buffer;
}
export interface TransformableToBuffer {
toBuffer(): Buffer;
toArray?(): Uint8Array;
}
export declare function bnToHex(value: BN): PrefixedHexString;
export declare const validateNoLeadingZeroes: (values: {
[key: string]: Buffer | undefined;
}) => void;
export declare function bnToUnpaddedBuffer(value: BN): Buffer;
export declare function bnToRlp(value: BN): Buffer;
export declare enum TypeOutput {
Number = 0,
BN = 1,
Buffer = 2,
PrefixedHexString = 3
}
export type TypeOutputReturnType = {
[TypeOutput.Number]: number;
[TypeOutput.BN]: BN;
[TypeOutput.Buffer]: Buffer;
[TypeOutput.PrefixedHexString]: PrefixedHexString;
};
export declare function toType<T extends TypeOutput>(input: ToBufferInputTypes, outputType: T): TypeOutputReturnType[T];