Re-enable affiliate fee
This commit is contained in:
parent
c81455c760
commit
ab7689d188
@ -97,7 +97,7 @@ export class BuyButton extends React.PureComponent<BuyButtonProps> {
|
||||
let txHash: string | undefined;
|
||||
const gasInfo = await gasPriceEstimator.getGasInfoAsync();
|
||||
const feeRecipient = oc(affiliateInfo).feeRecipient();
|
||||
const feePercentage = oc(affiliateInfo).feeRecipient();
|
||||
const feePercentage = oc(affiliateInfo).feePercentage();
|
||||
try {
|
||||
analytics.trackBuyStarted(swapQuote);
|
||||
txHash = await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(swapQuote, {
|
||||
@ -125,6 +125,13 @@ export class BuyButton extends React.PureComponent<BuyButtonProps> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// HACK(dekz): Wrappers no longer include decorators which map errors
|
||||
// like transaction deny
|
||||
if (e.message && e.message.includes('User denied transaction signature')) {
|
||||
analytics.trackBuySignatureDenied(swapQuote);
|
||||
this.props.onSignatureDenied(swapQuote);
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
const startTimeUnix = new Date().getTime();
|
||||
|
@ -163,8 +163,9 @@ class TokenSelectorRowIcon extends React.PureComponent<TokenSelectorRowIconProps
|
||||
const displaySymbol = assetUtils.bestNameForAsset(token);
|
||||
if (iconUrlIfExists !== undefined) {
|
||||
return <img src={iconUrlIfExists} />;
|
||||
} else if (TokenIcon !== undefined) {
|
||||
return <TokenIcon />;
|
||||
// HACK(dekz): Disale Token icon as it is throwing an error in React renderer
|
||||
// } else if (TokenIcon !== undefined) {
|
||||
// return <TokenIcon />;
|
||||
} else {
|
||||
return (
|
||||
<Text fontColor={ColorOption.white} fontSize="8px">
|
||||
|
@ -85,6 +85,7 @@ export class ZeroExInstantProvider extends React.PureComponent<ZeroExInstantProv
|
||||
),
|
||||
assetMetaDataMap: completeAssetMetaDataMap,
|
||||
onSuccess: props.onSuccess,
|
||||
affiliateInfo: props.affiliateInfo,
|
||||
};
|
||||
return storeStateFromProps;
|
||||
}
|
||||
@ -139,7 +140,7 @@ export class ZeroExInstantProvider extends React.PureComponent<ZeroExInstantProv
|
||||
state.providerState,
|
||||
window,
|
||||
state.selectedAsset,
|
||||
undefined,
|
||||
this.props.affiliateInfo,
|
||||
state.baseCurrency,
|
||||
),
|
||||
);
|
||||
|
@ -48,10 +48,9 @@ const validateInstantRenderConfig = (config: ZeroExInstantConfig, selector: stri
|
||||
if (config.zIndex !== undefined) {
|
||||
assert.isNumber('zIndex', config.zIndex);
|
||||
}
|
||||
// TODO(dave4506) reenable affiliate fees once we figure out how to work with it
|
||||
// if (config.affiliateInfo !== undefined) {
|
||||
// assert.isValidAffiliateInfo('affiliateInfo', config.affiliateInfo);
|
||||
// }
|
||||
if (config.affiliateInfo !== undefined) {
|
||||
assert.isValidAffiliateInfo('affiliateInfo', config.affiliateInfo);
|
||||
}
|
||||
if (config.provider !== undefined) {
|
||||
providerUtils.standardizeOrThrow(config.provider);
|
||||
}
|
||||
|
@ -291,6 +291,7 @@ const doesSwapQuoteMatchState = (swapQuote: MarketBuySwapQuote, state: State): b
|
||||
selectedAssetMetaData.decimals,
|
||||
);
|
||||
const doesAssetAmountMatch = selectedAssetAmountBaseUnits.eq(swapQuote.makerAssetFillAmount);
|
||||
|
||||
return doesAssetAmountMatch;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -192,6 +192,11 @@ export interface ZeroExInstantRequiredBaseConfig {
|
||||
orderSource: OrderSource;
|
||||
}
|
||||
|
||||
export interface AffiliateInfo {
|
||||
feeRecipient: string;
|
||||
feePercentage: number;
|
||||
}
|
||||
|
||||
export interface ZeroExInstantOptionalBaseConfig {
|
||||
provider: SupportedProvider;
|
||||
walletDisplayName: string;
|
||||
@ -200,6 +205,7 @@ export interface ZeroExInstantOptionalBaseConfig {
|
||||
defaultSelectedAssetData: string;
|
||||
additionalAssetMetaDataMap: ObjectMap<AssetMetaData>;
|
||||
networkId: Network;
|
||||
affiliateInfo: AffiliateInfo;
|
||||
shouldDisableAnalyticsTracking: boolean;
|
||||
onSuccess?: (txHash: string) => void;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user