@@ -4,6 +4,7 @@ import React, {
4 useCallback,
4 useCallback,
5 useContext,
5 useContext,
7} from 'react';
8} from 'react';
8import { Just, Nothing } from 'folktale/maybe';
9import { Just, Nothing } from 'folktale/maybe';
9import { includes } from 'lodash';
10import { includes } from 'lodash';
@@ -14,8 +15,11 @@ import {
14 addressFromSecp256k1Public,
15 addressFromSecp256k1Public,
15 walletFromMnemonic,
16 walletFromMnemonic,
16} from 'lib/wallet';
17} from 'lib/wallet';
18+import { getAuthToken } from 'lib/authToken';
17import { BRIDGE_ERROR } from 'lib/error';
19import { BRIDGE_ERROR } from 'lib/error';
21+import { useNetwork } from 'store/network';
19export const WalletContext = createContext(null);
23export const WalletContext = createContext(null);
21const DEFAULT_WALLET_TYPE = WALLET_TYPES.TICKET;
25const DEFAULT_WALLET_TYPE = WALLET_TYPES.TICKET;
@@ -46,6 +50,26 @@ function _useWallet(initialWallet = Nothing(), initialMnemonic = Nothing()) {
46 const [networkSeed, setNetworkSeed] = useState(Nothing());
50 const [networkSeed, setNetworkSeed] = useState(Nothing());
47 const [networkRevision, setNetworkRevision] = useState(Nothing());
51 const [networkRevision, setNetworkRevision] = useState(Nothing());
53+ const [authToken, setAuthToken] = useState(Nothing());
55+ const { web3 } = useNetwork();
58+ if (!Just.hasInstance(wallet) || !Just.hasInstance(web3)) {
61+ const _wallet = wallet.value;
62+ const _web3 = web3.value;
63+ const token = getAuthToken({
71+ }, [wallet, walletType, walletHdPath, web3]);
49 const setWalletType = useCallback(
73 const setWalletType = useCallback(
50 walletType => {
74 walletType => {
51 if (!includes(WALLET_TYPES, walletType)) {
75 if (!includes(WALLET_TYPES, walletType)) {