Skip to content

Commit

Permalink
fix: setup internal config on update and default to mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Oct 24, 2024
1 parent bb92715 commit fd4d8ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/snap/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const onRpcRequest: OnRpcRequestHandler = async ({
}

export const onInstall: OnInstallHandler = async () => {
const config = configFromNetwork('testnet')
const config = configFromNetwork('mainnet')
const state = new State(snap)
await state.set(INTERNAL_CONFIG, config)

Expand All @@ -136,6 +136,13 @@ export const onInstall: OnInstallHandler = async () => {
}

export const onUpdate: OnUpdateHandler = async () => {
const config = configFromNetwork('mainnet')
const state = new State(snap)

if (!(await state.has(INTERNAL_CONFIG))) {
await state.set(INTERNAL_CONFIG, config)
}

await snap.request({
method: 'snap_dialog',
params: {
Expand Down

0 comments on commit fd4d8ca

Please sign in to comment.