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.543.0 #6257

Merged
merged 13 commits into from
Feb 21, 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
8 changes: 4 additions & 4 deletions .env.app
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://api.thorchain.shapeshift.com

# nodes
REACT_APP_ETHEREUM_NODE_URL=https://daemon.ethereum.shapeshift.com
REACT_APP_ETHEREUM_NODE_URL=https://nownodes.shapeshift.com/ethereum
REACT_APP_AVALANCHE_NODE_URL=https://daemon.avalanche.shapeshift.com/ext/bc/C/rpc
REACT_APP_OPTIMISM_NODE_URL=https://daemon.optimism.shapeshift.com
REACT_APP_BNBSMARTCHAIN_NODE_URL=https://daemon.bnbsmartchain.shapeshift.com
REACT_APP_POLYGON_NODE_URL=https://daemon.polygon.shapeshift.com
REACT_APP_BNBSMARTCHAIN_NODE_URL=https://nownodes.shapeshift.com/bnbsmartchain
REACT_APP_POLYGON_NODE_URL=https://nownodes.shapeshift.com/polygon
REACT_APP_GNOSIS_NODE_URL=https://daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://daemon.arbitrum.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://nownodes.shapeshift.com/arbitrum
REACT_APP_ARBITRUM_NOVA_NODE_URL=https://daemon.arbitrum-nova.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://daemon.thorchain.shapeshift.com

Expand Down
8 changes: 4 additions & 4 deletions .env.private
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://api.thorchain.shapeshift.com

# nodes
REACT_APP_ETHEREUM_NODE_URL=https://daemon.ethereum.shapeshift.com
REACT_APP_ETHEREUM_NODE_URL=https://nownodes.shapeshift.com/ethereum
REACT_APP_AVALANCHE_NODE_URL=https://daemon.avalanche.shapeshift.com/ext/bc/C/rpc
REACT_APP_OPTIMISM_NODE_URL=https://daemon.optimism.shapeshift.com
REACT_APP_BNBSMARTCHAIN_NODE_URL=https://daemon.bnbsmartchain.shapeshift.com
REACT_APP_POLYGON_NODE_URL=https://daemon.polygon.shapeshift.com
REACT_APP_BNBSMARTCHAIN_NODE_URL=https://nownodes.shapeshift.com/bnbsmartchain
REACT_APP_POLYGON_NODE_URL=https://nownodes.shapeshift.com/polygon
REACT_APP_GNOSIS_NODE_URL=https://daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://daemon.arbitrum.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://nownodes.shapeshift.com/arbitrum
REACT_APP_ARBITRUM_NOVA_NODE_URL=https://daemon.arbitrum-nova.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://daemon.thorchain.shapeshift.com

