Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency ser-kit to v2 #721

Merged
merged 5 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"TTFB",
"Uids",
"UNWRAPPER",
"unprefix",
"vitalik",
"vercel",
"viem",
Expand Down
4 changes: 2 additions & 2 deletions deployables/app/app/components/AvatarInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { HexAddress, Waypoints } from '@zodiac/schema'
import { Blockie, Select, selectStyles, TextInput } from '@zodiac/ui'
import { useEffect, useState } from 'react'
import { useFetcher } from 'react-router'
import { parsePrefixedAddress, type PrefixedAddress } from 'ser-kit'
import { unprefixAddress, type PrefixedAddress } from 'ser-kit'
import { getAddress } from 'viem'

type Props = {
Expand All @@ -20,7 +20,7 @@ type Option = {
}

export const AvatarInput = ({ value, waypoints, onChange }: Props) => {
const address = parsePrefixedAddress(value)
const address = unprefixAddress(value)
const chainId = getChainId(value)
const [pendingValue, setPendingValue] = useState<string>(
address === ZERO_ADDRESS ? '' : address,
Expand Down
8 changes: 4 additions & 4 deletions deployables/app/app/components/ZodiacMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useFetcher } from 'react-router'
import {
AccountType,
ConnectionType,
parsePrefixedAddress,
unprefixAddress,
type PrefixedAddress,
} from 'ser-kit'
import { ModSelect, NO_MODULE_OPTION } from './ModSelect'
Expand All @@ -36,7 +36,7 @@ export const ZodiacMod = ({
const chainId = getChainId(avatar)
const pilotAddress = waypoints == null ? null : getPilotAddress(waypoints)

const hasAvatar = parsePrefixedAddress(avatar) !== ZERO_ADDRESS
const hasAvatar = unprefixAddress(avatar) !== ZERO_ADDRESS

const [isLoadingSafes, safes] = useSafes(chainId, pilotAddress)
const [isLoadingDelegates, delegates] = useDelegates(chainId, pilotAddress)
Expand Down Expand Up @@ -118,7 +118,7 @@ export const ZodiacMod = ({
}
isDisabled={disabled || isLoading}
placeholder={isLoading ? 'Loading modules...' : 'Select a module'}
avatarAddress={parsePrefixedAddress(avatar)}
avatarAddress={unprefixAddress(avatar)}
/>

{selectedModule?.type === SupportedZodiacModuleType.ROLES_V1 && (
Expand Down Expand Up @@ -170,7 +170,7 @@ const useModules = (chainId: ChainId, avatar: PrefixedAddress) => {
const { load, state, data = [] } = useFetcher<ZodiacModule[]>()

useEffect(() => {
const address = parsePrefixedAddress(avatar)
const address = unprefixAddress(avatar)

if (address === ZERO_ADDRESS) {
return
Expand Down
4 changes: 2 additions & 2 deletions deployables/app/app/routes/edit/edit-route.$data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
randomAddress,
randomPrefixedAddress,
} from '@zodiac/test-utils'
import { formatPrefixedAddress, type ChainId } from 'ser-kit'
import { prefixAddress, type ChainId } from 'ser-kit'
import { beforeEach, describe, expect, it, vi } from 'vitest'

const { mockGetSafesByOwner } = vi.hoisted(() => ({
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('Edit route', () => {
const safe = randomAddress()

const route = createMockExecutionRoute({
avatar: formatPrefixedAddress(Chain.ETH, safe),
avatar: prefixAddress(Chain.ETH, safe),
waypoints: createMockWaypoints({
end: createMockEndWaypoint({ account: { address: safe } }),
}),
Expand Down
6 changes: 3 additions & 3 deletions deployables/app/app/routes/submit.$route.$transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { useLoaderData } from 'react-router'
import {
execute,
ExecutionActionType,
parsePrefixedAddress,
planExecution,
unprefixAddress,
type ExecutionPlan,
type ExecutionState,
} from 'ser-kit'
Expand All @@ -33,7 +33,7 @@ export const loader = async ({ params }: Route.LoaderArgs) => {
const plan = await planExecution(metaTransactions, route)
return {
plan,
initiator: parsePrefixedAddress(route.initiator),
initiator: unprefixAddress(route.initiator),
avatar: route.avatar,
chainId: getChainId(route.avatar),
}
Expand Down Expand Up @@ -148,7 +148,7 @@ const SubmitTransaction = () => {
url.searchParams.set('safe', avatar)
url.searchParams.set(
'id',
`multisig_${parsePrefixedAddress(avatar)}_${safeTxHash}`,
`multisig_${unprefixAddress(avatar)}_${safeTxHash}`,
)

successToast({
Expand Down
13 changes: 5 additions & 8 deletions deployables/app/app/utils/dryRun/dryRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ZERO_ADDRESS } from '@zodiac/chains'
import { getRolesWaypoint } from '@zodiac/modules'
import type { ExecutionRoute } from '@zodiac/schema'
import type { JsonRpcProvider } from 'ethers'
import { AccountType, parsePrefixedAddress } from 'ser-kit'
import { AccountType, unprefixAddress } from 'ser-kit'
import { decodeGenericError } from './decodeError'
import { handleRolesV1Error } from './handleRolesV1Error'
import { handleRolesV2Error } from './handleRolesV2Error'
Expand All @@ -22,12 +22,12 @@ export async function dryRun(
): Promise<Result> {
if (
route.initiator == null ||
parsePrefixedAddress(route.initiator) === ZERO_ADDRESS
unprefixAddress(route.initiator) === ZERO_ADDRESS
) {
return { error: true, message: 'This route is not connected to a wallet.' }
}

if (parsePrefixedAddress(route.avatar) === ZERO_ADDRESS) {
if (unprefixAddress(route.avatar) === ZERO_ADDRESS) {
return { error: true, message: 'This route has no target.' }
}

Expand All @@ -44,10 +44,7 @@ export async function dryRun(
}

if (
!(await isSmartContractAddress(
parsePrefixedAddress(route.avatar),
provider,
))
!(await isSmartContractAddress(unprefixAddress(route.avatar), provider))
) {
return { error: true, message: 'Avatar is not a smart contract.' }
}
Expand All @@ -56,7 +53,7 @@ export async function dryRun(
request: {
to: ZERO_ADDRESS,
data: '0x00000000',
from: parsePrefixedAddress(route.avatar),
from: unprefixAddress(route.avatar),
},
route,
revertOnError: false,
Expand Down
4 changes: 2 additions & 2 deletions deployables/app/app/utils/dryRun/wrapRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ExecutionRoute, HexAddress } from '@zodiac/schema'
import { toQuantity } from 'ethers'
import {
AccountType,
parsePrefixedAddress,
unprefixAddress,
type MetaTransactionRequest,
} from 'ser-kit'
import { getInterface } from './getInterface'
Expand Down Expand Up @@ -86,7 +86,7 @@ export function wrapRequest({
invariant(route.initiator != null, 'No pilot address specified for the route')

return {
from: parsePrefixedAddress(route.initiator),
from: unprefixAddress(route.initiator),
to: rolesWaypoint.account.address,
data: data as HexAddress,
value: toQuantity(0n),
Expand Down
2 changes: 1 addition & 1 deletion deployables/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"react": "19.0.0",
"react-dom": "19.0.0",
"react-router": "7.1.5",
"ser-kit": "1.1.0",
"ser-kit": "2.0.0",
"viem": "2.22.21",
"wagmi": "2.14.9",
"zod": "3.24.1"
Expand Down
2 changes: 1 addition & 1 deletion deployables/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"react-dom": "19.0.0",
"react-router": "7.1.5",
"react-stick": "5.0.6",
"ser-kit": "1.1.0",
"ser-kit": "2.0.0",
"zod": "3.24.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'ethers'
import type { MetaTransactionRequest } from 'ser-kit'

const SIGN_MESSAGE_LIB_ADDRESS = '0xd53cd0aB83D845Ac265BE939c57F53AD838012c9'
const SIGN_MESSAGE_LIB_ADDRESS = '0xd53cd0ab83d845ac265be939c57f53ad838012c9'
const SIGN_MESSAGE_LIB_ABI = [
'function signMessage(bytes calldata _data)',
'function getMessageHash(bytes memory message) public view returns (bytes32)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { Check, TriangleAlert, UsersRound } from 'lucide-react'
import { useEffect, useState } from 'react'
import {
ExecutionActionType,
parsePrefixedAddress,
planExecution,
unprefixAddress,
type MetaTransactionRequest,
type Route as SerRoute,
} from 'ser-kit'
Expand All @@ -42,7 +42,7 @@ const simulateRolesTransaction = async (
'Only transaction execution is currently supported',
)

const from = parsePrefixedAddress(action.from)
const from = unprefixAddress(action.from)
const tx = {
...action.transaction,
from,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AlignJustify, Cog } from 'lucide-react'
import { useState } from 'react'
import { Link } from 'react-router'
import Stick from 'react-stick'
import { parsePrefixedAddress } from 'ser-kit'
import { unprefixAddress } from 'ser-kit'
import { ConnectionStack } from '../../../ConnectionStack'

export const RouteBubble = () => {
Expand Down Expand Up @@ -49,7 +49,7 @@ export const RouteBubble = () => {
>
<div className="flex items-center gap-2 overflow-hidden">
<Blockies
avatarAddress={parsePrefixedAddress(route.avatar)}
avatarAddress={unprefixAddress(route.avatar)}
moduleAddress={
rolesWaypoint == null ? undefined : rolesWaypoint.account.address
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@zodiac/ui'
import { ArrowUpFromLine, Landmark, RefreshCcw } from 'lucide-react'
import { useEffect, useRef } from 'react'
import { parsePrefixedAddress } from 'ser-kit'
import { unprefixAddress } from 'ser-kit'
import { RecordingIndicator } from './RecordingIndicator'
import { RouteBubble } from './RouteBubble'
import { Submit } from './Submit'
Expand All @@ -33,7 +33,7 @@ export const Transactions = () => {
useProviderBridge({
provider,
chainId: getChainId(route.avatar),
account: parsePrefixedAddress(route.avatar),
account: unprefixAddress(route.avatar),
})

// for now we assume global translations are generally auto-applied, so we don't need to show a button for them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getPilotAddress,
getRolesWaypoint,
} from '@zodiac/modules'
import { parsePrefixedAddress } from 'ser-kit'
import { unprefixAddress } from 'ser-kit'
import { Address } from './Address'

interface Props {
Expand All @@ -16,7 +16,7 @@ export const ConnectionStack = ({ route }: Props) => {
invariant(route.waypoints != null, 'Cannot render route without waypoints')

const pilotAddress = getPilotAddress(route.waypoints)
const avatarAddress = parsePrefixedAddress(route.avatar)
const avatarAddress = unprefixAddress(route.avatar)

const rolesWaypoint = getRolesWaypoint(route)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from 'react'
import {
ConnectionType,
parsePrefixedAddress,
unprefixAddress,
type MetaTransactionRequest,
} from 'ser-kit'
import { ExecutionStatus, useDispatch } from '../state'
Expand All @@ -30,15 +30,15 @@ export const ProvideProvider = ({ children }: PropsWithChildren) => {

const dispatch = useDispatch()

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

const moduleAddress =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Interface } from 'ethers'
import type { MetaTransactionRequest } from 'ser-kit'

// https://github.com/gnosisguild/snapshot-signer
const SNAPSHOT_SIGNER_ADDRESS = '0xa58Cf66d0f14AEFb2389c6998f6ad219dd4885c1'
const SNAPSHOT_SIGNER_ADDRESS = '0xa58cf66d0f14aefb2389c6998f6ad219dd4885c1'

const SnapshotSignerInterface = new Interface([
'function signSnapshotArrayVote(tuple(address from, string space, uint64 timestamp, bytes32 proposal, uint32[] choice, string reason, string app, string metadata) vote, tuple(string name, string version) domain)',
Expand Down
8 changes: 2 additions & 6 deletions deployables/extension/src/panel/providers/isConnected.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
type ChainId,
parsePrefixedAddress,
type PrefixedAddress,
} from 'ser-kit'
import { unprefixAddress, type ChainId, type PrefixedAddress } from 'ser-kit'
import type { ConnectionProvider } from './connectTypes'

export const isConnected = (
Expand All @@ -18,7 +14,7 @@ export const isConnected = (
return false
}

const accountAddress = parsePrefixedAddress(account)
const accountAddress = unprefixAddress(account)

return connection.accounts.some(
(account) => account.toLowerCase() === accountAddress.toLowerCase(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { id, Interface } from 'ethers'
import { Waypoints } from 'lucide-react'
import type { TransactionTranslation } from './types'

const GP_V2_SETTLEMENT_ADDRESS = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41'
const GP_V2_SETTLEMENT_ADDRESS = '0x9008d19f58aabD9ed0d60971565aa8510560ab41'
const GPv2SettlementInterface = new Interface([
{
type: 'function',
Expand All @@ -20,7 +20,7 @@ const GPv2SettlementInterface = new Interface([
])

const COWSWAP_ORDER_SIGNER_ADDRESS =
'0x23dA9AdE38E4477b23770DeD512fD37b12381FAB'
'0x23da9ade38e4477b23770ded512fd37b12381fab'

const CowswapOrderSignerInterface = new Interface([
'function signOrder(tuple(address sellToken, address buyToken, address receiver, uint256 sellAmount, uint256 buyAmount, uint32 validTo, bytes32 appData, uint256 feeAmount, bytes32 kind, bool partiallyFillable, bytes32 sellTokenBalance, bytes32 buyTokenBalance) order, uint32 validDuration, uint256 feeAmountBP)',
Expand Down
Loading
Loading