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

chore: release v1.513.0 #5956

Merged
merged 7 commits into from
Jan 8, 2024
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
9 changes: 2 additions & 7 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ REACT_APP_ETHERSCAN_API_KEY=XT8BI6VDYUGD9675X861ATHZNK3AN6HRMF
REACT_APP_WHEREVER_PARTNER_KEY=00da1f18-3bba-4b71-824c-21e5ed772dfa

# WalletConnect
REACT_APP_WALLET_CONNECT_PROJECT_ID=a28cc4392a374056df13372b666190a0
REACT_APP_WALLET_CONNECT_TO_DAPPS_PROJECT_ID=a28cc4392a374056df13372b666190a0
REACT_APP_WALLET_CONNECT_WALLET_PROJECT_ID=f58c0242def84c3b9befe9b1e6086bbd
REACT_APP_WALLET_CONNECT_RELAY_URL=wss://relay.walletconnect.com

# zerion
REACT_APP_ZERION_API_KEY=emtfcHJvZF8xMjE3ZGRmYjhlZDY0ZGEzYmE2MjFiODg2NjQ5MTM4Yzo=

# zapper
REACT_APP_ZAPPER_API_KEY=c1b0bac5-bfc4-44f2-9fee-ed82679f76b7

Expand All @@ -157,9 +155,6 @@ REACT_APP_FEATURE_COVALENT_JAYPEGS=true
#oneinch
REACT_APP_ONE_INCH_API_URL=https://api-shapeshift.1inch.io/v5.0

# 0x
REACT_APP_ZRX_API_KEY=834f3988-83d1-43de-8aeb-9337d1eccdbf

REACT_APP_SNAP_ID=npm:@shapeshiftoss/metamask-snaps
# REACT_APP_SNAP_ID=local:http://localhost:9000

Expand Down
14 changes: 1 addition & 13 deletions react-app-rewired/headers/csps/defi/swappers/0x.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import type { Csp } from '../../../types'

export const csp: Csp = {
'connect-src': [
// @shapeshiftoss/[email protected]: https://github.com/shapeshift/lib/blob/f833ac7f8c70dee801eaa24525336ca6992e5903/packages/swapper/src/swappers/zrx/utils/zrxService.ts#L4
'https://api.0x.org',
// @shapeshiftoss/[email protected]: https://github.com/shapeshift/lib/blob/476550629be9485bfc089decc4df85456968464a/packages/chain-adapters/src/ethereum/EthereumChainAdapter.ts#L226
'https://gas.api.0x.org',
// @shapeshiftoss/swapper: https://github.com/shapeshift/lib/blob/094c684297666bc4b78e7eb1805dbeed6e6e69b1/packages/swapper/src/swappers/zrx/utils/helpers/helpers.ts#L16
'https://avalanche.api.0x.org',
// @shapeshiftoss/swapper: https://github.com/shapeshift/lib/blob/baa02e4355bff52cd89efd93ea4f38a50fe284f5/packages/swapper/src/swappers/zrx/utils/helpers/helpers.ts#L24
'https://optimism.api.0x.org',
'https://polygon.api.0x.org',
'https://bsc.api.0x.org',
'https://arbitrum.api.0x.org/',
],
'connect-src': ['https://0x.shapeshift.com'],
}
2 changes: 1 addition & 1 deletion react-app-rewired/headers/csps/zerion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Csp } from '../types'

