Merge remote-tracking branch 'origin/develop' into update-nonce
This commit is contained in:
commit
77c87e24b1
|
@ -1,6 +1,6 @@
|
|||
# MyCrypto V4+ (ALPHA - VISIT [V3](https://github.com/MyCryptoHQ/mycrypto.com) for the current site)<br/>Just looking to download? Grab our [latest release](https://github.com/MyCryptoHQ/MyCrypto/releases)
|
||||
|
||||
[![Greenkeeper badge](https://badges.greenkeeper.io/MyCrypto/MyCrypto.svg)](https://greenkeeper.io/)
|
||||
[![Greenkeeper badge](https://badges.greenkeeper.io/MyCryptoHq/MyCrypto.svg)](https://greenkeeper.io/)
|
||||
|
||||
## Running the App
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,86 @@
|
|||
import React from 'react';
|
||||
import Modal, { IButton } from 'components/ui/Modal';
|
||||
import { HelpLink } from 'components/ui';
|
||||
import { HELP_ARTICLE } from 'config';
|
||||
|
||||
interface State {
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
export default class DisclaimerModal extends React.Component<{}, State> {
|
||||
public state: State = {
|
||||
isOpen: false
|
||||
};
|
||||
|
||||
public render() {
|
||||
const buttons: IButton[] = [{ text: 'Okay', type: 'default', onClick: this.closeModal }];
|
||||
return (
|
||||
<React.Fragment>
|
||||
<button className="Footer-modal-button" onClick={this.openModal}>
|
||||
Disclaimer
|
||||
</button>
|
||||
<Modal
|
||||
isOpen={this.state.isOpen}
|
||||
title="Disclaimer"
|
||||
buttons={buttons}
|
||||
handleClose={this.closeModal}
|
||||
>
|
||||
<p>
|
||||
<b>Be safe & secure: </b>
|
||||
<HelpLink article={HELP_ARTICLE.SECURING_YOUR_ETH}>
|
||||
We highly recommend that you read our guide on How to Prevent Loss & Theft for some
|
||||
recommendations on how to be proactive about your security.
|
||||
</HelpLink>
|
||||
</p>
|
||||
<p>
|
||||
<b>Always backup your keys: </b>
|
||||
MyCrypto.com & MyCrypto CX are not "web wallets". You do not create an account or give
|
||||
us your funds to hold onto. No data leaves your computer / your browser. We make it easy
|
||||
for you to create, save, and access your information and interact with the blockchain.
|
||||
</p>
|
||||
<p>
|
||||
<b>We are not responsible for any loss: </b>
|
||||
Ethereum, MyCrypto.com & MyCrypto CX, and some of the underlying Javascript libraries we
|
||||
use are under active development. While we have thoroughly tested & tens of thousands of
|
||||
wallets have been successfully created by people all over the globe, there is always the
|
||||
possibility something unexpected happens that causes your funds to be lost. Please do
|
||||
not invest more than you are willing to lose, and please be careful.
|
||||
</p>
|
||||
<p>
|
||||
<b>Translations of MyCrypto: </b>
|
||||
The community has done an amazing job translating MyCrypto into a variety of languages.
|
||||
However, MyCrypto can only verify the validity and accuracy of the information provided
|
||||
in English and, because of this, the English version of our website is the official
|
||||
text.
|
||||
</p>
|
||||
<p>
|
||||
<b>MIT License</b> Copyright © 2015-2017 MyCrypto LLC
|
||||
</p>
|
||||
<p>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
</p>
|
||||
<p>
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
</p>
|
||||
<b>
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
</b>
|
||||
</Modal>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
private openModal = () => this.setState({ isOpen: true });
|
||||
private closeModal = () => this.setState({ isOpen: false });
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
justify-content: space-around;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
border-top: 3px solid $brand-primary;
|
||||
|
||||
@media (min-width: $screen-sm-min) {
|
||||
flex-direction: row;
|
||||
|
@ -23,7 +24,12 @@
|
|||
}
|
||||
|
||||
&-social-media-wrap {
|
||||
margin-top: 32px;
|
||||
margin-top: $space;
|
||||
|
||||
@media (min-width: $screen-sm-min) {
|
||||
margin-top: $space-md;
|
||||
}
|
||||
|
||||
& .Footer-social-media-link {
|
||||
transition: opacity 0.3s;
|
||||
color: white;
|
||||
|
@ -40,24 +46,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
&-affiliate-wrap {
|
||||
& .Footer-affiliate-tag {
|
||||
background-color: #0e97c0;
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 30px;
|
||||
margin: 0rem 0.5rem 0.5rem 0px;
|
||||
transition: color 0.3s, background-color 0.3s;
|
||||
// Don't use &, needs to override styles
|
||||
.Footer-affiliate-tag {
|
||||
background-color: #0e97c0;
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 30px;
|
||||
margin: 0rem 0.5rem 0.5rem 0px;
|
||||
transition: color 0.3s, background-color 0.3s;
|
||||
&:hover {
|
||||
background-color: white;
|
||||
color: #0e97c0;
|
||||
}
|
||||
& a {
|
||||
transition: color 0s;
|
||||
color: inherit;
|
||||
&:hover {
|
||||
background-color: white;
|
||||
color: #0e97c0;
|
||||
}
|
||||
& a {
|
||||
transition: color 0s;
|
||||
color: inherit;
|
||||
&:hover {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,10 +74,10 @@
|
|||
&-about {
|
||||
&-logo {
|
||||
width: 100%;
|
||||
padding: 0 10px;
|
||||
padding: 0 10px 0 0;
|
||||
padding-top: 0;
|
||||
height: auto;
|
||||
max-width: 20rem;
|
||||
max-width: 12rem;
|
||||
}
|
||||
&-text {
|
||||
max-width: 50ch;
|
||||
|
@ -84,7 +89,7 @@
|
|||
&-info {
|
||||
& > a {
|
||||
display: block;
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.8rem;
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
@ -104,6 +109,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
&-copyright {
|
||||
&-spacer {
|
||||
margin: 0 $space-xs;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
margin: $space-xs 0 $space-sm;
|
||||
}
|
||||
|
@ -122,26 +133,22 @@
|
|||
|
||||
h5 {
|
||||
font-size: $font-size-bump;
|
||||
margin: $font-size-small 0 0;
|
||||
margin: $space-md 0;
|
||||
|
||||
i {
|
||||
margin-right: 0.25em;
|
||||
|
||||
@media (min-width: $screen-sm-min) {
|
||||
margin-left: -1.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
margin: 0 0 $space-xs 0;
|
||||
margin: 0 0 $space-md 0;
|
||||
}
|
||||
|
||||
> li,
|
||||
> p {
|
||||
font-size: $font-size-small;
|
||||
font-size: 0.8rem;
|
||||
margin: $space-sm 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import logo from 'assets/images/logo-mycrypto.svg';
|
||||
import {
|
||||
bityReferralURL,
|
||||
ledgerReferralURL,
|
||||
trezorReferralURL,
|
||||
bitboxReferralURL,
|
||||
|
@ -12,7 +11,7 @@ import React from 'react';
|
|||
import translate from 'translations';
|
||||
import './index.scss';
|
||||
import PreFooter from './PreFooter';
|
||||
import Modal, { IButton } from 'components/ui/Modal';
|
||||
import Disclaimer from './Disclaimer';
|
||||
import { NewTabLink } from 'components/ui';
|
||||
import OnboardModal from 'containers/OnboardModal';
|
||||
|
||||
|
@ -65,6 +64,15 @@ const SOCIAL_MEDIA: Link[] = [
|
|||
];
|
||||
|
||||
const PRODUCT_INFO: Link[] = [
|
||||
{
|
||||
link: knowledgeBaseURL,
|
||||
text: 'Knowledge Base'
|
||||
},
|
||||
{
|
||||
link: 'https://www.mycrypto.com/helpers.html',
|
||||
text: 'Helpers & ENS Debugging'
|
||||
},
|
||||
|
||||
{
|
||||
link: 'https://github.com/MyCryptoHQ/MyCrypto',
|
||||
text: 'Github: Current Site'
|
||||
|
@ -78,11 +86,6 @@ const PRODUCT_INFO: Link[] = [
|
|||
text: 'Github: Latest Release'
|
||||
},
|
||||
|
||||
{
|
||||
link:
|
||||
'https://chrome.google.com/webstore/detail/myetherwallet-cx/nlbmnnijcnlegkjjpcfjclmcfggfefdm?hl=en',
|
||||
text: 'MyEtherWallet Extension'
|
||||
},
|
||||
{
|
||||
link:
|
||||
'https://chrome.google.com/webstore/detail/etheraddresslookup/pdknmigbbbhmllnmgdfalmedcmcefdfn',
|
||||
|
@ -99,26 +102,8 @@ interface Props {
|
|||
latestBlock: string;
|
||||
}
|
||||
|
||||
interface State {
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
export default class Footer extends React.PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { isOpen: false };
|
||||
}
|
||||
|
||||
public openModal = () => {
|
||||
this.setState({ isOpen: true });
|
||||
};
|
||||
|
||||
public closeModal = () => {
|
||||
this.setState({ isOpen: false });
|
||||
};
|
||||
|
||||
export default class Footer extends React.PureComponent<Props> {
|
||||
public render() {
|
||||
const buttons: IButton[] = [{ text: 'Okay', type: 'default', onClick: this.closeModal }];
|
||||
return (
|
||||
<div>
|
||||
<OnboardModal />
|
||||
|
@ -137,94 +122,23 @@ export default class Footer extends React.PureComponent<Props, State> {
|
|||
</NewTabLink>
|
||||
</p>
|
||||
<p className="Footer-about-text">{translate('FOOTER_1')}</p>
|
||||
<NewTabLink href={knowledgeBaseURL}>Knowledge Base</NewTabLink>
|
||||
<NewTabLink href="https://www.myetherwallet.com/helpers">
|
||||
Helpers & ENS Debugging
|
||||
</NewTabLink>
|
||||
|
||||
<button className="Footer-modal-button" onClick={this.openModal}>
|
||||
Disclaimer
|
||||
</button>
|
||||
<Modal
|
||||
isOpen={this.state.isOpen}
|
||||
title="Disclaimer"
|
||||
buttons={buttons}
|
||||
handleClose={this.closeModal}
|
||||
>
|
||||
<p>
|
||||
<b>Be safe & secure: </b>
|
||||
<NewTabLink href={`${knowledgeBaseURL}/security/securing-your-ethereum`}>
|
||||
We highly recommend that you read our guide on How to Prevent Loss & Theft for
|
||||
some recommendations on how to be proactive about your security.
|
||||
</NewTabLink>
|
||||
</p>
|
||||
<p>
|
||||
<b>Always backup your keys: </b>
|
||||
MyCrypto.com & MyCrypto CX are not "web wallets". You do not create an account or
|
||||
give us your funds to hold onto. No data leaves your computer / your browser. We
|
||||
make it easy for you to create, save, and access your information and interact with
|
||||
the blockchain.
|
||||
</p>
|
||||
<p>
|
||||
<b>We are not responsible for any loss: </b>
|
||||
Ethereum, MyCrypto.com & MyCrypto CX, and some of the underlying Javascript
|
||||
libraries we use are under active development. While we have thoroughly tested &
|
||||
tens of thousands of wallets have been successfully created by people all over the
|
||||
globe, there is always the possibility something unexpected happens that causes your
|
||||
funds to be lost. Please do not invest more than you are willing to lose, and please
|
||||
be careful.
|
||||
</p>
|
||||
<p>
|
||||
<b>Translations of MyCrypto: </b>
|
||||
The community has done an amazing job translating MyCrypto into a variety of
|
||||
languages. However, MyCrypto can only verify the validity and accuracy of the
|
||||
information provided in English and, because of this, the English version of our
|
||||
website is the official text.
|
||||
</p>
|
||||
<p>
|
||||
<b>MIT License</b> Copyright © 2015-2017 MyCrypto LLC
|
||||
</p>
|
||||
<p>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
</p>
|
||||
<p>
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
</p>
|
||||
<b>
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</b>
|
||||
</Modal>
|
||||
<p>Latest Block#: {this.props.latestBlock}</p>
|
||||
<p>v{VERSION}</p>
|
||||
<p>© {new Date().getFullYear()} MyCrypto, LLC</p>
|
||||
<p className="Footer-copyright">
|
||||
© {new Date().getFullYear()} MyCrypto, LLC{' '}
|
||||
<span className="Footer-copyright-spacer">·</span> v{VERSION}
|
||||
</p>
|
||||
|
||||
<Disclaimer />
|
||||
</div>
|
||||
|
||||
<div className="Footer-info">
|
||||
<h5>
|
||||
<i aria-hidden="true">👫</i>
|
||||
You can support us by supporting our blockchain-family.
|
||||
</h5>
|
||||
<p>Consider using our affiliate links to</p>
|
||||
<ul className="Footer-affiliate-wrap">
|
||||
<AffiliateTag link={bityReferralURL} text="Swap ETH/BTC/EUR/CHF via Bity.com" />
|
||||
</ul>
|
||||
<p>Buy a</p>
|
||||
<ul className="Footer-affiliate-wrap">
|
||||
<h5>You can support us by buying a...</h5>
|
||||
<ul>
|
||||
<AffiliateTag link={ledgerReferralURL} text="Ledger Nano S" />
|
||||
<AffiliateTag link={trezorReferralURL} text="TREZOR" />
|
||||
<AffiliateTag link={bitboxReferralURL} text="Digital Bitbox" />
|
||||
</ul>
|
||||
|
||||
<h5>
|
||||
<i aria-hidden="true">💝</i>
|
||||
{translate('FOOTER_2')}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
width: 100%;
|
||||
position: relative;
|
||||
overflow-y: hidden;
|
||||
border-top: .25rem solid $brand-primary;
|
||||
border-top: 3px solid $brand-primary;
|
||||
transition: border 300ms ease;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import React from 'react';
|
||||
import { VERSION } from 'config/data';
|
||||
|
||||
const Version: React.SFC<{}> = () => <div className="Version">v{VERSION}</div>;
|
||||
|
||||
export default Version;
|
|
@ -80,10 +80,15 @@ $small-size: 900px;
|
|||
&-branding {
|
||||
color: white;
|
||||
padding: 0;
|
||||
@include bg-gradient;
|
||||
background: #274e7e;
|
||||
background-image: url('~assets/images/header-bg.jpg'),
|
||||
linear-gradient(130deg, #37709e, #274e7e);
|
||||
background-size: cover;
|
||||
background-position: left;
|
||||
|
||||
@include small-query {
|
||||
text-align: center;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
&-inner {
|
||||
|
@ -106,6 +111,8 @@ $small-size: 900px;
|
|||
width: auto;
|
||||
padding: 8px;
|
||||
padding-right: 0;
|
||||
filter: drop-shadow(0 1px 0 rgba(#000, 0.12))
|
||||
drop-shadow(1px 1px 0 rgba(#000, 0.12));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import {
|
|||
import Navigation from './components/Navigation';
|
||||
import CustomNodeModal from './components/CustomNodeModal';
|
||||
import OnlineStatus from './components/OnlineStatus';
|
||||
import Version from './components/Version';
|
||||
import { getKeyByValue } from 'utils/helpers';
|
||||
import { makeCustomNodeId } from 'utils/node';
|
||||
import { getNetworkConfigFromId } from 'utils/network';
|
||||
|
@ -122,10 +121,6 @@ export default class Header extends PureComponent<Props, State> {
|
|||
/>
|
||||
</Link>
|
||||
<div className="Header-branding-right">
|
||||
<span className="Header-branding-right-version hidden-xs">
|
||||
<Version />
|
||||
</span>
|
||||
|
||||
<div className="Header-branding-right-online">
|
||||
<OnlineStatus isOffline={isOffline} />
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
@import './variables';
|
||||
@import '~bootstrap-sass/assets/stylesheets/bootstrap/mixins';
|
||||
|
||||
@mixin bg-gradient {
|
||||
background: $ether-navy;
|
||||
background: linear-gradient(149deg, #132a45, #143a56, #21a4ce, #19b4ad);
|
||||
}
|
||||
|
||||
@mixin reset-button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
@ -2,7 +2,8 @@ declare module 'ethereumjs-util' {
|
|||
import { Buffer } from 'buffer';
|
||||
import BN from 'bn.js';
|
||||
export import rlp = require('rlp');
|
||||
|
||||
export * from 'ethjs-util';
|
||||
//TODO: missing types for secp256k1, defineProperties, isZeroAddress, ethjs-util package
|
||||
interface Signature {
|
||||
v: number;
|
||||
r: Buffer;
|
||||
|
@ -25,77 +26,375 @@ declare module 'ethereumjs-util' {
|
|||
|
||||
export const SHA3_RLP: Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns a buffer filled with 0s
|
||||
* @export
|
||||
* @param {number} bytes the number of bytes the buffer should be
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function zeros(bytes: number): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description
|
||||
* @export
|
||||
* @param {Buffer} msg the value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @param {boolean} right whether to start padding form the left or right (optional, default false)
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
|
||||
export function setLength(msg: Buffer, length: number, right: boolean): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description
|
||||
* @export
|
||||
* @param {number[]} msg the value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @param {boolean} right whether to start padding form the left or right (optional, default false)
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export function setLength(msg: number[], length: number, right: boolean): number[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Left Pads an Array or Buffer with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.
|
||||
* @export
|
||||
* @param {Buffer} msg the value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @param {boolean} right whether to start padding form the left or right (optional, default false)
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function setLengthLeft(msg: Buffer, length: number, right: boolean): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description
|
||||
* @export
|
||||
* @param {number[]} msg he value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @param {boolean} right whether to start padding form the left or right (optional, default false)
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export function setLengthLeft(msg: number[], length: number, right: boolean): number[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Right Pads an Array or Buffer with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.
|
||||
* @export
|
||||
* @param {Buffer} msg the value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function setLengthRight(msg: Buffer, length: number): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Right Pads an Array or Buffer with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.
|
||||
* @export
|
||||
* @param {number[]} msg the value to pad
|
||||
* @param {number} length the number of bytes the output should be
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export function setLengthRight(msg: number[], length: number): number[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Trims leading zeros from a Buffer or an Array
|
||||
* @export
|
||||
* @param {Buffer} a
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function unpad(a: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Trims leading zeros from a Buffer or an Array
|
||||
* @export
|
||||
* @param {number[]} a
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export function unpad(a: number[]): number[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Trims leading zeros from a Buffer or an Array
|
||||
* @export
|
||||
* @param {string} a
|
||||
* @returns {string}
|
||||
*/
|
||||
export function unpad(a: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Attempts to turn a value into a Buffer. As input it supports Buffer, String, Number, null/undefined, BN and other objects with a toArray() method.
|
||||
* @export
|
||||
* @param {*} v the value
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function toBuffer(v: any): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Converts a Buffer to a Number
|
||||
* @export
|
||||
* @param {(Buffer | BN)} buf
|
||||
* @returns {number}
|
||||
*/
|
||||
export function bufferToInt(buf: Buffer | BN): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Converts a Buffer into a hex String
|
||||
* @export
|
||||
* @param {(Buffer | BN)} buf
|
||||
* @returns {string}
|
||||
*/
|
||||
export function bufferToHex(buf: Buffer | BN): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Interprets a Buffer as a signed integer and returns a BN. Assumes 256-bit numbers.
|
||||
* @export
|
||||
* @param {(Buffer | BN)} num
|
||||
* @returns {BN}
|
||||
*/
|
||||
export function fromSigned(num: Buffer | BN): BN;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Converts a BN to an unsigned integer and returns it as a Buffer. Assumes 256-bit numbers.
|
||||
* @export
|
||||
* @param {BN} num
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function toUnsigned(num: BN): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Creates SHA-3 hash of the input
|
||||
* @export
|
||||
* @param {(Buffer | string | number | number[])} a the input data
|
||||
* @param {number} [bits] the SHA width (optional, default 256)
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function sha3(a: Buffer | string | number | number[], bits?: number): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Creates SHA256 hash of the input
|
||||
* @export
|
||||
* @param {(Buffer | string | number | number[])} a the input data
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function sha256(a: Buffer | string | number | number[]): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Creates RIPEMD160 hash of the input
|
||||
* @export
|
||||
* @param {(Buffer | string | number | number[])} a the input data
|
||||
* @param {boolean} [padded] whether it should be padded to 256 bits or not
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function ripemd160(a: Buffer | string | number | number[], padded?: boolean): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Creates SHA-3 hash of the RLP encoded version of the input
|
||||
* @export
|
||||
* @param {(Buffer | string | number | number[])} a the input data
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function rlphash(a: Buffer | string | number | number[]): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Checks if the private key satisfies the rules of the curve secp256k1.
|
||||
* @export
|
||||
* @param {Buffer} privateKey
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isValidPrivate(privateKey: Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Checks if the public key satisfies the rules of the curve secp256k1 and the requirements of Ethereum.
|
||||
* @export
|
||||
* @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
|
||||
* @param {boolean} [sanitize] Accept public keys in other formats (optional, default false)
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isValidPublic(publicKey: Buffer, sanitize?: boolean): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns the ethereum address of a given public key. Accepts "Ethereum public keys" and SEC1 encoded keys.
|
||||
* @export
|
||||
* @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
|
||||
* @param {boolean} [sanitize] Accept public keys in other formats (optional, default false)
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function pubToAddress(publicKey: Buffer, sanitize?: boolean): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns the ethereum address of a given public key. Accepts "Ethereum public keys" and SEC1 encoded keys.
|
||||
* @export
|
||||
* @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
|
||||
* @param {boolean} [sanitize] Accept public keys in other formats (optional, default false)
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function publicToAddress(publicKey: Buffer, sanitize?: boolean): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description the max integer that this VM can handle (a BN)
|
||||
* @export
|
||||
* @param {Buffer} privateKey
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function privateToPublic(privateKey: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Converts a public key to the Ethereum format.
|
||||
* @export
|
||||
* @param {Buffer} publicKey
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function importPublic(publicKey: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description ECDSA sign
|
||||
* @export
|
||||
* @param {Buffer} message
|
||||
* @param {Buffer} privateKey
|
||||
* @returns {Signature}
|
||||
*/
|
||||
export function ecsign(message: Buffer, privateKey: Buffer): Signature;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns the keccak-256 hash of message, prefixed with the header used by the eth_sign RPC call. The output of this function can be fed into ecsign to produce the same signature as the eth_sign call for a given message, or fed to ecrecover along with a signature to recover the public key used to produce the signature.
|
||||
* @export
|
||||
* @param {(Buffer | string)} message
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function hashPersonalMessage(message: Buffer | string): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description ECDSA public key recovery from signature
|
||||
* @export
|
||||
* @param {Buffer} msgHash
|
||||
* @param {number} v
|
||||
* @param {Buffer} r
|
||||
* @param {Buffer} s
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Convert signature parameters into the format of eth_sign RPC method
|
||||
* @export
|
||||
* @param {number} v
|
||||
* @param {Buffer} r
|
||||
* @param {Buffer} s
|
||||
* @returns {string}
|
||||
*/
|
||||
export function toRpcSig(v: number, r: Buffer, s: Buffer): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Convert signature format of the eth_sign RPC method to signature parameters NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
|
||||
* @export
|
||||
* @param {string} sig
|
||||
* @returns {Signature}
|
||||
*/
|
||||
export function fromRpcSig(sig: string): Signature;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns the ethereum address of a given private key
|
||||
* @export
|
||||
* @param {Buffer} privateKey A private key must be 256 bits wide
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function privateToAddress(privateKey: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Checks if the address is a valid. Accepts checksummed addresses too
|
||||
* @export
|
||||
* @param {string} address
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isValidAddress(address: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns a checksummed address
|
||||
* @export
|
||||
* @param {string} address
|
||||
* @returns {string}
|
||||
*/
|
||||
export function toChecksumAddress(address: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Checks if the address is a valid checksummed address
|
||||
* @export
|
||||
* @param {string} address
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isValidChecksumAddress(address: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Generates an address of a newly created contract
|
||||
* @export
|
||||
* @param {(Buffer | string)} from the address which is creating this new address
|
||||
* @param {(number | string | number[] | Buffer)} nonce the nonce of the from account
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function generateAddress(
|
||||
from: Buffer | string,
|
||||
nonce: number | string | number[] | Buffer
|
||||
): Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Returns true if the supplied address belongs to a precompiled account
|
||||
* @export
|
||||
* @param {(Buffer | string)} address
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPrecompiled(address: Buffer | string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Adds "0x" to a given String if it does not already start with "0x"
|
||||
* @export
|
||||
* @param {string} str
|
||||
* @returns {string}
|
||||
*/
|
||||
export function addHexPrefix(str: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Validate ECDSA signature
|
||||
* @export
|
||||
* @param {number} v
|
||||
* @param {(Buffer | string)} r
|
||||
* @param {(Buffer | string)} s
|
||||
* @param {boolean} [homestead] (optional, default true)
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isValidSignature(
|
||||
v: number,
|
||||
r: Buffer | string,
|
||||
|
@ -103,7 +402,12 @@ declare module 'ethereumjs-util' {
|
|||
homestead?: boolean
|
||||
): boolean;
|
||||
|
||||
export function padToEven(str: string): string;
|
||||
export function baToJSON(ba: Buffer): string;
|
||||
export function baToJSON(ba: any[]): string[];
|
||||
/**
|
||||
*
|
||||
* @description Converts a Buffer or Array to JSON
|
||||
* @export
|
||||
* @param {(Buffer | any[])} ba
|
||||
* @returns {string}
|
||||
*/
|
||||
export function baToJSON(ba: Buffer | any[]): string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue