fixed affiliate + fortmatic

This commit is contained in:
David Sun 2020-02-18 12:13:38 -05:00
parent 3b0c8f6d92
commit 5902d878d8
2 changed files with 11 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import { oc } from 'ts-optchain'; import { oc } from 'ts-optchain';
import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants'; import { DEFAULT_AFFILIATE_INFO, WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants';
import { ColorOption } from '../style/theme'; import { ColorOption } from '../style/theme';
import { AffiliateInfo, Asset, ZeroExInstantError } from '../types'; import { AffiliateInfo, Asset, ZeroExInstantError } from '../types';
import { analytics } from '../util/analytics'; import { analytics } from '../util/analytics';
@ -77,7 +77,7 @@ export class BuyButton extends React.PureComponent<BuyButtonProps> {
const { const {
swapQuote, swapQuote,
swapQuoteConsumer, swapQuoteConsumer,
affiliateInfo, affiliateInfo= DEFAULT_AFFILIATE_INFO,
accountAddress, accountAddress,
accountEthBalanceInWei, accountEthBalanceInWei,
web3Wrapper, web3Wrapper,
@ -109,6 +109,7 @@ export class BuyButton extends React.PureComponent<BuyButtonProps> {
takerAddress: accountAddress, takerAddress: accountAddress,
}); });
} catch (e) { } catch (e) {
console.log(e);
if (e instanceof Error) { if (e instanceof Error) {
if (e.message === SwapQuoteConsumerError.TransactionValueTooLow) { if (e.message === SwapQuoteConsumerError.TransactionValueTooLow) {
analytics.trackBuySimulationFailed(swapQuote); analytics.trackBuySimulationFailed(swapQuote);

View File

@ -1,6 +1,6 @@
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { AccountNotReady, AccountState, Network, ProviderType } from './types'; import { AccountNotReady, AccountState, AffiliateInfo, Network, ProviderType } from './types';
// TODO(dave4506) until we have /prices endpoint ready, we will use this whitelist for bridge order liquidity assets // TODO(dave4506) until we have /prices endpoint ready, we will use this whitelist for bridge order liquidity assets
export const SUPPORTED_TOKEN_ASSET_DATA_WITH_BRIDGE_ORDERS = [ export const SUPPORTED_TOKEN_ASSET_DATA_WITH_BRIDGE_ORDERS = [
@ -94,4 +94,10 @@ export const PROVIDER_TYPE_TO_NAME: { [key in ProviderType]: string } = {
[ProviderType.Fortmatic]: 'Fortmatic', [ProviderType.Fortmatic]: 'Fortmatic',
[ProviderType.Fallback]: 'Fallback', [ProviderType.Fallback]: 'Fallback',
}; };
export const FORTMATIC_API_KEY = process.env.INSTANT_FORTMATIC_API_KEY || 'pk_live_43E27F282B16AA8C'; export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
export const DEFAULT_AFFILIATE_INFO: AffiliateInfo = {
feeRecipient: NULL_ADDRESS,
feePercentage: 0,
};
export const FORTMATIC_API_KEY = process.env.INSTANT_FORTMATIC_API_KEY;