Skip to content

Feature/core 4 multi chain support #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1aefd0c
wip react-sdk multi chain(no wallet yet)
zhelezkov Sep 27, 2022
a4b9b49
minor compilation fix
zhelezkov Sep 28, 2022
8af62f8
react-sdk upd to new multi wallet sdk
zhelezkov Sep 30, 2022
1b8665e
update some parts of ui to new sdk
zhelezkov Oct 1, 2022
2ece5c9
fix react-sdk comp errors
zhelezkov Oct 1, 2022
9e2cdce
wip react-ui to new react-sdk
zhelezkov Oct 1, 2022
ed55c66
fix rerenders and double message signing
zhelezkov Oct 2, 2022
a88125b
remove starters
zhelezkov Oct 3, 2022
f04789a
add react-sdk aptos blockchain impl and adapt example for multi chain
zhelezkov Oct 3, 2022
080be1b
remove deprecated package
zhelezkov Oct 4, 2022
ad1eb84
migrating to new sdk, WIP
zhelezkov Oct 7, 2022
b466946
some fixes and intermediate publish to npm
zhelezkov Oct 7, 2022
3ee0144
remove outdated docs
zhelezkov Oct 10, 2022
46aaded
upd & simplify connection wrapper
zhelezkov Oct 11, 2022
d5d15d5
upd subscribe button
zhelezkov Oct 11, 2022
5c1d006
upd notifications and add examples
zhelezkov Oct 13, 2022
c876339
versions bump
zhelezkov Oct 13, 2022
540739e
update bottom chat example
zhelezkov Oct 13, 2022
fe5a6f2
retire chat example
zhelezkov Oct 13, 2022
9003d64
upd inbox multichain example
zhelezkov Oct 13, 2022
3358118
remove broadcast example
zhelezkov Oct 13, 2022
1b53c0a
upd subscribe example
zhelezkov Oct 13, 2022
2224305
rename notifications -> notifications-solana
zhelezkov Oct 13, 2022
5c95b02
fix useDialectDapp usage
zhelezkov Oct 14, 2022
502f448
remove tech debt aboud dapp address use case
zhelezkov Oct 14, 2022
7e1440b
remove trailing slash in tsconfig
zhelezkov Oct 14, 2022
ee25892
minor cleanup & add civic identity resolver in examples
zhelezkov Oct 14, 2022
cfee78a
remove magic strings
zhelezkov Oct 14, 2022
656858b
fix deduplication id type for local message
zhelezkov Oct 16, 2022
edd2047
types fixes
zhelezkov Oct 16, 2022
281eb06
version bump
zhelezkov Oct 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 0 additions & 191 deletions docs/react-lib-api-v1.md

This file was deleted.

File renamed without changes.
56 changes: 56 additions & 0 deletions examples/bottom-chat-multichain/components/AptosWallet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {
useWallet,
WalletProvider,
MartianWalletAdapter,
RiseWalletAdapter,
WalletReadyState,
} from '@manahippo/aptos-wallet-adapter';
import React, { useEffect } from 'react';

const wallets = [new MartianWalletAdapter(), new RiseWalletAdapter()];

function shortenAddress(address: string, chars = 4): string {
const addr = address.toString();
return `${addr.substring(0, chars)}...${addr.substring(addr.length - chars)}`;
}

export const AptosWalletButton = () => {
const wallet = useWallet();

useEffect(() => {
if (!wallet.autoConnect && wallet?.wallet?.adapter) {
wallet.connect();
}
}, [wallet]);

const firstAvailableAdapter = wallet.wallets.find(
(it) => it.readyState === WalletReadyState.Installed
);

return (
<button
className="border border-gray-500 text-white px-4 py-3 rounded-md"
onClick={() => {
if (!firstAvailableAdapter) return;
wallet.select(firstAvailableAdapter.adapter.name);
}}
>
{wallet.connected
? shortenAddress(wallet.account?.address?.toString() || '')
: 'Connect Aptos wallet'}
</button>
);
};

export const AptosWalletContext: React.FC<any> = (props) => {
return (
<WalletProvider
wallets={wallets}
onError={(error: Error) => {
console.log('Handle Error Message', error);
}}
>
{props.children}
</WalletProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
WalletMultiButton,
} from '@solana/wallet-adapter-react-ui';
import { clusterApiUrl } from '@solana/web3.js';
import { PhantomIcon } from '../Icon';
import { PhantomIcon } from './Icon';

// Default styles that can be overridden by your app
require('@solana/wallet-adapter-react-ui/styles.css');

export const Wallet = () => {
export const SolanaWalletButton = () => {
return (
<>
<WalletModalProvider>
Expand All @@ -32,7 +32,7 @@ export const Wallet = () => {
);
};

export const WalletContext: FC = (props) => {
export const SolanaWalletContext: FC = (props) => {
// Can be set to 'devnet', 'testnet', or 'mainnet-beta'
const network = WalletAdapterNetwork.Mainnet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@dialectlabs/identity-cardinal": "^0.0.2",
"@dialectlabs/identity-dialect-dapps": "^0.0.1",
"@dialectlabs/identity-sns": "^0.0.2",
"@dialectlabs/react-ui": "^1.0.0-beta.67",
"@dialectlabs/web3": "^0.3.2",
"@project-serum/anchor": "^0.23.0",
"@dialectlabs/identity-cardinal": "^1.0.0",
"@dialectlabs/identity-civic": "^1.0.0",
"@dialectlabs/identity-dialect-dapps": "^1.0.0",
"@dialectlabs/identity-sns": "^1.0.0",
"@dialectlabs/react-sdk-blockchain-aptos": "^1.0.0-beta.4",
"@dialectlabs/react-sdk-blockchain-solana": "^1.0.0-beta.3",
"@dialectlabs/react-ui": "^1.1.0-beta.4",
"@manahippo/aptos-wallet-adapter": "^0.4.9",
"@solana/wallet-adapter-base": "^0.9.5",
"@solana/wallet-adapter-react": "^0.15.4",
"@solana/wallet-adapter-react-ui": "^0.9.6",
"@solana/wallet-adapter-sollet": "^0.11.1",
"@solana/wallet-adapter-wallets": "^0.15.5",
"@solana/web3.js": "1.38.0",
"@solana/web3.js": "^1.64.0",
"aptos": "^1.3.16",
"next": "^12.1.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"swr": "^0.5.6"
"swr": "^1.3.0"
},
"devDependencies": {
"@svgr/webpack": "^6.2.0",
Expand Down
33 changes: 33 additions & 0 deletions examples/bottom-chat-multichain/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'tailwindcss/tailwind.css';
import '../styles/globals.css';
import '@dialectlabs/react-ui/index.css';
import React from 'react';
import type { AppProps } from 'next/app';
import Head from 'next/head';
import { SolanaWalletContext } from '../components/SolanaWallet';
import { AptosWalletContext } from '../components/AptosWallet';

function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin="true"
/>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
rel="stylesheet"
/>
</Head>
<SolanaWalletContext>
<AptosWalletContext>
<Component {...pageProps} />
</AptosWalletContext>
</SolanaWalletContext>
</>
);
}
export default MyApp;
Loading