diff --git a/src/core/currency/wallet/currency-wallet-cleaners.ts b/src/core/currency/wallet/currency-wallet-cleaners.ts index f56e4b008..b72dce2c5 100644 --- a/src/core/currency/wallet/currency-wallet-cleaners.ts +++ b/src/core/currency/wallet/currency-wallet-cleaners.ts @@ -22,6 +22,7 @@ import { EdgeTxActionFiat, EdgeTxActionStake, EdgeTxActionSwap, + EdgeTxActionTokenApproval, EdgeTxSwap } from '../../../types/types' import { asJsonObject } from '../../../util/file-helpers' @@ -268,10 +269,18 @@ export const asEdgeTxActionFiat = asObject({ cryptoAsset: asEdgeAssetAmount }) +export const asEdgeTxActionTokenApproval = asObject({ + actionType: asValue('tokenApproval'), + tokenApproved: asEdgeAssetAmount, + tokenContractAddress: asString, + contractAddress: asString +}) + export const asEdgeTxAction: Cleaner = asEither( asEdgeTxActionSwap, asEdgeTxActionStake, - asEdgeTxActionFiat + asEdgeTxActionFiat, + asEdgeTxActionTokenApproval ) export const asEdgeAssetActionType: Cleaner = asValue( @@ -289,7 +298,9 @@ export const asEdgeAssetActionType: Cleaner = asValue( 'swapOrderCancel', 'buy', 'sell', - 'sellNetworkFee' + 'sellNetworkFee', + 'tokenApproval', + 'transfer' ) export const asEdgeAssetAction = asObject({ diff --git a/src/types/types.ts b/src/types/types.ts index dd5c90fc2..d67fd4b43 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -304,10 +304,18 @@ export interface EdgeTxActionFiat { cryptoAsset: EdgeAssetAmount } +export interface EdgeTxActionTokenApproval { + actionType: 'tokenApproval' + tokenApproved: EdgeAssetAmount + tokenContractAddress: string + contractAddress: string +} + export type EdgeTxAction = | EdgeTxActionSwap | EdgeTxActionStake | EdgeTxActionFiat + | EdgeTxActionTokenApproval export type EdgeAssetActionType = | 'stake' @@ -325,6 +333,8 @@ export type EdgeAssetActionType = | 'buy' | 'sell' | 'sellNetworkFee' + | 'tokenApproval' + | 'transfer' export interface EdgeAssetAction { assetActionType: EdgeAssetActionType