# Changelog

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

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.8.0]

### Added

- **RemoteSigningError**: optional `apiCode` from Mimir JSON error bodies (`{ code, message, statusCode }`), so callers can branch on machine-readable codes instead of scraping the message string. `isByokWalletAlreadyExistsError` now prefers `apiCode`. ([#98](https://github.com/MetaMask/fox-sdk/pull/98))

## [2.7.0]

### Added

- **Predict relayer proxy**: optional `getHeaders` on `DepositWalletRelayerConfig` to inject headers (e.g. `Authorization`) on every POST to `{relayerUrl}/transaction`. ([#89](https://github.com/MetaMask/fox-sdk/pull/89))

### Fixed

- **BYOK wallet registration**: treat HTTP 409 `KEY_MANAGEMENT_WALLET_ALREADY_EXISTS` as idempotent success so `mm init` / keyring bootstrap can complete when the derived wallet is already on the project. ([#89](https://github.com/MetaMask/fox-sdk/pull/89))

## [2.6.0]

### Added

- Polymarket Data API: **`getPolymarketActivity`** / **`toolkit.data.getActivity`** for user activity (`/activity`), including redeem history filters (`type`, `market`, `limit`, `offset`, `sortBy`, `sortDirection`, `side`). ([#87](https://github.com/MetaMask/fox-sdk/pull/87))

## [2.5.0]

### Changed

- Polymarket: support market tick sizes `0.005` and `0.0025` (allowlist + rounding config), bump `@polymarket/clob-client-v2` to `^1.1.0`, and use integer-scaled price/tick alignment so quarter-cent prices validate correctly. ([#85](https://github.com/MetaMask/fox-sdk/pull/85))

## [2.4.0]

### Added

- **`bridgeQuoteId`** pass-through on transaction submission: `SignatureRequestContext.bridgeQuoteId` is forwarded on `POST /transaction-requests` bodies (eip1559, ERC-7821, BYOK-signed, and gasless relay) next to `txIntent`, and exposed on the client surface via `RemoteRequestOpts.bridgeQuoteId`, a fourth `submitTransaction` parameter, and the `submitErc7821Batch` / `submitGaslessRelay` options. Links a request to the bridge-api quote it executes (ADR-0059); no behavior when absent. ([#82](https://github.com/MetaMask/fox-sdk/pull/82))

## [2.3.1]

### Changed

- chore: pin `tsdown>rolldown` to 1.1.5 and run `verify-dist-exports` after `tsdown` in `build` / `build:prod`

### Fixed

- fix: prevent invalid minified `dist` shared chunks that exported `Tool` without a binding, which broke downstream bundlers (e.g. agentic-cli production build) ([#80](https://github.com/MetaMask/fox-sdk/pull/80))

## [2.3.0]

### Added

- feat: add ERC-7821 paid batch submit path (`submitErc7821Batch` / `sendErc7821Batch`) for BYOK and server wallets ([#76](https://github.com/MetaMask/fox-sdk/pull/76))

### Fixed

- fix: sign ERC-7821 BYOK EIP-7702 authorization at `txNonce + 1` when the EOA is the type-4 sender ([#76](https://github.com/MetaMask/fox-sdk/pull/76))
- fix: estimate ERC-7821 first-upgrade batch gas against the delegated code (state-override) instead of the codeless EOA, preventing out-of-gas reverts in BYOK and server modes ([#76](https://github.com/MetaMask/fox-sdk/pull/76))

## [2.2.0]

### Added

- feat: add unified MFA approval lookup via `getMfaApproval(requestId)` on `RemoteSigningClient`, server/BYOK adapters, and `ControllerEVMWalletClient` ([#74](https://github.com/MetaMask/fox-sdk/pull/74))

## [2.1.0]

### Added

- feat(MMAI-489): add gasless EIP-7702 relay submission via Mimir ([#66](https://github.com/MetaMask/fox-sdk/pull/66))

### Fixed

- fix(MMAI-812): beacon-aware deposit wallet derivation ([#67](https://github.com/MetaMask/fox-sdk/pull/67))

## [2.0.0]

### Added

- feat: integrate byok with server apis ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- feat(evm): export `evmByokAdapter`, `RemoteSigningClient`, `RemoteSigningClientDeps`, `isSignRequestTerminal`, and `buildTypedDataSignaturePayload` from `@metamask/fox-sdk/wallets/evm` ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- feat(keyring): export `WalletRegistrationConfig`, `ByokChallenge`, and `RegisteredByokWallet`; add `ByokKeyring.registerWallet()` for registering existing roster wallets server-side ([#64](https://github.com/MetaMask/fox-sdk/pull/64))

### Changed

- **Breaking:** BYOK keyring requires remote registration — `createKeyringController` and `ByokKeyring.create` now require `registration: WalletRegistrationConfig` (`baseUrl`, `authToken`, `projectId`). Newly derived wallets are registered with the remote signing service (challenge + local signature) before entering the roster. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** `ByokChainAdapterFactory` takes server deps — factory signature changed from `() => ByokChainAdapter` to `(deps: { http: ServerKeyringHttp; projectId: string }) => ByokChainAdapter`. `EvmByokAdapter` now requires `{ http, projectId }` at construction. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** BYOK EVM transactions route through the remote signing service — `ControllerEVMWalletClient.sendTransaction` in BYOK mode no longer broadcasts in-process via `TransactionController`; it signs locally (sign-only) and submits the signed raw tx for policy evaluation and server-side broadcast, polling until terminal. `submitTransaction`, `getJobStatus`, and `awaitJob` on the wallet client now apply to server-backed BYOK as well as server mode. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** removed `ControllerEVMWalletClient.signTransactionOnly` — BYOK sign-only tx flow is internal to `submitTransaction` / `sendTransaction`. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** removed `CreateByokWalletOpts.index` — `ByokKeyring.createWallet` always allocates the next free derivation index; callers can no longer pick a slot. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** `SIGN_JOB_STATUS.APPROVED` is a new terminal success status for server-backed BYOK signature requests (policy cleared; signature comes from local signing, not the server). Update callers that exhaustively match on `SIGN_TERMINAL_STATUSES` or poll signature jobs. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** custom EVM BYOK adapters must extend `EvmByokAdapter` — registration and server-backed signing require `signPersonalMessageLocal` and related methods; otherwise `IncompatibleAdapterError` is thrown. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))
- **Breaking:** `ByokChainAdapter.importDerivedKey` must be idempotent — re-importing an already-present key must return the existing address rather than throwing. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))

### Fixed

- fix(evm): server-backed BYOK signing now treats mimir's `APPROVED` status as a terminal success and returns the locally computed signature. Previously BYOK signature requests (which the server only policy-evaluates and never signs) hung polling for a `SIGNED`/server signature that never arrives, blocking flows like `mm perps open`. `APPROVED` is added to `SIGN_JOB_STATUS`, `SIGN_TERMINAL_STATUSES`, and `isSignRequestTerminal`. ([#64](https://github.com/MetaMask/fox-sdk/pull/64))

## [1.1.0]

### Added

- feat: add requestId support for transaction and signing methods ([#61](https://github.com/MetaMask/fox-sdk/pull/61))
- feat: expose optional `requestId` on `EVMWalletClient.sendTransaction`, `signMessage`, and agent tools (`sign_message`, `sign_typed_data_evm`); export `RemoteRequestOpts`
- feat: enhance EVMWalletClient with requestId support for signing and transaction methods ([#62](https://github.com/MetaMask/fox-sdk/pull/62))

## [1.0.0]

### Changed

- chore: migrate library build from tsup to tsdown ([#59](https://github.com/MetaMask/fox-sdk/pull/59))

## [0.7.1]

### Fixed

- fix(polymarket): strip trailing slashes from relayer URL before appending proxy path ([#57](https://github.com/MetaMask/fox-sdk/pull/57))

## [0.7.0]

### Changed

- chore: bump @toruslabs/ethereum-controllers to 9.11.0 ([#55](https://github.com/MetaMask/fox-sdk/pull/55))

## [0.6.0]

### Added

- feat(polymarket): add search/series/tags Gamma APIs and slug-or-id routing helper ([#53](https://github.com/MetaMask/fox-sdk/pull/53))

## [0.5.1]

### Added

- feat(evm): add txApprovalLink to TxJobStatus and SignatureRequestStatus ([#48](https://github.com/MetaMask/fox-sdk/pull/48))
- feat(MMAI-483): deposit wallet batch intent and flatten executeBatch API ([#40](https://github.com/MetaMask/fox-sdk/pull/40))
- feat(polymarket): add `checkGeoblock` API function, `GeoblockResult` type, and `toolkit.geoblock.check` namespace ([#41](https://github.com/MetaMask/fox-sdk/pull/41))

### Changed

- chore: disable provenance in npm publish workflow ([#51](https://github.com/MetaMask/fox-sdk/pull/51))
- chore: update GitHub Actions permissions for release workflows ([#46](https://github.com/MetaMask/fox-sdk/pull/46))
- chore: bump yarn to 4.16.0 to satisfy action-npm-publish@v6 requirement ([#44](https://github.com/MetaMask/fox-sdk/pull/44))
- chore(deps): bump MetaMask/action-npm-publish from 5 to 6 ([#39](https://github.com/MetaMask/fox-sdk/pull/39))

## [0.5.0]

### Added

- feat(polymarket): forward order signing intent to signTypedData ([#37](https://github.com/MetaMask/fox-sdk/pull/37))

### Changed

- chore: drop Node 20 and tighten build output ([#35](https://github.com/MetaMask/fox-sdk/pull/35))

## [0.4.0]

### Added

- feat: enhance submitSignTypedData to include protocol and payload ([#33](https://github.com/MetaMask/fox-sdk/pull/33))
- feat(evm): terminal tracking-expired tx statuses and remote signing intent ([#32](https://github.com/MetaMask/fox-sdk/pull/32))
- feat(evm): recognise `TX_JOB_STATUS.BROADCAST_TRACKING_EXPIRED` and `CONFIRMATION_TRACKING_EXPIRED` (Mimir-backend tracking timeouts) and add them to `TX_TERMINAL_STATUSES` so `pollUntilTerminal` / `isTerminalStatus` stop polling instead of looping.
- feat(evm): optional `intent` on server-mode signing and transaction submission; forwarded as `intent` / `txIntent` on signature and transaction request bodies via `SignatureRequestContext`.
- optional `SignTypedDataRequestOptions` (`intent`, `protocol`, `protocolPayload`) on `signTypedData` and `submitSignTypedData`; forwarded via `SignatureRequestContext` in server mode for mimir typed-data policy. ([#36](https://github.com/MetaMask/fox-sdk/pull/36))

## [0.3.1]

### Added

- feat(polymarket): add createAndPostClobMarketOrder primitive and expose on toolkit.clob.postMarketOrder ([#30](https://github.com/MetaMask/fox-sdk/pull/30))

### Fixed

- fix(evm): accept BROADCASTED as terminal success in server-mode sendTransaction ([#29](https://github.com/MetaMask/fox-sdk/pull/29))

## [0.3.0]

### Added

- Add Polymarket plugin primitives ([#24](https://github.com/MetaMask/fox-sdk/pull/24))
- feat(evm): per-call PollOpts + pre-flight balance guards ([#26](https://github.com/MetaMask/fox-sdk/pull/26))

## [0.2.0]

### Added

- [Plugin] Add plugin to decode EVM calldata ([#14](https://github.com/MetaMask/fox-sdk/pull/14))

### Changed

- [Plugin] remove clear signing from decoder plugin ([#21](https://github.com/MetaMask/fox-sdk/pull/21))

### Fixed

- Fix EVM signing request handling ([#22](https://github.com/MetaMask/fox-sdk/pull/22))

## [0.1.0]

### Added

- Initial `@metamask/fox-sdk` package with the plugin runtime, EVM and Solana wallet clients, EVM controller stack, keyring abstractions, remote-signing support, and Polymarket plugin exports.
- Add a Fox SDK `loglevel` logger with default `error` level, public logger utilities, `logLevel` options on top-level construction helpers, and targeted SDK-owned warning/error logs. ([#11](https://github.com/MetaMask/fox-sdk/pull/11))
- EVM and Solana chain registries with CAIP-2 helpers, built-in chain metadata, custom-chain merging, and EVM RPC validation for consumer-managed chain configuration. ([#7](https://github.com/MetaMask/fox-sdk/pull/7))
- `changelog:validate` and `changelog:update` scripts; validate changelog with Prettier via `lint:changelog`. Ship `README.md`, `LICENSE`, `LICENSE.MIT`, `LICENSE.APACHE2`, and `CHANGELOG.md` in the npm package `files` list.

### Changed

- Support configurable EVM controller stack gas-fee behavior, including EIP-1559 compatibility toggling and gas API endpoint overrides. ([#7](https://github.com/MetaMask/fox-sdk/pull/7))
- Rename BYOK keyring API for consistency with `KEYRING_KIND.BYOK`: `LocalKeyring` → `ByokKeyring`, `EvmLocalAdapter` → `EvmByokAdapter`, `LocalMnemonicWalletInfo` → `ByokWalletInfo`, `localMnemonicWalletId` → `byokWalletId` (new wallet ids use the `byok:` prefix; legacy `local:` ids remain accepted when hydrating persisted rosters), plus related type and error renames (`ILocalKeyring` → `IByokKeyring`, etc.).
- Dual-license the package as `(MIT OR Apache-2.0)`; replace the root `LICENSE` with a choice-of-license notice and add `LICENSE.MIT` / `LICENSE.APACHE2`, following the same layout as [MetaMask/agentic#45](https://github.com/MetaMask/agentic/pull/45). ([#5](https://github.com/MetaMask/fox-sdk/pull/5))

### Fixed

- Align the `EvmRpcConfig` helper and EIP-1559 stack option with tests.

[Unreleased]: https://github.com/MetaMask/fox-sdk/compare/v2.8.0...HEAD
[2.8.0]: https://github.com/MetaMask/fox-sdk/compare/v2.7.0...v2.8.0
[2.7.0]: https://github.com/MetaMask/fox-sdk/compare/v2.6.0...v2.7.0
[2.6.0]: https://github.com/MetaMask/fox-sdk/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/MetaMask/fox-sdk/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/MetaMask/fox-sdk/compare/v2.3.1...v2.4.0
[2.3.1]: https://github.com/MetaMask/fox-sdk/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/MetaMask/fox-sdk/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/MetaMask/fox-sdk/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/MetaMask/fox-sdk/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/MetaMask/fox-sdk/compare/v1.1.0...v2.0.0
[1.1.0]: https://github.com/MetaMask/fox-sdk/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/MetaMask/fox-sdk/compare/v0.7.1...v1.0.0
[0.7.1]: https://github.com/MetaMask/fox-sdk/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/MetaMask/fox-sdk/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/MetaMask/fox-sdk/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/MetaMask/fox-sdk/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/MetaMask/fox-sdk/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/MetaMask/fox-sdk/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/MetaMask/fox-sdk/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/MetaMask/fox-sdk/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/MetaMask/fox-sdk/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/MetaMask/fox-sdk/releases/tag/v0.1.0
