From 47c6bc07cb586e2366f0c5ae5c2a895c156714a7 Mon Sep 17 00:00:00 2001 From: the letter L <134443988+turbocrime@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:23:37 -0700 Subject: [PATCH] disconnect api (#1307) * add disconnect method to page api * minifront use disconnect api --- .changeset/moody-bulldogs-mate.md | 5 + .changeset/pink-starfishes-confess.md | 6 + .gitignore | 3 +- .../src/components/header/menu/provider.tsx | 23 ++- .../src/components/shared/error-boundary.tsx | 9 +- apps/minifront/src/prax.ts | 59 ++++--- packages/client/README.md | 111 +++++++++++++ packages/client/package.json | 7 +- packages/client/src/create.ts | 147 ++++++++++++++++++ packages/client/src/error.ts | 27 ++-- packages/client/src/index.ts | 48 ++++++ .../transport-chrome/src/session-client.ts | 61 ++++++-- packages/transport-dom/src/create.ts | 6 +- pnpm-lock.yaml | 3 + 14 files changed, 446 insertions(+), 69 deletions(-) create mode 100644 .changeset/moody-bulldogs-mate.md create mode 100644 .changeset/pink-starfishes-confess.md create mode 100644 packages/client/README.md create mode 100644 packages/client/src/create.ts diff --git a/.changeset/moody-bulldogs-mate.md b/.changeset/moody-bulldogs-mate.md new file mode 100644 index 0000000000..e5c2723b99 --- /dev/null +++ b/.changeset/moody-bulldogs-mate.md @@ -0,0 +1,5 @@ +--- +'@penumbra-zone/client': major +--- + +add disconnect method, add `create` module diff --git a/.changeset/pink-starfishes-confess.md b/.changeset/pink-starfishes-confess.md new file mode 100644 index 0000000000..3875707bbc --- /dev/null +++ b/.changeset/pink-starfishes-confess.md @@ -0,0 +1,6 @@ +--- +'@penumbra-zone/transport-chrome': minor +'@penumbra-zone/transport-dom': minor +--- + +support disconnection diff --git a/.gitignore b/.gitignore index 131bda9a69..86257dc813 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,8 @@ lerna-debug.log* *_pk.bin # pack outputs -penumbra-zone-*.tgz +packages/*/penumbra-zone-*.tgz +packages/*/repo-*-*.tgz packages/*/package tsconfig.tsbuildinfo \ No newline at end of file diff --git a/apps/minifront/src/components/header/menu/provider.tsx b/apps/minifront/src/components/header/menu/provider.tsx index 1a7d621496..a207dcb9c2 100644 --- a/apps/minifront/src/components/header/menu/provider.tsx +++ b/apps/minifront/src/components/header/menu/provider.tsx @@ -3,8 +3,9 @@ import * as NavigationMenu from '@radix-ui/react-navigation-menu'; import { getChainId } from '../../../fetchers/chain-id'; import { useCallback, useEffect, useState } from 'react'; import { itemStyle, triggerStyle, dropdownStyle, linkStyle } from './nav-style'; -import { Link1Icon } from '@radix-ui/react-icons'; +import { Link1Icon, LinkBreak1Icon } from '@radix-ui/react-icons'; import { getPraxManifest, getPraxOrigin } from '../../../prax'; +import { PenumbraSymbol } from '@penumbra-zone/client'; export const ProviderMenu = () => { const [chainId, setChainId] = useState(); @@ -14,8 +15,9 @@ export const ProviderMenu = () => { const [manifestIconUnavailable, setManifestIconUnavailable] = useState(); const disconnect = useCallback(() => { - console.log('unimplemented'); - //window[Symbol.for('penumbra')][providerOrigin].disconnect(), + void window[PenumbraSymbol]?.[providerOrigin] + ?.disconnect() + .then(() => window.location.reload()); }, [providerOrigin]); useEffect(() => { @@ -59,9 +61,18 @@ export const ProviderMenu = () => { - -