Expand Down
2 changes: 1 addition & 1 deletion __mocks__/ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ethersMock = {
...ethers,
providers: {
JsonRpcProvider: vi.fn(),
JsonRpcBatchProvider: vi.fn(),
StaticJsonRpcProvider: vi.fn(),
},
Contract: vi.fn().mockImplementation(address => ({
decimals: () => {
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@
"@shapeshiftoss/caip": "workspace:^",
"@shapeshiftoss/chain-adapters": "workspace:^",
"@shapeshiftoss/errors": "workspace:^",
"@shapeshiftoss/hdwallet-coinbase": "1.53.3",
"@shapeshiftoss/hdwallet-core": "1.53.3",
"@shapeshiftoss/hdwallet-keepkey": "1.53.3",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.53.3",
"@shapeshiftoss/hdwallet-keplr": "1.53.3",
"@shapeshiftoss/hdwallet-ledger": "1.53.3",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.53.3",
"@shapeshiftoss/hdwallet-metamask": "1.53.3",
"@shapeshiftoss/hdwallet-native": "1.53.3",
"@shapeshiftoss/hdwallet-native-vault": "1.53.3",
"@shapeshiftoss/hdwallet-shapeshift-multichain": "1.53.3",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.53.3",
"@shapeshiftoss/hdwallet-xdefi": "1.53.3",
"@shapeshiftoss/hdwallet-coinbase": "1.53.4",
"@shapeshiftoss/hdwallet-core": "1.53.4",
"@shapeshiftoss/hdwallet-keepkey": "1.53.4",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.53.4",
"@shapeshiftoss/hdwallet-keplr": "1.53.4",
"@shapeshiftoss/hdwallet-ledger": "1.53.4",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.53.4",
"@shapeshiftoss/hdwallet-metamask": "1.53.4",
"@shapeshiftoss/hdwallet-native": "1.53.4",
"@shapeshiftoss/hdwallet-native-vault": "1.53.4",
"@shapeshiftoss/hdwallet-shapeshift-multichain": "1.53.4",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.53.4",
"@shapeshiftoss/hdwallet-xdefi": "1.53.4",
"@shapeshiftoss/swapper": "workspace:^",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/caip/src/adapters/yearn/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { toChainId } from '../../chainId/chainId'
import { CHAIN_NAMESPACE, CHAIN_REFERENCE } from '../../constants'

const network = 1 // 1 for mainnet
const provider = new ethers.providers.JsonRpcBatchProvider(process.env.REACT_APP_ETHEREUM_NODE_URL)
const provider = new ethers.providers.StaticJsonRpcProvider(process.env.REACT_APP_ETHEREUM_NODE_URL)
const yearnSdk = new Yearn(network, { provider })

export const writeFiles = async (data: Record<string, Record<string, string>>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export interface TxMetadata extends BaseTxMetadata {

interface ParserArgs {
chainId: ChainId
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
}

export class Parser<T extends Tx> implements SubParser<T> {
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider

readonly chainId: ChainId
readonly abiInterface = new ethers.utils.Interface(bep20)
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/ethereum/parser/uniV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export interface TxMetadata extends BaseTxMetadata {

export interface ParserArgs {
chainId: ChainId
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
}

export class Parser implements SubParser<Tx> {
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
readonly chainId: ChainId
readonly wethContract: string
readonly abiInterface = new ethers.utils.Interface(UNIV2_ABI)
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/ethereum/parser/weth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export interface TxMetadata extends BaseTxMetadata {

export interface ParserArgs {
chainId: ChainId
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
}

export class Parser implements SubParser<Tx> {
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
readonly chainId: ChainId
readonly wethContract: string
readonly abiInterface = new ethers.utils.Interface(WETH_ABI)
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/parser/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export interface TxMetadata extends BaseTxMetadata {

interface ParserArgs {
chainId: ChainId
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
}

export class Parser<T extends Tx> implements SubParser<T> {
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider

readonly chainId: ChainId
readonly abiInterface = new ethers.utils.Interface(ERC20_ABI)
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export class BaseTransactionParser<T extends Tx> {
assetId: AssetId

protected readonly api: Api
protected readonly provider: ethers.providers.JsonRpcBatchProvider
protected readonly provider: ethers.providers.StaticJsonRpcProvider

private parsers: SubParser<T>[] = []

constructor(args: BaseTransactionParserArgs) {
this.chainId = args.chainId
this.assetId = args.assetId
this.api = args.api
this.provider = new ethers.providers.JsonRpcBatchProvider(args.rpcUrl)
this.provider = new ethers.providers.StaticJsonRpcProvider(args.rpcUrl)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/parser/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export interface TxMetadata extends BaseTxMetadata {
interface ParserArgs {
chainId: ChainId
api: Api
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider
}

const supportedTokenTypes = ['ERC721', 'ERC1155', 'BEP721', 'BEP1155']

export class Parser<T extends Tx> implements SubParser<T> {
provider: ethers.providers.JsonRpcBatchProvider
provider: ethers.providers.StaticJsonRpcProvider

readonly chainId: ChainId
readonly api: Api
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethereum/yearnVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ethereum } from '../baseAssets'
import { colorMap } from '../colorMap'

const network = 1 // 1 for mainnet
const provider = new ethers.providers.JsonRpcBatchProvider(process.env.ETHEREUM_NODE_URL)
const provider = new ethers.providers.StaticJsonRpcProvider(process.env.ETHEREUM_NODE_URL)
export const yearnSdk = new Yearn(network, { provider })

const explorerData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ describe.each([
wallet: {
supportsOfflineSigning: vi.fn().mockReturnValue(true),
ethSupportsEIP1559: vi.fn().mockReturnValue(walletSupportsEIP1559),
getVendor: vi.fn().mockReturnValue('Native'),
},
},
}) as unknown as IWalletContext,
Expand Down Expand Up @@ -231,7 +230,6 @@ describe.each([
wallet: {
supportsOfflineSigning: vi.fn().mockReturnValue(true),
ethSupportsEIP1559: vi.fn().mockReturnValue(walletSupportsEIP1559),
getVendor: vi.fn().mockReturnValue('Native'),
},
},
}) as unknown as IWalletContext,
Expand Down Expand Up @@ -298,7 +296,6 @@ describe.each([
supportsOfflineSigning: vi.fn().mockReturnValue(false),
supportsBroadcast: vi.fn().mockReturnValue(true),
ethSupportsEIP1559: vi.fn().mockReturnValue(walletSupportsEIP1559),
getVendor: vi.fn().mockReturnValue('Native'),
},
},
}) as unknown as IWalletContext,
Expand Down Expand Up @@ -354,7 +351,6 @@ describe.each([
supportsOfflineSigning: vi.fn().mockReturnValue(false),
supportsBroadcast: vi.fn().mockReturnValue(true),
ethSupportsEIP1559: vi.fn().mockReturnValue(walletSupportsEIP1559),
getVendor: vi.fn().mockReturnValue('Native'),
} as unknown as HDWallet
const toaster = vi.fn() as unknown as CreateToastFnReturn
const signAndBroadcastTransaction = vi.fn().mockResolvedValue('txid')
Expand Down
3 changes: 1 addition & 2 deletions src/components/Modals/Send/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
checkIsSnapInstalled,
} from 'hooks/useIsSnapInstalled/useIsSnapInstalled'
import { bn, bnOrZero } from 'lib/bignumber/bignumber'
import { assertGetChainAdapter, isKeepKeyHDWallet, tokenOrUndefined } from 'lib/utils'
import { assertGetChainAdapter, tokenOrUndefined } from 'lib/utils'
import { assertGetCosmosSdkChainAdapter } from 'lib/utils/cosmosSdk'
import { assertGetEvmChainAdapter, getSupportedEvmChainIds } from 'lib/utils/evm'
import { assertGetUtxoChainAdapter } from 'lib/utils/utxo'
Expand Down Expand Up @@ -141,7 +141,6 @@ export const handleSend = async ({
chainSpecific: { gasPrice, gasLimit, maxFeePerGas, maxPriorityFeePerGas },
} = fees
const shouldUseEIP1559Fees =
!isKeepKeyHDWallet(wallet) &&
(await wallet.ethSupportsEIP1559()) &&
maxFeePerGas !== undefined &&
maxPriorityFeePerGas !== undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,9 @@
import type { AccountId, AssetId, ChainId } from '@shapeshiftoss/caip'
import { fromAccountId, fromAssetId } from '@shapeshiftoss/caip'
import type { EvmChainId } from '@shapeshiftoss/chain-adapters'
import { type evm, type EvmChainAdapter, evmChainIds } from '@shapeshiftoss/chain-adapters'
import { type ETHWallet, type HDWallet } from '@shapeshiftoss/hdwallet-core'
import { isLedger } from '@shapeshiftoss/hdwallet-ledger'
import { fromAssetId } from '@shapeshiftoss/caip'
import { type evm, type EvmChainAdapter } from '@shapeshiftoss/chain-adapters'
import { type ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { TradeQuote } from '@shapeshiftoss/swapper'
import type { Result } from '@sniptt/monads'
import { Err, Ok } from '@sniptt/monads'
import { MAX_ALLOWANCE } from 'lib/swapper/swappers/utils/constants'
import { assertGetChainAdapter } from 'lib/utils'
import { getApproveContractData, getErc20Allowance, getFees } from 'lib/utils/evm'

export type GetAllowanceArgs = {
accountNumber: number
allowanceContract: string
chainId: ChainId
assetId: AssetId
wallet: HDWallet
accountId: AccountId
}

export enum GetAllowanceErr {
NotEVMChain = 'NotEVMChain',
IsFeeAsset = 'IsFeeAsset',
MissingArgs = 'MissingArgs',
}

export const getAllowance = async ({
accountNumber,
allowanceContract,
chainId,
assetId,
wallet,
accountId,
}: GetAllowanceArgs): Promise<Result<string, GetAllowanceErr>> => {
const adapter = assertGetChainAdapter(chainId)

if (!wallet) throw new Error('no wallet available')

// No approval needed for selling a non-EVM asset
if (!evmChainIds.includes(chainId as EvmChainId)) {
return Err(GetAllowanceErr.NotEVMChain)
}

// No approval needed for selling a fee asset
if (assetId === adapter.getFeeAssetId()) {
return Err(GetAllowanceErr.IsFeeAsset)
}

const fetchUnchainedAddress = Boolean(wallet && isLedger(wallet))
const from = await adapter.getAddress({
wallet,
accountNumber,
pubKey: fetchUnchainedAddress ? fromAccountId(accountId).account : undefined,
})

const { assetReference: sellAssetContractAddress } = fromAssetId(assetId)

const allowanceOnChainCryptoBaseUnit = await getErc20Allowance({
address: sellAssetContractAddress,
spender: allowanceContract,
from,
chainId,
})

return Ok(allowanceOnChainCryptoBaseUnit)
}
import { getApproveContractData, getFees } from 'lib/utils/evm'

export const getApprovalTxData = async ({
tradeQuoteStep,
Expand Down
Loading
Loading