ethers.js/packages/ethers/src.ts/utils.ts

216 lines
5.2 KiB
TypeScript
Raw Normal View History

2019-05-15 01:25:46 +03:00
"use strict";
2021-06-24 08:29:13 +03:00
import { AbiCoder, checkResultErrors, ConstructorFragment, defaultAbiCoder, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, Result, TransactionDescription }from "@ethersproject/abi";
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
2019-05-15 01:25:46 +03:00
import * as base64 from "@ethersproject/base64";
2020-07-31 00:04:53 +03:00
import { Base58 as base58 } from "@ethersproject/basex";
2020-10-03 20:18:56 +03:00
import { arrayify, concat, hexConcat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { _TypedDataEncoder, hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, getAccountPath, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
2019-05-15 01:25:46 +03:00
import { getJsonWalletAddress } from "@ethersproject/json-wallets";
import { keccak256 } from "@ethersproject/keccak256";
import { Logger } from "@ethersproject/logger";
import { computeHmac, ripemd160, sha256, sha512 } from "@ethersproject/sha2";
2019-05-15 01:25:46 +03:00
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity";
import { randomBytes, shuffled } from "@ethersproject/random";
import { checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties";
2019-05-15 01:25:46 +03:00
import * as RLP from "@ethersproject/rlp";
import { computePublicKey, recoverPublicKey, SigningKey } from "@ethersproject/signing-key";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs } from "@ethersproject/strings";
2021-05-31 00:47:04 +03:00
import { accessListify, computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction, TransactionTypes } from "@ethersproject/transactions";
2019-05-15 01:25:46 +03:00
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage, verifyTypedData } from "@ethersproject/wallet";
2020-07-31 08:32:26 +03:00
import { _fetchData, fetchJson, poll } from "@ethersproject/web";
2019-05-15 01:25:46 +03:00
////////////////////////
// Enums
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
2020-02-07 02:21:34 +03:00
import { UnsignedTransaction } from "@ethersproject/transactions";
2019-05-15 01:25:46 +03:00
////////////////////////
// Types and Interfaces
import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes"
2020-01-19 05:09:02 +03:00
import { Mnemonic } from "@ethersproject/hdnode";
2019-05-15 01:25:46 +03:00
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Deferrable } from "@ethersproject/properties";
import { Utf8ErrorFunc } from "@ethersproject/strings";
2021-03-30 22:22:45 +03:00
import { AccessList, AccessListish } from "@ethersproject/transactions";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web";
2019-05-15 01:25:46 +03:00
////////////////////////
// Exports
export {
AbiCoder,
defaultAbiCoder,
Fragment,
2021-06-24 08:29:13 +03:00
ConstructorFragment,
ErrorFragment,
2019-05-15 01:25:46 +03:00
EventFragment,
FunctionFragment,
ParamType,
2019-07-21 01:57:21 +03:00
FormatTypes,
2019-05-15 01:25:46 +03:00
checkResultErrors,
Result,
Logger,
2019-05-15 01:25:46 +03:00
RLP,
2020-07-31 08:32:26 +03:00
_fetchData,
2019-05-15 01:25:46 +03:00
fetchJson,
2019-06-06 04:52:09 +03:00
poll,
2019-05-15 01:25:46 +03:00
checkProperties,
deepCopy,
defineReadOnly,
getStatic,
2019-05-15 01:25:46 +03:00
resolveProperties,
shallowCopy,
arrayify,
concat,
stripZeros,
zeroPad,
isBytes,
isBytesLike,
defaultPath,
2019-05-15 01:25:46 +03:00
HDNode,
SigningKey,
Interface,
LogDescription,
TransactionDescription,
2020-07-31 00:04:53 +03:00
base58,
2019-05-15 01:25:46 +03:00
base64,
hexlify,
isHexString,
2020-10-03 20:18:56 +03:00
hexConcat,
2019-05-15 01:25:46 +03:00
hexStripZeros,
hexValue,
hexZeroPad,
hexDataLength,
hexDataSlice,
nameprep,
_toEscapedUtf8String,
2019-05-15 01:25:46 +03:00
toUtf8Bytes,
toUtf8CodePoints,
2019-05-15 01:25:46 +03:00
toUtf8String,
Utf8ErrorFuncs,
2019-05-15 01:25:46 +03:00
formatBytes32String,
parseBytes32String,
hashMessage,
namehash,
isValidName,
2019-05-15 01:25:46 +03:00
id,
_TypedDataEncoder,
2019-05-15 01:25:46 +03:00
getAddress,
getIcapAddress,
getContractAddress,
getCreate2Address,
2019-05-15 01:25:46 +03:00
isAddress,
formatEther,
parseEther,
formatUnits,
parseUnits,
commify,
computeHmac,
2019-05-15 01:25:46 +03:00
keccak256,
ripemd160,
2019-05-15 01:25:46 +03:00
sha256,
sha512,
2019-05-15 01:25:46 +03:00
randomBytes,
shuffled,
2019-05-15 01:25:46 +03:00
solidityPack,
solidityKeccak256,
soliditySha256,
splitSignature,
joinSignature,
2021-03-30 22:22:45 +03:00
accessListify,
2019-05-15 01:25:46 +03:00
parseTransaction,
serializeTransaction,
2021-05-31 00:47:04 +03:00
TransactionTypes,
2019-05-15 01:25:46 +03:00
getJsonWalletAddress,
computeAddress,
recoverAddress,
computePublicKey,
recoverPublicKey,
verifyMessage,
verifyTypedData,
2019-05-15 01:25:46 +03:00
getAccountPath,
2019-05-15 01:25:46 +03:00
mnemonicToEntropy,
entropyToMnemonic,
isValidMnemonic,
mnemonicToSeed,
////////////////////////
// Enums
SupportedAlgorithm,
2019-05-15 01:25:46 +03:00
UnicodeNormalizationForm,
Utf8ErrorReason,
2019-05-15 01:25:46 +03:00
////////////////////////
// Types
Bytes,
BytesLike,
Hexable,
2021-03-30 22:22:45 +03:00
AccessList,
AccessListish,
2020-02-07 02:21:34 +03:00
UnsignedTransaction,
2019-05-15 01:25:46 +03:00
CoerceFunc,
Indexed,
2020-01-19 05:09:02 +03:00
Mnemonic,
Deferrable,
Utf8ErrorFunc,
2019-05-15 01:25:46 +03:00
ConnectionInfo,
OnceBlockable,
OncePollable,
2019-05-15 01:25:46 +03:00
PollOptions,
FetchJsonResponse,
2019-05-15 01:25:46 +03:00
EncryptOptions,
ProgressCallback
}