Skip to content

Commit

Permalink
Update @safe-global/safe-apps-sdk to ^8.0.0 (#2339)
Browse files Browse the repository at this point in the history
Co-authored-by: katspaugh <[email protected]>
  • Loading branch information
mmv08 and katspaugh authored Aug 14, 2023
1 parent ba62ea1 commit 17fd26c
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 177 deletions.
4 changes: 4 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Used for __tests__/testing-library.js
// Learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect'
import { TextEncoder, TextDecoder } from 'util'

jest.mock('@web3-onboard/coinbase', () => jest.fn())
jest.mock('@web3-onboard/injected-wallets', () => ({ ProviderLabel: { MetaMask: 'MetaMask' } }))
Expand Down Expand Up @@ -42,4 +43,7 @@ jest.mock('@web3-onboard/core', () => () => ({
const NumberFormat = Intl.NumberFormat
const englishTestLocale = 'en'

// `viem` used by the `safe-apps-sdk` uses `TextEncoder` and `TextDecoder` which are not available in jsdom for some reason
Object.assign(global, { TextDecoder, TextEncoder })

jest.spyOn(Intl, 'NumberFormat').mockImplementation((locale, ...rest) => new NumberFormat([englishTestLocale], ...rest))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@mui/material": "^5.14.3",
"@mui/x-date-pickers": "^5.0.12",
"@reduxjs/toolkit": "^1.9.5",
"@safe-global/safe-apps-sdk": "7.11.0",
"@safe-global/safe-apps-sdk": "^8.0.0",
"@safe-global/safe-core-sdk": "^3.3.4",
"@safe-global/safe-core-sdk-utils": "^1.7.4",
"@safe-global/safe-deployments": "^1.25.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/safe-apps/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const FEATURES = [
'speaker-selection',
]

export type AllowedFeatures = typeof FEATURES[number]
export type AllowedFeatures = (typeof FEATURES)[number]

export const isBrowserFeature = (featureKey: string): featureKey is AllowedFeatures => {
return FEATURES.includes(featureKey as AllowedFeatures)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const ReviewSignMessageOnChain = ({ message, method, requestId }: SignMessageOnC
// the primary type. And there must only be one type that is not used by any other type.
delete typesCopy.EIP712Domain
txData = readOnlySignMessageLibContract.encode('signMessage', [
// @ts-expect-error ethers type is complaining about missing BigNumber's methods. But we're not getting a BigNumber instance from a JSON
_TypedDataEncoder.hash(message.domain, typesCopy, message.message),
])
}
Expand Down
6 changes: 3 additions & 3 deletions src/services/pairing/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ const pairingModule = (): WalletInit => {
public chains: Chain[]
public disconnect: EIP1193Provider['disconnect']
// @ts-expect-error - 'emit' does not exist on `typeof EventEmitter`
public emit: typeof EventEmitter['emit']
public emit: (typeof EventEmitter)['emit']
// @ts-expect-error - 'on' does not exist on `typeof EventEmitter`
public on: typeof EventEmitter['on']
public on: (typeof EventEmitter)['on']
// @ts-expect-error - 'removeListener' does not exist on `typeof EventEmitter`
public removeListener: typeof EventEmitter['removeListener']
public removeListener: (typeof EventEmitter)['removeListener']

private disconnected$: InstanceType<typeof Subject>
private providers: Record<string, InstanceType<typeof StaticJsonRpcProvider>>
Expand Down
Loading

0 comments on commit 17fd26c

Please sign in to comment.