diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-11-07 14:33:58 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-11-08 06:25:23 +0800 |
commit | 28df5bfd94e817cb90689059d7255495ca6522ad (patch) | |
tree | f8368784de47d8fb73ebc6792100e2870ea0e815 /packages/instant/src/types.ts | |
parent | dfbf10c94bfbbdbca353531c5cae6707e05981f0 (diff) | |
download | dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar.gz dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar.bz2 dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar.lz dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar.xz dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.tar.zst dexon-0x-contracts-28df5bfd94e817cb90689059d7255495ca6522ad.zip |
feat(instant): add Account to the ProviderState
Diffstat (limited to 'packages/instant/src/types.ts')
-rw-r--r-- | packages/instant/src/types.ts | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts index 0ab227310..d65f70008 100644 --- a/packages/instant/src/types.ts +++ b/packages/instant/src/types.ts @@ -1,4 +1,4 @@ -import { AssetBuyer } from '@0x/asset-buyer'; +import { AssetBuyer, BigNumber } from '@0x/asset-buyer'; import { AssetProxyId, ObjectMap, SignedOrder } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider } from 'ethereum-types'; @@ -93,23 +93,30 @@ export interface AffiliateInfo { feePercentage: number; } -/** - * Our provider may be of 3 different types: - * Props: the provider was passed in a prop to the component - * Injected: the provider was injected into `window` - * FallbackEmptyWallet: the provider has no wallet but responds to data requests using infura - */ -export enum ProviderType { - Props = 'PROPS', - Injected = 'INJECTED', - FallbackEmptyWallet = 'FALLBACK_EMPTY_WALLET', -} - export interface ProviderState { - type: ProviderType; provider: Provider; assetBuyer: AssetBuyer; web3Wrapper: Web3Wrapper; + account: Account; +} + +export enum AccountState { + Loading = 'LOADING', + Ready = 'READY', + Locked = 'LOCKED', // TODO(bmillman): break this up into locked / privacy mode enabled + Error = 'ERROR', + None = 'NONE,', } +export interface AccountReady { + state: AccountState.Ready; + address: string; + ethBalanceInWei?: BigNumber; +} +export interface AccountNotReady { + state: AccountState.None | AccountState.Loading | AccountState.Locked | AccountState.Error; +} + +export type Account = AccountReady | AccountNotReady; + export type OrderSource = string | SignedOrder[]; |