Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
.turbo
vite.config.ts.timestamp-*.mjs
.vscode
.worktrees

package.json.backup
yarn.lock
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"scripts": {
"build": "turbo build --filter=@vocdoni*",
"lint:fix": "prettier -c . --write",
"lint": "turbo lint && prettier -c .",
"lint": "turbo lint --filter=!@vocdoni/chakra-components && prettier -c .",
"clean": "turbo clean --filter=@vocdoni* && rm -fr node_modules",
"test": "jest"
},
Expand All @@ -45,7 +45,8 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.37.1",
"@wagmi/core": "2.20.3"
"@wagmi/core": "^2.22.1",
"@tanstack/react-query": "^5.90.21"
},
"onlyBuiltDependencies": [
"esbuild",
Expand Down
2 changes: 2 additions & 0 deletions packages/chakra-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

# @vocdoni/chakra-components

**Deprecated:** This package is no longer maintained and will be removed in a future major release.

This package provides UI components that integrate the Vocdoni voting protocol. The components can be styled with Chakra UI-based custom theming.

The best place to learn about using this package is the [developer portal](https://developer.vocdoni.io/ui-components).
Expand Down
1 change: 1 addition & 0 deletions packages/chakra-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"directory": "packages/chakra-components"
},
"description": "Vocdoni's Chakra UI Components",
"deprecated": "Deprecated. This package is no longer maintained and will be removed in a future major release.",
"keywords": [
"react",
"chakra",
Expand Down
19 changes: 14 additions & 5 deletions packages/rainbowkit-wallets/src/wagmi/localStorageConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export interface LocalStorageConnectorParameters {
* A connector that uses the local storage to store seed for a deterministic wallet generation
*/
export function localStorageConnector(parameters: LocalStorageConnectorParameters = {}): CreateConnectorFn {
return createConnector((config) => {
return createConnector(((config) => {
let currentWallet: any = null

return {
id: parameters.id || 'localStorageConnector',
name: parameters.name || 'localStorage',
type: parameters.id || 'localStorageConnector',

async connect() {
connect: (async ({ withCapabilities = false }: { withCapabilities?: boolean } = {}) => {
try {
const provider = createPublicClient({
chain: mainnet,
Expand All @@ -44,14 +44,23 @@ export function localStorageConnector(parameters: LocalStorageConnectorParameter

currentWallet = wallet

const accounts = withCapabilities ? [{ address: account as Address, capabilities: {} }] : [account as Address]

return {
accounts: [account as Address],
accounts,
chainId: mainnet.id,
}
} catch (error) {
throw new UserRejectedRequestError(error as Error)
}
},
}) as <withCapabilities extends boolean = false>(args?: {
withCapabilities?: withCapabilities
}) => Promise<{
accounts: withCapabilities extends true
? readonly { address: Address; capabilities: Record<string, unknown> }[]
: readonly Address[]
chainId: number
}>,

async disconnect() {
await localStorageWallet.deleteWallet()
Expand Down Expand Up @@ -117,5 +126,5 @@ export function localStorageConnector(parameters: LocalStorageConnectorParameter
onDisconnect() {},
onMessage() {},
}
})
}) as unknown as CreateConnectorFn)
}
73 changes: 73 additions & 0 deletions packages/react-providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,79 @@ const App = () => {

`ClientProvider` is a dependency of the other providers, so you'll have to ensure you initialize it first as the parent.

## i18n (i18next)

This package relies on `i18next` + `react-i18next`. Your app must initialize i18next and provide the `I18nextProvider`.

Example initialization:

~~~ts
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { reactProvidersResources, reactProvidersNamespace } from '@vocdoni/react-providers'

i18n.use(initReactI18next).init({
lng: 'en',
resources: reactProvidersResources, // merge with your app resources
ns: [reactProvidersNamespace],
defaultNS: reactProvidersNamespace,
})
~~~

### Extraction guidance

We export base resources so you can merge them with your app translations:

~~~ts
import { reactProvidersResources } from '@vocdoni/react-providers'
~~~

If you want to scan for keys in workspace/local dev (monorepo), point your extractor to the source:

~~~js
// i18next-parser.config.cjs
module.exports = {
locales: ['en'],
defaultNamespace: 'react-providers',
namespaceSeparator: ':',
keySeparator: '.',
input: ['../packages/react-providers/src/**/*.{ts,tsx}', 'src/**/*.{ts,tsx}'],
output: 'src/locales/$LOCALE/$NAMESPACE.json',
}
~~~

For published installs, the package ships `dist` only. Do not scan `node_modules`. Scan your app
code and merge with `reactProvidersResources` instead.

### How to create your translation JSON files

If you want to add a new language, use the exported base resources as the key template and fill in
translations on the app side.

Example: create `src/locales/es/react-providers.json`

~~~ts
import { reactProvidersResources, reactProvidersNamespace } from '@vocdoni/react-providers'

const base = reactProvidersResources.en[reactProvidersNamespace]

// Then translate values into your JSON file using the same keys:
// src/locales/es/react-providers.json
// {
// "errors": {
// "unauthorized": "No autorizado para votar"
// }
// }
~~~

Load it with i18next:

~~~ts
import esReactProviders from './locales/es/react-providers.json'

i18n.addResourceBundle('es', reactProvidersNamespace, esReactProviders, true, true)
~~~

## Reference

The developer portal includes a [reference](https://developer.vocdoni.io/ui-components) for using the `@vocdoni/react-providers` package.
Expand Down
6 changes: 6 additions & 0 deletions packages/react-providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"peerDependencies": {
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"i18next": "^25.8.13",
"react-i18next": "^16.5.4",
"@tanstack/react-query": "^5.0.0",
"@vocdoni/sdk": "~0.9.3",
"date-fns": "^4.1.0",
"react": ">= 16.8.0 <19.0.0",
Expand All @@ -40,6 +43,9 @@
"devDependencies": {
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"i18next": "^25.8.13",
"react-i18next": "^16.5.4",
"@tanstack/react-query": "^5.0.0",
"@types/latinize": "^0.2.15",
"@types/react": "^18.0.30",
"@vocdoni/sdk": "~0.9.3",
Expand Down
Loading