Cleaned up the redundant content of the remaining 6 packages

pull/21/head
Wen Zhang 5 years ago committed by Ganesha Upadhyaya
parent 40fc994fae
commit 61a8b8e7c0
  1. 65
      packages/harmony-contract/src/abi/abiCoder.ts
  2. 2
      packages/harmony-contract/src/events/eventFactory.ts
  3. 1
      packages/harmony-contract/src/index.ts
  4. 1
      packages/harmony-contract/src/models/types.ts
  5. 1
      packages/harmony-contract/src/utils/decoder.ts
  6. 1
      packages/harmony-contract/src/utils/encoder.ts
  7. 1
      packages/harmony-contract/src/utils/formatter.ts
  8. 1
      packages/harmony-contract/src/utils/mapper.ts
  9. 1
      packages/harmony-contract/src/utils/options.ts
  10. 1
      packages/harmony-contract/src/utils/status.ts
  11. 1
      packages/harmony-crypto/src/bech32.ts
  12. 1
      packages/harmony-crypto/src/bytes.ts
  13. 25
      packages/harmony-crypto/src/errors.ts
  14. 1
      packages/harmony-crypto/src/keyTool.ts
  15. 1
      packages/harmony-crypto/src/keystore.ts
  16. 1
      packages/harmony-crypto/src/rlp.ts
  17. 1
      packages/harmony-network/src/messenger/messenger.ts
  18. 2
      packages/harmony-network/src/messenger/responseMiddleware.ts
  19. 1
      packages/harmony-network/src/providers/baseProvider.ts
  20. 1
      packages/harmony-network/src/providers/baseSocket.ts
  21. 1
      packages/harmony-network/src/providers/defaultFetcher.ts
  22. 1
      packages/harmony-network/src/providers/http.ts
  23. 1
      packages/harmony-network/src/rpcMethod/builder.ts
  24. 1
      packages/harmony-network/src/tracker/baseTracker.ts
  25. 1
      packages/harmony-network/src/tracker/pollingTracker.ts
  26. 1
      packages/harmony-network/src/tracker/subscribeTracker.ts
  27. 1
      packages/harmony-network/src/util.ts
  28. 2
      packages/harmony-staking/src/factory.ts
  29. 3
      packages/harmony-staking/src/stakingTransaction.ts
  30. 2
      packages/harmony-staking/test/testSign.test.ts
  31. 1
      packages/harmony-transaction/src/transactionBase.ts
  32. 5
      packages/harmony-transaction/src/types.ts
  33. 1
      packages/harmony-transaction/src/utils.ts
  34. 4
      packages/harmony-utils/src/chain.ts
  35. 1
      packages/harmony-utils/src/tools.ts
  36. 2
      packages/harmony-utils/src/transformers.ts
  37. 1
      packages/harmony-utils/src/utils.ts

