Skip to content
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

Fixes Error: [svelte-web3] no store named contracts #63

Merged
merged 4 commits into from
Jul 17, 2023
Merged
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
10 changes: 8 additions & 2 deletions src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const getWindowEthereum = () => {
}
}

// always get chainId as number EDIT: Always as hex
// always get chainId as hex (required since web3js 4.x.x)
const alwaysHex = (n) => (Web3.utils.isHex(n) ? n : Web3.utils.toHex(n))

export const createStore = () => {
Expand Down Expand Up @@ -211,7 +211,13 @@ const getData = (id) => {
return noData
}

const subStoreNames = ['web3', 'selectedAccount', 'connected', 'chainId']
const subStoreNames = [
'web3',
'selectedAccount',
'connected',
'chainId',
'contracts'
]

export const makeEvmStores = (name) => {
const evmStore = (allStores[name] = createStore())
Expand Down