ethers.js/src.ts/utils/index.ts

115 lines
2.5 KiB
TypeScript
Raw Normal View History

2016-07-25 10:55:16 +03:00
'use strict';
2016-07-16 06:47:35 +03:00
// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)
//var unorm = require('unorm');
import { getAddress, getContractAddress, getIcapAddress } from './address';
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from './abi-coder';
2018-06-13 22:39:39 +03:00
import * as base64 from './base64';
import { bigNumberify, ConstantNegativeOne, ConstantZero, ConstantOne, ConstantTwo, ConstantWeiPerEther } from './bignumber';
2018-07-12 09:44:45 +03:00
import { AddressZero, arrayify, concat, HashZero, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';
2018-06-18 12:42:41 +03:00
import { hashMessage, id, namehash } from './hash';
2018-06-13 22:39:39 +03:00
import { keccak256 } from './keccak256';
import { sha256 } from './sha2';
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from './solidity';
2018-06-13 22:39:39 +03:00
import { randomBytes } from './random-bytes';
2018-07-16 07:48:41 +03:00
import { getNetwork } from './networks';
import { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from './properties';
2018-06-13 22:39:39 +03:00
import * as RLP from './rlp';
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
import { toUtf8Bytes, toUtf8String } from './utf8';
import { formatEther, parseEther, formatUnits, parseUnits } from './units';
2018-06-13 22:39:39 +03:00
import { fetchJson } from './web';
import * as errors from './errors';
// NFKD (decomposed)
//const etherSymbol = '\uD835\uDF63';
2016-07-16 06:47:35 +03:00
// NFKC (composed)
const etherSymbol = '\u039e';
2018-06-13 22:39:39 +03:00
2018-07-12 09:44:45 +03:00
const constants = {
AddressZero: AddressZero,
HashZero: HashZero,
NegativeOne: ConstantNegativeOne,
Zero: ConstantZero,
One: ConstantOne,
Two: ConstantTwo,
WeiPerEther: ConstantWeiPerEther
};
export {
AbiCoder,
defaultAbiCoder,
formatSignature,
formatParamType,
parseSignature,
parseParamType,
2016-07-16 06:47:35 +03:00
2018-07-12 09:44:45 +03:00
constants,
RLP,
2016-07-16 06:47:35 +03:00
fetchJson,
2018-07-16 07:48:41 +03:00
getNetwork,
2016-07-16 06:47:35 +03:00
defineReadOnly,
defineFrozen,
resolveProperties,
shallowCopy,
2016-07-16 06:47:35 +03:00
etherSymbol,
2016-07-16 06:47:35 +03:00
arrayify,
concat,
padZeros,
stripZeros,
2016-07-16 06:47:35 +03:00
base64,
bigNumberify,
2016-08-24 05:06:26 +03:00
hexlify,
2018-07-12 09:44:45 +03:00
hexStripZeros,
hexZeroPad,
hexDataLength,
hexDataSlice,
2017-05-04 03:24:07 +03:00
toUtf8Bytes,
toUtf8String,
hashMessage,
namehash,
id,
2016-07-16 06:47:35 +03:00
getAddress,
getIcapAddress,
getContractAddress,
formatEther,
parseEther,
formatUnits,
parseUnits,
keccak256,
sha256,
randomBytes,
solidityPack,
solidityKeccak256,
soliditySha256,
splitSignature,
joinSignature,
parseTransaction,
serializeTransaction,
errors
2016-07-16 06:47:35 +03:00
}