Skip to content

Commit

Permalink
Merge branch 'main' into block-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
KillariDev authored Nov 21, 2024
2 parents 5a9a50a + d16a7f6 commit 0905962
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/css/interceptor.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ body { font-family: "Inter" !important; }
--alpha-005: rgba(255, 255, 255, 0.05);
--alpha-015: rgba(255, 255, 255, 0.15);

--big-font-size: 28px;
--normal-font-size: 14px;
--modal-background-color: rgba(10, 10, 10, .7)
}

Expand Down Expand Up @@ -756,7 +758,7 @@ svg.spinner > circle {
.swap-grid {
grid-template-columns: auto auto;
display: grid;
place-content: center;
place-content: space-between;
column-gap: 0.25em;
}

Expand Down
5 changes: 3 additions & 2 deletions app/ts/background/background-startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function migrateAddressInfoAndContactsFromV1ToV2() {
async function migrateAddressInfoAndContactsFromV2ToV3() {
const userAddressBookEntries = (await browserStorageLocalGet(['userAddressBookEntriesV2'])).userAddressBookEntriesV2
const convertOldActiveAddressToAddressBookEntry = (entry: AddressBookEntry): AddressBookEntry => {
if ('chainId' in entry && entry.chainId !== undefined) return entry
if (entry.chainId !== undefined) return entry
if (entry.useAsActiveAddress === true && entry.type === 'contact') return { ...entry, chainId: 'AllChains' }
return { ...entry, chainId: 1n }
}
Expand Down Expand Up @@ -194,7 +194,7 @@ async function newBlockAttemptCallback(blockheader: EthereumBlockHeader, ethereu
}
}

async function onErrorBlockCallback(ethereumClientService: EthereumClientService) {
async function onErrorBlockCallback(ethereumClientService: EthereumClientService, error: unknown) {
try {
const rpcConnectionStatus = {
isConnected: false,
Expand All @@ -206,6 +206,7 @@ async function onErrorBlockCallback(ethereumClientService: EthereumClientService
await setRpcConnectionStatus(rpcConnectionStatus)
await updateExtensionBadge()
await sendPopupMessageToOpenWindows({ method: 'popup_failed_to_get_block', data: { rpcConnectionStatus } })
await handleUnexpectedError(error)
} catch(error) {
await handleUnexpectedError(error)
}
Expand Down
8 changes: 4 additions & 4 deletions app/ts/simulation/services/EthereumClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export class EthereumClientService {
private cacheRefreshTimer: NodeJS.Timer | undefined = undefined
private retrievingBlock = false
private newBlockAttemptCallback: (blockHeader: EthereumBlockHeader, ethereumClientService: EthereumClientService, isNewBlock: boolean) => Promise<void>
private onErrorBlockCallback: (ethereumClientService: EthereumClientService) => Promise<void>
private onErrorBlockCallback: (ethereumClientService: EthereumClientService, error: unknown) => Promise<void>
private requestHandler
private rpcEntry

constructor(requestHandler: IEthereumJSONRpcRequestHandler, newBlockAttemptCallback: (blockHeader: EthereumBlockHeader, ethereumClientService: EthereumClientService, isNewBlock: boolean) => Promise<void>, onErrorBlockCallback: (ethereumClientService: EthereumClientService) => Promise<void>, rpcEntry: RpcEntry) {
constructor(requestHandler: IEthereumJSONRpcRequestHandler, newBlockAttemptCallback: (blockHeader: EthereumBlockHeader, ethereumClientService: EthereumClientService, isNewBlock: boolean) => Promise<void>, onErrorBlockCallback: (ethereumClientService: EthereumClientService, error: unknown) => Promise<void>, rpcEntry: RpcEntry) {
this.requestHandler = requestHandler
this.newBlockAttemptCallback = newBlockAttemptCallback
this.onErrorBlockCallback = onErrorBlockCallback
Expand Down Expand Up @@ -80,8 +80,8 @@ export class EthereumClientService {
if (gotNewBlock) this.requestHandler.clearCache()
this.newBlockAttemptCallback(newBlock, this, gotNewBlock)
this.cachedBlock = newBlock
} catch(error) {
return this.onErrorBlockCallback(this)
} catch(error: unknown) {
return this.onErrorBlockCallback(this, error)
} finally {
this.retrievingBlock = false
}
Expand Down
4 changes: 2 additions & 2 deletions app/ts/simulation/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const parseInputData = async (transaction: { to: EthereumAddress | undefi
return { paramName, typeValue: parseSolidityValueByTypePure(verifiedSolidityType.value, value, isArray) }
})
return {
input: transaction.input,
input: transaction.input,
type: 'Parsed' as const,
name: parsed.name,
args: valuesWithTypes,
Expand Down Expand Up @@ -208,7 +208,7 @@ export class Simulator {
public ethereum: EthereumClientService
public tokenPriceService: TokenPriceService
private newBlockAttemptCallback: NewBlockCallBack
public constructor(rpcNetwork: RpcEntry, newBlockAttemptCallback: NewBlockCallBack, onErrorBlockCallback: (ethereumClientService: EthereumClientService) => Promise<void>, tokenPriceCacheAge = 60000) {
public constructor(rpcNetwork: RpcEntry, newBlockAttemptCallback: NewBlockCallBack, onErrorBlockCallback: (ethereumClientService: EthereumClientService, error: unknown) => Promise<void>, tokenPriceCacheAge = 60000) {
this.newBlockAttemptCallback = newBlockAttemptCallback
this.ethereum = new EthereumClientService(
new EthereumJSONRpcRequestHandler(rpcNetwork.httpsRpc, true),
Expand Down

0 comments on commit 0905962

Please sign in to comment.