From 84af6177ad250f404526f7457f02af1d930e022b Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 23 Feb 2022 11:24:30 -0800 Subject: [PATCH] update eager connect hook and make app concerned with selected pubkey, refactor token to be stored as object --- apps/trading/pages/index.page.tsx | 60 ++++++++++++++-- .../src/lib/vega-wallet/connect-dialog.tsx | 6 ++ .../src/lib/vega-wallet/connectors.ts | 71 +++++++++++++++---- .../src/lib/vega-wallet/context.ts | 6 -- .../src/lib/vega-wallet/provider.tsx | 30 ++------ .../lib/vega-wallet/rest-connector-form.tsx | 1 + 6 files changed, 126 insertions(+), 48 deletions(-) diff --git a/apps/trading/pages/index.page.tsx b/apps/trading/pages/index.page.tsx index 542157953..40d7be503 100644 --- a/apps/trading/pages/index.page.tsx +++ b/apps/trading/pages/index.page.tsx @@ -1,14 +1,16 @@ import { Callout, Button } from '@vegaprotocol/ui-toolkit'; -import { useVegaWallet } from '@vegaprotocol/react-helpers'; -import { useEffect } from 'react'; import { rest } from '../lib/connectors'; +import { useVegaWallet, VegaKeyExtended } from '@vegaprotocol/react-helpers'; +import { useEffect, useMemo, useState } from 'react'; +import { Connectors, rest } from '../lib/connectors'; import { LocalStorage } from '@vegaprotocol/storage'; export function Index() { // Get keys from vega wallet immediately useEagerConnect(); - const { publicKey, publicKeys, selectPublicKey } = useVegaWallet(); + const { publicKeys } = useVegaWallet(); + const { publicKey, onSelect } = useCurrentVegaKey(); return (
@@ -31,7 +33,7 @@ export function Index() {