Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat_usdt_reset_er…
Browse files Browse the repository at this point in the history
…rwhere_2
  • Loading branch information
gomesalexandre committed Sep 4, 2024
2 parents 33db74b + 1df5578 commit 3af7a9f
Show file tree
Hide file tree
Showing 194 changed files with 1,429 additions and 1,070 deletions.
3 changes: 0 additions & 3 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,5 @@ REACT_APP_EXPERIMENTAL_CUSTOM_SEND_NONCE=false
# Sentry
REACT_APP_SENTRY_DSN_URL=https://c612e7f4ef0637e4add433a2f4683aa8@o4507174990905344.ingest.de.sentry.io/4507174994444368

# Arbitrum One RFOX proxy contract address
REACT_APP_RFOX_PROXY_CONTRACT_ADDRESS=0xac2a4fd70bcd8bab0662960455c363735f0e2b56

# Zerion
REACT_APP_ZERION_BASE_URL=https://api.proxy.shapeshift.com/api/v1/zerion
4 changes: 0 additions & 4 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,3 @@ REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com

# thorchain
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2

# Arbitrum One testing RFOX proxy contract address - *not* the actual main contract, only for testing
# Uncomment me if you want to test RFOX with a shorter cooldown period
# REACT_APP_RFOX_PROXY_CONTRACT_ADDRESS=0x1094c4a99fce60e69ffe75849309408f1262d304
4 changes: 0 additions & 4 deletions .env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com

# thorchain
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2

# Arbitrum One testing RFOX proxy contract address - *not* the actual main contract, only for testing
# Uncomment me if you want to test RFOX with a shorter cooldown period
# REACT_APP_RFOX_PROXY_CONTRACT_ADDRESS=0x1094c4a99fce60e69ffe75849309408f1262d304
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@
"@shapeshiftoss/caip": "workspace:^",
"@shapeshiftoss/chain-adapters": "workspace:^",
"@shapeshiftoss/errors": "workspace:^",
"@shapeshiftoss/hdwallet-coinbase": "1.54.1",
"@shapeshiftoss/hdwallet-core": "1.54.1",
"@shapeshiftoss/hdwallet-keepkey": "1.54.1",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.54.1",
"@shapeshiftoss/hdwallet-keplr": "1.54.1",
"@shapeshiftoss/hdwallet-ledger": "1.54.1",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.54.1",
"@shapeshiftoss/hdwallet-metamask": "1.54.1",
"@shapeshiftoss/hdwallet-native": "1.54.1",
"@shapeshiftoss/hdwallet-native-vault": "1.54.1",
"@shapeshiftoss/hdwallet-shapeshift-multichain": "1.54.1",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.54.1",
"@shapeshiftoss/hdwallet-xdefi": "1.54.1",
"@shapeshiftoss/hdwallet-coinbase": "1.54.2",
"@shapeshiftoss/hdwallet-core": "1.54.2",
"@shapeshiftoss/hdwallet-keepkey": "1.54.2",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.54.2",
"@shapeshiftoss/hdwallet-keplr": "1.54.2",
"@shapeshiftoss/hdwallet-ledger": "1.54.2",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.54.2",
"@shapeshiftoss/hdwallet-metamask": "1.54.2",
"@shapeshiftoss/hdwallet-native": "1.54.2",
"@shapeshiftoss/hdwallet-native-vault": "1.54.2",
"@shapeshiftoss/hdwallet-shapeshift-multichain": "1.54.2",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.54.2",
"@shapeshiftoss/hdwallet-xdefi": "1.54.2",
"@shapeshiftoss/swapper": "workspace:^",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions packages/chain-adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@shapeshiftoss/caip": "workspace:^",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
"@shapeshiftoss/utils": "workspace:^",
"bech32": "^2.0.0",
"coinselect": "^3.1.13",
"multicoin-address-validator": "^0.5.12",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AssetId, ChainId } from '@shapeshiftoss/caip'
import { fromChainId, generateAssetIdFromCosmosSdkDenom } from '@shapeshiftoss/caip'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, CosmosSdkChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import * as unchained from '@shapeshiftoss/unchained-client'
import { bech32 } from 'bech32'
Expand Down Expand Up @@ -75,8 +75,6 @@ export const cosmosSdkChainIds = [
KnownChainIds.ThorchainMainnet,
] as const

export type CosmosSdkChainId = (typeof cosmosSdkChainIds)[number]

export type CosmosSdkChainAdapter = cosmos.ChainAdapter | thorchain.ChainAdapter

