Skip to content

Commit fc667ac

Browse files
authored
Prolink RPC Link Format Implementation (#158)
* prolink to spec * prolink playground * fix: lint and type errors * remove displaying qr code * format and lint * invert env check * odd length test cases * use Ox for hex handling * format * remove dialog * conditional exports based on env * decode added to playground
1 parent c5a29c3 commit fc667ac

File tree

21 files changed

+3958
-10
lines changed

21 files changed

+3958
-10
lines changed

examples/testapp/src/components/Layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const PAGES = [
3636
'/payment',
3737
'/pay-playground',
3838
'/subscribe-playground',
39+
'/prolink-playground',
3940
];
4041

4142
export function Layout({ children }: LayoutProps) {

examples/testapp/src/pages/index.page.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import { useEIP1193Provider } from '../context/EIP1193ProviderContextProvider';
2323

2424
export default function Home() {
2525
const { provider } = useEIP1193Provider();
26-
// @ts-expect-error refactor soon
27-
const [connected, setConnected] = React.useState(Boolean(provider?.connected));
26+
const [connected, setConnected] = React.useState(false);
2827
const [chainId, setChainId] = React.useState<number | undefined>(undefined);
2928
// This is for Extension compatibility, Extension with SDK3.9 does not emit connect event
3029
// correctly, so we manually check if the extension is connected, and set the connected state
@@ -40,21 +39,19 @@ export default function Home() {
4039
setConnected(true);
4140
});
4241
provider?.on('chainChanged', (newChainId) => {
43-
// @ts-expect-error refactor soon
44-
setChainId(newChainId);
42+
setChainId(Number.parseInt(newChainId as string, 16));
4543
});
4644
}, [provider]);
4745

4846
useEffect(() => {
4947
if (connected) {
5048
provider?.request({ method: 'eth_chainId' }).then((chainId) => {
51-
// @ts-expect-error refactor soon
52-
setChainId(Number.parseInt(chainId, 16));
49+
setChainId(Number.parseInt(chainId as string, 16));
5350
});
5451
}
5552

5653
// Injected provider does not emit a 'connect' event
57-
// @ts-expect-error refactor soon
54+
// @ts-expect-error isCoinbaseBrowser only exists on injected providers
5855
if (provider?.isCoinbaseBrowser) {
5956
setConnected(true);
6057
}

0 commit comments

Comments
 (0)