Skip to content

Commit

Permalink
more adjustments around parsePrefixedAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Dec 11, 2024
1 parent a49f2ca commit c79c854
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion extension/src/panel/execution-routes/useRouteConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const useCanEstablishConnection = (route: ExecutionRoute) => {

const pilotAddress =
route.initiator && route.initiator !== `eoa:` + ZeroAddress
? parsePrefixedAddress(route.initiator)[1].toLowerCase()
? parsePrefixedAddress(route.initiator).toLowerCase()
: undefined

if (pilotAddress == null) {
Expand Down
3 changes: 1 addition & 2 deletions extension/src/panel/pages/legacyConnectionMigrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ export function asLegacyConnection(route: ExecutionRoute): LegacyConnection {
invariant(chainId != null, 'chainId is empty')

const pilotAddress =
(route.initiator &&
parsePrefixedAddress(route.initiator)[1].toLowerCase()) ||
(route.initiator && parsePrefixedAddress(route.initiator).toLowerCase()) ||
''

const moduleWaypoint = route.waypoints?.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const getPilotAddress = (route: ExecutionRoute) => {
return null
}

const address = parsePrefixedAddress(route.initiator)[1].toLowerCase()
const address = parsePrefixedAddress(route.initiator).toLowerCase()

if (address === ZeroAddress) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const simulateRolesTransaction = async (
throw new Error('Only transaction execution is currently supported')
}

const [, from] = parsePrefixedAddress(plan[0].from)
const from = parsePrefixedAddress(plan[0].from)
const tx = {
...plan[0].transaction,
from,
Expand Down
2 changes: 1 addition & 1 deletion extension/src/panel/pages/transactions/Submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const Submit = () => {
console.debug(
`Transaction batch has been proposed with safeTxHash ${safeTxHash}`,
)
const [, avatarAddress] = parsePrefixedAddress(avatar)
const avatarAddress = parsePrefixedAddress(avatar)
successToast({
title: 'Transaction batch has been proposed for execution',
message: (
Expand Down
6 changes: 3 additions & 3 deletions extension/src/panel/providers-ui/ProvideProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ export const ProvideProvider = ({ children }: PropsWithChildren) => {

const dispatch = useDispatch()

const [, avatarAddress] = parsePrefixedAddress(route.avatar)
const avatarAddress = parsePrefixedAddress(route.avatar)
const avatarWaypoint = route.waypoints?.[route.waypoints.length - 1]
const connectionType =
avatarWaypoint &&
'connection' in avatarWaypoint &&
avatarWaypoint.connection.type
const [, connectedFrom] =
const connectedFrom =
(avatarWaypoint &&
'connection' in avatarWaypoint &&
parsePrefixedAddress(avatarWaypoint.connection.from)) ||
[]
''

const moduleAddress =
connectionType === ConnectionType.IS_ENABLED ? connectedFrom : undefined

Check failure on line 44 in extension/src/panel/providers-ui/ProvideProvider.tsx

View workflow job for this annotation

GitHub Actions / unit_tests

src/panel/pages/transactions/Transactions.spec.ts > Transactions > List > lists transactions

TypeError: Cannot read properties of undefined (reading 'IS_ENABLED') ❯ ProvideProvider src/panel/providers-ui/ProvideProvider.tsx:44:39 ❯ renderWithHooks ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:15486:18 ❯ mountIndeterminateComponent ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:20103:13 ❯ beginWork ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:21626:16 ❯ HTMLUnknownElement.callCallback ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4164:14 ❯ HTMLUnknownElement.#callDispatchEventListeners ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:286:41 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:121:35 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/nodes/element/Element.ts:1252:29 ❯ HTMLUnknownElement.#goThroughDispatchEventPhases ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:184:32 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:116:38

Check failure on line 44 in extension/src/panel/providers-ui/ProvideProvider.tsx

View workflow job for this annotation

GitHub Actions / unit_tests

src/panel/providers/injected-provider/useConnectProvider.spec.ts > useConnectProvider > Connection fails > makes the information that a connection has failed accessible

TypeError: Cannot read properties of undefined (reading 'IS_ENABLED') ❯ ProvideProvider src/panel/providers-ui/ProvideProvider.tsx:44:39 ❯ renderWithHooks ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:15486:18 ❯ mountIndeterminateComponent ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:20103:13 ❯ beginWork ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:21626:16 ❯ HTMLUnknownElement.callCallback ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4164:14 ❯ HTMLUnknownElement.#callDispatchEventListeners ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:286:41 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:121:35 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/nodes/element/Element.ts:1252:29 ❯ HTMLUnknownElement.#goThroughDispatchEventPhases ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:184:32 ❯ HTMLUnknownElement.dispatchEvent ../node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/event/EventTarget.ts:116:38
Expand Down
2 changes: 1 addition & 1 deletion extension/src/panel/providers/isConnected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const isConnected = (
return false
}

const [, accountAddress] = parsePrefixedAddress(account)
const accountAddress = parsePrefixedAddress(account)

return connection.accounts.some(
(account) => account.toLowerCase() === accountAddress.toLowerCase(),
Expand Down

0 comments on commit c79c854

Please sign in to comment.