Skip to content

Commit

Permalink
added get assets to custom token (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky-fleek authored Sep 7, 2021
1 parent b288c21 commit b3e60f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@fleekhq/browser-rpc": "^2.0.2",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@psychedelic/plug-controller": "0.4.7",
"@psychedelic/plug-inpage-provider": "1.2.0",
"@psychedelic/plug-controller": "0.4.6",
"@reduxjs/toolkit": "^1.6.0",
"advanced-css-reset": "^1.2.2",
"axios": "^0.21.1",
Expand Down
7 changes: 5 additions & 2 deletions source/Popup/Views/AddToken/Steps/Step2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { TokenIcon } from '@components';
import { USD_PER_TC, CYCLES_PER_TC } from '@shared/constants/currencies';
import { HANDLER_TYPES, sendMessage } from '@background/Keyring';
import { setAssets, setAssetsLoading } from '@redux/wallet';
import { useDispatch } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';

import useStyles from '../styles';

const cyclesToTC = cycles => cycles ? cycles / CYCLES_PER_TC : 0; // eslint-disable-line
Expand All @@ -37,14 +38,16 @@ const Step2 = ({ selectedToken, handleClose }) => {
const dispatch = useDispatch();
const [loading, setLoading] = useState(false);
const displayToken = parseTokenBySymbol(selectedToken);
const { icpPrice } = useSelector((state) => state.icp);
const registerToken = () => {
setLoading(true);
sendMessage({
type: HANDLER_TYPES.ADD_CUSTOM_TOKEN,
params: selectedToken?.token.canisterId,
}, async () => {
sendMessage({
type: HANDLER_TYPES.GET_BALANCE,
type: HANDLER_TYPES.GET_ASSETS,
params: { icpPrice, refresh: true },
}, (keyringAssets) => {
dispatch(setAssets(keyringAssets));
dispatch(setAssetsLoading(false));
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1381,10 +1381,10 @@
node-gyp "^7.1.0"
read-package-json-fast "^2.0.1"

"@psychedelic/[email protected].6":
version "0.4.6"
resolved "https://npm.pkg.github.com/download/@psychedelic/plug-controller/0.4.6/1da619e5bceec96a740781be821696c030ffc5db7e9240d9f9f02000b63ceca6#1fdf77ffed5a61427a7cf7dfae5f86ba67ea0856"
integrity sha512-rFL3ST0lQhrEAIee3YtTZsYDFP9XGyCUWraleSYlnol8BeqtjxJHvkNWKzXsOQd20SwUARrhsEVimtGQivrXEA==
"@psychedelic/[email protected].7":
version "0.4.7"
resolved "https://npm.pkg.github.com/download/@psychedelic/plug-controller/0.4.7/f3dcef2958522dcce335b130328723abbb9a719a1e7997d40e96c26a19a4e49a#8b746f0c96bf83a7978c3e43e3939a7656a314f6"
integrity sha512-OAf1Ye/tyBv1N9jg4FqhuGuGwFu5Z70PhGXjAueWpe/vgD/4UY4fuP4PkYz+Orzs8U6UxTNeCG/mvRLorzq7qA==
dependencies:
"@babel/preset-env" "^7.14.4"
"@dfinity/agent" "^0.9.3"
Expand Down

0 comments on commit b3e60f4

Please sign in to comment.