@ -1,5 +1,4 @@
/**
*
* @packageDocumentation
* @module harmony-contract
*/
@ -27,18 +26,23 @@ import {
} from '@harmony-js/crypto';
import { hexToBN, defineReadOnly } from '@harmony-js/utils';
/** @hidden */
const NegativeOne: BN = new BN(-1);
/** @hidden */
const One: BN = new BN(1);
// const Two: BN = new BN(2);
/** @hidden */
const Zero: BN = new BN(0);
/** @hidden */
const HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
/** @hidden */
const MaxUint256: BN = hexToBN(
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
);
/** @hidden */
export type CoerceFunc = (type: string, value: any) => any;
/** @hidden */
export interface ParamType {
name?: string;
type: string;
@ -48,6 +52,7 @@ export interface ParamType {
// @TODO: should this just be a combined Fragment?
/** @hidden */
export interface EventFragment {
type: string;
name: string;
@ -57,6 +62,7 @@ export interface EventFragment {
inputs: ParamType[];
}
/** @hidden */
export interface FunctionFragment {
type: string;
name: string;
@ -73,11 +79,14 @@ export interface FunctionFragment {
}
///////////////////////////////
/** @hidden */
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
/** @hidden */
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
/** @hidden */
const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
/** @hidden */
export const defaultCoerceFunc: CoerceFunc = (type: string, value: any): any => {
const match = type.match(paramTypeNumber);
if (match && parseInt(match[2], 10) <= 48) {
@ -93,9 +102,12 @@ export const defaultCoerceFunc: CoerceFunc = (type: string, value: any): any =>
///////////////////////////////////
// Parsing for Solidity Signatures
/** @hidden */
const regexParen = new RegExp('^([^)(]*)\\((.*)\\)([^)(]*)$');
/** @hidden */
const regexIdentifier = new RegExp('^[A-Za-z_][A-Za-z0-9_]*$');
/** @hidden */
function verifyType(type: string): string {
// These need to be transformed to their full description
if (type.match(/^uint($|[^1-9])/)) {
@ -107,6 +119,7 @@ function verifyType(type: string): string {
return type;
}
/** @hidden */
interface ParseState {
allowArray?: boolean;
allowName?: boolean;
@ -115,6 +128,7 @@ interface ParseState {
readArray?: boolean;
}
/** @hidden */
interface ParseNode {
parent?: any;
type?: string;
@ -124,6 +138,7 @@ interface ParseNode {
components?: any[];
}
/** @hidden */
function parseParam(param: string, allowIndexed?: boolean): ParamType {
const originalParam = param;
// tslint:disable-next-line: no-shadowed-variable
@ -298,6 +313,7 @@ function parseParam(param: string, allowIndexed?: boolean): ParamType {
}
// @TODO: Better return type
/** @hidden */
function parseSignatureEvent(fragment: string): EventFragment {
const abi: EventFragment = {
anonymous: false,
@ -338,15 +354,18 @@ function parseSignatureEvent(fragment: string): EventFragment {
return abi;
}
/** @hidden */
export function parseParamType(type: string): ParamType {
return parseParam(type, true);
}
// @TODO: Allow a second boolean to expose names
/** @hidden */
export function formatParamType(paramType: ParamType): string {
return getParamCoder(defaultCoerceFunc, paramType).type;
}
/** @hidden */
function parseSignatureFunction(fragment: string): FunctionFragment {
const abi: FunctionFragment = {
constant: false,
@ -439,10 +458,12 @@ function parseSignatureFunction(fragment: string): FunctionFragment {
}
// @TODO: Allow a second boolean to expose names and modifiers
/** @hidden */
export function formatSignature(fragment: EventFragment | FunctionFragment): string {
return fragment.name + '(' + fragment.inputs.map((i) => formatParamType(i)).join(',') + ')';
}
/** @hidden */
export function parseSignature(fragment: string): EventFragment | FunctionFragment {
if (typeof fragment === 'string') {
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
@ -468,11 +489,13 @@ export function parseSignature(fragment: string): EventFragment | FunctionFragme
///////////////////////////////////
// Coders
/** @hidden */
interface DecodedResult {
consumed: number;
value: any;
}
/** @hidden */
abstract class Coder {
readonly coerceFunc: CoerceFunc;
readonly name: string;
@ -499,6 +522,7 @@ abstract class Coder {
// Clones the functionality of an existing Coder, but without a localName
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderAnonymous extends Coder {
private coder: Coder;
constructor(coder: Coder) {
@ -514,6 +538,7 @@ class CoderAnonymous extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderNull extends Coder {
constructor(coerceFunc: CoerceFunc, localName: string) {
super(coerceFunc, 'null', '', localName, false);
@ -536,6 +561,7 @@ class CoderNull extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderNumber extends Coder {
readonly size: number;
readonly signed: boolean;
@ -606,6 +632,8 @@ class CoderNumber extends Coder {
};
}
}
/** @hidden */
const uint256Coder = new CoderNumber(
(type: string, value: any) => {
return value;
@ -616,6 +644,7 @@ const uint256Coder = new CoderNumber(
);
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderBoolean extends Coder {
constructor(coerceFunc: CoerceFunc, localName: string) {
super(coerceFunc, 'bool', 'bool', localName, false);
@ -647,6 +676,7 @@ class CoderBoolean extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderFixedBytes extends Coder {
readonly length: number;
constructor(coerceFunc: CoerceFunc, length: number, localName: string) {
@ -699,6 +729,7 @@ class CoderFixedBytes extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderAddress extends Coder {
constructor(coerceFunc: CoerceFunc, localName: string) {
super(coerceFunc, 'address', 'address', localName, false);
@ -735,6 +766,7 @@ class CoderAddress extends Coder {
}
}
/** @hidden */
function _encodeDynamicBytes(value: Uint8Array): Uint8Array {
const dataLength = 32 * Math.ceil(value.length / 32);
const padding = new Uint8Array(dataLength - value.length);
@ -742,6 +774,7 @@ function _encodeDynamicBytes(value: Uint8Array): Uint8Array {
return concat([uint256Coder.encode(new BN(value.length)), value, padding]);
}
/** @hidden */
function _decodeDynamicBytes(data: Uint8Array, offset: number, localName: string): DecodedResult {
if (data.length < offset + 32) {
throwError('insufficient data for dynamicBytes length', INVALID_ARGUMENT, {
@ -778,6 +811,7 @@ function _decodeDynamicBytes(data: Uint8Array, offset: number, localName: string
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderDynamicBytes extends Coder {
constructor(coerceFunc: CoerceFunc, localName: string) {
super(coerceFunc, 'bytes', 'bytes', localName, true);
@ -804,6 +838,7 @@ class CoderDynamicBytes extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderString extends Coder {
constructor(coerceFunc: CoerceFunc, localName: string) {
super(coerceFunc, 'string', 'string', localName, true);
@ -827,10 +862,12 @@ class CoderString extends Coder {
}
}
/** @hidden */
function alignSize(size: number): number {
return 32 * Math.ceil(size / 32);
}
/** @hidden */
function pack(coders: Coder[], values: any[]): Uint8Array {
if (Array.isArray(values)) {
// do nothing
@ -895,6 +932,7 @@ function pack(coders: Coder[], values: any[]): Uint8Array {
return data;
}
/** @hidden */
function unpack(coders: Coder[], data: Uint8Array, offset: number): DecodedResult {
const baseOffset = offset;
let consumed = 0;
@ -942,6 +980,7 @@ function unpack(coders: Coder[], data: Uint8Array, offset: number): DecodedResul
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderArray extends Coder {
readonly coder: Coder;
readonly length: number;
@ -1031,6 +1070,7 @@ class CoderArray extends Coder {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
class CoderTuple extends Coder {
readonly coders: Coder[];
constructor(coerceFunc: CoerceFunc, coders: Coder[], localName: string) {
@ -1060,6 +1100,7 @@ class CoderTuple extends Coder {
}
}
/** @hidden */
function splitNesting(value: string): any[] {
value = value.trim();
@ -1093,6 +1134,7 @@ function splitNesting(value: string): any[] {
}
// @TODO: Is there a way to return "class"?
/** @hidden */
const paramTypeSimple: { [key: string]: any } = {
address: CoderAddress,
bool: CoderBoolean,
@ -1100,6 +1142,7 @@ const paramTypeSimple: { [key: string]: any } = {
bytes: CoderDynamicBytes,
};
/** @hidden */
function getTupleParamCoder(
coerceFunc: CoerceFunc,
components: any[],
@ -1116,6 +1159,7 @@ function getTupleParamCoder(
return new CoderTuple(coerceFunc, coders, localName);
}
/** @hidden */
function getParamCoder(coerceFunc: CoerceFunc, param: ParamType | any): any {
const coder = paramTypeSimple[param.type];
if (coder) {
@ -1168,6 +1212,7 @@ function getParamCoder(coerceFunc: CoerceFunc, param: ParamType | any): any {
});
}
/** @hidden */
export enum UnicodeNormalizationForm {
current = '',
NFC = 'NFC',
@ -1176,6 +1221,7 @@ export enum UnicodeNormalizationForm {
NFKD = 'NFKD',
}
/** @hidden */
export function toUtf8Bytes(
str: string,
form: UnicodeNormalizationForm = UnicodeNormalizationForm.current,
@ -1219,6 +1265,7 @@ export function toUtf8Bytes(
}
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
/** @hidden */
export function toUtf8String(bytes: Arrayish, ignoreErrors?: boolean): string {
bytes = arrayify(bytes) || new Uint8Array();
@ -1337,6 +1384,7 @@ export function toUtf8String(bytes: Arrayish, ignoreErrors?: boolean): string {
return result;
}
/** @hidden */
export function formatBytes32String(text: string): string {
// Get the bytes
const bytes = toUtf8Bytes(text);
@ -1350,6 +1398,7 @@ export function formatBytes32String(text: string): string {
return hexlify(concat([bytes, HashZero]).slice(0, 32));
}
/** @hidden */
export function parseBytes32String(bytes: Arrayish): string {
const data = arrayify(bytes) || new Uint8Array();
@ -1371,10 +1420,12 @@ export function parseBytes32String(bytes: Arrayish): string {
return toUtf8String(data.slice(0, length));
}
/** @hidden */
export function isType(object: any, type: string): boolean {
return object && object._ethersType === type;
}
/** @hidden */
export function shallowCopy(object: any): any {
const result: any = {};
// tslint:disable-next-line: forin
@ -1384,12 +1435,14 @@ export function shallowCopy(object: any): any {
return result;
}
/** @hidden */
const opaque: { [key: string]: boolean } = {
boolean: true,
number: true,
string: true,
};
/** @hidden */
export function deepCopy(object: any, frozen?: boolean): any {
// Opaque objects are not mutable, so safe to copy by assignment
if (object === undefined || object === null || opaque[typeof object]) {
@ -1443,6 +1496,7 @@ export function deepCopy(object: any, frozen?: boolean): any {
}
// tslint:disable-next-line: max-classes-per-file
/** @hidden */
export class AbiCoder {
coerceFunc: CoerceFunc;
constructor(coerceFunc?: CoerceFunc) {
@ -1504,4 +1558,5 @@ export class AbiCoder {
}
}
/** @hidden */
export const defaultAbiCoder: AbiCoder = new AbiCoder();

@ -30,7 +30,7 @@ export class EventFactory {
const newObject: any = {};
newObject[key] = (params: any) =>
new EventMethod(
key
key,
// params,
this.map(this.abiModel, this.contract, params),
this.abiModel.getEvent(key),

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
export * from './abi/index';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
// defined by web3.js

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
import { AbiItemModel } from '../models/types';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
import { isArray } from '@harmony-js/utils';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
import { hexlify, isHexString, keccak256, toChecksumAddress } from '@harmony-js/crypto';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
import { isArray } from '@harmony-js/utils';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
export interface ContractOptions {

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-contract
* @hidden
*/
export enum ContractStatus {

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
import { isAddress } from '@harmony-js/utils';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
// This file is ported from ether.js/src.ts/utils/bytes.ts

@ -6,13 +6,16 @@
// This file is ported from ether.js/src.ts/errors.ts
// Unknown Error
/** @hidden */
export const UNKNOWN_ERROR = 'UNKNOWN_ERROR';
// Not implemented
/** @hidden */
export const NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';
// Missing new operator to an object
// - name: The name of the class
/** @hidden */
export const MISSING_NEW = 'MISSING_NEW';
// Call exception
@ -23,50 +26,62 @@ export const MISSING_NEW = 'MISSING_NEW';
// - errorSignature?: The EIP848 error signature
// - errorArgs?: The EIP848 error parameters
// - reason: The reason (only for EIP848 "Error(string)")
/** @hidden */
export const CALL_EXCEPTION = 'CALL_EXCEPTION';
// Invalid argument (e.g. value is incompatible with type) to a function:
// - argument: The argument name that was invalid
// - value: The value of the argument
/** @hidden */
export const INVALID_ARGUMENT = 'INVALID_ARGUMENT';
// Missing argument to a function:
// - count: The number of arguments received
// - expectedCount: The number of arguments expected
/** @hidden */
export const MISSING_ARGUMENT = 'MISSING_ARGUMENT';
// Too many arguments
// - count: The number of arguments received
// - expectedCount: The number of arguments expected
/** @hidden */
export const UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT';
// Numeric Fault
// - operation: the operation being executed
// - fault: the reason this faulted
/** @hidden */
export const NUMERIC_FAULT = 'NUMERIC_FAULT';
// Insufficien funds (< value + gasLimit * gasPrice)
// - transaction: the transaction attempted
/** @hidden */
export const INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS';
// Nonce has already been used
// - transaction: the transaction attempted
/** @hidden */
export const NONCE_EXPIRED = 'NONCE_EXPIRED';
// The replacement fee for the transaction is too low
// - transaction: the transaction attempted
/** @hidden */
export const REPLACEMENT_UNDERPRICED = 'REPLACEMENT_UNDERPRICED';
// Unsupported operation
// - operation
/** @hidden */
export const UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';
// tslint:disable-next-line: variable-name
/** @hidden */
let _permanentCensorErrors = false;
// tslint:disable-next-line: variable-name
/** @hidden */
let _censorErrors = false;
// @TODO: Enum
/** @hidden */
export function throwError(message: string, code: string | null | undefined, params: any): never {
if (_censorErrors) {
throw new Error('unknown error');
@ -106,12 +121,14 @@ export function throwError(message: string, code: string | null | undefined, par
throw error;
}
/** @hidden */
export function checkNew(self: any, kind: any): void {
if (!(self instanceof kind)) {
throwError('missing new', MISSING_NEW, { name: kind.name });
}
}
/** @hidden */
export function checkArgumentCount(count: number, expectedCount: number, suffix?: string): void {
if (!suffix) {
suffix = '';
@ -130,6 +147,7 @@ export function checkArgumentCount(count: number, expectedCount: number, suffix?
}
}
/** @hidden */
export function setCensorship(censorship: boolean, permanent?: boolean): void {
if (_permanentCensorErrors) {
throwError('error censorship permanent', UNSUPPORTED_OPERATION, {
@ -141,6 +159,7 @@ export function setCensorship(censorship: boolean, permanent?: boolean): void {
_permanentCensorErrors = !!permanent;
}
/** @hidden */
export function checkNormalize(): void {
try {
// Make sure all forms of normalization are supported
@ -163,6 +182,7 @@ export function checkNormalize(): void {
}
}
/** @hidden */
const LogLevels: { [name: string]: number } = {
debug: 1,
default: 2,
@ -171,8 +191,10 @@ const LogLevels: { [name: string]: number } = {
error: 4,
off: 5,
};
/** @hidden */
let LogLevel = LogLevels.default;
/** @hidden */
export function setLogLevel(logLevel: string): void {
const level = LogLevels[logLevel];
if (level == null) {
@ -182,6 +204,7 @@ export function setLogLevel(logLevel: string): void {
LogLevel = level;
}
/** @hidden */
function log(logLevel: string, args: [any?, ...any[]]): void {
if (LogLevel > LogLevels[logLevel]) {
return;
@ -189,10 +212,12 @@ function log(logLevel: string, args: [any?, ...any[]]): void {
console.log.apply(console, args);
}
/** @hidden */
export function warn(...args: [any?, ...any[]]): void {
log('warn', args);
}
/** @hidden */
export function info(...args: [any?, ...any[]]): void {
log('info', args);
}

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
import elliptic from 'elliptic';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
import aes from 'aes-js';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
// this file is ported from https://github.com/ethers-io/ethers.js/blob/master/src.ts/utils/rlp.ts

@ -12,6 +12,7 @@ import { WSProvider } from '../providers/ws';
import { RPCMethod } from '../rpcMethod/rpc';
import { SubscribeReturns, ShardingItem } from '../types';
/** @hidden */
export interface ShardingProvider {
current: boolean;
shardID: number;

@ -1,7 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @ignore
* @hidden
*/
import { RPCResponseBody } from '../types';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { ReqMiddleware, ResMiddleware, MiddlewareType } from '../types';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { isWs } from '@harmony-js/utils';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import fetch from 'cross-fetch';

@ -9,6 +9,7 @@ import { composeMiddleware, performRPC, DEFAULT_TIMEOUT, DEFAULT_HEADERS } from
import { RPCRequestPayload } from '../types';
/** @hidden */
const defaultOptions = {
method: 'POST',
timeout: DEFAULT_TIMEOUT,

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { RPCRequestPayload } from '../types';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { isHex, hexToNumber } from '@harmony-js/utils';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { BaseBlockTracker } from './baseTracker';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { Messenger } from '../messenger/messenger';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { ResponseMiddleware } from './messenger/responseMiddleware';

@ -21,6 +21,7 @@ import {
import { Unit } from '@harmony-js/utils';
import { TxStatus } from '@harmony-js/transaction';
/** @hidden */
export interface DescriptionInterface {
name: string;
identity: string;
@ -29,6 +30,7 @@ export interface DescriptionInterface {
details: string;
}
/** @hidden */
export interface CommissionRateInterface {
rate: string;
maxRate: string;

@ -21,11 +21,13 @@ import { defaultMessenger, TransactionBase, TxStatus } from '@harmony-js/transac
import { numberToHex, Unit } from '@harmony-js/utils';
import { TextEncoder } from 'text-encoding';
/** @hidden */
export class StakingSettings {
public static PRECISION = 18;
public static MAX_DECIMAL = 1000000000000000000;
}
/** @hidden */
export const enum Directive {
DirectiveCreateValidator,
DirectiveEditValidator,
@ -239,6 +241,7 @@ export class Description {
}
}
/** @hidden */
export class Decimal {
value: BN;

@ -1,7 +1,7 @@
/**
* @packageDocumentation
* @module harmony-staking
* @ig
* @ignore
*/
import { Wallet } from '@harmony-js/account';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-transaction
* @hidden
*/
import { BN, getAddress, HarmonyAddress } from '@harmony-js/crypto';

@ -1,10 +1,11 @@
/**
* @packageDocumentation
* @module harmony-transaction
*
*/
import { BN, Signature } from '@harmony-js/crypto';
/** @hidden */
export interface TxParams {
id: string;
from: string;
@ -23,6 +24,7 @@ export interface TxParams {
receipt?: TransasctionReceipt;
}
/** @hidden */
export const enum TxStatus {
NONE = 'NONE',
INTIALIZED = 'INITIALIZED',
@ -32,6 +34,7 @@ export const enum TxStatus {
REJECTED = 'REJECTED',
}
/** @hidden */
export interface TransasctionReceipt {
transactionHash: string;
transactionIndex: string;

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-transaction
* @hidden
*/
import { hexToNumber, isHex, isAddress, strip0x, ChainType } from '@harmony-js/utils';

@ -27,6 +27,7 @@ export const enum ChainID {
HmyPangaea = 3,
}
/** @hidden */
export const defaultConfig = {
Default: {
Chain_ID: ChainID.HmyLocal,
@ -42,6 +43,7 @@ export const defaultConfig = {
},
};
/** @hidden */
export abstract class HarmonyCore {
chainType: ChainType;
chainId: ChainID;
@ -73,6 +75,8 @@ export abstract class HarmonyCore {
}
}
/** @hidden */
export const HDPath = `m/44'/1023'/0'/0/`;
/** @hidden */
export const AddressSuffix = '-';

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-utils
* @hidden
*/
export function defineReadOnly(object: any, name: string, value: any): void {

@ -21,6 +21,7 @@ export const enum Units {
Tether = 'Tether',
}
/** @hidden */
export const unitMap = new Map([
[Units.wei, '1'],
[Units.Kwei, '1000'], // 1e3 wei
@ -36,6 +37,7 @@ export const unitMap = new Map([
[Units.Tether, '1000000000000000000000000000000'], // 1e30 wei
]);
/** @hidden */
const DEFAULT_OPTIONS = {
pad: false,
};

@ -27,6 +27,7 @@ export const enum AssertType {
optional = 'optional',
}
/** @hidden */
export const validatorArray: any = {
isNumber: [isNumber],
isString: [isString],

Loading…
Cancel
Save