export enum Denoms {
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-adapters/src/cosmossdk/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type { CosmosSdkChainId, CosmosSdkChainAdapter } from './CosmosSdkBaseAdapter'
export type { CosmosSdkChainAdapter } from './CosmosSdkBaseAdapter'
export { cosmosSdkChainIds, CosmosSdkBaseAdapter } from './CosmosSdkBaseAdapter'

export * as cosmossdk from './types'
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-adapters/src/cosmossdk/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { AssetId } from '@shapeshiftoss/caip'
import type { CosmosSdkChainId } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'

import type * as types from '../types'
import type { CosmosSdkChainId } from './CosmosSdkBaseAdapter'

export type Account = {
sequence: string
Expand Down
10 changes: 4 additions & 6 deletions packages/chain-adapters/src/evm/EvmBaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
supportsOptimism,
supportsPolygon,
} from '@shapeshiftoss/hdwallet-core'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import BigNumber from 'bignumber.js'
Expand Down Expand Up @@ -67,8 +67,8 @@ import type {
BuildCustomApiTxInput,
BuildCustomTxInput,
EstimateGasRequest,
Fees,
GasFeeDataEstimate,
NetworkFees,
} from './types'
import { getErc20Data } from './utils'

Expand All @@ -84,8 +84,6 @@ export const evmChainIds = [
KnownChainIds.BaseMainnet,
] as const

export type EvmChainId = (typeof evmChainIds)[number]

export type EvmChainAdapter =
| ethereum.ChainAdapter
| avalanche.ChainAdapter
Expand Down Expand Up @@ -284,7 +282,7 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap

const isTokenSend = !!contractAddress

const fees = ((): Fees => {
const fees = ((): NetworkFees => {
if (maxFeePerGas && maxPriorityFeePerGas) {
return {
maxFeePerGas: toHex(BigInt(maxFeePerGas)),
Expand Down Expand Up @@ -570,7 +568,7 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap

const account = await this.getAccount(from)

const fees: Fees =
const fees: NetworkFees =
maxFeePerGas && maxPriorityFeePerGas
? {
maxFeePerGas: toHex(BigInt(maxFeePerGas)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { arbitrumAssetId, arbitrumChainId, ASSET_REFERENCE, fromChainId } from '
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as arbitrum from './ArbitrumChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -17,7 +17,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as arbitrumNova from './ArbitrumNovaChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -17,7 +17,6 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as avalanche from './AvalancheChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/chain-adapters/src/evm/base/BaseChainAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASSET_REFERENCE, baseAssetId, baseChainId, fromChainId } from '@shapesh
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as base from './BaseChainAdapter'

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASSET_REFERENCE, bscAssetId, bscChainId, fromChainId } from '@shapeshif
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,6 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as bsc from './BscChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASSET_REFERENCE, CHAIN_REFERENCE, ethAssetId, ethChainId } from '@shape
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,6 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as ethereum from './EthereumChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
2 changes: 2 additions & 0 deletions packages/chain-adapters/src/evm/evm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './utils'
export * from './types'
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ASSET_REFERENCE, fromChainId, gnosisAssetId, gnosisChainId } from '@sha
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -18,7 +18,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as gnosis from './GnosisChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/chain-adapters/src/evm/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type { EvmChainId, EvmChainAdapter } from './EvmBaseAdapter'
export type { EvmChainAdapter } from './EvmBaseAdapter'
export { isEvmChainId, evmChainIds, EvmBaseAdapter } from './EvmBaseAdapter'

export * as evm from './types'
export * as evm from './evm'

export * as ethereum from './ethereum'
export * as avalanche from './avalanche'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASSET_REFERENCE, fromChainId, optimismAssetId, optimismChainId } from '
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as optimism from './OptimismChainAdapter'

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASSET_REFERENCE, fromChainId, polygonAssetId, polygonChainId } from '@s
import type { ETHSignMessage, ETHSignTx, ETHWallet } from '@shapeshiftoss/hdwallet-core'
import type { NativeAdapterArgs } from '@shapeshiftoss/hdwallet-native'
import { NativeHDWallet } from '@shapeshiftoss/hdwallet-native'
import type { BIP44Params } from '@shapeshiftoss/types'
import type { BIP44Params, EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'
import type * as unchained from '@shapeshiftoss/unchained-client'
import { merge } from 'lodash'
Expand All @@ -12,7 +12,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput } from '../../types'
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import * as polygon from './PolygonChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down
11 changes: 8 additions & 3 deletions packages/chain-adapters/src/evm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type BuildCustomTxInput = {
data: string
value: string
gasLimit: string
} & Fees
} & NetworkFees

export type BuildCustomApiTxInput = Omit<BuildCustomTxInput, 'wallet'> & { from: string }

Expand All @@ -32,7 +32,7 @@ export type BuildTxInput = {
contractAddress?: string
data?: string
sendmax?: never
} & Fees &
} & NetworkFees &
L1FeeData

export type EstimateFeeDataInput<T extends ChainId> = common.GetFeeDataInput<T> & {
Expand All @@ -58,7 +58,7 @@ export type FeeData = {
maxPriorityFeePerGas?: string
} & L1FeeData

export type Fees =
export type NetworkFees =
| {
gasPrice: string
maxFeePerGas?: never
Expand Down Expand Up @@ -86,3 +86,8 @@ export type GetFeeDataInput = {
}

export type TransactionMetadata = unchained.evm.TxMetadata

export type Fees = NetworkFees & {
gasLimit: string
networkFeeCryptoBaseUnit: string
}
Loading

0 comments on commit 3af7a9f

Please sign in to comment.