Skip to content

Commit

Permalink
Merge branch 'main' into when-removing-address,-match-for-chain-id-to
Browse files Browse the repository at this point in the history
  • Loading branch information
KillariDev authored Nov 28, 2024
2 parents 3c9cc01 + 078d851 commit c9b8828
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
5 changes: 3 additions & 2 deletions app/ts/components/pages/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ export function useRpcConnectionsList() {
const entries = useSignal<RpcEntries>([])

const trackRpcListChanges = (message: unknown) => {
const parsedMessage = MessageToPopup.parse(message)
if (parsedMessage.method === 'popup_update_rpc_list') { entries.value = parsedMessage.data }
const parsedMessage = MessageToPopup.safeParse(message)
if (parsedMessage.success === false) return
if (parsedMessage.value.method === 'popup_update_rpc_list') { entries.value = parsedMessage.value.data }
}

const initiallyLoadEntriesFromStorage = async () => { entries.value = await getRpcList() }
Expand Down
2 changes: 1 addition & 1 deletion app/ts/components/subcomponents/ChainSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function ChainSelector(params: ChainSelectorParams) {
setIsOpen(false)
}

return <div ref = { wrapperRef } class = { `dropdown ${ isOpen ? 'is-active' : '' }` } style = { { justifyContent: 'end', width: '100%' } }>
return <div ref = { wrapperRef } class = { `dropdown ${ isOpen ? 'is-active' : '' }` } style = { { width: '100%' } }>
<div class = 'dropdown-trigger' style = { { maxWidth: '100%' } }>
<button className = { `button is-primary is-reveal ${ chain.value === undefined ? 'is-danger' : '' }` } aria-haspopup = 'true' aria-controls = 'dropdown-menu' onClick = { () => setIsOpen(!isOpen) } title = { chain.value === undefined ? 'unknown' : chain.value.name } style = { { width: '100%', columnGap: '0.5em' } }>
<span class = 'truncate' style = { { contain: 'content' } }>{ chain.value === undefined ? 'unknown' : chain.value.name }</span>
Expand Down
15 changes: 12 additions & 3 deletions build/bundler.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path'
import * as url from 'url'
import { promises as fs } from 'fs'
import * as path from 'node:path'
import * as url from 'node:url'
import { promises as fs } from 'node:fs'

const directoryOfThisFile = path.dirname(url.fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -62,12 +62,21 @@ async function* getFiles(topDir: string): AsyncGenerator<string, any, undefined>
}
}

async function ensureDirectoryExists(dir: string) {
try {
await fs.access(dir)
} catch {
await fs.mkdir(dir)
}
}

async function replaceImportsInJSFiles() {
const folders = [
path.join(directoryOfThisFile, '..', 'app', 'js'),
path.join(directoryOfThisFile, '..', 'app', 'vendor')
]
for (const folder of folders) {
await ensureDirectoryExists(folder)
for await (const filePath of getFiles(folder)) {
if (path.extname(filePath) !== '.js' && path.extname(filePath) !== '.mjs') continue
const replaced = replaceImport(filePath, await fs.readFile(filePath, 'utf8'))
Expand Down
8 changes: 4 additions & 4 deletions build/vendor.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path'
import * as url from 'url'
import { promises as fs } from 'fs'
import { FileType, recursiveDirectoryCopy } from '@zoltu/file-copier'
import * as path from 'node:path'
import * as url from 'node:url'
import { promises as fs } from 'node:fs'
import { type FileType, recursiveDirectoryCopy } from '@zoltu/file-copier'
import { createHash } from 'node:crypto'

const directoryOfThisFile = path.dirname(url.fileURLToPath(import.meta.url))
Expand Down

0 comments on commit c9b8828

Please sign in to comment.