Skip to content

Commit

Permalink
migrate some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Dec 11, 2024
1 parent 5df3351 commit 05862c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions extension/src/panel/pages/legacyConnectionMigrations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ProviderType,
type ExecutionRoute,
type LegacyConnection,
ProviderType,
} from '@/types'
import { MULTISEND, MULTISEND_CALL_ONLY } from '@/zodiac'
import { invariant } from '@epic-web/invariant'
Expand All @@ -13,6 +13,7 @@ import {
formatPrefixedAddress,
parsePrefixedAddress,
splitPrefixedAddress,
type PrefixedAddress,
type Waypoint,
} from 'ser-kit'

Expand Down Expand Up @@ -46,22 +47,22 @@ export function fromLegacyConnection(
const delayModuleWaypoint = moduleType === KnownContracts.DELAY && {
account: {
type: AccountType.DELAY,
prefixedAddress: modulePrefixedAddress,
prefixedAddress: modulePrefixedAddress?.toLowerCase(),
address: connection.moduleAddress,
chain: chainId,
},

connection: {
type: ConnectionType.IS_ENABLED,
from: pilotPrefixedAddress,
from: pilotPrefixedAddress.toLowerCase(),
},
}

const rolesModuleWaypoint = (moduleType === KnownContracts.ROLES_V1 ||
moduleType === KnownContracts.ROLES_V2) && {
account: {
type: AccountType.ROLES,
prefixedAddress: modulePrefixedAddress,
prefixedAddress: modulePrefixedAddress?.toLowerCase(),
address: connection.moduleAddress,
chain: chainId,
version: moduleType === KnownContracts.ROLES_V1 ? 1 : 2,
Expand All @@ -72,7 +73,7 @@ export function fromLegacyConnection(
connection: pilotPrefixedAddress
? {
type: ConnectionType.IS_MEMBER,
from: pilotPrefixedAddress,
from: pilotPrefixedAddress.toLowerCase(),
roles: [connection.roleId].filter(Boolean) as string[],
}
: undefined,
Expand All @@ -85,12 +86,12 @@ export function fromLegacyConnection(
account: isEoa
? ({
type: AccountType.EOA,
prefixedAddress: pilotPrefixedAddress,
prefixedAddress: pilotPrefixedAddress.toLowerCase(),
address: pilotAddress,
} as const)
: ({
type: AccountType.SAFE,
prefixedAddress: pilotPrefixedAddress,
prefixedAddress: pilotPrefixedAddress.toLowerCase(),
address: pilotAddress,
chain: chainId,
threshold: NaN, // we don't know the threshold
Expand All @@ -102,19 +103,19 @@ export function fromLegacyConnection(
{
account: {
type: AccountType.SAFE,
prefixedAddress: avatarPrefixedAddress,
prefixedAddress: avatarPrefixedAddress.toLowerCase(),
address: avatarAddress,
chain: chainId,
threshold: NaN, // we don't know the threshold
},
connection: modulePrefixedAddress
? {
type: ConnectionType.IS_ENABLED,
from: modulePrefixedAddress,
from: modulePrefixedAddress.toLowerCase(),
}
: {
type: ConnectionType.OWNS,
from: pilotPrefixedAddress,
from: pilotPrefixedAddress.toLowerCase(),
},
} as Waypoint,
]
Expand All @@ -125,8 +126,10 @@ export function fromLegacyConnection(
lastUsed: connection.lastUsed,
providerType,
waypoints: waypoints as ExecutionRoute['waypoints'],
initiator: pilotAddress ? pilotPrefixedAddress : undefined,
avatar: avatarPrefixedAddress,
initiator: pilotAddress
? (pilotPrefixedAddress.toLowerCase() as PrefixedAddress)
: undefined,
avatar: avatarPrefixedAddress.toLowerCase() as PrefixedAddress,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('karpatkey bridge aware translations', () => {
{
to: bridgeAwareContract.address,
data: '0x56aa9cae000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
value: '0',
value: 0n,
},
])
})
Expand Down

0 comments on commit 05862c3

Please sign in to comment.