Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.
/ swaps-controller Public archive

Latest commit

 

History

History
431 lines (278 loc) · 21.2 KB

File metadata and controls

431 lines (278 loc) · 21.2 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Changed

  • BREAKING: Use new Messenger from @metamask/messenger (#421)
    • Previously, SwapsController accepted a RestrictedMessenger instance from @metamask/base-controller.
  • BREAKING: Metadata property anonymous renamed to includeInDebugSnapshot (#421)
  • BREAKING: Bump peer dependency @metamask/gas-fee-controller from ^24.0.0 to ^25.0.0 (#421)
  • BREAKING: Bump peer dependency @metamask/network-controller from ^24.0.0 to ^25.0.0 (#421)
  • Bump @metamask/base-controller from ^8.0.3 to ^9.0.0((#421)

Added

  • Add two new controller state metadata properties: includeInStateLogs and usedInUi (#1234)

Changed

  • BREAKING: Bump peer dependency @metamask/gas-fee-controller from ^22.0.0 to ^24.0.0 (#412)
  • BREAKING: Bump peer dependency @metamask/network-controller from ^22.0.0 to ^24.0.0 (#412)
  • Bump @metamask/base-controller from ^7.0.1 to ^8.0.3 (#1234)

Changed

  • Migrate fetchTopAssets to use the Bridge API instead of the Swaps API (#408)

Changed

  • Add SEI network support (#406)

Changed

  • Allow using a chainId or networkClientId to call fetchTopAssets (#403)

Changed

  • Allow immediate fetching of topAssets without changing the network by relying on state.chainCache[chainId].topAssetsLastFetched instead of state.topAssetsLastFetched (#401)
  • BREAKING: Remove state.topAssetsLastFetched (#401)

Changed

  • Add the "enableGasIncludedQuotes" param for fetching quotes (#390)
  • Add back rimraf for the build:clean script (#376)
  • Export CHAIN_ID_TO_NAME_MAP (#383)
  • Export FeatureFlags type (#380)

Changed

  • BREAKING: Consumers must now allow NetworkController:getNetworkClientById as a messenger action (#347)
  • BREAKING: Consumers must no longer allow NetworkController:findNetworkClientIdByChainId as a messenger action (#347)
  • BREAKING: Consumers must now allow NetworkController:networkDidChange as a messenger event (#347)
  • BREAKING: Update startFetchAndSetQuotes so that a networkClientId must be specified within the fetch metadata (#347)
  • BREAKING: Update fetchTokenWithCache, fetchTopAssetsWithCache, and fetchAggregatorMetadataWithCache so that a networkClientId must be specified as an option (#347)
  • BREAKING: Update signature of fetchGasFeeEstimates option so that the function expects a networkClientId option (#347)
  • BREAKING: Update signature of fetchEstimatedMultiLayerL1Fee option so that the function expects a networkClientId rather than chainId (#347)
  • BREAKING: Update type of fetchParamsMetaData in SwapsControllerState to add required property networkClientId (#347)
  • BREAKING: Update type of fetchGasFeeEstimates in SwapsControllerOptions to match signature of same method in GasFeeController (#347)
  • BREAKING: Update type of fetchEstimatedMultiLayerL1Fee in SwapsControllerOptions by replacing chainId in options with networkClientId (#347)
  • The chain cache in state will now automatically be updated whenever the network has changed (#347)
    • This aims to replace behavior provided by setProvider and setChainId.
  • BREAKING: Bump peer dependency @metamask/gas-fee-controller to ^22.0.0 (#369, #379)
  • BREAKING: Bump peer dependency @metamask/network-controller to ^22.0.0 (#369, #379)

Removed

  • BREAKING: Remove chainId from constructor options (#347)
    • The global chain ID no longer needs to be tracked. Methods that rely on a network now take a networkClientId option.
  • BREAKING: Remove setChainId method (#347)
    • Instead of calling this method when the network changes to capture the current chain ID, pass networkClientId to the appropriate method.
  • BREAKING: Remove setProvider method (#347)
    • Instead of calling this method when the network changes to capture the current provider, pass networkClientId to the appropriate method.
    • Note that setProvider was also allowing the pollCountLimit to be reset. However, upon reviewing clients, it was discovered that the pollCountLimit never changes. Instead of using method to set this option, pass it to the constructor when initializing the controller.
  • BREAKING: Remove chainId from SwapsControllerOptions type (#347)

Changed

  • BREAKING: Bump @metamask/network-controller peer dependency from ^18.1.0 to ^21.1.0 (#332)
  • BREAKING: @metamask/gas-fee-controller is now listed as peer dependency (#331)
    • The package version has been bumped from ^15.1.2 to ^21.0.0
  • Bump @metamask/transaction-controller from ^19.0.1 to ^37.3.0 (#333)
  • Bump @metamask/approval-controller from ^5.1.1 to ^7.1.0 (#333)
  • Bump @metamask/utils from ^8.5.0 to ^10.0.0 (#330)
  • Bump @metamask/controller-utils from ^10.0.0 to ^11.3.0 (#322)
  • Bump @metamask/base-controller from ^5.0.2 to ^7.0.1 (#319)
  • Bump @metamask/safe-event-emitter from ^3.1.1 to ^3.1.2 (#329)
  • Bump secp256k1 in the npm_and_yarn group (#327)
  • Bump @metamask/rpc-errors from ^6.3.1 to ^6.4.0 (#325)
  • Update LICENSE (#338)

Changed

  • BREAKING: Upgrade controller to BaseController V2 (#277)

Fixed

  • Fix incorrect version after revert (#318)
  • Update name of Polygon network token from MATIC to POL (#312)

Changed

  • Remove Web3 and use Ethers to read allowance from contracts, speeding up performance on Android (#309)

Changed

  • Re-release due to publishing failure

Fixed

  • Updates the publish step (#291)

Fixed

  • Remove setup node steps on publish (#289)

Fixed

  • Fix for publish-npm-dry-run workflow (#287)

Fixed

  • Fix for broken node-version on github workflow (#285)

Fixed

  • Fix for publish-release workflow (#282)

Fixed

  • Upgrade to Yarn v4 and fix publishing (#278)

Changed

  • Increase test coverage (#274)
  • Bump braces from 3.0.2 to 3.0.3 (#257)

Fixed

  • Fix issue in Mobile Swaps where users would be blocked from pressing the swap button after the first poll finishes (#275)

Changed

  • Update old codefi.network urls (#260)

Fixed

  • Fix Web3 import behaving differently between unit test and React Native envs (#255)
  • Fix bigint cast to Number results in null on Android only (#259)

Changed

  • BREAKING: peerDependency @metamask/composable-controller requires upgrade from v1 to v4 (#219)
  • BREAKING: Update @metamask/gas-fee-controller from v3 to v12 (#219)
  • Update @metamask/base-controller from v1 to v4 (#219)

Fixed

  • Remove dependency on deprecated web3-provider-engine (#219)
  • Upgrade legacy eth-sig-util to @metamask/eth-sig-util (#219)
  • Replace legacy ethjs with @metamask/ethjs (#219)
  • Replace legacy ethjs-query with @metamask/ethjs-query (#219)

Added

  • Add fetchSwapsFeatureFlags to fetch global and chain feature flags at once (#229)

Fixed

  • Fix bug in contract instance creation for getERC20Allowance (#241)

Changed

  • BREAKING: Replace @metamask/controllers with individual controller packages (#193) (#214) (#215)
  • Bump async-mutex from ^0.3.1 to ^0.4.1 (#194)
  • Bump @metamask/auto-changelog from ^2.5.0 to ^3.4.4 (#194)
  • Replace @metamask/ethjs-query with @metamask/eth-query (#191)
  • Move dependencies from/to devDependencies (#215) (#217)
  • Fix web3 import (#212)
  • Exclude tests from dist and change target on tsconfig.json (#212)

Removed

  • Remove dependency ethereumjs-util (#192)

Added

  • Add Base constants (#206)

Changed

  • BREAKING: Bump @metamask/controllers from 26.0.0 to 33.0.0 (#139)
    • This is breaking because it changes the type of the state property usedGasEstimate. Specifically, it is now possible for the historicalBaseFeeRange, baseFeeTrend, latestPriorityFeeRange, historicalPriorityFeeRange, priorityFeeTrend, and networkCongestion properties in this object to be null.
  • BREAKING: Change chainId and supportedChainIds config options so that they must be 0x-prefixed hex strings (#184)
  • BREAKING: Change fetchEstimatedMultiLayerL1Fee constructor option so that the chainId option must be an 0x-prefixed hex string (#184)
  • BREAKING: Change getNewChainCache method so that chainId must be an 0x-prefixed hex string (#184)
  • BREAKING: Change chainId setter so that the value must be an 0x-prefixed hex string (#184)
  • BREAKING: Change chainCache state property so that it is keyed by a 0x-prefixed chain ID (#184)
  • BREAKING: Change various utility functions so that their chainId argument must be an 0x-prefixed hex string (#184)
    • getNativeSwapsToken
    • getSwapsContractAddress
    • isValidContractAddress
    • shouldEnableDirectWrapping
    • getBaseApiURL
    • getTokenMetadataURL
    • fetchTradesInfo
    • fetchTokens
    • fetchAggregatorMetadata
    • fetchTopAssets
    • fetchSwapsFeatureLiveness
    • fetchGasPrices
  • BREAKING: Bump minimum Node version to 18 (#186)
  • Update Gas API base URL from https://gas.metaswap.codefi.network to https://gas.api.cx.metamask.io (#185)

Added

  • Add Linea constants (#170)

Changed

  • Bump word-wrap from 1.2.3 to 1.2.5 (#166)

Changed

  • Update dev base url (#167)
  • Update CODEOWNERS (#156)

Added

  • Enable zkSync (#160)

Changed

  • Rename ZKSYNC to ZKSYNC_ERA (#162)
  • Bump cookiejar from 2.1.2 to 2.1.4 (#154)
  • Bump json5 from 1.0.1 to 1.0.2 (#152)

Added

  • Fetch an L1 fee for each quote on Optimism (#150)

Changed

  • Bump decode-uri-component from 0.2.0 to 0.2.2 (#148)
  • Bump qs from 6.5.2 to 6.5.3 (#149)

Fixed

  • Handle empty values for sourceToken and destinationToken (#146)

Fixed

  • Change contract addresses for Arbitrum and Optimism to lowercase (#144)

Added

  • Add support for new networks - Optimism and Arbitrum (#141)

Changed

  • Bump minimist from 1.2.5 to 1.2.6 (#118)

Added

  • Update default supported chains and add check for supported chainId on fetch methods (#113)

Changed

  • Bump @metamask/controllers from 25.1.0 to 26.0.0 (#114)

Added

  • Add Avalanche constants (#111)

Changed

  • Bump @metamask/controllers from 22.0.0 to 25.1.0 (#109)

Changed

  • Use named api urls for swap and gas (#99)

Fixed

  • Fix feature liveness types (#95)

Added

  • License file (#83)

Changed

  • Set clientId on HTTP request headers (#84)

Added

  • Add Token metadata API endpoint and function (#80)

Fixed

  • Fix unwrapping by bypassing allowance check (#76)
  • Fix polygon contract address constant (#76)

Changed

  • Moved wrapped contracts to constants (#70)
  • Use standalone gas API endpoint (#70)
  • Bump @metamask/controllers from 14.1.0 to 14.2.0 (#69)