-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1127 from MyCryptoHQ/develop
Tag Beta 0.3.0
- Loading branch information
Showing
70 changed files
with
1,395 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as interfaces from './actionTypes'; | ||
import { TypeKeys } from './constants'; | ||
|
||
export type TFetchGasEstimates = typeof fetchGasEstimates; | ||
export function fetchGasEstimates(): interfaces.FetchGasEstimatesAction { | ||
return { | ||
type: TypeKeys.GAS_FETCH_ESTIMATES | ||
}; | ||
} | ||
|
||
export type TSetGasEstimates = typeof setGasEstimates; | ||
export function setGasEstimates( | ||
payload: interfaces.SetGasEstimatesAction['payload'] | ||
): interfaces.SetGasEstimatesAction { | ||
return { | ||
type: TypeKeys.GAS_SET_ESTIMATES, | ||
payload | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TypeKeys } from './constants'; | ||
import { GasEstimates } from 'api/gas'; | ||
|
||
export interface FetchGasEstimatesAction { | ||
type: TypeKeys.GAS_FETCH_ESTIMATES; | ||
} | ||
|
||
export interface SetGasEstimatesAction { | ||
type: TypeKeys.GAS_SET_ESTIMATES; | ||
payload: GasEstimates; | ||
} | ||
|
||
/*** Union Type ***/ | ||
export type GasAction = FetchGasEstimatesAction | SetGasEstimatesAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum TypeKeys { | ||
GAS_FETCH_ESTIMATES = 'GAS_FETCH_ESTIMATES', | ||
GAS_SET_ESTIMATES = 'GAS_SET_ESTIMATES' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './actionCreators'; | ||
export * from './actionTypes'; | ||
export * from './constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as interfaces from './actionTypes'; | ||
import { TypeKeys } from './constants'; | ||
|
||
export type TFetchTransactionData = typeof fetchTransactionData; | ||
export function fetchTransactionData(txhash: string): interfaces.FetchTransactionDataAction { | ||
return { | ||
type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA, | ||
payload: txhash | ||
}; | ||
} | ||
|
||
export type TSetTransactionData = typeof setTransactionData; | ||
export function setTransactionData( | ||
payload: interfaces.SetTransactionDataAction['payload'] | ||
): interfaces.SetTransactionDataAction { | ||
return { | ||
type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA, | ||
payload | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { TypeKeys } from './constants'; | ||
import { TransactionData, TransactionReceipt } from 'libs/nodes'; | ||
|
||
export interface FetchTransactionDataAction { | ||
type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA; | ||
payload: string; | ||
} | ||
|
||
export interface SetTransactionDataAction { | ||
type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA; | ||
payload: { | ||
txhash: string; | ||
data: TransactionData | null; | ||
receipt: TransactionReceipt | null; | ||
error: string | null; | ||
}; | ||
} | ||
|
||
/*** Union Type ***/ | ||
export type TransactionsAction = FetchTransactionDataAction | SetTransactionDataAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum TypeKeys { | ||
TRANSACTIONS_FETCH_TRANSACTION_DATA = 'TRANSACTIONS_FETCH_TRANSACTION_DATA', | ||
TRANSACTIONS_SET_TRANSACTION_DATA = 'TRANSACTIONS_SET_TRANSACTION_DATA', | ||
TRANSACTIONS_SET_TRANSACTION_ERROR = 'TRANSACTIONS_SET_TRANSACTION_ERROR' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './actionCreators'; | ||
export * from './actionTypes'; | ||
export * from './constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { checkHttpStatus, parseJSON } from './utils'; | ||
|
||
const MAX_GAS_FAST = 250; | ||
|
||
interface RawGasEstimates { | ||
safeLow: number; | ||
standard: number; | ||
fast: number; | ||
fastest: number; | ||
block_time: number; | ||
blockNum: number; | ||
} | ||
|
||
export interface GasEstimates { | ||
safeLow: number; | ||
standard: number; | ||
fast: number; | ||
fastest: number; | ||
time: number; | ||
isDefault: boolean; | ||
} | ||
|
||
export function fetchGasEstimates(): Promise<GasEstimates> { | ||
return fetch('https://dev.blockscale.net/api/gasexpress.json', { | ||
mode: 'cors' | ||
}) | ||
.then(checkHttpStatus) | ||
.then(parseJSON) | ||
.then((res: object) => { | ||
// Make sure it looks like a raw gas estimate, and it has valid values | ||
const keys = ['safeLow', 'standard', 'fast', 'fastest']; | ||
keys.forEach(key => { | ||
if (typeof res[key] !== 'number') { | ||
throw new Error( | ||
`Gas estimate API has invalid shape: Expected numeric key '${key}' in response, got '${ | ||
res[key] | ||
}' instead` | ||
); | ||
} | ||
}); | ||
|
||
// Make sure the estimate isn't totally crazy | ||
const estimateRes = res as RawGasEstimates; | ||
if (estimateRes.fast > MAX_GAS_FAST) { | ||
throw new Error( | ||
`Gas estimate response estimate too high: Max fast is ${MAX_GAS_FAST}, was given ${ | ||
estimateRes.fast | ||
}` | ||
); | ||
} | ||
|
||
if ( | ||
estimateRes.safeLow > estimateRes.standard || | ||
estimateRes.standard > estimateRes.fast || | ||
estimateRes.fast > estimateRes.fastest | ||
) { | ||
throw new Error( | ||
`Gas esimates are in illogical order: should be safeLow < standard < fast < fastest, received ${ | ||
estimateRes.safeLow | ||
} < ${estimateRes.standard} < ${estimateRes.fast} < ${estimateRes.fastest}` | ||
); | ||
} | ||
|
||
return estimateRes; | ||
}) | ||
.then((res: RawGasEstimates) => ({ | ||
...res, | ||
time: Date.now(), | ||
isDefault: false | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
common/components/BalanceSidebar/PromoComponents/Shapeshift.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import ShapeshiftLogo from 'assets/images/logo-shapeshift.svg'; | ||
|
||
export const Shapeshift: React.SFC = () => ( | ||
<Link className="Promos-promo Promos--shapeshift" to="/swap"> | ||
<div className="Promos-promo-inner"> | ||
<div className="Promos-promo-text"> | ||
<h5> | ||
Exchange Coins | ||
<br /> | ||
& Tokens with | ||
</h5> | ||
</div> | ||
<div className="Promos-promo-images"> | ||
<img src={ShapeshiftLogo} /> | ||
</div> | ||
</div> | ||
</Link> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './HardwareWallets'; | ||
export * from './Coinbase'; | ||
export * from './Bity'; | ||
export * from './Shapeshift'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.