Skip to content

Commit

Permalink
Merge branch 'main' into keyring-with-pk
Browse files Browse the repository at this point in the history
  • Loading branch information
jagodarybacka committed Jun 13, 2023
2 parents 98ea9e7 + e3cad97 commit 085b99c
Show file tree
Hide file tree
Showing 258 changed files with 6,193 additions and 9,210 deletions.
32 changes: 12 additions & 20 deletions .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,34 @@ BLOCKNATIVE_API_KEY="f60816ff-da02-463f-87a6-67a09c6d53fa"
SIMPLE_HASH_API_KEY="tally_sk_428718ba-abc9-453a-af95-fd07d046f115_cp3n5shchhcf05xk"
READ_REDUX_CACHE=true
WRITE_REDUX_CACHE=true
HIDE_TOKEN_FEATURES=true
HIDE_IMPORT_DERIVATION_PATH=true
HIDE_SWAP_REWARDS=true
GAS_PRICE_POOLING_FREQUENCY=120
ETHEREUM_NETWORK=mainnet
WEBSITE_ORIGIN=https://taho.xyz
USE_MAINNET_FORK=false
MAINNET_FORK_URL="ws://mainnet-fork.tally.cash:2096/"
MAINNET_FORK_CHAIN_ID=1337
FILE_DIRECTORY_IPFS_HASH="QmYwYkRdYMBCtMqbimgaXjf7UL4RUb5zBQu4TDE67oZbq5"
PART_GLOSSARY_IPFS_HASH="bafybeibytsozn7qsvqgecogv5urg5en34r7v3zxo326vacumi56ckah5b4"
RESOLVE_RNS_NAMES=true
USE_UPDATED_SIGNING_UI=true
SUPPORT_MULTIPLE_LANGUAGES=false
SUPPORT_TABBED_ONBOARDING=true
SUPPORT_KEYRING_LOCKING=true
SUPPORT_FORGOT_PASSWORD=false
SUPPORT_ARBITRUM_NOVA=false
SUPPORT_SWAP_QUOTE_REFRESH=false
ENABLE_ACHIEVEMENTS_TAB=true
SUPPORT_ACHIEVEMENTS_BANNER=false
SWITCH_RUNTIME_FLAGS=false
SUPPORT_NFT_TAB=true
SUPPORT_NFT_SEND=false
UNS_API_KEY="4a77c949-511b-4c16-9862-6edfb6ae6012"
REACT_DEVTOOLS_DEFAULT_PORT=8097
SUPPORT_ANALYTICS=true
ENABLE_ANALYTICS_DEFAULT_ON=true
SHOW_ANALYTICS_DELETE_DATA_BUTTON=true
POSTHOG_URL="https://app.posthog.com/capture/"
POSTHOG_API_KEY="phc_VzveyNxrn2xyiKDYn7XjrgaqELGeUilDZGiBVh6jNmh"
POSTHOG_PERSONAL_API_KEY="phx_pE7GvpSzv207stzDwDqUOMfg8SzNzojzaFLrSdwKWE9"
USE_ANALYTICS_SOURCE="DEV"
POAP_API_KEY="Djq0jJrWaQCzzvvoTqy0BgFidzy4bugDX1mTY28EZpqcUDSNICLcVQnex2wY7D9t5QB2aQlPQRdw8GiOVcE5kgQywGiDraJDfd3GVxnDASm1PoRBjOBh9fOrgymNsMQc"
HIDE_TOKEN_FEATURES=true
HIDE_IMPORT_DERIVATION_PATH=true
HIDE_SWAP_REWARDS=true
SUPPORT_WALLET_CONNECT=false
SUPPORT_CUSTOM_NETWORKS=false
SUPPORT_CUSTOM_RPCS=false
SUPPORT_UNVERIFIED_ASSET=true
USE_UPDATED_SIGNING_UI=true
SUPPORT_MULTIPLE_LANGUAGES=false
SUPPORT_ARBITRUM_NOVA=false
SUPPORT_SWAP_QUOTE_REFRESH=false
SUPPORT_ACHIEVEMENTS_BANNER=false
SUPPORT_NFT_SEND=false
USE_MAINNET_FORK=false
ENABLE_UPDATED_DAPP_CONNECTIONS=false
SUPPORT_PRIVATE_KEYS=true
SUPPORT_ASSET_TRUST=false
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ body:
label: Version
description: What version of the extension are you running?
options:
- v0.36.1
- v0.36.0
- v0.35.0
- v0.34.0
- v0.33.0
- v0.32.0
- v0.31.1
- v0.31.0
- v0.30.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-list/release-test-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ This release checklist should be performed before release is published.
- [ ] check assets
- [ ] check balance
- [ ] check NFTs
- [ ] check abilities
- [ ] check abilities (abilities should not be displayed)
- [ ] check activities
- [ ] check overview page
2. Add read-only account with UNS
- [ ] check assets
- [ ] check balance
- [ ] check NFTs
- [ ] check abilities
- [ ] check abilities (abilities should not be displayed)
- [ ] check activities
- [ ] check overview page
3. Add read-only account with 0x address
- [ ] check assets
- [ ] check balance
- [ ] check NFTs
- [ ] check abilities
- [ ] check abilities (abilities should not be displayed)
- [ ] check activities
- [ ] check overview page
4. Import account with a seed phrase
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ app/extension-scripts/api/playground/
.DS_Store
.vscode
playwright-report
test-results/
test-results/
8 changes: 6 additions & 2 deletions background/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const ABILITY_TYPES_ENABLED = [
// https://docs.daylight.xyz/reference/ability-model#ability-types
export const ABILITY_TYPES = [
...ABILITY_TYPES_ENABLED,
"product",
"event",
"article",
"result",
Expand All @@ -53,6 +52,12 @@ export type Ability = {
removedFromUi: boolean
address: NormalizedEVMAddress
requirement: AbilityRequirement
/**
* Order number from the most interesting to the user.
* A lower number indicates a more interesting ability.
* Rank is determined by the order in which data arrives from the Daylight API.
*/
interestRank: number
}

export const ABILITY_TYPE_COLOR = {
Expand All @@ -61,7 +66,6 @@ export const ABILITY_TYPE_COLOR = {
vote: "#E3C10B",
result: "#E3C10B",
access: "#02C0EA",
product: "#D824DC",
event: "#FF8A1E",
article: "#B2B2B2",
misc: "#CBCBCB",
Expand Down
26 changes: 22 additions & 4 deletions background/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,24 @@ export type AssetMetadata = {
websiteURL?: string
tokenLists?: TokenListCitation[]
/**
* Set by the user on assets discovered through transaction annotations
* Set by the user to indicate explicitly trust in a
* legitimate asset.
*/
trusted?: boolean
verified?: boolean
}

/**
* Every asset has metadata. Some of them have network-specific metadata.
*/
export type NetworkSpecificAssetMetadata = AssetMetadata & {
/**
* Set on assets discovered through transaction annotations
*/
discoveryTxHash?: HexString
}

export type AnyAssetMetadata = AssetMetadata | NetworkSpecificAssetMetadata

/**
* The name and symbol of an arbitrary asset, fungible or non-fungible,
* alongside potential metadata about that asset.
Expand Down Expand Up @@ -87,7 +100,10 @@ export type FiatCurrency = FungibleAsset
* Any asset that exists on a particular network; see {@link NetworkSpecific)
* for information on network-specific objects.
*/
export type NetworkSpecificAsset = NetworkSpecific & Asset
export type NetworkSpecificAsset = NetworkSpecific &
Asset & {
metadata?: NetworkSpecificAssetMetadata
}

/**
* Any asset that is managed by a smart contract; see {@link SmartContract) for
Expand All @@ -99,7 +115,9 @@ export type SmartContractAsset = SmartContract & Asset
* Any fungible asset that is managed by a smart contract; see
* {@link SmartContract) for information on smart contract objects.
*/
export type SmartContractFungibleAsset = FungibleAsset & SmartContract
export type SmartContractFungibleAsset = FungibleAsset &
SmartContract &
NetworkSpecificAsset

/*
* The primary type representing amounts in fungible or non-fungible asset
Expand Down
6 changes: 6 additions & 0 deletions background/constants/base-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ const BNB: NetworkBaseAsset = {
},
}

const ZK_SYNC_ETH: NetworkBaseAsset = {
...ETH,
chainID: "324",
}

export const BASE_ASSETS_BY_CUSTOM_NAME = {
ETH,
MATIC,
Expand All @@ -104,6 +109,7 @@ export const BASE_ASSETS_BY_CUSTOM_NAME = {
ARBITRUM_NOVA_ETH,
OPTIMISTIC_ETH,
GOERLI_ETH,
ZK_SYNC_ETH,
}

export const BASE_ASSETS = Object.values(BASE_ASSETS_BY_CUSTOM_NAME)
5 changes: 5 additions & 0 deletions background/constants/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export const GOERLI_ETH: NetworkBaseAsset & Required<CoinGeckoAsset> = {
...ETH_DATA,
}

export const ZK_SYNC_ETH: NetworkBaseAsset & Required<CoinGeckoAsset> = {
...BASE_ASSETS_BY_CUSTOM_NAME.ZK_SYNC_ETH,
...ETH_DATA,
}

export const MATIC: NetworkBaseAsset & Required<CoinGeckoAsset> = {
...BASE_ASSETS_BY_CUSTOM_NAME.MATIC,
coinType: coinTypesByAssetSymbol.MATIC,
Expand Down
7 changes: 6 additions & 1 deletion background/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ export const MINUTE = 60 * SECOND
export const HOUR = 60 * MINUTE
export const DAY = 24 * HOUR

export const COMMUNITY_MULTISIG_ADDRESS =
export const DEFAULT_COMMUNITY_MULTISIG_ADDRESS =
"0x99b36fDbC582D113aF36A21EBa06BFEAb7b9bE12"

// TODO add correct multisig community addresses for chains
export const COMMUNITY_MULTISIG_ADDRESS_BY_CHAINID: {
[chainID: string]: string
} = {}

export enum EarnStages {
ComingSoon = "ComingSoon",
Deploying = "Deploying",
Expand Down
9 changes: 9 additions & 0 deletions background/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MATIC,
OPTIMISTIC_ETH,
RBTC,
ZK_SYNC_ETH,
} from "./currencies"

export const ETHEREUM: EVMNetwork = {
Expand Down Expand Up @@ -85,6 +86,13 @@ export const GOERLI: EVMNetwork = {
coingeckoPlatformID: "ethereum",
}

export const ZK_SYNC: EVMNetwork = {
name: "zkSync Era",
baseAsset: ZK_SYNC_ETH,
chainID: "324",
family: "EVM",
}

export const DEFAULT_NETWORKS = [
ETHEREUM,
POLYGON,
Expand Down Expand Up @@ -136,6 +144,7 @@ export const NETWORK_BY_CHAIN_ID = {
[BINANCE_SMART_CHAIN.chainID]: BINANCE_SMART_CHAIN,
[GOERLI.chainID]: GOERLI,
[FORK.chainID]: FORK,
[ZK_SYNC.chainID]: ZK_SYNC,
}

export const TEST_NETWORK_BY_CHAIN_ID = new Set(
Expand Down
48 changes: 29 additions & 19 deletions background/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Feature flags which are set at build time.
*/
const BuildTimeFlag = {
SUPPORT_TABBED_ONBOARDING: process.env.SUPPORT_TABBED_ONBOARDING === "true",
SWITCH_RUNTIME_FLAGS: process.env.SWITCH_RUNTIME_FLAGS === "true",
} as const

Expand All @@ -11,32 +10,24 @@ const BuildTimeFlag = {
*/
export const RuntimeFlag = {
USE_MAINNET_FORK: process.env.USE_MAINNET_FORK === "true",
RESOLVE_RNS_NAMES: process.env.RESOLVE_RNS_NAMES === "true",
HIDE_IMPORT_DERIVATION_PATH:
process.env.HIDE_IMPORT_DERIVATION_PATH === "true",
HIDE_SWAP_REWARDS: process.env.HIDE_SWAP_REWARDS === "true",
USE_UPDATED_SIGNING_UI: process.env.USE_UPDATED_SIGNING_UI === "true",
SUPPORT_MULTIPLE_LANGUAGES: process.env.SUPPORT_MULTIPLE_LANGUAGES === "true",
SUPPORT_ANALYTICS: process.env.SUPPORT_ANALYTICS === "true",
ENABLE_ANALYTICS_DEFAULT_ON:
process.env.ENABLE_ANALYTICS_DEFAULT_ON === "true",
SHOW_ANALYTICS_DELETE_DATA_BUTTON:
process.env.SHOW_ANALYTICS_DELETE_DATA_BUTTON === "true",
SUPPORT_KEYRING_LOCKING: process.env.SUPPORT_KEYRING_LOCKING === "true",
SUPPORT_FORGOT_PASSWORD: process.env.SUPPORT_FORGOT_PASSWORD === "true",
ENABLE_ACHIEVEMENTS_TAB: process.env.ENABLE_ACHIEVEMENTS_TAB === "true",
HIDE_TOKEN_FEATURES: process.env.HIDE_TOKEN_FEATURES === "true",
SUPPORT_ARBITRUM_NOVA: process.env.SUPPORT_ARBITRUM_NOVA === "true",
SUPPORT_ACHIEVEMENTS_BANNER:
process.env.SUPPORT_ACHIEVEMENTS_BANNER === "true",
SUPPORT_NFT_TAB: process.env.SUPPORT_NFT_TAB === "true",
SUPPORT_NFT_SEND: process.env.SUPPORT_NFT_SEND === "true",
SUPPORT_WALLET_CONNECT: process.env.SUPPORT_WALLET_CONNECT === "true",
SUPPORT_SWAP_QUOTE_REFRESH: process.env.SUPPORT_SWAP_QUOTE_REFRESH === "true",
SUPPORT_CUSTOM_NETWORKS: process.env.SUPPORT_CUSTOM_NETWORKS === "true",
SUPPORT_CUSTOM_RPCS: process.env.SUPPORT_CUSTOM_RPCS === "true",
SUPPORT_UNVERIFIED_ASSET: process.env.SUPPORT_UNVERIFIED_ASSET === "true",
ENABLE_UPDATED_DAPP_CONNECTIONS:
process.env.ENABLE_UPDATED_DAPP_CONNECTIONS === "true",
SUPPORT_PRIVATE_KEYS: process.env.SUPPORT_PRIVATE_KEYS === "true",
SUPPORT_ASSET_TRUST: process.env.SUPPORT_ASSET_TRUST === "true",
} as const

type BuildTimeFlagType = keyof typeof BuildTimeFlag
Expand All @@ -56,16 +47,24 @@ export const FeatureFlags = Object.keys({
}

/**
* Checks the status of the feature flag.
* If the SWITCH_RUNTIME_FLAGS is off all flags are read from environment variables.
* If the SWITCH_RUNTIME_FLAGS is on then value for run time flag is read from Local Storage.
* If value is not exist then is read from environment variables.
* The value for the build time flag is read from environment variables.
* Checks the status of the feature flag and returns `true` if the flag is set
* to `true`. Note that some historical flags might have inverted meaning by
* default (e.g. `HIDE_...`, when set to `true`, might indicate disabling a
* feature).
*
* If the `SWITCH_RUNTIME_FLAGS` feature flag is disabled all flags are read from
* environment variables.
*
* If the `SWITCH_RUNTIME_FLAGS` feature flag is on then the value for runtime
* flags are read from localStorage first, and, if the value does not exist in
* localStorage, then it is read from the environment variables.
*
* The value for build time flags is always read from environment variables.
*/
export const isEnabled = (
export function isEnabled(
flagName: FeatureFlagType,
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS
): boolean => {
): boolean {
// Guard to narrow flag type
const isBuildTimeFlag = (flag: string): flag is BuildTimeFlagType =>
flag in BuildTimeFlag
Expand All @@ -81,3 +80,14 @@ export const isEnabled = (

return RuntimeFlag[flagName]
}

/**
* Checks the inverse of `isEnabled`; used for clarity as an alternative to
* `!isEnabled`.
*/
export function isDisabled(
flagName: FeatureFlagType,
checkBrowserStorage: boolean = BuildTimeFlag.SWITCH_RUNTIME_FLAGS
): boolean {
return !isEnabled(flagName, checkBrowserStorage)
}
Loading

0 comments on commit 085b99c

Please sign in to comment.