-
Notifications
You must be signed in to change notification settings - Fork 393
refactor: implements @web-examples/shared
#944
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a shared package (@web-examples/shared) to centralize common utilities, chain data, wallet libraries, and types across WalletConnect web examples. This refactoring promotes code reuse and maintainability by consolidating previously duplicated code into a single package.
Key Changes:
- Created a new TypeScript package with wallet libraries for 13+ blockchain networks (EIP155, Solana, Cosmos, Polkadot, Near, Kadena, MultiversX, Stacks, Sui, Tezos, Ton, Tron, Bitcoin)
- Added shared type definitions and helper functions
- Configured package exports and TypeScript build setup
- Included chain logos and metadata assets
Reviewed Changes
Copilot reviewed 117 out of 157 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/package.json | Package configuration with dependencies for all supported blockchain SDKs |
| shared/tsconfig.json | TypeScript compiler configuration for the shared package |
| shared/index.ts | Main barrel export file exposing chains, helpers, wallets, constants, and types |
| shared/wallets/*.ts | Wallet library implementations for 13 blockchains with signing and transaction capabilities |
| shared/types/*.ts | Shared TypeScript type definitions |
| shared/helpers/*.ts | Helper utilities including EIP-712 and Tron-specific functions |
| shared/public/chain-logos/* | Chain logo assets (SVG/PNG) for UI display |
Files not reviewed (2)
- advanced/dapps/react-dapp-v2/pnpm-lock.yaml: Language not supported
- advanced/wallets/react-wallet-v2/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| const addressData = this.getAddressData(address, chainId) | ||
| if (!addressData) { | ||
| throw new Error(`Unkown address: ${address}`) |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Unkown" should be "Unknown".
|
|
||
| const addressData = this.getAddressData(account, chainId) | ||
| if (!addressData) { | ||
| throw new Error(`Unkown address: ${account}`) |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Unkown" should be "Unknown".
| import { TezosToolkit } from '@taquito/taquito' | ||
| import { InMemorySigner } from '@taquito/signer' | ||
| import { localForger } from '@taquito/local-forging' | ||
| import { Wallet } from 'ethers/' |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing Wallet from ethers/ for Tezos wallet implementation is inconsistent with the library's purpose. This appears to be using an Ethereum wallet utility to generate mnemonics for Tezos. While functional, it creates an unnecessary dependency on ethers for a Tezos-specific library. Consider using a Tezos-native or chain-agnostic mnemonic generation library instead.
| @@ -1,4 +1,4 @@ | |||
| import { EIP155Chain } from '@/data/EIP155Data' | |||
| import { EIP155Chain } from '@web-examples/shared' | |||
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import EIP155Chain.
| import { networkFromName, StacksNetworks } from '@stacks/network' | ||
| import { STACKS_MAINNET, STACKS_TESTNET, STACKS_TESTNET_CAIP2 } from '@/data/StacksData' | ||
| import { STACKS_MAINNET_CAIP2 } from '@/data/StacksData' | ||
| import { STACKS_MAINNET, STACKS_TESTNET, STACKS_TESTNET_CAIP2 } from '@web-examples/shared' |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports STACKS_MAINNET, STACKS_TESTNET.
|
|
||
| static async init(networkId: string, seedPhrase: string) { | ||
| // Derive keypair from seed phrase | ||
| const { secretKey, publicKey } = parseSeedPhrase(seedPhrase); |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable publicKey.
| chainId, | ||
| messageParams, | ||
| }: SignMessageParams): Promise<SignedMessage> { | ||
| const { message, nonce, recipient, callbackUrl, state, accountId } = |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable state.
| publicKeyFromSignatureRsv, | ||
| publicKeyToHex, | ||
| } from '@stacks/transactions' | ||
| import { networkFromName, StacksNetworks } from '@stacks/network' |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import StacksNetworks.
| publicKeyToHex, | ||
| } from '@stacks/transactions' | ||
| import { networkFromName, StacksNetworks } from '@stacks/network' | ||
| import { STACKS_MAINNET, STACKS_TESTNET, STACKS_TESTNET_CAIP2 } from '../chains' |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports STACKS_MAINNET, STACKS_TESTNET.
| import { | ||
| WalletContractV4, | ||
| TonClient, | ||
| internal, | ||
| Address, | ||
| Transaction, | ||
| Cell, | ||
| Message, | ||
| address, | ||
| beginCell, | ||
| storeMessage | ||
| } from '@ton/ton' |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports Cell, Transaction, address.
| "postinstall": "cd ../../../shared && pnpm install && pnpm build || echo 'Warning: Shared package postinstall failed'" | ||
| }, | ||
| "dependencies": { | ||
| "@web-examples/shared": "file:../../../shared", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the monorepo instead of this?
This PR introduces a shared package (@web-examples/shared) to centralize common utilities, chain data, wallet libraries, and types across WalletConnect web examples. This refactoring promotes code reuse and maintainability by consolidating previously duplicated code into a single package.
Key Changes: