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

Versions that go bump in the night: Bump versions across a few different core dependencies #3415

Merged
merged 12 commits into from
Aug 31, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
4851e7989a3473c64b03adb4fbef16b3957ac2ab
# Shift to @thesis-co/eslint-config.
fd45e9ffe8405e00ed34ca500bbf8f88d06de20f
# Bump to @thesis-co/eslint-config@0.6.0 with prettier 3.x.
9c4488cebd14d578dcd2cf9d3d3b26934b5262df
8 changes: 5 additions & 3 deletions .github/workflows/builds/detect-env-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = async function detectEnvBlock({ github, context }) {
context.issue?.number,
"; status code was ",
status,
". "
". ",
)
return ""
}
Expand All @@ -46,15 +46,17 @@ module.exports = async function detectEnvBlock({ github, context }) {
varName.startsWith("ENABLE_") ||
varName.startsWith("USE_") ||
varName.startsWith("SHOW_") ||
varName.startsWith("SUPPORT_")
varName.startsWith("SUPPORT_"),
)
.map((varPair) => varPair.join("="))

const validEnvBlock = validEnvLines.join("\n")

if (envLines.length !== validEnvLines.length) {
console.warn(
`Filtered ${validEnvLines.length - envLines.length} disallowed env lines.`
`Filtered ${
validEnvLines.length - envLines.length
} disallowed env lines.`,
)
}
console.log("Detected env block", validEnvBlock)
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/builds/post-build-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = async function postBuildLink({ github, context }) {
const manualWorkFlowId = context?.inputs?.workflow_run_id

const workflowRunId = Number(
context.payload?.workflow_run?.id ?? manualWorkFlowId
context.payload?.workflow_run?.id ?? manualWorkFlowId,
)

if (Number.isNaN(workflowRunId)) {
Expand All @@ -31,7 +31,7 @@ module.exports = async function postBuildLink({ github, context }) {

if (workflowLookupStatus !== 200) {
throw new Error(
`Failed to fetch workflow :( Status ${workflowLookupStatus}.`
`Failed to fetch workflow :( Status ${workflowLookupStatus}.`,
)
}

Expand All @@ -46,36 +46,36 @@ module.exports = async function postBuildLink({ github, context }) {

if (artifactLookupStatus !== 200) {
throw new Error(
`Failed to fetch workflow artifacts :( Status ${artifactLookupStatus}.`
`Failed to fetch workflow artifacts :( Status ${artifactLookupStatus}.`,
)
}

const matchArtifact = allArtifacts.filter((artifact) =>
artifact.name.startsWith("extension-builds-")
artifact.name.startsWith("extension-builds-"),
)[0]

if (matchArtifact === undefined || matchArtifact === null) {
throw new Error(
`Failed to find extension artifact :( Artifacts were ${JSON.stringify(
allArtifacts
)}`
allArtifacts,
)}`,
)
}

const prNumber = matchArtifact.name.match(/extension-builds-(.*)/)?.[1]

if (prNumber === undefined) {
throw new Error(
`Could not extract PR number from extension artifact filename (${matchArtifact.name}) :(`
`Could not extract PR number from extension artifact filename (${matchArtifact.name}) :(`,
)
} else if (prNumber.match(/^[a-f0-9]+$/) && !prNumber.match(/^[0-9]+$/)) {
console.log(
"Workflow was for a merge commit rather than a PR, skipping build link."
"Workflow was for a merge commit rather than a PR, skipping build link.",
)
return
} else if (!prNumber.match(/^[0-9]+$/)) {
throw new Error(
`Could not extract PR number from extension artifact filename (${matchArtifact.name}) :(`
`Could not extract PR number from extension artifact filename (${matchArtifact.name}) :(`,
)
}

Expand All @@ -96,14 +96,14 @@ module.exports = async function postBuildLink({ github, context }) {
const artifactUrl = `${baseUrl}/suites/${checkSuiteId}/artifacts/${matchArtifact.id}`

console.log(
`Detected artifact ${matchArtifact.name} at ${artifactUrl}, posting...`
`Detected artifact ${matchArtifact.name} at ${artifactUrl}, posting...`,
)

const updatedBody = `${(body ?? "").replace(
/\s+Latest build: [^\n]*/,
""
"",
)}\n\nLatest build: [${matchArtifact.name}](${artifactUrl}) (as of ${new Date(
workflowUpdatedAt
workflowUpdatedAt,
).toUTCString()}).`

await github.rest.pulls.update({
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pledge-signer-sync/pledge-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getAddresses = async () => {
await signInWithEmailAndPassword(
getAuth(app),
FIRESTORE_USER,
FIRESTORE_PASSWORD
FIRESTORE_PASSWORD,
)

const db = getFirestore(app)
Expand All @@ -56,7 +56,7 @@ const getAddresses = async () => {
dbCollection,
orderBy("signedManifesto.timestamp", "desc"),
limit(CHUNK_SIZE),
where("signedManifesto.timestamp", ">=", TARGET_DATE)
where("signedManifesto.timestamp", ">=", TARGET_DATE),
)

if (offset) {
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.10.0
v16.20.0
2 changes: 1 addition & 1 deletion __mocks__/@ethersproject/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sinon from "sinon"

const mock =
jest.createMockFromModule<typeof import("@ethersproject/web")>(
"@ethersproject/web"
"@ethersproject/web",
)

const actual =
Expand Down
8 changes: 4 additions & 4 deletions __mocks__/uuid.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const uuidMock = jest.createMockFromModule<typeof import("uuid")>("uuid")
const uuidActual = jest.requireActual<typeof import("uuid")>("uuid")

const v4Spy = jest.spyOn(uuidActual, "v4")
const v4Mock = jest
.fn()
.mockImplementation(() => jest.requireActual("uuid").v4())

module.exports = {
...uuidMock,
v4: v4Spy,
v4: v4Mock,
}
2 changes: 1 addition & 1 deletion __mocks__/webextension-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
getCurrent: jest.fn(() =>
// getCurrent can return undefined if there is no tab, and we act accordingly
// in the code.
Promise.resolve(undefined as unknown as Tabs.Tab)
Promise.resolve(undefined as unknown as Tabs.Tab),
),
},
windows: {
Expand Down
2 changes: 1 addition & 1 deletion background/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const ABILITY_TYPES = [
"misc",
] as const

export type AbilityType = typeof ABILITY_TYPES[number]
export type AbilityType = (typeof ABILITY_TYPES)[number]

export type Ability = {
type: AbilityType
Expand Down
12 changes: 6 additions & 6 deletions background/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function isFungibleAsset(asset: AnyAsset): asset is FungibleAsset {
* Type guard to check if an AnyAsset is actually a SmartContractFungibleAsset.
*/
export function isSmartContractFungibleAsset<T extends AnyAsset>(
asset: T
asset: T,
): asset is T & SmartContractFungibleAsset {
return "homeNetwork" in asset && isFungibleAsset(asset)
}
Expand All @@ -232,7 +232,7 @@ export function isSmartContractFungibleAsset<T extends AnyAsset>(
* FungibleAsset nature of the internal asset!
*/
export function isFungibleAssetAmount(
assetAmount: AnyAssetAmount
assetAmount: AnyAssetAmount,
): assetAmount is FungibleAssetAmount {
return isFungibleAsset(assetAmount.asset)
}
Expand Down Expand Up @@ -279,7 +279,7 @@ export function flipPricePoint(pricePoint: PricePoint): PricePoint {
*/
export function convertAssetAmountViaPricePoint<T extends AnyAssetAmount>(
sourceAssetAmount: T,
assetPricePoint: PricePoint | undefined
assetPricePoint: PricePoint | undefined,
): FungibleAssetAmount | undefined {
if (typeof assetPricePoint === "undefined") {
return undefined
Expand Down Expand Up @@ -350,7 +350,7 @@ export function convertAssetAmountViaPricePoint<T extends AnyAssetAmount>(
* is undefined.
*/
export function unitPricePointForPricePoint(
assetPricePoint: PricePoint | undefined
assetPricePoint: PricePoint | undefined,
): UnitPricePoint<FungibleAsset> | undefined {
if (typeof assetPricePoint === "undefined") {
return undefined
Expand All @@ -366,7 +366,7 @@ export function unitPricePointForPricePoint(
: 1n,
asset: sourceAsset,
},
assetPricePoint
assetPricePoint,
)

if (typeof unitPrice !== "undefined") {
Expand Down Expand Up @@ -394,7 +394,7 @@ export function unitPricePointForPricePoint(
*/
export function assetAmountToDesiredDecimals(
assetAmount: FungibleAssetAmount,
desiredDecimals: number
desiredDecimals: number,
): number {
const {
amount,
Expand Down
2 changes: 1 addition & 1 deletion background/constants/coin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export const coinTypesByAssetSymbol = {
* All coin types known to the extension.
*/
export type Slip44CoinType =
typeof coinTypesByAssetSymbol[keyof typeof coinTypesByAssetSymbol]
(typeof coinTypesByAssetSymbol)[keyof typeof coinTypesByAssetSymbol]
2 changes: 1 addition & 1 deletion background/constants/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const USD: FiatCurrency = {

export const FIAT_CURRENCIES = [USD]
export const FIAT_CURRENCIES_SYMBOL = FIAT_CURRENCIES.map(
(currency) => currency.symbol
(currency) => currency.symbol,
)

export const ETH_DATA = {
Expand Down
22 changes: 12 additions & 10 deletions background/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ export const DEFAULT_NETWORKS = [

export function isBuiltInNetwork(network: EVMNetwork): boolean {
return DEFAULT_NETWORKS.some(
(builtInNetwork) => builtInNetwork.chainID === network.chainID
(builtInNetwork) => builtInNetwork.chainID === network.chainID,
)
}

export const DEFAULT_NETWORKS_BY_CHAIN_ID = new Set(
DEFAULT_NETWORKS.map((network) => network.chainID)
DEFAULT_NETWORKS.map((network) => network.chainID),
)

export const FORK: EVMNetwork = {
Expand All @@ -124,13 +124,13 @@ export const FORK: EVMNetwork = {
}

export const EIP_1559_COMPLIANT_CHAIN_IDS = new Set(
[ETHEREUM, POLYGON, GOERLI, AVALANCHE].map((network) => network.chainID)
[ETHEREUM, POLYGON, GOERLI, AVALANCHE].map((network) => network.chainID),
)

export const CHAINS_WITH_MEMPOOL = new Set(
[ETHEREUM, POLYGON, AVALANCHE, GOERLI, BINANCE_SMART_CHAIN].map(
(network) => network.chainID
)
(network) => network.chainID,
),
)

export const NETWORK_BY_CHAIN_ID = {
Expand All @@ -148,7 +148,7 @@ export const NETWORK_BY_CHAIN_ID = {
}

export const TEST_NETWORK_BY_CHAIN_ID = new Set(
[GOERLI].map((network) => network.chainID)
[GOERLI].map((network) => network.chainID),
)

export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON]
Expand All @@ -168,13 +168,13 @@ export const CHAIN_ID_TO_0X_API_BASE: {
}

export const NETWORKS_SUPPORTING_SWAPS = new Set(
Object.keys(CHAIN_ID_TO_0X_API_BASE)
Object.keys(CHAIN_ID_TO_0X_API_BASE),
)

export const ALCHEMY_SUPPORTED_CHAIN_IDS = new Set(
[ETHEREUM, POLYGON, ARBITRUM_ONE, OPTIMISM, GOERLI].map(
(network) => network.chainID
)
(network) => network.chainID,
),
)

export const FLASHBOTS_SUPPORTED_CHAIN_IDS = new Set([ETHEREUM.chainID])
Expand Down Expand Up @@ -251,5 +251,7 @@ export const CHAIN_ID_TO_OPENSEA_CHAIN = {
}

export const NETWORKS_WITH_FEE_SETTINGS = new Set(
[ETHEREUM, POLYGON, ARBITRUM_ONE, AVALANCHE].map((network) => network.chainID)
[ETHEREUM, POLYGON, ARBITRUM_ONE, AVALANCHE].map(
(network) => network.chainID,
),
)
8 changes: 4 additions & 4 deletions background/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const FeatureFlags = Object.keys({
*/
export function isEnabled(
flagName: FeatureFlagType,
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS,
): boolean {
// Guard to narrow flag type
const isBuildTimeFlag = (flag: string): flag is BuildTimeFlagType =>
Expand All @@ -82,7 +82,7 @@ export function isEnabled(
*/
export function isDisabled(
flagName: FeatureFlagType,
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS,
): boolean {
return !isEnabled(flagName, checkBrowserStorage)
}
Expand All @@ -105,7 +105,7 @@ export function isDisabled(
*/
export function wrapIfEnabled<T>(
flag: FeatureFlagType,
valueToWrap: T
valueToWrap: T,
): [T] | [] {
return isEnabled(flag) ? [valueToWrap] : []
}
Expand All @@ -117,7 +117,7 @@ export function wrapIfEnabled<T>(
*/
export function wrapIfDisabled<T>(
flag: FeatureFlagType,
valueToWrap: T
valueToWrap: T,
): [T] | [] {
return isDisabled(flag) ? [valueToWrap] : []
}
8 changes: 4 additions & 4 deletions background/generate-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ const ajvJSON = new AjvJSON({

const jtdModuleCode = standaloneCode(ajvJTD).replace(
'/*# sourceURL="https://uniswap.org/tokenlist.schema.json" */',
""
"",
)
const jsonModuleCode = standaloneCode(ajvJSON).replace(
'/*# sourceURL="https://uniswap.org/tokenlist.schema.json" */',
""
"",
)

writeFileSync(
path.join(__dirname, "/lib/validate/jtd-validators.js"),
jtdModuleCode
jtdModuleCode,
)

writeFileSync(
path.join(__dirname, "/lib/validate/json-validators.js"),
jsonModuleCode
jsonModuleCode,
)
Loading