@reef-chain/react-lib 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/prices.d.ts +8 -0
- package/dist/api/tokens.d.ts +2 -0
- package/dist/appState/accountState.d.ts +15 -0
- package/dist/appState/accountStateUtil.d.ts +6 -0
- package/dist/appState/appState.d.ts +3 -0
- package/dist/appState/index.d.ts +1 -0
- package/dist/appState/nftTokenState.d.ts +12 -0
- package/dist/appState/providerState.d.ts +4 -0
- package/dist/appState/tokenState.d.ts +13 -0
- package/dist/appState/updateStateModel.d.ts +14 -0
- package/dist/appState/util.d.ts +22 -0
- package/dist/assets/abi/ERC1155Uri.d.ts +2 -0
- package/dist/assets/abi/ERC20.d.ts +2 -0
- package/dist/assets/abi/ERC721Uri.d.ts +2 -0
- package/dist/assets/abi/ReefswapFactory.d.ts +2 -0
- package/dist/assets/abi/ReefswapPair.d.ts +2 -0
- package/dist/assets/abi/ReefswapRouter.d.ts +2 -0
- package/dist/components/AccountSelector/AccountInlineInfo.d.ts +10 -0
- package/dist/components/AccountSelector/AccountListModal.d.ts +11 -0
- package/dist/components/AccountSelector/AccountSelector.d.ts +17 -0
- package/dist/components/AddLiquidity/index.d.ts +10 -0
- package/dist/components/EvmBind/EvmBindComponent.d.ts +15 -0
- package/dist/components/OverlayAction/index.d.ts +12 -0
- package/dist/components/PoolActions/ConfirmPopups/Address.d.ts +7 -0
- package/dist/components/PoolActions/ConfirmPopups/Bond.d.ts +11 -0
- package/dist/components/PoolActions/ConfirmPopups/Provide.d.ts +14 -0
- package/dist/components/PoolActions/ConfirmPopups/Send.d.ts +11 -0
- package/dist/components/PoolActions/ConfirmPopups/SummaryItem.d.ts +7 -0
- package/dist/components/PoolActions/ConfirmPopups/Token.d.ts +11 -0
- package/dist/components/PoolActions/ConfirmPopups/Trade.d.ts +14 -0
- package/dist/components/PoolActions/ConfirmPopups/Withdraw.d.ts +15 -0
- package/dist/components/PoolActions/Finalizing.d.ts +2 -0
- package/dist/components/PoolActions/Provide.d.ts +19 -0
- package/dist/components/PoolActions/TokenDropdown.d.ts +9 -0
- package/dist/components/PoolActions/TokenField.d.ts +11 -0
- package/dist/components/PoolActions/Trade.d.ts +23 -0
- package/dist/components/PoolActions/Withdraw.d.ts +12 -0
- package/dist/components/PoolActions/index.d.ts +6 -0
- package/dist/components/RemoveLiquidity/RemoveConfirmationModal.d.ts +10 -0
- package/dist/components/RemoveLiquidity/index.d.ts +7 -0
- package/dist/components/SelectToken/index.d.ts +14 -0
- package/dist/components/SwapComponent/SwapConfirmationModal.d.ts +10 -0
- package/dist/components/SwapComponent/index.d.ts +11 -0
- package/dist/components/TokenFields/TokenAmountField.d.ts +24 -0
- package/dist/components/TokenFields/TokenAmountView.d.ts +8 -0
- package/dist/components/TokenFields/index.d.ts +2 -0
- package/dist/components/TransactionSettings/index.d.ts +10 -0
- package/dist/components/Transfer/Send.d.ts +14 -0
- package/dist/components/Transfer/SendConfirmationModal.d.ts +9 -0
- package/dist/components/Transfer/TransferComponent.d.ts +14 -0
- package/dist/components/Transfer/index.d.ts +2 -0
- package/dist/components/common/Alert/index.d.ts +2 -0
- package/dist/components/common/Button/index.d.ts +27 -0
- package/dist/components/common/Card/index.d.ts +19 -0
- package/dist/components/common/Display/index.d.ts +35 -0
- package/dist/components/common/Dropdown/index.d.ts +11 -0
- package/dist/components/common/Icons/index.d.ts +33 -0
- package/dist/components/common/Input/index.d.ts +52 -0
- package/dist/components/common/Label/index.d.ts +12 -0
- package/dist/components/common/List/index.d.ts +10 -0
- package/dist/components/common/Loading/index.d.ts +9 -0
- package/dist/components/common/Modal/index.d.ts +27 -0
- package/dist/components/common/Text/index.d.ts +18 -0
- package/dist/components/common/Tooltip/index.d.ts +6 -0
- package/dist/components/common/index.d.ts +13 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/graphql/apollo.d.ts +15 -0
- package/dist/graphql/evmEvents.d.ts +6 -0
- package/dist/graphql/gql.d.ts +3 -0
- package/dist/graphql/index.d.ts +1 -0
- package/dist/graphql/pools.d.ts +323 -0
- package/dist/graphql/utils.d.ts +5 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/poolHooks.d.ts +25 -0
- package/dist/hooks/useAddLiquidity.d.ts +29 -0
- package/dist/hooks/useAllNfts.d.ts +4 -0
- package/dist/hooks/useAllPools.d.ts +7 -0
- package/dist/hooks/useAsyncEffect.d.ts +2 -0
- package/dist/hooks/useFromTime.d.ts +7 -0
- package/dist/hooks/useInitReefState.d.ts +2 -0
- package/dist/hooks/useKeepTokenUpdated.d.ts +3 -0
- package/dist/hooks/useLoadPool.d.ts +14 -0
- package/dist/hooks/useLoadPools.d.ts +4 -0
- package/dist/hooks/useLoadSignerTokens.d.ts +3 -0
- package/dist/hooks/useLoadSigners.d.ts +11 -0
- package/dist/hooks/useLoader.d.ts +9 -0
- package/dist/hooks/useObservableState.d.ts +2 -0
- package/dist/hooks/usePoolData.d.ts +34 -0
- package/dist/hooks/usePoolLists.d.ts +25 -0
- package/dist/hooks/usePoolStats.d.ts +29 -0
- package/dist/hooks/usePriceEstimator.d.ts +2 -0
- package/dist/hooks/useProvider.d.ts +3 -0
- package/dist/hooks/useReefPriceInterval.d.ts +2 -0
- package/dist/hooks/useRemoveLiquidity.d.ts +28 -0
- package/dist/hooks/useSwapState.d.ts +31 -0
- package/dist/hooks/useUpdateAccountBalance.d.ts +2 -0
- package/dist/hooks/useUpdateAmount.d.ts +11 -0
- package/dist/hooks/userInterval.d.ts +2 -0
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +5 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/rpc/accounts.d.ts +16 -0
- package/dist/rpc/index.d.ts +3 -0
- package/dist/rpc/rpc.d.ts +20 -0
- package/dist/rpc/tokens.d.ts +7 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/network.d.ts +26 -0
- package/dist/state/nft.d.ts +14 -0
- package/dist/state/pool.d.ts +33 -0
- package/dist/state/settings.d.ts +15 -0
- package/dist/state/token.d.ts +71 -0
- package/dist/state/types.d.ts +76 -0
- package/dist/store/actionTypes.d.ts +16 -0
- package/dist/store/actions/addLiquidity.d.ts +21 -0
- package/dist/store/actions/defaultActions.d.ts +70 -0
- package/dist/store/actions/index.d.ts +4 -0
- package/dist/store/actions/removeLiquidity.d.ts +9 -0
- package/dist/store/actions/swap.d.ts +22 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/reducers/addLiquidity.d.ts +15 -0
- package/dist/store/reducers/index.d.ts +3 -0
- package/dist/store/reducers/removeLiquidity.d.ts +14 -0
- package/dist/store/reducers/swap.d.ts +15 -0
- package/dist/utils/bindUtil.d.ts +10 -0
- package/dist/utils/dataWithProgress.d.ts +8 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/math.d.ts +55 -0
- package/dist/utils/modalUtil.d.ts +2 -0
- package/dist/utils/nftUtil.d.ts +7 -0
- package/dist/utils/providerUtil.d.ts +3 -0
- package/dist/utils/rpcErrorMessageHandler.d.ts +4 -0
- package/dist/utils/tokenUtil.d.ts +12 -0
- package/dist/utils/transactionUtil.d.ts +37 -0
- package/dist/utils/utils.d.ts +32 -0
- package/package.json +97 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @reef-chain/react-lib
|
|
2
|
+
|
|
3
|
+
> Reef React Library
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@reef-chain/react-lib) [](https://standardjs.com)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add @reef-chain/react-lib
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import React, { Component } from 'react'
|
|
17
|
+
|
|
18
|
+
import { Components } from '@reef-chain/react-lib'
|
|
19
|
+
import '@reef-chain/react-lib/dist/index.css'
|
|
20
|
+
|
|
21
|
+
const { Card, Button } = Components;
|
|
22
|
+
|
|
23
|
+
const Example = (): JSX.Element => (
|
|
24
|
+
<Card.Card>
|
|
25
|
+
<Card.Header>
|
|
26
|
+
<Card.Title>Hello from the other side!</Card.Title>
|
|
27
|
+
<Button.Back onClick={() => {}} />
|
|
28
|
+
</Card.Header>
|
|
29
|
+
</Card.Card>
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TokenPrices {
|
|
2
|
+
[currenty: string]: number;
|
|
3
|
+
}
|
|
4
|
+
export declare const getTokenPrice: (tokenId: string) => Promise<number>;
|
|
5
|
+
export declare const getTokenListPrices: (tokenIds: string[]) => Promise<TokenPrices>;
|
|
6
|
+
export declare const getTokenEthAddressListPrices: (tokenAddressList: string[]) => Promise<TokenPrices>;
|
|
7
|
+
export declare const retrieveReefCoingeckoPrice: () => Promise<number>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Observable, ReplaySubject, Subject } from 'rxjs';
|
|
2
|
+
import { AccountJson } from '@reef-defi/extension-base/background/types';
|
|
3
|
+
import type { InjectedAccountWithMeta } from '@reef-defi/extension-inject/types';
|
|
4
|
+
import type { Signer as InjectedSigningKey } from '@polkadot/api/types';
|
|
5
|
+
import { UpdateDataCtx } from './updateStateModel';
|
|
6
|
+
import { ReefSigner } from '../state';
|
|
7
|
+
export declare const accountsSubj: ReplaySubject<ReefSigner[] | null>;
|
|
8
|
+
export declare const accountsJsonSubj: ReplaySubject<AccountJson[] | InjectedAccountWithMeta[] | null>;
|
|
9
|
+
export declare const accountsJsonSigningKeySubj: ReplaySubject<InjectedSigningKey>;
|
|
10
|
+
export declare const reloadSignersSubj: Subject<UpdateDataCtx<ReefSigner[]>>;
|
|
11
|
+
export declare const signersInjected$: Observable<ReefSigner[]>;
|
|
12
|
+
export declare const signers$: Observable<ReefSigner[] | null>;
|
|
13
|
+
export declare const setCurrentAddress: (address: string | undefined) => void;
|
|
14
|
+
export declare const currentAddress$: Observable<string | undefined>;
|
|
15
|
+
export declare const selectedSigner$: Observable<ReefSigner | undefined | null>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UpdateAction, UpdateDataType } from './updateStateModel';
|
|
2
|
+
import { ReefSigner } from '../state';
|
|
3
|
+
export declare const isUpdateAll: (addresses: string[] | null) => boolean;
|
|
4
|
+
export declare const getSignersToUpdate: (updateType: UpdateDataType, updateActions: UpdateAction[], signers: ReefSigner[]) => ReefSigner[];
|
|
5
|
+
export declare const replaceUpdatedSigners: (existingSigners?: ReefSigner[], updatedSigners?: ReefSigner[], appendNew?: boolean) => ReefSigner[];
|
|
6
|
+
export declare const updateSignersEvmBindings: (updateActions: UpdateAction[], signers?: ReefSigner[]) => Promise<ReefSigner[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as appState from './appState';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { NFT } from '../state';
|
|
3
|
+
export interface VerifiedNft {
|
|
4
|
+
token_address: string;
|
|
5
|
+
balance: string;
|
|
6
|
+
nft_id: string;
|
|
7
|
+
info: {
|
|
8
|
+
symbol: string;
|
|
9
|
+
};
|
|
10
|
+
contractType: 'ERC1155' | 'ERC721';
|
|
11
|
+
}
|
|
12
|
+
export declare const selectedSignerNFTs$: Observable<NFT[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Token, TokenTransfer, TokenWithAmount } from '../state/token';
|
|
3
|
+
import { ReefSigner } from '../state';
|
|
4
|
+
import { PoolReserves } from '../graphql/pools';
|
|
5
|
+
export declare const reefPrice$: Observable<number>;
|
|
6
|
+
export declare const validatedTokens$: Observable<Token[]>;
|
|
7
|
+
export declare const SIGNER_TOKENS_GQL: import("@apollo/client").DocumentNode;
|
|
8
|
+
export declare const selectedSignerTokenBalances$: Observable<Token[] | null>;
|
|
9
|
+
export declare const selectedSignerAddressUpdate$: Observable<ReefSigner | null | undefined>;
|
|
10
|
+
export declare const allAvailableSignerTokens$: Observable<Token[]>;
|
|
11
|
+
export declare const pools$: Observable<PoolReserves[]>;
|
|
12
|
+
export declare const tokenPrices$: Observable<TokenWithAmount[]>;
|
|
13
|
+
export declare const transferHistory$: Observable<null | TokenTransfer[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum UpdateDataType {
|
|
2
|
+
ACCOUNT_NATIVE_BALANCE = 0,
|
|
3
|
+
ACCOUNT_TOKENS = 1,
|
|
4
|
+
ACCOUNT_EVM_BINDING = 2
|
|
5
|
+
}
|
|
6
|
+
export interface UpdateAction {
|
|
7
|
+
address?: string;
|
|
8
|
+
type: UpdateDataType;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateDataCtx<T> {
|
|
11
|
+
data?: T;
|
|
12
|
+
updateActions: UpdateAction[];
|
|
13
|
+
ctx?: any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContractInterface } from 'ethers';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { ContractType, Token, TokenWithAmount } from '../state/token';
|
|
4
|
+
import { UpdateAction, UpdateDataCtx } from './updateStateModel';
|
|
5
|
+
import { TxStatusUpdate } from '../utils';
|
|
6
|
+
import { ipfsUrlResolverFn } from '../utils/nftUtil';
|
|
7
|
+
import { PoolReserves } from '../graphql/pools';
|
|
8
|
+
import { ReefSigner } from '../state';
|
|
9
|
+
export declare const reloadSignersSubj: Subject<UpdateDataCtx<ReefSigner[]>>;
|
|
10
|
+
export declare let _NFT_IPFS_RESOLVER_FN: ipfsUrlResolverFn | undefined;
|
|
11
|
+
export declare const setNftIpfsResolverFn: (val?: ipfsUrlResolverFn) => void;
|
|
12
|
+
export declare const combineTokensDistinct: ([tokens1, tokens2]: [
|
|
13
|
+
Token[],
|
|
14
|
+
Token[]
|
|
15
|
+
]) => Token[];
|
|
16
|
+
export declare const toTokensWithPrice: ([tokens, reefPrice, pools]: [
|
|
17
|
+
Token[],
|
|
18
|
+
number,
|
|
19
|
+
PoolReserves[]
|
|
20
|
+
]) => TokenWithAmount[];
|
|
21
|
+
export declare const onTxUpdateResetSigners: (txUpdateData: TxStatusUpdate, updateActions: UpdateAction[]) => void;
|
|
22
|
+
export declare const getContractTypeAbi: (contractType: ContractType) => ContractInterface;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface AccountInlineInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
address: string;
|
|
4
|
+
evmAddress: string;
|
|
5
|
+
source: string;
|
|
6
|
+
toggle?: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const AccountInlineInfo: ({ name, address, evmAddress, source, toggle, onClick, }: AccountInlineInfo) => JSX.Element;
|
|
10
|
+
export default AccountInlineInfo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ReefSigner } from '../../state';
|
|
3
|
+
interface AccountListModal {
|
|
4
|
+
id: string;
|
|
5
|
+
accounts: ReefSigner[];
|
|
6
|
+
selectAccount: (index: number, signer: ReefSigner) => void;
|
|
7
|
+
backButtonModalId?: string;
|
|
8
|
+
title?: string | ReactElement;
|
|
9
|
+
}
|
|
10
|
+
export declare const AccountListModal: ({ id, accounts, selectAccount, backButtonModalId, title, }: AccountListModal) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReefSigner } from '../../state';
|
|
2
|
+
import './AccountSelector.css';
|
|
3
|
+
export type Network = 'mainnet' | 'testnet';
|
|
4
|
+
export type Language = 'en' | 'hi';
|
|
5
|
+
interface AccountSelector {
|
|
6
|
+
accounts: ReefSigner[];
|
|
7
|
+
selectedSigner?: ReefSigner;
|
|
8
|
+
selectAccount: (index: number, signer: ReefSigner) => void;
|
|
9
|
+
selectedNetwork?: Network;
|
|
10
|
+
onNetworkSelect?: (network: Network) => any;
|
|
11
|
+
onLanguageSelect?: (language: Language) => any;
|
|
12
|
+
isBalanceHidden?: boolean;
|
|
13
|
+
showBalance?: (...args: any[]) => any;
|
|
14
|
+
availableNetworks: Network[];
|
|
15
|
+
}
|
|
16
|
+
export declare const AccountSelector: ({ selectedSigner, accounts, selectAccount, selectedNetwork, onNetworkSelect, onLanguageSelect, isBalanceHidden, showBalance, availableNetworks, }: AccountSelector) => JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReefSigner, Token } from '../../state';
|
|
2
|
+
import { AddLiquidityComponentActions, AddLiquidityState } from '../../store';
|
|
3
|
+
interface AddLiquidityComponent {
|
|
4
|
+
tokens: Token[];
|
|
5
|
+
signer: ReefSigner;
|
|
6
|
+
state: AddLiquidityState;
|
|
7
|
+
actions: AddLiquidityComponentActions;
|
|
8
|
+
}
|
|
9
|
+
export declare const AddLiquidity: ({ state, tokens, signer, actions: { back, onAddLiquidity, selectToken1, selectToken2, setSettings, onAddressChange, setToken1Amount, setToken2Amount, }, }: AddLiquidityComponent) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReefSigner } from '../../state';
|
|
2
|
+
import { TxStatusHandler } from '../../utils';
|
|
3
|
+
import './bind.css';
|
|
4
|
+
export declare enum EvmBindComponentTxType {
|
|
5
|
+
TRANSFER = "TRANSFER",
|
|
6
|
+
BIND = "BIND"
|
|
7
|
+
}
|
|
8
|
+
interface EvmBindComponent {
|
|
9
|
+
bindSigner: ReefSigner;
|
|
10
|
+
signers: ReefSigner[];
|
|
11
|
+
onTxUpdate?: TxStatusHandler;
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const EvmBindComponent: ({ bindSigner, onTxUpdate, signers, onComplete, }: EvmBindComponent) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './overlay-action.css';
|
|
3
|
+
interface OverlayAction {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose?: () => any;
|
|
6
|
+
onOpened?: () => any;
|
|
7
|
+
onClosed?: () => any;
|
|
8
|
+
className?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const OverlayAction: React.FC<OverlayAction>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './confirm-popup.css';
|
|
2
|
+
export interface Props {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: (...args: any[]) => any;
|
|
5
|
+
onConfirm?: (...args: any[]) => any;
|
|
6
|
+
name?: string;
|
|
7
|
+
amount?: string;
|
|
8
|
+
contract?: string;
|
|
9
|
+
duration?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const BondConfirmPopup: ({ isOpen, onClose, onConfirm, name, amount, contract, duration, }: Props) => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TokenWithAmount } from '../../../state';
|
|
2
|
+
import './confirm-popup.css';
|
|
3
|
+
export interface Props {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: (...args: any[]) => any;
|
|
6
|
+
onConfirm?: (...args: any[]) => any;
|
|
7
|
+
token1: TokenWithAmount;
|
|
8
|
+
token2: TokenWithAmount;
|
|
9
|
+
poolShare: string;
|
|
10
|
+
percentage: number;
|
|
11
|
+
LPTokens: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare const ProvidePopup: ({ isOpen, onClose, onConfirm, token1, token2, poolShare, percentage, LPTokens, }: Props) => JSX.Element;
|
|
14
|
+
export default ProvidePopup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TokenWithAmount } from '../../../state';
|
|
2
|
+
import './confirm-popup.css';
|
|
3
|
+
export interface SendPopup {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
token: TokenWithAmount;
|
|
6
|
+
address?: string;
|
|
7
|
+
onClose: (...args: any[]) => any;
|
|
8
|
+
onConfirm?: (...args: any[]) => any;
|
|
9
|
+
}
|
|
10
|
+
declare const SendPopup: ({ isOpen, token, address, onClose, onConfirm, }: SendPopup) => JSX.Element;
|
|
11
|
+
export default SendPopup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './confirm-popup.css';
|
|
2
|
+
export interface Props {
|
|
3
|
+
image?: string;
|
|
4
|
+
symbol?: string;
|
|
5
|
+
price?: string | number;
|
|
6
|
+
amount?: string | number;
|
|
7
|
+
value?: string | number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Token: ({ image, symbol, price, amount, value, className, }: Props) => JSX.Element;
|
|
11
|
+
export default Token;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TokenWithAmount } from '../../../state';
|
|
2
|
+
import './confirm-popup.css';
|
|
3
|
+
export interface TradePopup {
|
|
4
|
+
fee: string;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
slippage: number;
|
|
7
|
+
exchangeRate?: string;
|
|
8
|
+
token1: TokenWithAmount;
|
|
9
|
+
token2: TokenWithAmount;
|
|
10
|
+
onClose: (...args: any[]) => any;
|
|
11
|
+
onConfirm?: (...args: any[]) => any;
|
|
12
|
+
}
|
|
13
|
+
declare const TradePopup: ({ fee, isOpen, token1, token2, slippage, exchangeRate, onClose, onConfirm, }: TradePopup) => JSX.Element;
|
|
14
|
+
export default TradePopup;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Pool } from '../../../state';
|
|
2
|
+
import './confirm-popup.css';
|
|
3
|
+
export interface Props {
|
|
4
|
+
pool: Pool;
|
|
5
|
+
price1: number;
|
|
6
|
+
price2: number;
|
|
7
|
+
percentageAmount: number;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
LPTokens: string | number;
|
|
10
|
+
poolShare: string;
|
|
11
|
+
onClose: (...args: any[]) => any;
|
|
12
|
+
onConfirm?: (...args: any[]) => any;
|
|
13
|
+
}
|
|
14
|
+
declare const WithdrawPopup: ({ price1, price2, pool, isOpen, LPTokens, poolShare, percentageAmount, onClose, onConfirm, }: Props) => JSX.Element;
|
|
15
|
+
export default WithdrawPopup;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AddLiquidityState } from '../../store';
|
|
2
|
+
import { SelectToken } from './TokenField';
|
|
3
|
+
import { Token } from '../../state';
|
|
4
|
+
interface ProvideActions {
|
|
5
|
+
onAddLiquidity: () => Promise<void>;
|
|
6
|
+
setToken1Amount: (amount: string) => void;
|
|
7
|
+
setToken2Amount: (amount: string) => void;
|
|
8
|
+
setPercentage: (amount: number) => void;
|
|
9
|
+
selectToken1?: SelectToken;
|
|
10
|
+
selectToken2?: SelectToken;
|
|
11
|
+
}
|
|
12
|
+
interface Provide {
|
|
13
|
+
tokens: Token[];
|
|
14
|
+
state: AddLiquidityState;
|
|
15
|
+
actions: ProvideActions;
|
|
16
|
+
confirmText?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Provide: ({ state, tokens, actions: { onAddLiquidity, setPercentage, setToken1Amount, setToken2Amount, selectToken1, selectToken2, }, }: Provide) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Token, TokenWithAmount } from '../../state';
|
|
2
|
+
import './token-field.css';
|
|
3
|
+
interface TokenDropdown {
|
|
4
|
+
token: TokenWithAmount;
|
|
5
|
+
tokens: Token[];
|
|
6
|
+
selectToken?: (token: Token) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const TokenDropdown: ({ token, tokens, selectToken }: TokenDropdown) => JSX.Element;
|
|
9
|
+
export default TokenDropdown;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Token, TokenWithAmount } from '../../state';
|
|
2
|
+
import './token-field.css';
|
|
3
|
+
export type SelectToken = (token: Token) => void;
|
|
4
|
+
interface TokenField {
|
|
5
|
+
token: TokenWithAmount;
|
|
6
|
+
tokens?: Token[];
|
|
7
|
+
selectToken?: SelectToken;
|
|
8
|
+
onAmountChange: (amount: string) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const TokenField: ({ token, tokens, onAmountChange, selectToken, }: TokenField) => JSX.Element;
|
|
11
|
+
export default TokenField;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SwapState } from '../../store';
|
|
2
|
+
import { SelectToken } from './TokenField';
|
|
3
|
+
import { LastPoolReserves, Token } from '../../state';
|
|
4
|
+
interface TradeActions {
|
|
5
|
+
onSwitch: () => void;
|
|
6
|
+
onSwap: () => Promise<void>;
|
|
7
|
+
setToken1Amount: (amount: string) => void;
|
|
8
|
+
setToken2Amount: (amount: string) => void;
|
|
9
|
+
setPercentage: (amount: number) => void;
|
|
10
|
+
selectToken1?: SelectToken;
|
|
11
|
+
selectToken2?: SelectToken;
|
|
12
|
+
setSlippage?: (slippage: number) => void;
|
|
13
|
+
}
|
|
14
|
+
interface Trade {
|
|
15
|
+
pools: LastPoolReserves[];
|
|
16
|
+
tokens: Token[];
|
|
17
|
+
state: SwapState;
|
|
18
|
+
actions: TradeActions;
|
|
19
|
+
maxSlippage?: number;
|
|
20
|
+
confirmText?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const Trade: ({ state: { token1, percentage, token2, focus, isLoading, isValid, pool, settings, status, }, actions: { onSwap, onSwitch, setPercentage, setToken1Amount, setToken2Amount, selectToken1, selectToken2, setSlippage, }, pools, tokens, maxSlippage, }: Trade) => JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RemoveLiquidityState } from '../../store';
|
|
2
|
+
interface WithdrawActions {
|
|
3
|
+
onRemoveLiquidity: () => Promise<void>;
|
|
4
|
+
setPercentage: (percentage: number) => void;
|
|
5
|
+
}
|
|
6
|
+
interface Withdraw {
|
|
7
|
+
state: RemoveLiquidityState;
|
|
8
|
+
actions: WithdrawActions;
|
|
9
|
+
confirmText?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const Withdraw: ({ state: { pool, isLoading, isValid, percentage, status, token1, token2, }, actions: { onRemoveLiquidity, setPercentage, }, }: Withdraw) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Pool } from '../../state';
|
|
2
|
+
interface RemoveConfirmationModal {
|
|
3
|
+
id: string;
|
|
4
|
+
pool?: Pool;
|
|
5
|
+
slippage: number;
|
|
6
|
+
percentageAmount: number;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const RemoveConfirmationModal: ({ id, pool, slippage, percentageAmount, onRemove, }: RemoveConfirmationModal) => JSX.Element;
|
|
10
|
+
export default RemoveConfirmationModal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RemoveLiquidityComponentActions, RemoveLiquidityState } from '../../store';
|
|
2
|
+
interface RemoveLiquidityComponent {
|
|
3
|
+
state: RemoveLiquidityState;
|
|
4
|
+
actions: RemoveLiquidityComponentActions;
|
|
5
|
+
}
|
|
6
|
+
export declare const RemoveLiquidityComponent: ({ state: { settings, pool, isLoading, isValid, percentage: percentageAmount, status, token1, token2, }, actions: { back, onRemoveLiquidity, setPercentage, setSettings, }, }: RemoveLiquidityComponent) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReefSigner, Token } from '../../state';
|
|
2
|
+
interface SelectToken {
|
|
3
|
+
id: string;
|
|
4
|
+
iconUrl: string;
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
selectedTokenName: string;
|
|
7
|
+
tokens: Token[];
|
|
8
|
+
onTokenSelect: (newToken: Token) => void;
|
|
9
|
+
onAddressChange?: (address: string) => Promise<void>;
|
|
10
|
+
hideCommonBaseView?: boolean;
|
|
11
|
+
signer: ReefSigner;
|
|
12
|
+
}
|
|
13
|
+
export declare const SelectToken: ({ id, tokens, selectedTokenName, onTokenSelect, fullWidth, iconUrl, onAddressChange, hideCommonBaseView, signer, }: SelectToken) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TokenWithAmount } from '../../state';
|
|
2
|
+
interface SwapConfirmationModal {
|
|
3
|
+
id?: string;
|
|
4
|
+
percentage: number;
|
|
5
|
+
buy: TokenWithAmount;
|
|
6
|
+
sell: TokenWithAmount;
|
|
7
|
+
confirmFun: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare const SwapConfirmationModal: ({ id, buy, sell, percentage, confirmFun, }: SwapConfirmationModal) => JSX.Element;
|
|
10
|
+
export default SwapConfirmationModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReefSigner, Token } from '../../state';
|
|
2
|
+
import { SwapComponentActions } from '../../store/actions/swap';
|
|
3
|
+
import { SwapState } from '../../store/reducers/swap';
|
|
4
|
+
interface SwapComponent {
|
|
5
|
+
tokens: Token[];
|
|
6
|
+
account: ReefSigner;
|
|
7
|
+
state: SwapState;
|
|
8
|
+
actions: SwapComponentActions;
|
|
9
|
+
}
|
|
10
|
+
export declare const SwapComponent: ({ tokens, account, state: { token2: buy, token1: sell, status, isValid, settings, isLoading, }, actions: { onSwap, onSwitch, setSettings, selectToken1, selectToken2, setToken1Amount, setToken2Amount, onAddressChange, }, }: SwapComponent) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ReefSigner, Token, TokenWithAmount } from '../../state';
|
|
3
|
+
interface TokenAmountFieldProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
tokens: Token[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
token: TokenWithAmount;
|
|
8
|
+
onTokenSelect: (newToken: Token) => void;
|
|
9
|
+
onAmountChange: (amount: string) => void;
|
|
10
|
+
onAddressChange?: (address: string) => Promise<void>;
|
|
11
|
+
hideSelectTokenCommonBaseView?: boolean;
|
|
12
|
+
signer: ReefSigner;
|
|
13
|
+
}
|
|
14
|
+
export declare const TokenAmountField: ({ id, token, tokens, signer, placeholder, onTokenSelect, onAmountChange, onAddressChange, }: TokenAmountFieldProps) => JSX.Element;
|
|
15
|
+
interface TokenAmountFieldMax extends TokenAmountFieldProps {
|
|
16
|
+
afterBalanceEl?: ReactElement;
|
|
17
|
+
hideSelectTokenCommonBaseView?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const TokenAmountFieldMax: ({ id, token, tokens, signer, placeholder, onTokenSelect, onAmountChange, onAddressChange, afterBalanceEl, hideSelectTokenCommonBaseView, }: TokenAmountFieldMax) => JSX.Element;
|
|
20
|
+
interface TokenAmountFieldImpactPriceProps extends TokenAmountFieldProps {
|
|
21
|
+
percentage: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const TokenAmountFieldImpactPrice: ({ id, token, tokens, signer, placeholder, percentage, onTokenSelect, onAmountChange, onAddressChange, }: TokenAmountFieldImpactPriceProps) => JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Settings } from '../../state';
|
|
3
|
+
interface TransactionSettings {
|
|
4
|
+
id?: string;
|
|
5
|
+
settings: Settings;
|
|
6
|
+
defaultSlippageTolerance?: number;
|
|
7
|
+
setSettings: (value: Settings) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TransactionSettings: React.FC<TransactionSettings>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Provider } from '@reef-chain/evm-provider';
|
|
2
|
+
import { NotifyFun, ReefSigner, Token } from '../../state';
|
|
3
|
+
import '../PoolActions/pool-actions.css';
|
|
4
|
+
import './Send.css';
|
|
5
|
+
interface Send {
|
|
6
|
+
tokens: Token[];
|
|
7
|
+
signer: ReefSigner;
|
|
8
|
+
provider: Provider;
|
|
9
|
+
accounts: ReefSigner[];
|
|
10
|
+
notify: NotifyFun;
|
|
11
|
+
tokenAddress?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Send: ({ signer, tokens, accounts, provider, tokenAddress, }: Send) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenWithAmount } from '../../state';
|
|
2
|
+
interface SendConfirmationModal {
|
|
3
|
+
id: string;
|
|
4
|
+
to: string;
|
|
5
|
+
token: TokenWithAmount;
|
|
6
|
+
confirmFun: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const SendConfirmationModal: ({ id, to, token: { amount, decimals, price, name, }, confirmFun, }: SendConfirmationModal) => JSX.Element;
|
|
9
|
+
export default SendConfirmationModal;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Provider } from '@reef-chain/evm-provider';
|
|
2
|
+
import { ReefSigner, Token, TokenWithAmount } from '../../state';
|
|
3
|
+
import { TxStatusHandler } from '../../utils/transactionUtil';
|
|
4
|
+
interface TransferComponent {
|
|
5
|
+
tokens: Token[];
|
|
6
|
+
from: ReefSigner;
|
|
7
|
+
token?: TokenWithAmount;
|
|
8
|
+
provider: Provider;
|
|
9
|
+
onTxUpdate?: TxStatusHandler;
|
|
10
|
+
accounts: ReefSigner[];
|
|
11
|
+
currentAccount: ReefSigner;
|
|
12
|
+
}
|
|
13
|
+
export declare const TransferComponent: ({ tokens, from, token, provider, onTxUpdate, currentAccount, accounts, }: TransferComponent) => JSX.Element;
|
|
14
|
+
export {};
|