export const csp: Csp = {
'connect-src': ['https://api.zerion.io/v1/'],
'connect-src': ['https://zerion.shapeshift.com'],
}
5 changes: 2 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const validators = {
REACT_APP_MTPELERIN_REFERRAL_CODE: str(),
REACT_APP_FRIENDLY_CAPTCHA_SITE_KEY: str(),
REACT_APP_FEATURE_DASHBOARD_TABS: bool({ default: false }),
REACT_APP_ZERION_API_KEY: str(),
REACT_APP_FEATURE_DEFI_DASHBOARD: bool({ default: false }),
REACT_APP_ZAPPER_API_KEY: str(),
REACT_APP_COVALENT_API_KEY: str(),
Expand All @@ -94,7 +93,8 @@ const validators = {
REACT_APP_FEATURE_COINBASE_WALLET: bool({ default: false }),
REACT_APP_FEATURE_LEDGER_WALLET: bool({ default: false }),
REACT_APP_FEATURE_WALLET_CONNECT_V2: bool({ default: false }),
REACT_APP_WALLET_CONNECT_PROJECT_ID: str({ default: '' }),
REACT_APP_WALLET_CONNECT_TO_DAPPS_PROJECT_ID: str({ default: '' }),
REACT_APP_WALLET_CONNECT_WALLET_PROJECT_ID: str({ default: '' }),
REACT_APP_WALLET_CONNECT_RELAY_URL: str({ default: 'wss://relay.walletconnect.com' }),
REACT_APP_YAT_NODE_URL: url({ default: 'https://a.y.at' }),
REACT_APP_TOKEMAK_STATS_URL: url({ default: 'https://stats.tokemaklabs.com/' }),
Expand Down Expand Up @@ -150,7 +150,6 @@ const validators = {
REACT_APP_ALCHEMY_POLYGON_JAYPEGS_BASE_URL: url(),
REACT_APP_ALCHEMY_OPTIMISM_JAYPEGS_BASE_URL: url(),
REACT_APP_ALCHEMY_ARBITRUM_JAYPEGS_BASE_URL: url(),
REACT_APP_ZRX_API_KEY: str(),
REACT_APP_CHATWOOT_TOKEN: str(),
REACT_APP_CHATWOOT_URL: str(),
REACT_APP_FEATURE_CHATWOOT: bool({ default: false }),
Expand Down
4 changes: 2 additions & 2 deletions src/context/WalletProvider/WalletConnectV2/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const walletConnectV2OptionalChainIds: AtLeastOneNumber = (() => {
})()

const {
REACT_APP_WALLET_CONNECT_PROJECT_ID,
REACT_APP_WALLET_CONNECT_WALLET_PROJECT_ID,
REACT_APP_AVALANCHE_NODE_URL,
REACT_APP_OPTIMISM_NODE_URL,
REACT_APP_BNBSMARTCHAIN_NODE_URL,
Expand All @@ -79,7 +79,7 @@ const {
} = getConfig()

export const walletConnectV2ProviderConfig: EthereumProviderOptions = {
projectId: REACT_APP_WALLET_CONNECT_PROJECT_ID,
projectId: REACT_APP_WALLET_CONNECT_WALLET_PROJECT_ID,
chains: walletConnectV2RequiredChainIds,
optionalChains: walletConnectV2OptionalChainIds,
optionalMethods: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getSupportedChainIds } from '../utils/helpers/helpers'

export const filterAssetIdsBySellable = (assets: Asset[]): AssetId[] => {
const supportedChainIds = getSupportedChainIds()
console.log({ assets, supportedChainIds })
return assets
.filter(asset => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { describe, expect, it, vi } from 'vitest'
import { BTC } from '../../utils/test-data/assets'
import { gasFeeData } from '../../utils/test-data/fees'
import { setupQuote } from '../../utils/test-data/setupSwapQuote'
import { baseUrlFromChainId } from '../utils/helpers/helpers'
import { zrxServiceFactory } from '../utils/zrxService'
import { getZrxTradeQuote } from './getZrxTradeQuote'

Expand Down Expand Up @@ -37,10 +36,9 @@ vi.mock('../utils/helpers/helpers', async () => {
const actual = await vi.importActual('../utils/helpers/helpers')
return {
...actual,
baseUrlFromChainId: vi.fn(() => 'https://api.0x.org/'),
baseUrlFromChainId: vi.fn(() => 'https://0x.shapeshift.com/ethereum/'),
}
})
vi.mock('../../utils/helpers/helpers')
vi.mock('@shapeshiftoss/chain-adapters', () => {
const { KnownChainIds } = require('@shapeshiftoss/types')
return {
Expand Down Expand Up @@ -72,9 +70,7 @@ vi.mock('context/PluginProvider/chainAdapterSingleton', () => {
const mockOk = Ok
const mockErr = Err
describe('getZrxTradeQuote', () => {
const zrxService = zrxServiceFactory({ baseUrl: 'https://api.0x.org/' })

vi.mocked(baseUrlFromChainId).mockReturnValue('https://api.0x.org/')
const zrxService = zrxServiceFactory({ baseUrl: 'https://0x.shapeshift.com/ethereum/' })

it('returns quote with fee data', async () => {
const { quoteInput } = setupQuote()
Expand Down
12 changes: 6 additions & 6 deletions src/lib/swapper/swappers/ZrxSwapper/utils/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import { zrxSupportedChainIds } from '../../types'
export const baseUrlFromChainId = (chainId: ZrxSupportedChainId): string => {
switch (chainId) {
case KnownChainIds.EthereumMainnet:
return 'https://api.0x.org/'
return 'https://0x.shapeshift.com/ethereum/'
case KnownChainIds.AvalancheMainnet:
return 'https://avalanche.api.0x.org/'
return 'https://0x.shapeshift.com/avalanche/'
case KnownChainIds.OptimismMainnet:
return 'https://optimism.api.0x.org/'
return 'https://0x.shapeshift.com/optimism/'
case KnownChainIds.BnbSmartChainMainnet:
return 'https://bsc.api.0x.org/'
return 'https://0x.shapeshift.com/bnbsmartchain/'
case KnownChainIds.PolygonMainnet:
return 'https://polygon.api.0x.org/'
return 'https://0x.shapeshift.com/polygon/'
case KnownChainIds.ArbitrumMainnet:
return 'https://arbitrum.api.0x.org/'
return 'https://0x.shapeshift.com/arbitrum/'
default:
assertUnreachable(chainId)
}
Expand Down
6 changes: 0 additions & 6 deletions src/lib/swapper/swappers/ZrxSwapper/utils/zrxService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SwapperName } from '@shapeshiftoss/swapper'
import type { AxiosInstance, AxiosRequestConfig } from 'axios'
import axios from 'axios'
import { getConfig } from 'config'
import identity from 'lodash/identity'
import type { RetryConfig } from 'retry-axios'
import type { MonadicSwapperAxiosService } from 'lib/swapper/utils'
Expand All @@ -19,11 +18,6 @@ type AxiosInstanceHoF = (

const axiosConfig: AxiosRequestConfig = {
timeout: 10000,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'0x-api-key': getConfig().REACT_APP_ZRX_API_KEY,
},
adapter: cache.adapter,
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/walletConnectToDapps/walletUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ let core: ICore
// WalletConnect Core singleton
export const getWalletConnectCore = () => {
if (!core) {
const walletConnectProjectId = getConfig().REACT_APP_WALLET_CONNECT_PROJECT_ID
const walletConnectToDappsProjectId = getConfig().REACT_APP_WALLET_CONNECT_TO_DAPPS_PROJECT_ID
core = new Core({
projectId: walletConnectProjectId,
projectId: walletConnectToDappsProjectId,
})
}

Expand Down
9 changes: 2 additions & 7 deletions src/state/apis/zerion/zerionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@ import type { AssetId } from '@shapeshiftoss/caip'
import { FEE_ASSET_IDS, fromAssetId } from '@shapeshiftoss/caip'
import { isEvmChainId } from '@shapeshiftoss/chain-adapters'
import axios from 'axios'
import { getConfig } from 'config'
import memoize from 'lodash/memoize'
import { isSome } from 'lib/utils'
import { BASE_RTK_CREATE_API_CONFIG } from 'state/apis/const'

import { zerionImplementationToMaybeAssetId } from './mapping'
import { zerionFungiblesSchema } from './validators/fungible'

const ZERION_BASE_URL = 'https://api.zerion.io/v1'
const ZERION_BASE_URL = 'https://zerion.shapeshift.com'

const options = {
method: 'GET' as const,
baseURL: ZERION_BASE_URL,
headers: {
accept: 'application/json',
authorization: `Basic ${getConfig().REACT_APP_ZERION_API_KEY}`,
},
}

// Looks like we're using a useless memoize here as zerionApi.endpoints.getRelatedAssetIds takes care of caching
Expand All @@ -31,7 +26,7 @@ export const _getRelatedAssetIds = memoize(async (assetId: AssetId): Promise<Ass

try {
const filter = { params: { 'filter[implementation_address]': assetReference } }
const url = '/fungibles/'
const url = '/fungibles'
const payload = { ...options, ...filter, url }
const { data: res } = await axios.request(payload)
const validationResult = zerionFungiblesSchema.parse(res)
Expand Down
Loading