@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Provider } from '@reef-chain/evm-provider';
|
|
2
|
+
import { BigNumber } from 'ethers';
|
|
3
|
+
import { Network, ReefSigner } from '../state';
|
|
4
|
+
export type TxStatusHandler = (status: TxStatusUpdate) => void;
|
|
5
|
+
export declare enum TX_STATUS_ERROR_CODE {
|
|
6
|
+
ERROR_MIN_BALANCE_AFTER_TX = 0,
|
|
7
|
+
ERROR_BALANCE_TOO_LOW = 1,
|
|
8
|
+
ERROR_UNDEFINED = 2
|
|
9
|
+
}
|
|
10
|
+
export interface TxStatusUpdate {
|
|
11
|
+
txIdent: string;
|
|
12
|
+
txHash?: string;
|
|
13
|
+
error?: {
|
|
14
|
+
message: string;
|
|
15
|
+
code: TX_STATUS_ERROR_CODE;
|
|
16
|
+
};
|
|
17
|
+
isInBlock?: boolean;
|
|
18
|
+
isComplete?: boolean;
|
|
19
|
+
txTypeEvm?: boolean;
|
|
20
|
+
url?: string;
|
|
21
|
+
componentTxType?: string;
|
|
22
|
+
addresses?: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const handleErr: (e: {
|
|
25
|
+
message: string;
|
|
26
|
+
} | string, txIdent: string, txHash: string, txHandler: TxStatusHandler, signer: ReefSigner) => void;
|
|
27
|
+
export declare const nativeTransfer: (amount: string, destinationAddress: string, provider: Provider, signer: ReefSigner) => Promise<void>;
|
|
28
|
+
export declare const sendToNativeAddress: (provider: Provider, signer: ReefSigner, toAmt: BigNumber, to: string, txHandler: TxStatusHandler) => string;
|
|
29
|
+
export declare const getExtrinsicUrl: (extrinsic: {
|
|
30
|
+
id: string;
|
|
31
|
+
}, network?: Network) => string;
|
|
32
|
+
export declare const getTransferUrl: (extrinsic: {
|
|
33
|
+
id: string;
|
|
34
|
+
}, event: {
|
|
35
|
+
index: string;
|
|
36
|
+
}, network?: Network) => string;
|
|
37
|
+
export declare const getContractUrl: (address: string, network?: Network) => string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
3
|
+
export declare const REEF_ADDRESS = "0x0000000000000000000000000000000001000000";
|
|
4
|
+
export declare const EMPTY_ADDRESS = "0x";
|
|
5
|
+
export declare const REEF_ADDRESS_SPECIFIC_STRING = "(ONLY for Reef chain!)";
|
|
6
|
+
export declare const MIN_NATIVE_TX_BALANCE = 1;
|
|
7
|
+
export declare const MIN_EVM_TX_BALANCE = 65;
|
|
8
|
+
export declare const POLL_INTERVAL = 5000;
|
|
9
|
+
export interface ButtonStatus {
|
|
10
|
+
text: string;
|
|
11
|
+
isValid: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const trim: (value: string, size?: number) => string;
|
|
14
|
+
export declare const toAddressShortDisplay: (address: string) => string;
|
|
15
|
+
export declare const shortAddress: (address: string) => string;
|
|
16
|
+
export declare const ensure: (condition: boolean, message: string) => void;
|
|
17
|
+
export declare const toReefBalanceDisplay: (value?: BigNumber) => string;
|
|
18
|
+
export declare const uniqueCombinations: <T>(array: T[]) => [T, T][];
|
|
19
|
+
export declare const errorStatus: (text: string) => ButtonStatus;
|
|
20
|
+
export declare const ensureVoidRun: (canRun: boolean) => <I>(fun: (obj: I) => void, obj: I) => void;
|
|
21
|
+
export declare const removeUndefinedItem: <Type>(item: Type | undefined) => item is Type;
|
|
22
|
+
export declare const formatAgoDate: (timestamp: number | string) => string;
|
|
23
|
+
export declare const dropDuplicatesMultiKey: <Obj, Key extends keyof Obj>(objects: Obj[], keys: Key[]) => Obj[];
|
|
24
|
+
export declare const fromReefEVMAddressWithNotification: (address: string) => string;
|
|
25
|
+
export declare const toReefEVMAddressWithNotification: (address: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns icnUrl if exists, otherwise return sample icon based on calculated
|
|
28
|
+
* checksum from provided address. Returned sample icon is svg encoded to base64
|
|
29
|
+
* and prefixed with data string, so it can be used directly with <img /> tag.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getIconUrl: (tokenAddress?: string) => string;
|
|
32
|
+
export declare const showEvmCopyAddressAlert: () => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reef-chain/react-lib",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Reef React Library",
|
|
5
|
+
"author": "Reef chain",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "git@github.com:reef-chain/react-lib.git",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"module": "dist/index.modern.js",
|
|
10
|
+
"source": "src/index.ts",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=10"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"mb": "microbundle --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx --format modern,cjs",
|
|
16
|
+
"build": "yarn run mb",
|
|
17
|
+
"start": "yarn run mb watch --no-compress",
|
|
18
|
+
"prepare": "run-s build",
|
|
19
|
+
"test": "run-s test:unit test:lint test:build",
|
|
20
|
+
"lint": "yarn prettier ./src && eslint --fix --ext .ts,.tsx ./src/",
|
|
21
|
+
"test:build": "run-s build",
|
|
22
|
+
"test:lint": "eslint .",
|
|
23
|
+
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
|
|
24
|
+
"test:watch": "react-scripts test --env=jsdom",
|
|
25
|
+
"predeploy": "cd example && yarn install && yarn run build",
|
|
26
|
+
"deploy": "gh-pages -d example/build"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@fortawesome/free-regular-svg-icons": "^6.1.0",
|
|
30
|
+
"@fortawesome/free-solid-svg-icons": "^6.1.0",
|
|
31
|
+
"@polkadot/extension-dapp": "^0.40.4",
|
|
32
|
+
"@polkadot/react-identicon": "^0.86.4",
|
|
33
|
+
"@reef-chain/util-lib": "^1.0.0-rc9",
|
|
34
|
+
"@reef-chain/evm-provider": "^1.0.12",
|
|
35
|
+
"@reef-defi/extension-base": "^1.0.14",
|
|
36
|
+
"@reef-defi/extension-dapp": "^1.0.14",
|
|
37
|
+
"@reef-defi/extension-inject": "^1.0.14",
|
|
38
|
+
"@reef-chain/ui-kit": "^1.1.4",
|
|
39
|
+
"@types/react-router-dom": "^5.3.0",
|
|
40
|
+
"axios": "^0.21.4",
|
|
41
|
+
"bignumber.js": "^9.0.2",
|
|
42
|
+
"bootstrap": "^5.1.1",
|
|
43
|
+
"eslint-import-resolver-typescript": "^2.4.0",
|
|
44
|
+
"ethers": "^5.7.0",
|
|
45
|
+
"process": "^0.11.10",
|
|
46
|
+
"react-copy-to-clipboard": "^5.0.4",
|
|
47
|
+
"react-router-dom": "^5.3.0",
|
|
48
|
+
"react-tooltip": "^4.2.21",
|
|
49
|
+
"rxjs": "^7.5.4"
|
|
50
|
+
},
|
|
51
|
+
"resolutions": {
|
|
52
|
+
"@types/react": "17.0.2",
|
|
53
|
+
"@types/react-dom": "17.0.2",
|
|
54
|
+
"ethers": "^5.7.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"react": "^17.0.2"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@testing-library/jest-dom": "^4.2.4",
|
|
61
|
+
"@testing-library/react": "^11.1.0",
|
|
62
|
+
"@testing-library/user-event": "^7.2.1",
|
|
63
|
+
"@types/bootstrap": "^5.1.12",
|
|
64
|
+
"@types/jest": "^25.1.4",
|
|
65
|
+
"@types/node": "^12.12.38",
|
|
66
|
+
"@types/react": "^17.0.2",
|
|
67
|
+
"@types/react-copy-to-clipboard": "^5.0.1",
|
|
68
|
+
"@types/react-dom": "^17.0.2",
|
|
69
|
+
"@types/react-tooltip": "^4.2.4",
|
|
70
|
+
"@types/validator": "^13.1.0",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^4.18.0",
|
|
72
|
+
"@typescript-eslint/parser": "^4.18.0",
|
|
73
|
+
"babel-eslint": "^10.0.3",
|
|
74
|
+
"cross-env": "^7.0.2",
|
|
75
|
+
"eslint": "^7.29.0",
|
|
76
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
77
|
+
"eslint-plugin-import": "^2.23.4",
|
|
78
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
79
|
+
"eslint-plugin-react": "^7.24.0",
|
|
80
|
+
"eslint-plugin-react-hooks": "^4.2.0",
|
|
81
|
+
"gh-pages": "^2.2.0",
|
|
82
|
+
"microbundle": "^0.14.2",
|
|
83
|
+
"npm-run-all": "^4.1.5",
|
|
84
|
+
"prettier": "2.5.1",
|
|
85
|
+
"react": "^17.0.2",
|
|
86
|
+
"react-dom": "^17.0.2",
|
|
87
|
+
"react-scripts": "5.0.0",
|
|
88
|
+
"tslib": "^2.4.0",
|
|
89
|
+
"typescript": "^4.6.3",
|
|
90
|
+
"yalc": "^1.0.0-pre.53"
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dist",
|
|
94
|
+
"README.md"
|
|
95
|
+
],
|
|
96
|
+
"private": false
|
|
97
|
+
}
|