From 5add29978a6192937a0f9e357381c2e676cc6397 Mon Sep 17 00:00:00 2001 From: hzhu Date: Thu, 18 May 2023 17:16:50 -0700 Subject: [PATCH] feat: the initial commit release-as: 0.0.5 --- .env.example | 2 + .github/.CONTRIBUTING.md | 55 + .github/workflows/release-please.yaml | 32 + .github/workflows/test.yml | 22 + .gitignore | 18 + LICENSE | 21 + README.md | 54 + examples/web/index.html | 125 + package-lock.json | 2428 +++++ package.json | 56 + src/abi/IZeroEx.json | 7887 +++++++++++++++++ src/constants.ts | 8 + src/index.ts | 115 + src/parsers/index.ts | 402 + src/tests/executeMetaTransaction.test.ts | 260 + src/tests/fillLimitOrder.test.ts | 114 + src/tests/fillOtcOrder.test.ts | 101 + src/tests/fillOtcOrderForEth.test.ts | 128 + src/tests/fillOtcOrderWithEth.test.ts | 126 + src/tests/fillTakerSignedOtcOrder.test.ts | 114 + .../fillTakerSignedOtcOrderForEth.test.ts | 121 + src/tests/index.test.ts | 36 + .../multiplexBatchSellEthForToken.test.ts | 189 + .../multiplexBatchSellTokenForEth.test.ts | 223 + .../multiplexBatchSellTokenForToken.test.ts | 212 + .../multiplexMultiHopSellEthForToken.test.ts | 213 + .../multiplexMultiHopSellTokenForEth.test.ts | 245 + ...multiplexMultiHopSellTokenForToken.test.ts | 207 + src/tests/permitAndCall.test.ts | 125 + src/tests/sellEthForTokenToUniswapV3.test.ts | 119 + src/tests/sellToLiquidityProvider.test.ts | 233 + src/tests/sellToPancakeSwap.test.ts | 273 + src/tests/sellToUniswap.test.ts | 118 + src/tests/sellTokenForEthToUniswapV3.test.ts | 158 + .../sellTokenForTokenToUniswapV3.test.ts | 158 + src/tests/transformERC20.test.ts | 525 ++ src/types.ts | 69 + src/utils/index.test.ts | 47 + src/utils/index.ts | 94 + tsconfig.json | 20 + 40 files changed, 15453 insertions(+) create mode 100644 .env.example create mode 100644 .github/.CONTRIBUTING.md create mode 100644 .github/workflows/release-please.yaml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 examples/web/index.html create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/abi/IZeroEx.json create mode 100644 src/constants.ts create mode 100644 src/index.ts create mode 100644 src/parsers/index.ts create mode 100644 src/tests/executeMetaTransaction.test.ts create mode 100644 src/tests/fillLimitOrder.test.ts create mode 100644 src/tests/fillOtcOrder.test.ts create mode 100644 src/tests/fillOtcOrderForEth.test.ts create mode 100644 src/tests/fillOtcOrderWithEth.test.ts create mode 100644 src/tests/fillTakerSignedOtcOrder.test.ts create mode 100644 src/tests/fillTakerSignedOtcOrderForEth.test.ts create mode 100644 src/tests/index.test.ts create mode 100644 src/tests/multiplexBatchSellEthForToken.test.ts create mode 100644 src/tests/multiplexBatchSellTokenForEth.test.ts create mode 100644 src/tests/multiplexBatchSellTokenForToken.test.ts create mode 100644 src/tests/multiplexMultiHopSellEthForToken.test.ts create mode 100644 src/tests/multiplexMultiHopSellTokenForEth.test.ts create mode 100644 src/tests/multiplexMultiHopSellTokenForToken.test.ts create mode 100644 src/tests/permitAndCall.test.ts create mode 100644 src/tests/sellEthForTokenToUniswapV3.test.ts create mode 100644 src/tests/sellToLiquidityProvider.test.ts create mode 100644 src/tests/sellToPancakeSwap.test.ts create mode 100644 src/tests/sellToUniswap.test.ts create mode 100644 src/tests/sellTokenForEthToUniswapV3.test.ts create mode 100644 src/tests/sellTokenForTokenToUniswapV3.test.ts create mode 100644 src/tests/transformERC20.test.ts create mode 100644 src/types.ts create mode 100644 src/utils/index.test.ts create mode 100644 src/utils/index.ts create mode 100644 tsconfig.json diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..83f5127 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +RPC_TEST_URL="https://rpc.flashbots.net" + \ No newline at end of file diff --git a/.github/.CONTRIBUTING.md b/.github/.CONTRIBUTING.md new file mode 100644 index 0000000..c766138 --- /dev/null +++ b/.github/.CONTRIBUTING.md @@ -0,0 +1,55 @@ +# Contributing Guide + +Thanks for your interest in contributing. Please review this guide prior to submitting a pull request. + +## Development + +Start by [forking](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and cloning the repository onto your computer. Afterwards, you can start development by installing the dependencies and running the tests. + +1. Install dependencies + +``` +npm install +``` + +2. Run tests + +``` +npm test +``` + +Once you have completed your changes, you can create a [pull request from the fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork). Project maintainers may create pull requests in the repository without a fork. + +## Pull requests + +For large or impactful change, please open an [issue](https://github.com/hzhu/eth-balances/issues/new) or [discussion](https://github.com/hzhu/eth-balances/discussions/new?category=q-a) prior to submitting a pull request. This allows the project maintainers and contributors to discuss alternatives and solutions prior to implementation. + +### Workflow + +1. Open an issue +1. Fork the repo and create a branch +1. Add new commits + 1. Commits should be [concise, descriptive, and well formatted](https://cbea.ms/git-commit/#seven-rules) + 1. Commits should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification and use the [standard headings](https://github.com/googleapis/release-please/blob/cb0f936e598c5bfb8d3e0a9c0eeb57ae59a35140/src/changelog-notes.ts#L43-L54) + 1. This repo has a linear git history and merge commits are not allowed +1. Open a new pull request on GitHub + 1. [Link](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) the issue you created earlier with the pull request + +### Dependabot + +This repository uses [Dependabot](https://docs.github.com/en/code-security/dependabot) to help [secure](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates) and [update](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#about-version-updates-for-dependencies) project dependencies. It does this by automatically opening pull requests to update package dependencies. Project maintainers are responsible for reviewing, testing, approving, and merging Dependabot pull requests. + +## Release + +Project maintainers can publish releases. Releases are automated with Google's [release-please](https://github.com/googleapis/release-please) GitHub action. Simply merge the release pull request ([release PR](https://github.com/googleapis/release-please#whats-a-release-pr)) to publish a release 🚀. + +The GitHub action parses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) to help automate releases. It creates a release PR that is kept up-to-date as additional commits are merged. The release PR can be merged once maintainers are ready to publish the release. Merging the release PR triggers the action to: + +1. Update the `CHANGELOG.md` and `package.json` +2. Tag the commit with the [version](https://semver.org/) +3. Create a GitHub release based on the tag +4. Publish [the package](https://www.npmjs.com/package/@0x/0x-parser) to npm + +## Versioning + +This project follows [Semantic Versioning 2.0](https://semver.org/) and the release tooling automatically parses the semantic version based on the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). \ No newline at end of file diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..1ac935c --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,32 @@ +on: + push: + branches: + - main +name: release-please +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: node + package-name: test-release-please + # The logic below handles the npm publication: + - uses: actions/checkout@v3 + # these if statements ensure that a publication only occurs when + # a new release is created: + if: ${{ steps.release.outputs.release_created }} + - uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: "https://registry.npmjs.org" + if: ${{ steps.release.outputs.release_created }} + - run: npm ci + if: ${{ steps.release.outputs.release_created }} + - run: npm run build + if: ${{ steps.release.outputs.release_created }} + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.release.outputs.release_created }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a87f016 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Build & Test +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - uses: actions/checkout@v3 + - run: npm ci + - run: npm run build + - run: npm test --coverage + env: + RPC_TEST_URL: "https://rpc.flashbots.net" + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./coverage/ + fail_ci_if_error: true + flags: unittests + verbose: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48db3d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# dependencies +node_modules + +# artifacts +dist + +# example artifacts +examples/web/index.esm.js +examples/node/index.cjs.js + +# coverage files +coverage + +# hardhat cache +cache + +# environment variables +.env \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7d8d3f8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2023] 0x + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ba77dc5 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# 0x-parser + +[![npm version](https://img.shields.io/npm/v/@0x/0x-parser.svg?style=flat-square)](https://www.npmjs.com/package/@0x/0x-parser) +[![build and test](https://github.com/0xproject/0x-parser/actions/workflows/test.yml/badge.svg)](https://github.com/0xproject/0x-parser/actions/workflows/test.yml) +[![codecov](https://codecov.io/gh/0xproject/0x-parser/branch/main/graph/badge.svg?token=OnNsoc2OrF)](https://codecov.io/gh/0xproject/0x-parser) + +Designed for [0x integrators](https://0x.org/docs/introduction/introduction-to-0x), this library offers a solution to parse swap amounts from 0x transactions, a task that becomes complex when trades involve Automated Market Makers (AMMs). Given the potential for [slippage](https://0x.org/post/what-is-slippage) in these trades, the final swap amounts cannot be anticipated before trade execution. This library addresses this challenge by accepting a transaction hash as input, then parsing through the event logs to identify the exact swap amounts. + +## Installation + +``` +npm install @0x/0x-parser +``` + +## Usage + +```javascript +import { parseSwap } from '@0x/0x-parser'; + +async function main() { + const { getAddress, JsonRpcProvider, Contract } = ethers; + const EXCHANGE_PROXY = "0xDef1C0ded9bec7F1a1670819833240f027b25EfF"; + const transactionHash = "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d"; + const abiUrl = "https://raw.githubusercontent.com/0xProject/protocol/development/packages/contract-artifacts/artifacts/IZeroEx.json"; + const response = await fetch(abiUrl); + const IZeroEx = await response.json(); + const { interface } = new Contract(EXCHANGE_PROXY, IZeroEx.compilerOutput.abi); + const provider = new JsonRpcProvider("https://eth.llamarpc.com"); + const [tx, txReceipt] = await Promise.all([ + provider.getTransaction(transactionHash), + provider.getTransactionReceipt(transactionHash), + ]); + const txDescription = interface.parseTransaction(tx); + const data = await parseSwap({ rpcUrl: "https://eth.llamarpc.com", txReceipt, txDescription }); + + console.log(JSON.stringify(data); +} + +main(); +``` + +## Live demo + +Try a demo app that uses 0x-parser [here](https://0x-parser-demo.vercel.app/). + +0x parser React demo app + +## Examples + +This repository includes an example you can execute locally using the `npm run web:example` command. Additionally, there's another repository that showcases how to use this package within a simple React app, which you can find [here](https://github.com/hzhu/0x-parser-demo). + +## Contributing + +Contributions are welcomed! Please follow the [contributing guidelines](./.github/.CONTRIBUTING.md). diff --git a/examples/web/index.html b/examples/web/index.html new file mode 100644 index 0000000..5b4c293 --- /dev/null +++ b/examples/web/index.html @@ -0,0 +1,125 @@ + + + + Ethereum Balances + + + + + + + +
+ + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..48bb65c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2428 @@ +{ + "name": "exchange-proxy-amounts", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "exchange-proxy-amounts", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "@vitest/coverage-c8": "^0.31.0", + "dotenv": "^16.0.3", + "esbuild": "^0.17.5", + "ethers": "^6.2.2", + "http-server": "^14.1.1", + "typescript": "^5.0.2", + "vitest": "^0.31.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz", + "integrity": "sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ==", + "dev": true + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@types/chai": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.2.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.1.tgz", + "integrity": "sha512-DqJociPbZP1lbZ5SQPk4oag6W7AyaGMO6gSfRwq3PWl4PXTwJpRQJhDq4W0kzrg3w6tJ1SwlvGZ5uKFHY13LIg==", + "dev": true + }, + "node_modules/@vitest/coverage-c8": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/coverage-c8/-/coverage-c8-0.31.1.tgz", + "integrity": "sha512-6TkjQpmgYez7e3dbAUoYdRXxWN81BojCmUILJwgCy39uZFG33DsQ0rSRSZC9beAEdCZTpxR63nOvd9hxDQcJ0g==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.1", + "c8": "^7.13.0", + "magic-string": "^0.30.0", + "picocolors": "^1.0.0", + "std-env": "^3.3.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": ">=0.30.0 <1" + } + }, + "node_modules/@vitest/expect": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.31.1.tgz", + "integrity": "sha512-BV1LyNvhnX+eNYzJxlHIGPWZpwJFZaCcOIzp2CNG0P+bbetenTupk6EO0LANm4QFt0TTit+yqx7Rxd1qxi/SQA==", + "dev": true, + "dependencies": { + "@vitest/spy": "0.31.1", + "@vitest/utils": "0.31.1", + "chai": "^4.3.7" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.31.1.tgz", + "integrity": "sha512-imWuc82ngOtxdCUpXwtEzZIuc1KMr+VlQ3Ondph45VhWoQWit5yvG/fFcldbnCi8DUuFi+NmNx5ehMUw/cGLUw==", + "dev": true, + "dependencies": { + "@vitest/utils": "0.31.1", + "concordance": "^5.0.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.31.1.tgz", + "integrity": "sha512-L3w5uU9bMe6asrNzJ8WZzN+jUTX4KSgCinEJPXyny0o90fG4FPQMV0OWsq7vrCWfQlAilMjDnOF9nP8lidsJ+g==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "pretty-format": "^27.5.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.31.1.tgz", + "integrity": "sha512-1cTpt2m9mdo3hRLDyCG2hDQvRrePTDgEJBFQQNz1ydHHZy03EiA6EpFxY+7ODaY7vMRCie+WlFZBZ0/dQWyssQ==", + "dev": true, + "dependencies": { + "tinyspy": "^2.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.31.1.tgz", + "integrity": "sha512-yFyRD5ilwojsZfo3E0BnH72pSVSuLg2356cN1tCEe/0RtDzxTPYwOomIC+eQbot7m6DRy4tPZw+09mB7NkbMmA==", + "dev": true, + "dependencies": { + "concordance": "^5.0.4", + "loupe": "^2.3.6", + "pretty-format": "^27.5.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.3.tgz", + "integrity": "sha512-/xJX0/VTPcbc5xQE2VUP91y1xN8q/rDfhEzLm+vLc3hYvb5+qHCnpJRuFcrKn63zumK/sCwYYzhG8HP78JYSTA==", + "dev": true + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/blueimp-md5": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", + "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/c8": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-7.13.0.tgz", + "integrity": "sha512-/NL4hQTv1gBL6J6ei80zu3IiTrmePDKXKXOTLpHvcIWZTVYQlDhVWjjWvkhICylE8EwwnMVzDZugCvdx0/DIIA==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^2.0.0", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.1.4", + "rimraf": "^3.0.2", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.0.0", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/concordance": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", + "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", + "dev": true, + "dependencies": { + "date-time": "^3.1.0", + "esutils": "^2.0.3", + "fast-diff": "^1.2.0", + "js-string-escape": "^1.0.1", + "lodash": "^4.17.15", + "md5-hex": "^3.0.1", + "semver": "^7.3.2", + "well-known-symbols": "^2.0.0" + }, + "engines": { + "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" + } + }, + "node_modules/concordance/node_modules/semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", + "dev": true, + "dependencies": { + "time-zone": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ethers": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.3.0.tgz", + "integrity": "sha512-CKFYvTne1YT4S1glTiu7TgGsj0t6c6GAD7evrIk8zbeUb6nK8dcUPAiAWM8uDX/1NmRTvLM9+1Vnn49hwKtEzw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.9.0", + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.7.1", + "aes-js": "4.0.0-beta.3", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-server": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz", + "integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==", + "dev": true, + "dependencies": { + "basic-auth": "^2.0.1", + "chalk": "^4.1.2", + "corser": "^2.0.1", + "he": "^1.2.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy": "^1.18.1", + "mime": "^1.6.0", + "minimist": "^1.2.6", + "opener": "^1.5.1", + "portfinder": "^1.0.28", + "secure-compare": "3.0.1", + "union": "~0.5.0", + "url-join": "^4.0.1" + }, + "bin": { + "http-server": "bin/http-server" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/md5-hex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", + "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", + "dev": true, + "dependencies": { + "blueimp-md5": "^2.10.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mlly": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.1.tgz", + "integrity": "sha512-1aMEByaWgBPEbWV2BOPEMySRrzl7rIHXmQxam4DM8jVjalTQDjpN2ZKOLUrwyhfZQO7IXHml2StcHMhooDeEEQ==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "pathe": "^1.1.0", + "pkg-types": "^1.0.3", + "ufo": "^1.1.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", + "integrity": "sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "node_modules/portfinder": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", + "integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==", + "dev": true, + "dependencies": { + "async": "^2.6.4", + "debug": "^3.2.7", + "mkdirp": "^0.5.6" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/postcss": { + "version": "8.4.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", + "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.22.0.tgz", + "integrity": "sha512-imsigcWor5Y/dC0rz2q0bBt9PabcL3TORry2hAa6O6BuMvY71bqHyfReAz5qyAqiQATD1m70qdntqBfBQjVWpQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/secure-compare": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz", + "integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==", + "dev": true + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", + "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/tinybench": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.0.tgz", + "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.5.0.tgz", + "integrity": "sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.0.tgz", + "integrity": "sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/ufo": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.2.tgz", + "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", + "dev": true + }, + "node_modules/union": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz", + "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==", + "dev": true, + "dependencies": { + "qs": "^6.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "dev": true + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/vite": { + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.8.tgz", + "integrity": "sha512-uYB8PwN7hbMrf4j1xzGDk/lqjsZvCDbt/JC5dyfxc19Pg8kRm14LinK/uq+HSLNswZEoKmweGdtpbnxRtrAXiQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.17.5", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.31.1.tgz", + "integrity": "sha512-BajE/IsNQ6JyizPzu9zRgHrBwczkAs0erQf/JRpgTIESpKvNj9/Gd0vxX905klLkb0I0SJVCKbdrl5c6FnqYKA==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.2.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vite-node/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/vitest": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.31.1.tgz", + "integrity": "sha512-/dOoOgzoFk/5pTvg1E65WVaobknWREN15+HF+0ucudo3dDG/vCZoXTQrjIfEaWvQXmqScwkRodrTbM/ScMpRcQ==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.5", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.31.1", + "@vitest/runner": "0.31.1", + "@vitest/snapshot": "0.31.1", + "@vitest/spy": "0.31.1", + "@vitest/utils": "0.31.1", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "concordance": "^5.0.4", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "std-env": "^3.3.2", + "strip-literal": "^1.0.1", + "tinybench": "^2.5.0", + "tinypool": "^0.5.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.31.1", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*", + "playwright": "*", + "safaridriver": "*", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/well-known-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", + "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..79f9641 --- /dev/null +++ b/package.json @@ -0,0 +1,56 @@ +{ + "name": "@0x/0x-parser", + "version": "0.0.4", + "description": "Parse events from the 0x protocol", + "keywords": [ + "logs", + "swap", + "erc-20", + "events", + "ethereum", + "0x protocol", + "exchange proxy" + ], + "author": "henryzhu.eth", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/0xproject/0x-parser" + }, + "bugs": { + "url": "https://github.com/0xproject/0x-parser/issues" + }, + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "types": "dist/index.d.ts", + "sideEffects": false, + "files": [ + "dist", + "src" + ], + "engines": { + "node": ">=18" + }, + "scripts": { + "start": "npm run build && cp ./dist ./public/dist", + "build": "npm run build:cjs && npm run build:esm && npm run types", + "build:esm": "esbuild src/index.ts --bundle --minify --format=esm --outfile=dist/index.esm.js", + "build:cjs": "esbuild src/index.ts --bundle --minify --platform=node --target=node18 --outfile=dist/index.cjs.js", + "build:dev": "npm run build:cjs:dev && npm run build:esm:dev && npm run types", + "build:esm:dev": "esbuild src/index.ts --bundle --format=esm --outfile=dist/index.esm.js", + "build:cjs:dev": "esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.cjs.js", + "types": "rm -rf ./dist/index.d.ts && tsc --emitDeclarationOnly --outDir ./dist", + "web:example": "npm run clean && npm run build:dev && cp ./dist/index.esm.js ./examples/web && http-server ./examples/web --port 8000 -o", + "clean": "rm -rf dist", + "test": "vitest --coverage" + }, + "devDependencies": { + "@vitest/coverage-c8": "^0.31.0", + "dotenv": "^16.0.3", + "esbuild": "^0.17.5", + "ethers": "^6.2.2", + "http-server": "^14.1.1", + "typescript": "^5.0.2", + "vitest": "^0.31.0" + } +} diff --git a/src/abi/IZeroEx.json b/src/abi/IZeroEx.json new file mode 100644 index 0000000..db16f14 --- /dev/null +++ b/src/abi/IZeroEx.json @@ -0,0 +1,7887 @@ +{ + "schemaVersion": "2.0.0", + "contractName": "IZeroEx", + "compilerOutput": { + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "ERC1155OrderCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc20FillAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "erc1155FillAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "address", + "name": "matcher", + "type": "address" + } + ], + "name": "ERC1155OrderFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "feeData", "type": "bytes" } + ], + "indexed": false, + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "name": "ERC1155OrderPreSigned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "ERC721OrderCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "matcher", + "type": "address" + } + ], + "name": "ERC721OrderFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "feeData", "type": "bytes" } + ], + "indexed": false, + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "name": "ERC721OrderPreSigned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "takerTokenFeeFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "protocolFeePaid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "pool", + "type": "bytes32" + } + ], + "name": "LimitOrderFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "inputTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "outputTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract ILiquidityProvider", + "name": "provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "LiquidityProviderSwap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "migrator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "Migrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + } + ], + "name": "OrderCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "OrderSignerRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "name": "OtcOrderFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "PairCancelledLimitOrders", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "PairCancelledRfqOrders", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldImpl", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImpl", + "type": "address" + } + ], + "name": "ProxyFunctionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "quoteSigner", + "type": "address" + } + ], + "name": "QuoteSignerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "pool", + "type": "bytes32" + } + ], + "name": "RfqOrderFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "origin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "addrs", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "RfqOrderOriginsAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "inputToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "outputToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "inputTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "outputTokenAmount", + "type": "uint256" + } + ], + "name": "TransformedERC20", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "transformerDeployer", + "type": "address" + } + ], + "name": "TransformerDeployerUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "taker", "type": "address" }, + { "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "_fillLimitOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "taker", "type": "address" }, + { "internalType": "bool", "name": "useSelfBalance", "type": "bool" }, + { "internalType": "address", "name": "recipient", "type": "address" } + ], + "name": "_fillOtcOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "taker", "type": "address" }, + { "internalType": "bool", "name": "useSelfBalance", "type": "bool" }, + { "internalType": "address", "name": "recipient", "type": "address" } + ], + "name": "_fillRfqOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.BatchSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "bool", + "name": "useSelfBalance", + "type": "bool" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { "internalType": "address", "name": "payer", "type": "address" } + ], + "internalType": "struct IMultiplexFeature.BatchSellParams", + "name": "params", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "_multiplexBatchSell", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.MultiHopSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "bool", + "name": "useSelfBalance", + "type": "bool" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { "internalType": "address", "name": "payer", "type": "address" } + ], + "internalType": "struct IMultiplexFeature.MultiHopSellParams", + "name": "params", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "_multiplexMultiHopSell", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "encodedPath", "type": "bytes" }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "address", "name": "recipient", "type": "address" } + ], + "name": "_sellHeldTokenForTokenToUniswapV3", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "encodedPath", "type": "bytes" }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "address", "name": "payer", "type": "address" } + ], + "name": "_sellTokenForTokenToUniswapV3", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "taker", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "inputTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOutputTokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "deploymentNonce", + "type": "uint32" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct ITransformERC20Feature.Transformation[]", + "name": "transformations", + "type": "tuple[]" + }, + { + "internalType": "bool", + "name": "useSelfBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct ITransformERC20Feature.TransformERC20Args", + "name": "args", + "type": "tuple" + } + ], + "name": "_transformERC20", + "outputs": [ + { + "internalType": "uint256", + "name": "outputTokenAmount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order[]", + "name": "sellOrders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "uint128[]", + "name": "erc1155TokenAmounts", + "type": "uint128[]" + }, + { + "internalType": "bytes[]", + "name": "callbackData", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "revertIfIncomplete", + "type": "bool" + } + ], + "name": "batchBuyERC1155s", + "outputs": [ + { "internalType": "bool[]", "name": "successes", "type": "bool[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order[]", + "name": "sellOrders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes[]", + "name": "callbackData", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "revertIfIncomplete", + "type": "bool" + } + ], + "name": "batchBuyERC721s", + "outputs": [ + { "internalType": "bool[]", "name": "successes", "type": "bool[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "orderNonces", + "type": "uint256[]" + } + ], + "name": "batchCancelERC1155Orders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "orderNonces", + "type": "uint256[]" + } + ], + "name": "batchCancelERC721Orders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder[]", + "name": "orders", + "type": "tuple[]" + } + ], + "name": "batchCancelLimitOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token[]", + "name": "makerTokens", + "type": "address[]" + }, + { + "internalType": "contract IERC20Token[]", + "name": "takerTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minValidSalts", + "type": "uint256[]" + } + ], + "name": "batchCancelPairLimitOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { + "internalType": "contract IERC20Token[]", + "name": "makerTokens", + "type": "address[]" + }, + { + "internalType": "contract IERC20Token[]", + "name": "takerTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minValidSalts", + "type": "uint256[]" + } + ], + "name": "batchCancelPairLimitOrdersWithSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token[]", + "name": "makerTokens", + "type": "address[]" + }, + { + "internalType": "contract IERC20Token[]", + "name": "takerTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minValidSalts", + "type": "uint256[]" + } + ], + "name": "batchCancelPairRfqOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { + "internalType": "contract IERC20Token[]", + "name": "makerTokens", + "type": "address[]" + }, + { + "internalType": "contract IERC20Token[]", + "name": "takerTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minValidSalts", + "type": "uint256[]" + } + ], + "name": "batchCancelPairRfqOrdersWithSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder[]", + "name": "orders", + "type": "tuple[]" + } + ], + "name": "batchCancelRfqOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeature.MetaTransactionData[]", + "name": "mtxs", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "batchExecuteMetaTransactions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "returnResults", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionFeeData[]", + "name": "fees", + "type": "tuple[]" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionDataV2[]", + "name": "mtxs", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "batchExecuteMetaTransactionsV2", + "outputs": [ + { + "internalType": "bytes[]", + "name": "returnResults", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder[]", + "name": "orders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "uint128[]", + "name": "takerTokenFillAmounts", + "type": "uint128[]" + }, + { + "internalType": "bool", + "name": "revertIfIncomplete", + "type": "bool" + } + ], + "name": "batchFillLimitOrders", + "outputs": [ + { + "internalType": "uint128[]", + "name": "takerTokenFilledAmounts", + "type": "uint128[]" + }, + { + "internalType": "uint128[]", + "name": "makerTokenFilledAmounts", + "type": "uint128[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder[]", + "name": "orders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "uint128[]", + "name": "takerTokenFillAmounts", + "type": "uint128[]" + }, + { + "internalType": "bool", + "name": "revertIfIncomplete", + "type": "bool" + } + ], + "name": "batchFillRfqOrders", + "outputs": [ + { + "internalType": "uint128[]", + "name": "takerTokenFilledAmounts", + "type": "uint128[]" + }, + { + "internalType": "uint128[]", + "name": "makerTokenFilledAmounts", + "type": "uint128[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder[]", + "name": "orders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "makerSignatures", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "takerSignatures", + "type": "tuple[]" + }, + { "internalType": "bool[]", "name": "unwrapWeth", "type": "bool[]" } + ], + "name": "batchFillTakerSignedOtcOrders", + "outputs": [ + { "internalType": "bool[]", "name": "successes", "type": "bool[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder[]", + "name": "orders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "batchGetLimitOrderRelevantStates", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo[]", + "name": "orderInfos", + "type": "tuple[]" + }, + { + "internalType": "uint128[]", + "name": "actualFillableTakerTokenAmounts", + "type": "uint128[]" + }, + { + "internalType": "bool[]", + "name": "isSignatureValids", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder[]", + "name": "orders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "batchGetRfqOrderRelevantStates", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo[]", + "name": "orderInfos", + "type": "tuple[]" + }, + { + "internalType": "uint128[]", + "name": "actualFillableTakerTokenAmounts", + "type": "uint128[]" + }, + { + "internalType": "bool[]", + "name": "isSignatureValids", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order[]", + "name": "sellOrders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order[]", + "name": "buyOrders", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "sellOrderSignatures", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature[]", + "name": "buyOrderSignatures", + "type": "tuple[]" + } + ], + "name": "batchMatchERC721Orders", + "outputs": [ + { + "internalType": "uint256[]", + "name": "profits", + "type": "uint256[]" + }, + { "internalType": "bool[]", "name": "successes", "type": "bool[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "sellOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "erc1155BuyAmount", + "type": "uint128" + }, + { "internalType": "bytes", "name": "callbackData", "type": "bytes" } + ], + "name": "buyERC1155", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "sellOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { "internalType": "bytes", "name": "callbackData", "type": "bytes" } + ], + "name": "buyERC721", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "orderNonce", "type": "uint256" } + ], + "name": "cancelERC1155Order", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "orderNonce", "type": "uint256" } + ], + "name": "cancelERC721Order", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "cancelLimitOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "cancelPairLimitOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "cancelPairLimitOrdersWithSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "cancelPairRfqOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minValidSalt", + "type": "uint256" + } + ], + "name": "cancelPairRfqOrdersWithSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "cancelRfqOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "createTransformWallet", + "outputs": [ + { + "internalType": "contract IFlashWallet", + "name": "wallet", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeature.MetaTransactionData", + "name": "mtx", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "executeMetaTransaction", + "outputs": [ + { "internalType": "bytes", "name": "returnResult", "type": "bytes" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionFeeData[]", + "name": "fees", + "type": "tuple[]" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionDataV2", + "name": "mtx", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "executeMetaTransactionV2", + "outputs": [ + { "internalType": "bytes", "name": "returnResult", "type": "bytes" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" }, + { "internalType": "address", "name": "impl", "type": "address" } + ], + "name": "extend", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillLimitOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillOrKillLimitOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillOrKillRfqOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillOtcOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillOtcOrderForEth", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + } + ], + "name": "fillOtcOrderWithEth", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "takerTokenFillAmount", + "type": "uint128" + } + ], + "name": "fillRfqOrder", + "outputs": [ + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "makerTokenFilledAmount", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "takerSignature", + "type": "tuple" + } + ], + "name": "fillTakerSignedOtcOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "makerSignature", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "takerSignature", + "type": "tuple" + } + ], + "name": "fillTakerSignedOtcOrderForEth", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "order", + "type": "tuple" + } + ], + "name": "getERC1155OrderHash", + "outputs": [ + { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "order", + "type": "tuple" + } + ], + "name": "getERC1155OrderInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNFTOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "orderAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "remainingAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.OrderInfo", + "name": "orderInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "order", + "type": "tuple" + } + ], + "name": "getERC721OrderHash", + "outputs": [ + { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "order", + "type": "tuple" + } + ], + "name": "getERC721OrderStatus", + "outputs": [ + { + "internalType": "enum LibNFTOrder.OrderStatus", + "name": "status", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "uint248", "name": "nonceRange", "type": "uint248" } + ], + "name": "getERC721OrderStatusBitVector", + "outputs": [ + { "internalType": "uint256", "name": "bitVector", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getLimitOrderHash", + "outputs": [ + { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getLimitOrderInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo", + "name": "orderInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerTokenFeeAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.LimitOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "getLimitOrderRelevantState", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo", + "name": "orderInfo", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "actualFillableTakerTokenAmount", + "type": "uint128" + }, + { "internalType": "bool", "name": "isSignatureValid", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeature.MetaTransactionData", + "name": "mtx", + "type": "tuple" + } + ], + "name": "getMetaTransactionExecutedBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeature.MetaTransactionData", + "name": "mtx", + "type": "tuple" + } + ], + "name": "getMetaTransactionHash", + "outputs": [ + { "internalType": "bytes32", "name": "mtxHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "mtxHash", "type": "bytes32" } + ], + "name": "getMetaTransactionHashExecutedBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionFeeData[]", + "name": "fees", + "type": "tuple[]" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionDataV2", + "name": "mtx", + "type": "tuple" + } + ], + "name": "getMetaTransactionV2ExecutedBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address payable", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expirationTimeSeconds", + "type": "uint256" + }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "contract IERC20Token", + "name": "feeToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionFeeData[]", + "name": "fees", + "type": "tuple[]" + } + ], + "internalType": "struct IMetaTransactionsFeatureV2.MetaTransactionDataV2", + "name": "mtx", + "type": "tuple" + } + ], + "name": "getMetaTransactionV2Hash", + "outputs": [ + { "internalType": "bytes32", "name": "mtxHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "mtxHash", "type": "bytes32" } + ], + "name": "getMetaTransactionV2HashExecutedBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getOtcOrderHash", + "outputs": [ + { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiryAndNonce", + "type": "uint256" + } + ], + "internalType": "struct LibNativeOrder.OtcOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getOtcOrderInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + } + ], + "internalType": "struct LibNativeOrder.OtcOrderInfo", + "name": "orderInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFeeMultiplier", + "outputs": [ + { "internalType": "uint32", "name": "multiplier", "type": "uint32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getQuoteSigner", + "outputs": [ + { "internalType": "address", "name": "signer", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getRfqOrderHash", + "outputs": [ + { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + } + ], + "name": "getRfqOrderInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo", + "name": "orderInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Token", + "name": "makerToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "takerToken", + "type": "address" + }, + { + "internalType": "uint128", + "name": "makerAmount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "takerAmount", + "type": "uint128" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "address", + "name": "txOrigin", + "type": "address" + }, + { "internalType": "bytes32", "name": "pool", "type": "bytes32" }, + { "internalType": "uint64", "name": "expiry", "type": "uint64" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" } + ], + "internalType": "struct LibNativeOrder.RfqOrder", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "getRfqOrderRelevantState", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "enum LibNativeOrder.OrderStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "takerTokenFilledAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNativeOrder.OrderInfo", + "name": "orderInfo", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "actualFillableTakerTokenAmount", + "type": "uint128" + }, + { "internalType": "bool", "name": "isSignatureValid", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" }, + { "internalType": "uint256", "name": "idx", "type": "uint256" } + ], + "name": "getRollbackEntryAtIndex", + "outputs": [ + { "internalType": "address", "name": "impl", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" } + ], + "name": "getRollbackLength", + "outputs": [ + { + "internalType": "uint256", + "name": "rollbackLength", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTransformWallet", + "outputs": [ + { + "internalType": "contract IFlashWallet", + "name": "wallet", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTransformerDeployer", + "outputs": [ + { "internalType": "address", "name": "deployer", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "signer", "type": "address" } + ], + "name": "isValidOrderSigner", + "outputs": [ + { "internalType": "bool", "name": "isAllowed", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "txOrigin", "type": "address" }, + { "internalType": "uint64", "name": "nonceBucket", "type": "uint64" } + ], + "name": "lastOtcTxOriginNonce", + "outputs": [ + { "internalType": "uint128", "name": "lastNonce", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "sellOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "buyOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "sellOrderSignature", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "buyOrderSignature", + "type": "tuple" + } + ], + "name": "matchERC721Orders", + "outputs": [ + { "internalType": "uint256", "name": "profit", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "migrate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.BatchSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexBatchSellEthForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.BatchSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexBatchSellTokenForEth", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.BatchSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexBatchSellTokenForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.MultiHopSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexMultiHopSellEthForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.MultiHopSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexMultiHopSellTokenForEth", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "enum IMultiplexFeature.MultiplexSubcall", + "name": "id", + "type": "uint8" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct IMultiplexFeature.MultiHopSellSubcall[]", + "name": "calls", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + } + ], + "name": "multiplexMultiHopSellTokenForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "operator", "type": "address" }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "onERC1155Received", + "outputs": [ + { "internalType": "bytes4", "name": "success", "type": "bytes4" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "operator", "type": "address" }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "onERC721Received", + "outputs": [ + { "internalType": "bytes4", "name": "success", "type": "bytes4" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "ownerAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "order", + "type": "tuple" + } + ], + "name": "preSignERC1155Order", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "order", + "type": "tuple" + } + ], + "name": "preSignERC721Order", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "signer", "type": "address" }, + { "internalType": "bool", "name": "allowed", "type": "bool" } + ], + "name": "registerAllowedOrderSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "origins", + "type": "address[]" + }, + { "internalType": "bool", "name": "allowed", "type": "bool" } + ], + "name": "registerAllowedRfqOrigins", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" }, + { "internalType": "address", "name": "targetImpl", "type": "address" } + ], + "name": "rollback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "buyOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "erc1155SellAmount", + "type": "uint128" + }, + { + "internalType": "bool", + "name": "unwrapNativeToken", + "type": "bool" + }, + { "internalType": "bytes", "name": "callbackData", "type": "bytes" } + ], + "name": "sellERC1155", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "buyOrder", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "unwrapNativeToken", + "type": "bool" + }, + { "internalType": "bytes", "name": "callbackData", "type": "bytes" } + ], + "name": "sellERC721", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "encodedPath", "type": "bytes" }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "address", "name": "recipient", "type": "address" } + ], + "name": "sellEthForTokenToUniswapV3", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "internalType": "contract ILiquidityProvider", + "name": "provider", + "type": "address" + }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "bytes", "name": "auxiliaryData", "type": "bytes" } + ], + "name": "sellToLiquidityProvider", + "outputs": [ + { + "internalType": "uint256", + "name": "boughtAmount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { + "internalType": "enum IPancakeSwapFeature.ProtocolFork", + "name": "fork", + "type": "uint8" + } + ], + "name": "sellToPancakeSwap", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "bool", "name": "isSushi", "type": "bool" } + ], + "name": "sellToUniswap", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "encodedPath", "type": "bytes" }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + } + ], + "name": "sellTokenForEthToUniswapV3", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "encodedPath", "type": "bytes" }, + { + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBuyAmount", + "type": "uint256" + }, + { "internalType": "address", "name": "recipient", "type": "address" } + ], + "name": "sellTokenForTokenToUniswapV3", + "outputs": [ + { "internalType": "uint256", "name": "buyAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "quoteSigner", + "type": "address" + } + ], + "name": "setQuoteSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "transformerDeployer", + "type": "address" + } + ], + "name": "setTransformerDeployer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + ], + "name": "supportInterface", + "outputs": [ + { "internalType": "bool", "name": "isSupported", "type": "bool" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "poolIds", + "type": "bytes32[]" + } + ], + "name": "transferProtocolFeesForPools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "erc20", + "type": "address" + }, + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { + "internalType": "address payable", + "name": "recipientWallet", + "type": "address" + } + ], + "name": "transferTrappedTokensTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Token", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "contract IERC20Token", + "name": "outputToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "inputTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOutputTokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "deploymentNonce", + "type": "uint32" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct ITransformERC20Feature.Transformation[]", + "name": "transformations", + "type": "tuple[]" + } + ], + "name": "transformERC20", + "outputs": [ + { + "internalType": "uint256", + "name": "outputTokenAmount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "amount0Delta", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1Delta", + "type": "int256" + }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "uniswapV3SwapCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "order", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + } + ], + "name": "validateERC1155OrderProperties", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC1155Token", + "name": "erc1155Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc1155TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc1155TokenProperties", + "type": "tuple[]" + }, + { + "internalType": "uint128", + "name": "erc1155TokenAmount", + "type": "uint128" + } + ], + "internalType": "struct LibNFTOrder.ERC1155Order", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "validateERC1155OrderSignature", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "order", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + } + ], + "name": "validateERC721OrderProperties", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum LibNFTOrder.TradeDirection", + "name": "direction", + "type": "uint8" + }, + { "internalType": "address", "name": "maker", "type": "address" }, + { "internalType": "address", "name": "taker", "type": "address" }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "contract IERC20Token", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc20TokenAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "feeData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Fee[]", + "name": "fees", + "type": "tuple[]" + }, + { + "internalType": "contract IERC721Token", + "name": "erc721Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "erc721TokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "contract IPropertyValidator", + "name": "propertyValidator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "propertyData", + "type": "bytes" + } + ], + "internalType": "struct LibNFTOrder.Property[]", + "name": "erc721TokenProperties", + "type": "tuple[]" + } + ], + "internalType": "struct LibNFTOrder.ERC721Order", + "name": "order", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum LibSignature.SignatureType", + "name": "signatureType", + "type": "uint8" + }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct LibSignature.Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "validateERC721OrderSignature", + "outputs": [], + "stateMutability": "view", + "type": "function" + } + ], + "devdoc": { + "details": "Interface for a fully featured Exchange Proxy.", + "kind": "dev", + "methods": { + "_fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address,address)": { + "details": "Fill a limit order. Internal variant. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to `msg.sender` (not `sender`).", + "params": { + "order": "The limit order.", + "sender": "The order sender.", + "signature": "The order signature.", + "taker": "The order taker.", + "takerTokenFillAmount": "Maximum taker token to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much maker token was filled." + } + }, + "_fillOtcOrder((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32),uint128,address,bool,address)": { + "details": "Fill an OTC order for up to `takerTokenFillAmount` taker tokens. Internal variant.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order.", + "recipient": "The recipient of the bought maker tokens.", + "taker": "The address to fill the order in the context of.", + "takerTokenFillAmount": "Maximum taker token amount to fill this order with.", + "useSelfBalance": "Whether to use the Exchange Proxy's balance of input tokens." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much taker token was filled." + } + }, + "_fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address,bool,address)": { + "details": "Fill an RFQ order. Internal variant.", + "params": { + "order": "The RFQ order.", + "recipient": "The recipient of the maker tokens.", + "signature": "The order signature.", + "taker": "The order taker.", + "takerTokenFillAmount": "Maximum taker token to fill this order with.", + "useSelfBalance": "Whether to use the ExchangeProxy's transient balance of taker tokens to fill the order." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much maker token was filled." + } + }, + "_multiplexBatchSell((address,address,uint256,(uint8,uint256,bytes)[],bool,address,address),uint256)": { + "details": "Executes a multiplex BatchSell using the given parameters. Internal only.", + "params": { + "minBuyAmount": "The minimum amount of `params.outputToken` that must be bought for this function to not revert.", + "params": "The parameters for the BatchSell." + }, + "returns": { + "boughtAmount": "The amount of `params.outputToken` bought." + } + }, + "_multiplexMultiHopSell((address[],uint256,(uint8,bytes)[],bool,address,address),uint256)": { + "details": "Executes a multiplex MultiHopSell using the given parameters. Internal only.", + "params": { + "minBuyAmount": "The minimum amount of the output token that must be bought for this function to not revert.", + "params": "The parameters for the MultiHopSell." + }, + "returns": { + "boughtAmount": "The amount of the output token bought." + } + }, + "_sellHeldTokenForTokenToUniswapV3(bytes,uint256,uint256,address)": { + "details": "Sell a token for another token directly against uniswap v3. Private variant, uses tokens held by `address(this)`.", + "params": { + "encodedPath": "Uniswap-encoded path.", + "minBuyAmount": "Minimum amount of the last token in the path to buy.", + "recipient": "The recipient of the bought tokens. Can be zero for sender.", + "sellAmount": "amount of the first token in the path to sell." + }, + "returns": { + "buyAmount": "Amount of the last token in the path bought." + } + }, + "_sellTokenForTokenToUniswapV3(bytes,uint256,uint256,address,address)": { + "details": "Sell a token for another token directly against uniswap v3. Internal variant.", + "params": { + "encodedPath": "Uniswap-encoded path.", + "minBuyAmount": "Minimum amount of the last token in the path to buy.", + "payer": "The address to pull the sold tokens from.", + "recipient": "The recipient of the bought tokens. Can be zero for payer.", + "sellAmount": "amount of the first token in the path to sell." + }, + "returns": { + "buyAmount": "Amount of the last token in the path bought." + } + }, + "_transformERC20((address,address,address,uint256,uint256,(uint32,bytes)[],bool,address))": { + "details": "Internal version of `transformERC20()`. Only callable from within.", + "params": { "args": "A `TransformERC20Args` struct." }, + "returns": { + "outputTokenAmount": "The amount of `outputToken` received by the taker." + } + }, + "batchBuyERC1155s((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bytes[],bool)": { + "details": "Buys multiple ERC1155 assets by filling the given orders.", + "params": { + "callbackData": "The data (if any) to pass to the taker callback for each order. Refer to the `callbackData` parameter to for `buyERC1155`.", + "erc1155TokenAmounts": "The amounts of the ERC1155 assets to buy for each order.", + "revertIfIncomplete": "If true, reverts if this function fails to fill any individual order.", + "sellOrders": "The ERC1155 sell orders.", + "signatures": "The order signatures." + }, + "returns": { + "successes": "An array of booleans corresponding to whether each order in `orders` was successfully filled." + } + }, + "batchBuyERC721s((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[])[],(uint8,uint8,bytes32,bytes32)[],bytes[],bool)": { + "details": "Buys multiple ERC721 assets by filling the given orders.", + "params": { + "callbackData": "The data (if any) to pass to the taker callback for each order. Refer to the `callbackData` parameter to for `buyERC721`.", + "revertIfIncomplete": "If true, reverts if this function fails to fill any individual order.", + "sellOrders": "The ERC721 sell orders.", + "signatures": "The order signatures." + }, + "returns": { + "successes": "An array of booleans corresponding to whether each order in `orders` was successfully filled." + } + }, + "batchCancelERC1155Orders(uint256[])": { + "details": "Cancel multiple ERC1155 orders by their nonces. The caller should be the maker of the orders. Silently succeeds if an order with the same nonce has already been filled or cancelled.", + "params": { "orderNonces": "The order nonces." } + }, + "batchCancelERC721Orders(uint256[])": { + "details": "Cancel multiple ERC721 orders by their nonces. The caller should be the maker of the orders. Silently succeeds if an order with the same nonce has already been filled or cancelled.", + "params": { "orderNonces": "The order nonces." } + }, + "batchCancelLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[])": { + "details": "Cancel multiple limit orders. The caller must be the maker or a valid order signer. Silently succeeds if the order has already been cancelled.", + "params": { "orders": "The limit orders." } + }, + "batchCancelPairLimitOrders(address[],address[],uint256[])": { + "details": "Cancel all limit orders for a given maker and pairs with salts less than the values provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.", + "params": { + "makerTokens": "The maker tokens.", + "minValidSalts": "The new minimum valid salts.", + "takerTokens": "The taker tokens." + } + }, + "batchCancelPairLimitOrdersWithSigner(address,address[],address[],uint256[])": { + "details": "Cancel all limit orders for a given maker and pairs with salts less than the values provided. The caller must be a signer registered to the maker. Subsequent calls to this function with the same maker and pair require the new salt to be >= the old salt.", + "params": { + "maker": "The maker for which to cancel.", + "makerTokens": "The maker tokens.", + "minValidSalts": "The new minimum valid salts.", + "takerTokens": "The taker tokens." + } + }, + "batchCancelPairRfqOrders(address[],address[],uint256[])": { + "details": "Cancel all RFQ orders for a given maker and pairs with salts less than the values provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.", + "params": { + "makerTokens": "The maker tokens.", + "minValidSalts": "The new minimum valid salts.", + "takerTokens": "The taker tokens." + } + }, + "batchCancelPairRfqOrdersWithSigner(address,address[],address[],uint256[])": { + "details": "Cancel all RFQ orders for a given maker and pairs with salts less than the values provided. The caller must be a signer registered to the maker. Subsequent calls to this function with the same maker and pair require the new salt to be >= the old salt.", + "params": { + "maker": "The maker for which to cancel.", + "makerTokens": "The maker tokens.", + "minValidSalts": "The new minimum valid salts.", + "takerTokens": "The taker tokens." + } + }, + "batchCancelRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[])": { + "details": "Cancel multiple RFQ orders. The caller must be the maker or a valid order signer. Silently succeeds if the order has already been cancelled.", + "params": { "orders": "The RFQ orders." } + }, + "batchExecuteMetaTransactions((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256)[],(uint8,uint8,bytes32,bytes32)[])": { + "details": "Execute multiple meta-transactions.", + "params": { + "mtxs": "The meta-transactions.", + "signatures": "The signature by each respective `mtx.signer`." + }, + "returns": { + "returnResults": "The ABI-encoded results of the underlying calls." + } + }, + "batchExecuteMetaTransactionsV2((address,address,uint256,uint256,bytes,address,(address,uint256)[])[],(uint8,uint8,bytes32,bytes32)[])": { + "details": "Execute multiple meta-transactions.", + "params": { + "mtxs": "The meta-transactions.", + "signatures": "The signature by each respective `mtx.signer`." + }, + "returns": { + "returnResults": "The ABI-encoded results of the underlying calls." + } + }, + "batchFillLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": { + "details": "Fills multiple limit orders.", + "params": { + "orders": "Array of limit orders.", + "revertIfIncomplete": "If true, reverts if this function fails to fill the full fill amount for any individual order.", + "signatures": "Array of signatures corresponding to each order.", + "takerTokenFillAmounts": "Array of desired amounts to fill each order." + }, + "returns": { + "makerTokenFilledAmounts": "Array of amounts filled, in maker token.", + "takerTokenFilledAmounts": "Array of amounts filled, in taker token." + } + }, + "batchFillRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": { + "details": "Fills multiple RFQ orders.", + "params": { + "orders": "Array of RFQ orders.", + "revertIfIncomplete": "If true, reverts if this function fails to fill the full fill amount for any individual order.", + "signatures": "Array of signatures corresponding to each order.", + "takerTokenFillAmounts": "Array of desired amounts to fill each order." + }, + "returns": { + "makerTokenFilledAmounts": "Array of amounts filled, in maker token.", + "takerTokenFilledAmounts": "Array of amounts filled, in taker token." + } + }, + "batchFillTakerSignedOtcOrders((address,address,uint128,uint128,address,address,address,uint256)[],(uint8,uint8,bytes32,bytes32)[],(uint8,uint8,bytes32,bytes32)[],bool[])": { + "details": "Fills multiple taker-signed OTC orders.", + "params": { + "makerSignatures": "Array of maker signatures for each order.", + "orders": "Array of OTC orders.", + "takerSignatures": "Array of taker signatures for each order.", + "unwrapWeth": "Array of booleans representing whether or not to unwrap bought WETH into ETH for each order. Should be set to false if the maker token is not WETH." + }, + "returns": { + "successes": "Array of booleans representing whether or not each order in `orders` was filled successfully." + } + }, + "batchGetLimitOrderRelevantStates((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": { + "details": "Batch version of `getLimitOrderRelevantState()`, without reverting. Orders that would normally cause `getLimitOrderRelevantState()` to revert will have empty results.", + "params": { + "orders": "The limit orders.", + "signatures": "The order signatures." + }, + "returns": { + "actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.", + "isSignatureValids": "Whether each signature is valid for the order.", + "orderInfos": "Info about the orders." + } + }, + "batchGetRfqOrderRelevantStates((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": { + "details": "Batch version of `getRfqOrderRelevantState()`, without reverting. Orders that would normally cause `getRfqOrderRelevantState()` to revert will have empty results.", + "params": { + "orders": "The RFQ orders.", + "signatures": "The order signatures." + }, + "returns": { + "actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.", + "isSignatureValids": "Whether each signature is valid for the order.", + "orderInfos": "Info about the orders." + } + }, + "batchMatchERC721Orders((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[])[],(uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[])[],(uint8,uint8,bytes32,bytes32)[],(uint8,uint8,bytes32,bytes32)[])": { + "details": "Matches pairs of complementary orders that have non-negative spreads. Each order is filled at their respective price, and the matcher receives a profit denominated in the ERC20 token.", + "params": { + "buyOrderSignatures": "Signatures for the buy orders.", + "buyOrders": "Orders buying ERC721 assets.", + "sellOrderSignatures": "Signatures for the sell orders.", + "sellOrders": "Orders selling ERC721 assets." + }, + "returns": { + "profits": "The amount of profit earned by the caller of this function for each pair of matched orders (denominated in the ERC20 token of the order pair).", + "successes": "An array of booleans corresponding to whether each pair of orders was successfully matched." + } + }, + "buyERC1155((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128),(uint8,uint8,bytes32,bytes32),uint128,bytes)": { + "details": "Buys an ERC1155 asset by filling the given order.", + "params": { + "callbackData": "If this parameter is non-zero, invokes `zeroExERC1155OrderCallback` on `msg.sender` after the ERC1155 asset has been transferred to `msg.sender` but before transferring the ERC20 tokens to the seller. Native tokens acquired during the callback can be used to fill the order.", + "erc1155BuyAmount": "The amount of the ERC1155 asset to buy.", + "sellOrder": "The ERC1155 sell order.", + "signature": "The order signature." + } + }, + "buyERC721((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),(uint8,uint8,bytes32,bytes32),bytes)": { + "details": "Buys an ERC721 asset by filling the given order.", + "params": { + "callbackData": "If this parameter is non-zero, invokes `zeroExERC721OrderCallback` on `msg.sender` after the ERC721 asset has been transferred to `msg.sender` but before transferring the ERC20 tokens to the seller. Native tokens acquired during the callback can be used to fill the order.", + "sellOrder": "The ERC721 sell order.", + "signature": "The order signature." + } + }, + "cancelERC1155Order(uint256)": { + "details": "Cancel a single ERC1155 order by its nonce. The caller should be the maker of the order. Silently succeeds if an order with the same nonce has already been filled or cancelled.", + "params": { "orderNonce": "The order nonce." } + }, + "cancelERC721Order(uint256)": { + "details": "Cancel a single ERC721 order by its nonce. The caller should be the maker of the order. Silently succeeds if an order with the same nonce has already been filled or cancelled.", + "params": { "orderNonce": "The order nonce." } + }, + "cancelLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": { + "details": "Cancel a single limit order. The caller must be the maker or a valid order signer. Silently succeeds if the order has already been cancelled.", + "params": { "order": "The limit order." } + }, + "cancelPairLimitOrders(address,address,uint256)": { + "details": "Cancel all limit orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.", + "params": { + "makerToken": "The maker token.", + "minValidSalt": "The new minimum valid salt.", + "takerToken": "The taker token." + } + }, + "cancelPairLimitOrdersWithSigner(address,address,address,uint256)": { + "details": "Cancel all limit orders for a given maker and pair with a salt less than the value provided. The caller must be a signer registered to the maker. Subsequent calls to this function with the same maker and pair require the new salt to be >= the old salt.", + "params": { + "maker": "The maker for which to cancel.", + "makerToken": "The maker token.", + "minValidSalt": "The new minimum valid salt.", + "takerToken": "The taker token." + } + }, + "cancelPairRfqOrders(address,address,uint256)": { + "details": "Cancel all RFQ orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.", + "params": { + "makerToken": "The maker token.", + "minValidSalt": "The new minimum valid salt.", + "takerToken": "The taker token." + } + }, + "cancelPairRfqOrdersWithSigner(address,address,address,uint256)": { + "details": "Cancel all RFQ orders for a given maker and pair with a salt less than the value provided. The caller must be a signer registered to the maker. Subsequent calls to this function with the same maker and pair require the new salt to be >= the old salt.", + "params": { + "maker": "The maker for which to cancel.", + "makerToken": "The maker token.", + "minValidSalt": "The new minimum valid salt.", + "takerToken": "The taker token." + } + }, + "cancelRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": { + "details": "Cancel a single RFQ order. The caller must be the maker or a valid order signer. Silently succeeds if the order has already been cancelled.", + "params": { "order": "The RFQ order." } + }, + "createTransformWallet()": { + "details": "Deploy a new flash wallet instance and replace the current one with it. Useful if we somehow break the current wallet instance. Only callable by the owner.", + "returns": { "wallet": "The new wallet instance." } + }, + "executeMetaTransaction((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256),(uint8,uint8,bytes32,bytes32))": { + "details": "Execute a single meta-transaction.", + "params": { + "mtx": "The meta-transaction.", + "signature": "The signature by `mtx.signer`." + }, + "returns": { + "returnResult": "The ABI-encoded result of the underlying call." + } + }, + "executeMetaTransactionV2((address,address,uint256,uint256,bytes,address,(address,uint256)[]),(uint8,uint8,bytes32,bytes32))": { + "details": "Execute a single meta-transaction.", + "params": { + "mtx": "The meta-transaction.", + "signature": "The signature by `mtx.signer`." + }, + "returns": { + "returnResult": "The ABI-encoded result of the underlying call." + } + }, + "extend(bytes4,address)": { + "details": "Register or replace a function.", + "params": { + "impl": "The implementation contract for the function.", + "selector": "The function selector." + } + }, + "fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill a limit order. The taker and sender will be the caller.", + "params": { + "order": "The limit order. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to the caller.", + "signature": "The order signature.", + "takerTokenFillAmount": "Maximum taker token amount to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much maker token was filled." + } + }, + "fillOrKillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens. The taker will be the caller. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to the caller.", + "params": { + "order": "The limit order.", + "signature": "The order signature.", + "takerTokenFillAmount": "How much taker token to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled." + } + }, + "fillOrKillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens. The taker will be the caller.", + "params": { + "order": "The RFQ order.", + "signature": "The order signature.", + "takerTokenFillAmount": "How much taker token to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled." + } + }, + "fillOtcOrder((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill an OTC order for up to `takerTokenFillAmount` taker tokens.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order.", + "takerTokenFillAmount": "Maximum taker token amount to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much taker token was filled." + } + }, + "fillOtcOrderForEth((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill an OTC order for up to `takerTokenFillAmount` taker tokens. Unwraps bought WETH into ETH before sending it to the taker.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order.", + "takerTokenFillAmount": "Maximum taker token amount to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much taker token was filled." + } + }, + "fillOtcOrderWithEth((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32))": { + "details": "Fill an OTC order whose taker token is WETH for up to `msg.value`.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much taker token was filled." + } + }, + "fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": { + "details": "Fill an RFQ order for up to `takerTokenFillAmount` taker tokens. The taker will be the caller.", + "params": { + "order": "The RFQ order.", + "signature": "The order signature.", + "takerTokenFillAmount": "Maximum taker token amount to fill this order with." + }, + "returns": { + "makerTokenFilledAmount": "How much maker token was filled.", + "takerTokenFilledAmount": "How much maker token was filled." + } + }, + "fillTakerSignedOtcOrder((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32),(uint8,uint8,bytes32,bytes32))": { + "details": "Fully fill an OTC order. \"Meta-transaction\" variant, requires order to be signed by both maker and taker.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order.", + "takerSignature": "The order signature from the taker." + } + }, + "fillTakerSignedOtcOrderForEth((address,address,uint128,uint128,address,address,address,uint256),(uint8,uint8,bytes32,bytes32),(uint8,uint8,bytes32,bytes32))": { + "details": "Fully fill an OTC order. \"Meta-transaction\" variant, requires order to be signed by both maker and taker. Unwraps bought WETH into ETH before sending it to the taker.", + "params": { + "makerSignature": "The order signature from the maker.", + "order": "The OTC order.", + "takerSignature": "The order signature from the taker." + } + }, + "getERC1155OrderHash((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128))": { + "details": "Get the EIP-712 hash of an ERC1155 order.", + "params": { "order": "The ERC1155 order." }, + "returns": { "orderHash": "The order hash." } + }, + "getERC1155OrderInfo((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128))": { + "details": "Get the order info for an ERC1155 order.", + "params": { "order": "The ERC1155 order." }, + "returns": { "orderInfo": "Infor about the order." } + }, + "getERC721OrderHash((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]))": { + "details": "Get the EIP-712 hash of an ERC721 order.", + "params": { "order": "The ERC721 order." }, + "returns": { "orderHash": "The order hash." } + }, + "getERC721OrderStatus((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]))": { + "details": "Get the current status of an ERC721 order.", + "params": { "order": "The ERC721 order." }, + "returns": { "status": "The status of the order." } + }, + "getERC721OrderStatusBitVector(address,uint248)": { + "details": "Get the order status bit vector for the given maker address and nonce range.", + "params": { + "maker": "The maker of the order.", + "nonceRange": "Order status bit vectors are indexed by maker address and the upper 248 bits of the order nonce. We define `nonceRange` to be these 248 bits." + }, + "returns": { + "bitVector": "The order status bit vector for the given maker and nonce range." + } + }, + "getLimitOrderHash((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": { + "details": "Get the canonical hash of a limit order.", + "params": { "order": "The limit order." }, + "returns": { "orderHash": "The order hash." } + }, + "getLimitOrderInfo((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": { + "details": "Get the order info for a limit order.", + "params": { "order": "The limit order." }, + "returns": { "orderInfo": "Info about the order." } + }, + "getLimitOrderRelevantState((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": { + "details": "Get order info, fillable amount, and signature validity for a limit order. Fillable amount is determined using balances and allowances of the maker.", + "params": { + "order": "The limit order.", + "signature": "The order signature." + }, + "returns": { + "actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.", + "isSignatureValid": "Whether the signature is valid.", + "orderInfo": "Info about the order." + } + }, + "getMetaTransactionExecutedBlock((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": { + "details": "Get the block at which a meta-transaction has been executed.", + "params": { "mtx": "The meta-transaction." }, + "returns": { + "blockNumber": "The block height when the meta-transactioin was executed." + } + }, + "getMetaTransactionHash((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": { + "details": "Get the EIP712 hash of a meta-transaction.", + "params": { "mtx": "The meta-transaction." }, + "returns": { "mtxHash": "The EIP712 hash of `mtx`." } + }, + "getMetaTransactionHashExecutedBlock(bytes32)": { + "details": "Get the block at which a meta-transaction hash has been executed.", + "params": { "mtxHash": "The meta-transaction hash." }, + "returns": { + "blockNumber": "The block height when the meta-transactioin was executed." + } + }, + "getMetaTransactionV2ExecutedBlock((address,address,uint256,uint256,bytes,address,(address,uint256)[]))": { + "details": "Get the block at which a meta-transaction has been executed.", + "params": { "mtx": "The meta-transaction." }, + "returns": { + "blockNumber": "The block height when the meta-transactioin was executed." + } + }, + "getMetaTransactionV2Hash((address,address,uint256,uint256,bytes,address,(address,uint256)[]))": { + "details": "Get the EIP712 hash of a meta-transaction.", + "params": { "mtx": "The meta-transaction." }, + "returns": { "mtxHash": "The EIP712 hash of `mtx`." } + }, + "getMetaTransactionV2HashExecutedBlock(bytes32)": { + "details": "Get the block at which a meta-transaction hash has been executed.", + "params": { + "mtxHash": "The EIP712 hash of the MetaTransactionDataV2 struct." + }, + "returns": { + "blockNumber": "The block height when the meta-transactioin was executed." + } + }, + "getOtcOrderHash((address,address,uint128,uint128,address,address,address,uint256))": { + "details": "Get the canonical hash of an OTC order.", + "params": { "order": "The OTC order." }, + "returns": { "orderHash": "The order hash." } + }, + "getOtcOrderInfo((address,address,uint128,uint128,address,address,address,uint256))": { + "details": "Get the order info for an OTC order.", + "params": { "order": "The OTC order." }, + "returns": { "orderInfo": "Info about the order." } + }, + "getProtocolFeeMultiplier()": { + "details": "Get the protocol fee multiplier. This should be multiplied by the gas price to arrive at the required protocol fee to fill a native order.", + "returns": { "multiplier": "The protocol fee multiplier." } + }, + "getQuoteSigner()": { + "details": "Return the optional signer for `transformERC20()` calldata.", + "returns": { "signer": "The transform deployer address." } + }, + "getRfqOrderHash((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": { + "details": "Get the canonical hash of an RFQ order.", + "params": { "order": "The RFQ order." }, + "returns": { "orderHash": "The order hash." } + }, + "getRfqOrderInfo((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": { + "details": "Get the order info for an RFQ order.", + "params": { "order": "The RFQ order." }, + "returns": { "orderInfo": "Info about the order." } + }, + "getRfqOrderRelevantState((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": { + "details": "Get order info, fillable amount, and signature validity for an RFQ order. Fillable amount is determined using balances and allowances of the maker.", + "params": { + "order": "The RFQ order.", + "signature": "The order signature." + }, + "returns": { + "actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.", + "isSignatureValid": "Whether the signature is valid.", + "orderInfo": "Info about the order." + } + }, + "getRollbackEntryAtIndex(bytes4,uint256)": { + "details": "Retrieve an entry in the rollback history for a function.", + "params": { + "idx": "The index in the rollback history.", + "selector": "The function selector." + }, + "returns": { + "impl": "An implementation address for the function at index `idx`." + } + }, + "getRollbackLength(bytes4)": { + "details": "Retrieve the length of the rollback history for a function.", + "params": { "selector": "The function selector." }, + "returns": { + "rollbackLength": "The number of items in the rollback history for the function." + } + }, + "getTransformWallet()": { + "details": "Return the current wallet instance that will serve as the execution context for transformations.", + "returns": { "wallet": "The wallet instance." } + }, + "getTransformerDeployer()": { + "details": "Return the allowed deployer for transformers.", + "returns": { "deployer": "The transform deployer address." } + }, + "isValidOrderSigner(address,address)": { + "details": "checks if a given address is registered to sign on behalf of a maker address", + "params": { + "maker": "The maker address encoded in an order (can be a contract)", + "signer": "The address that is providing a signature" + } + }, + "lastOtcTxOriginNonce(address,uint64)": { + "details": "Get the last nonce used for a particular tx.origin address and nonce bucket.", + "params": { + "nonceBucket": "The nonce bucket index.", + "txOrigin": "The address." + }, + "returns": { "lastNonce": "The last nonce value used." } + }, + "matchERC721Orders((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),(uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),(uint8,uint8,bytes32,bytes32),(uint8,uint8,bytes32,bytes32))": { + "details": "Matches a pair of complementary orders that have a non-negative spread. Each order is filled at their respective price, and the matcher receives a profit denominated in the ERC20 token.", + "params": { + "buyOrder": "Order buying an ERC721 asset.", + "buyOrderSignature": "Signature for the buy order.", + "sellOrder": "Order selling an ERC721 asset.", + "sellOrderSignature": "Signature for the sell order." + }, + "returns": { + "profit": "The amount of profit earned by the caller of this function (denominated in the ERC20 token of the matched orders)." + } + }, + "migrate(address,bytes,address)": { + "details": "Execute a migration function in the context of the ZeroEx contract. The result of the function being called should be the magic bytes 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner. The owner will be temporarily set to `address(this)` inside the call. Before returning, the owner will be set to `newOwner`.", + "params": { + "data": "The call data.", + "newOwner": "The address of the new owner.", + "target": "The migrator contract address." + } + }, + "multiplexBatchSellEthForToken(address,(uint8,uint256,bytes)[],uint256)": { + "details": "Sells attached ETH for `outputToken` using the provided calls.", + "params": { + "calls": "The calls to use to sell the attached ETH.", + "minBuyAmount": "The minimum amount of `outputToken` that must be bought for this function to not revert.", + "outputToken": "The token to buy." + }, + "returns": { "boughtAmount": "The amount of `outputToken` bought." } + }, + "multiplexBatchSellTokenForEth(address,(uint8,uint256,bytes)[],uint256,uint256)": { + "details": "Sells `sellAmount` of the given `inputToken` for ETH using the provided calls.", + "params": { + "calls": "The calls to use to sell the input tokens.", + "inputToken": "The token to sell.", + "minBuyAmount": "The minimum amount of ETH that must be bought for this function to not revert.", + "sellAmount": "The amount of `inputToken` to sell." + }, + "returns": { "boughtAmount": "The amount of ETH bought." } + }, + "multiplexBatchSellTokenForToken(address,address,(uint8,uint256,bytes)[],uint256,uint256)": { + "details": "Sells `sellAmount` of the given `inputToken` for `outputToken` using the provided calls.", + "params": { + "calls": "The calls to use to sell the input tokens.", + "inputToken": "The token to sell.", + "minBuyAmount": "The minimum amount of `outputToken` that must be bought for this function to not revert.", + "outputToken": "The token to buy.", + "sellAmount": "The amount of `inputToken` to sell." + }, + "returns": { "boughtAmount": "The amount of `outputToken` bought." } + }, + "multiplexMultiHopSellEthForToken(address[],(uint8,bytes)[],uint256)": { + "details": "Sells attached ETH via the given sequence of tokens and calls. `tokens[0]` must be WETH. The last token in `tokens` is the output token that will ultimately be sent to `msg.sender`", + "params": { + "calls": "The sequence of calls to use for the sell.", + "minBuyAmount": "The minimum amount of output tokens that must be bought for this function to not revert.", + "tokens": "The sequence of tokens to use for the sell, i.e. `tokens[i]` will be sold for `tokens[i+1]` via `calls[i]`." + }, + "returns": { "boughtAmount": "The amount of output tokens bought." } + }, + "multiplexMultiHopSellTokenForEth(address[],(uint8,bytes)[],uint256,uint256)": { + "details": "Sells `sellAmount` of the input token (`tokens[0]`) for ETH via the given sequence of tokens and calls. The last token in `tokens` must be WETH.", + "params": { + "calls": "The sequence of calls to use for the sell.", + "minBuyAmount": "The minimum amount of ETH that must be bought for this function to not revert.", + "tokens": "The sequence of tokens to use for the sell, i.e. `tokens[i]` will be sold for `tokens[i+1]` via `calls[i]`." + }, + "returns": { "boughtAmount": "The amount of ETH bought." } + }, + "multiplexMultiHopSellTokenForToken(address[],(uint8,bytes)[],uint256,uint256)": { + "details": "Sells `sellAmount` of the input token (`tokens[0]`) via the given sequence of tokens and calls. The last token in `tokens` is the output token that will ultimately be sent to `msg.sender`", + "params": { + "calls": "The sequence of calls to use for the sell.", + "minBuyAmount": "The minimum amount of output tokens that must be bought for this function to not revert.", + "tokens": "The sequence of tokens to use for the sell, i.e. `tokens[i]` will be sold for `tokens[i+1]` via `calls[i]`." + }, + "returns": { "boughtAmount": "The amount of output tokens bought." } + }, + "onERC1155Received(address,address,uint256,uint256,bytes)": { + "details": "Callback for the ERC1155 `safeTransferFrom` function. This callback can be used to sell an ERC1155 asset if a valid ERC1155 order, signature and `unwrapNativeToken` are encoded in `data`. This allows takers to sell their ERC1155 asset without first calling `setApprovalForAll`.", + "params": { + "data": "Additional data with no specified format. If a valid ERC1155 order, signature and `unwrapNativeToken` are encoded in `data`, this function will try to fill the order using the received asset.", + "from": "The address which previously owned the token.", + "operator": "The address which called `safeTransferFrom`.", + "tokenId": "The ID of the asset being transferred.", + "value": "The amount being transferred." + }, + "returns": { + "success": "The selector of this function (0xf23a6e61), indicating that the callback succeeded." + } + }, + "onERC721Received(address,address,uint256,bytes)": { + "details": "Callback for the ERC721 `safeTransferFrom` function. This callback can be used to sell an ERC721 asset if a valid ERC721 order, signature and `unwrapNativeToken` are encoded in `data`. This allows takers to sell their ERC721 asset without first calling `setApprovalForAll`.", + "params": { + "data": "Additional data with no specified format. If a valid ERC721 order, signature and `unwrapNativeToken` are encoded in `data`, this function will try to fill the order using the received asset.", + "from": "The address which previously owned the token.", + "operator": "The address which called `safeTransferFrom`.", + "tokenId": "The ID of the asset being transferred." + }, + "returns": { + "success": "The selector of this function (0x150b7a02), indicating that the callback succeeded." + } + }, + "owner()": { + "details": "The owner of this contract.", + "returns": { "ownerAddress": "The owner address." } + }, + "preSignERC1155Order((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128))": { + "details": "Approves an ERC1155 order on-chain. After pre-signing the order, the `PRESIGNED` signature type will become valid for that order and signer.", + "params": { "order": "An ERC1155 order." } + }, + "preSignERC721Order((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]))": { + "details": "Approves an ERC721 order on-chain. After pre-signing the order, the `PRESIGNED` signature type will become valid for that order and signer.", + "params": { "order": "An ERC721 order." } + }, + "registerAllowedOrderSigner(address,bool)": { + "details": "Register a signer who can sign on behalf of msg.sender This allows one to sign on behalf of a contract that calls this function", + "params": { + "allowed": "True to register, false to unregister.", + "signer": "The address from which you plan to generate signatures" + } + }, + "registerAllowedRfqOrigins(address[],bool)": { + "details": "Mark what tx.origin addresses are allowed to fill an order that specifies the message sender as its txOrigin.", + "params": { + "allowed": "True to register, false to unregister.", + "origins": "An array of origin addresses to update." + } + }, + "rollback(bytes4,address)": { + "details": "Roll back to a prior implementation of a function.", + "params": { + "selector": "The function selector.", + "targetImpl": "The address of an older implementation of the function." + } + }, + "sellERC1155((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128),(uint8,uint8,bytes32,bytes32),uint256,uint128,bool,bytes)": { + "details": "Sells an ERC1155 asset to fill the given order.", + "params": { + "buyOrder": "The ERC1155 buy order.", + "callbackData": "If this parameter is non-zero, invokes `zeroExERC1155OrderCallback` on `msg.sender` after the ERC20 tokens have been transferred to `msg.sender` but before transferring the ERC1155 asset to the buyer.", + "erc1155SellAmount": "The amount of the ERC1155 asset to sell.", + "erc1155TokenId": "The ID of the ERC1155 asset being sold. If the given order specifies properties, the asset must satisfy those properties. Otherwise, it must equal the tokenId in the order.", + "signature": "The order signature from the maker.", + "unwrapNativeToken": "If this parameter is true and the ERC20 token of the order is e.g. WETH, unwraps the token before transferring it to the taker." + } + }, + "sellERC721((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),(uint8,uint8,bytes32,bytes32),uint256,bool,bytes)": { + "details": "Sells an ERC721 asset to fill the given order.", + "params": { + "buyOrder": "The ERC721 buy order.", + "callbackData": "If this parameter is non-zero, invokes `zeroExERC721OrderCallback` on `msg.sender` after the ERC20 tokens have been transferred to `msg.sender` but before transferring the ERC721 asset to the buyer.", + "erc721TokenId": "The ID of the ERC721 asset being sold. If the given order specifies properties, the asset must satisfy those properties. Otherwise, it must equal the tokenId in the order.", + "signature": "The order signature from the maker.", + "unwrapNativeToken": "If this parameter is true and the ERC20 token of the order is e.g. WETH, unwraps the token before transferring it to the taker." + } + }, + "sellEthForTokenToUniswapV3(bytes,uint256,address)": { + "details": "Sell attached ETH directly against uniswap v3.", + "params": { + "encodedPath": "Uniswap-encoded path, where the first token is WETH.", + "minBuyAmount": "Minimum amount of the last token in the path to buy.", + "recipient": "The recipient of the bought tokens. Can be zero for sender." + }, + "returns": { + "buyAmount": "Amount of the last token in the path bought." + } + }, + "sellToLiquidityProvider(address,address,address,address,uint256,uint256,bytes)": { + "details": "Sells `sellAmount` of `inputToken` to the liquidity provider at the given `provider` address.", + "params": { + "auxiliaryData": "Auxiliary data supplied to the `provider` contract.", + "inputToken": "The token being sold.", + "minBuyAmount": "The minimum acceptable amount of `outputToken` to buy. Reverts if this amount is not satisfied.", + "outputToken": "The token being bought.", + "provider": "The address of the on-chain liquidity provider to trade with.", + "recipient": "The recipient of the bought tokens. If equal to address(0), `msg.sender` is assumed to be the recipient.", + "sellAmount": "The amount of `inputToken` to sell." + }, + "returns": { "boughtAmount": "The amount of `outputToken` bought." } + }, + "sellToPancakeSwap(address[],uint256,uint256,uint8)": { + "details": "Efficiently sell directly to PancakeSwap (and forks).", + "params": { + "fork": "The protocol fork to use.", + "minBuyAmount": "Minimum amount of `tokens[-1]` to buy.", + "sellAmount": "of `tokens[0]` Amount to sell.", + "tokens": "Sell path." + }, + "returns": { "buyAmount": "Amount of `tokens[-1]` bought." } + }, + "sellToUniswap(address[],uint256,uint256,bool)": { + "details": "Efficiently sell directly to uniswap/sushiswap.", + "params": { + "isSushi": "Use sushiswap if true.", + "minBuyAmount": "Minimum amount of `tokens[-1]` to buy.", + "sellAmount": "of `tokens[0]` Amount to sell.", + "tokens": "Sell path." + }, + "returns": { "buyAmount": "Amount of `tokens[-1]` bought." } + }, + "sellTokenForEthToUniswapV3(bytes,uint256,uint256,address)": { + "details": "Sell a token for ETH directly against uniswap v3.", + "params": { + "encodedPath": "Uniswap-encoded path, where the last token is WETH.", + "minBuyAmount": "Minimum amount of ETH to buy.", + "recipient": "The recipient of the bought tokens. Can be zero for sender.", + "sellAmount": "amount of the first token in the path to sell." + }, + "returns": { "buyAmount": "Amount of ETH bought." } + }, + "sellTokenForTokenToUniswapV3(bytes,uint256,uint256,address)": { + "details": "Sell a token for another token directly against uniswap v3.", + "params": { + "encodedPath": "Uniswap-encoded path.", + "minBuyAmount": "Minimum amount of the last token in the path to buy.", + "recipient": "The recipient of the bought tokens. Can be zero for sender.", + "sellAmount": "amount of the first token in the path to sell." + }, + "returns": { + "buyAmount": "Amount of the last token in the path bought." + } + }, + "setQuoteSigner(address)": { + "details": "Replace the optional signer for `transformERC20()` calldata. Only callable by the owner.", + "params": { "quoteSigner": "The address of the new calldata signer." } + }, + "setTransformerDeployer(address)": { + "details": "Replace the allowed deployer for transformers. Only callable by the owner.", + "params": { + "transformerDeployer": "The address of the new trusted deployer for transformers." + } + }, + "supportInterface(bytes4)": { + "details": "Indicates whether the 0x Exchange Proxy implements a particular ERC165 interface. This function should use at most 30,000 gas.", + "params": { + "interfaceId": "The interface identifier, as specified in ERC165." + }, + "returns": { + "isSupported": "Whether the given interface is supported by the 0x Exchange Proxy." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new address.", + "params": { "newOwner": "The address that will become the owner." } + }, + "transferProtocolFeesForPools(bytes32[])": { + "details": "Transfers protocol fees from the `FeeCollector` pools into the staking contract.", + "params": { "poolIds": "Staking pool IDs" } + }, + "transferTrappedTokensTo(address,uint256,address)": { + "details": "calledFrom FundRecoveryFeature.transferTrappedTokensTo() This will be delegatecalled in the context of the Exchange Proxy instance being used.", + "params": { + "amountOut": "Amount of tokens to withdraw.", + "erc20": "ERC20 Token Address.", + "recipientWallet": "Recipient wallet address." + } + }, + "transformERC20(address,address,uint256,uint256,(uint32,bytes)[])": { + "details": "Executes a series of transformations to convert an ERC20 `inputToken` to an ERC20 `outputToken`.", + "params": { + "inputToken": "The token being provided by the sender. If `0xeee...`, ETH is implied and should be provided with the call.`", + "inputTokenAmount": "The amount of `inputToken` to take from the sender.", + "minOutputTokenAmount": "The minimum amount of `outputToken` the sender must receive for the entire transformation to succeed.", + "outputToken": "The token to be acquired by the sender. `0xeee...` implies ETH.", + "transformations": "The transformations to execute on the token balance(s) in sequence." + }, + "returns": { + "outputTokenAmount": "The amount of `outputToken` received by the sender." + } + }, + "uniswapV3SwapCallback(int256,int256,bytes)": { + "details": "The UniswapV3 pool swap callback which pays the funds requested by the caller/pool to the pool. Can only be called by a valid UniswapV3 pool.", + "params": { + "amount0Delta": "Token0 amount owed.", + "amount1Delta": "Token1 amount owed.", + "data": "Arbitrary data forwarded from swap() caller. An ABI-encoded struct of: inputToken, outputToken, fee, payer" + } + }, + "validateERC1155OrderProperties((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128),uint256)": { + "details": "If the given order is buying an ERC1155 asset, checks whether or not the given token ID satisfies the required properties specified in the order. If the order does not specify any properties, this function instead checks whether the given token ID matches the ID in the order. Reverts if any checks fail, or if the order is selling an ERC1155 asset.", + "params": { + "erc1155TokenId": "The ID of the ERC1155 asset.", + "order": "The ERC1155 order." + } + }, + "validateERC1155OrderSignature((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[],uint128),(uint8,uint8,bytes32,bytes32))": { + "details": "Checks whether the given signature is valid for the the given ERC1155 order. Reverts if not.", + "params": { + "order": "The ERC1155 order.", + "signature": "The signature to validate." + } + }, + "validateERC721OrderProperties((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),uint256)": { + "details": "If the given order is buying an ERC721 asset, checks whether or not the given token ID satisfies the required properties specified in the order. If the order does not specify any properties, this function instead checks whether the given token ID matches the ID in the order. Reverts if any checks fail, or if the order is selling an ERC721 asset.", + "params": { + "erc721TokenId": "The ID of the ERC721 asset.", + "order": "The ERC721 order." + } + }, + "validateERC721OrderSignature((uint8,address,address,uint256,uint256,address,uint256,(address,uint256,bytes)[],address,uint256,(address,bytes)[]),(uint8,uint8,bytes32,bytes32))": { + "details": "Checks whether the given signature is valid for the the given ERC721 order. Reverts if not.", + "params": { + "order": "The ERC721 order.", + "signature": "The signature to validate." + } + } + }, + "version": 1 + }, + "evm": { + "bytecode": { "object": "0x" }, + "deployedBytecode": { "immutableReferences": {}, "object": "0x" } + } + }, + "compiler": { + "name": "solc", + "version": "0.6.12+commit.27d51765", + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000, + "details": { + "yul": true, + "deduplicate": true, + "cse": true, + "constantOptimizer": true + } + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "devdoc", + "evm.bytecode.object", + "evm.bytecode.sourceMap", + "evm.deployedBytecode.object", + "evm.deployedBytecode.sourceMap", + "evm.methodIdentifiers" + ] + } + }, + "evmVersion": "istanbul" + } + }, + "chains": {} +} diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..5044dbd --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,8 @@ +export const WETH_CONTRACT_ADDRESS = + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; + +export const ZERO_EX_EXCHANGE_PROXY = + "0xDef1C0ded9bec7F1a1670819833240f027b25EfF"; + +export const ERC20_TRANSFER_EVENT_HASH = + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..a69ed71 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,115 @@ +import { + fillLimitOrder, + fillOtcOrder, + fillOtcOrderForEth, + fillOtcOrderWithEth, + fillTakerSignedOtcOrder, + fillTakerSignedOtcOrderForEth, + executeMetaTransaction, + multiplexBatchSellTokenForToken, + multiplexBatchSellTokenForEth, + multiplexBatchSellEthForToken, + multiplexMultiHopSellTokenForToken, + multiplexMultiHopSellEthForToken, + multiplexMultiHopSellTokenForEth, + permitAndCall, + sellToUniswap, + sellTokenForEthToUniswapV3, + sellEthForTokenToUniswapV3, + sellTokenForTokenToUniswapV3, + sellToLiquidityProvider, + sellToPancakeSwap, + transformERC20, +} from "./parsers"; +import { ERC20_TRANSFER_EVENT_HASH } from "./constants"; +import { erc20Rpc, formatUnits, convertHexToAddress } from "./utils"; +import { TransactionStatus } from "./types"; +import type { + Log, + LogParsers, + EnrichedTxReceipt, + EnrichedLogWithoutAmount, + ParseSwapArgs, + ProcessedLog, + TransactionReceipt, +} from "./types"; + +async function enrichLog({ + log, + rpcUrl, +}: { + log: Log; + rpcUrl: string; +}): Promise { + const [symbol, decimals] = await Promise.all([ + erc20Rpc.getSymbol(log.address, rpcUrl), + erc20Rpc.getDecimals(log.address, rpcUrl), + ]); + + return { ...log, symbol, decimals }; +} + +function processLog(log: EnrichedLogWithoutAmount): ProcessedLog { + const { topics, data, decimals, symbol, address } = log; + const { 1: fromHex, 2: toHex } = topics; + const from = convertHexToAddress(fromHex); + const to = convertHexToAddress(toHex); + const amount = formatUnits(data, decimals); + + return { to, from, symbol, amount, address, decimals }; +} + +async function enrichTxReceipt({ + txReceipt, + rpcUrl, +}: { + txReceipt: TransactionReceipt; + rpcUrl: string; +}): Promise { + const isERC20TransferEvent = (log: Log) => + log.topics[0] === ERC20_TRANSFER_EVENT_HASH; + const filteredLogs = txReceipt.logs.filter(isERC20TransferEvent); + const enrichedLogs = await Promise.all( + filteredLogs.map((log) => enrichLog({ log, rpcUrl })) + ); + const logs = enrichedLogs.map(processLog); + + return { logs, from: txReceipt.from }; +} + +export async function parseSwap({ + txReceipt, + txDescription, + rpcUrl, +}: ParseSwapArgs) { + if (txReceipt.status === TransactionStatus.REVERTED) return null; + const txReceiptEnriched = await enrichTxReceipt({ txReceipt, rpcUrl }); + const logParsers: LogParsers = { + fillLimitOrder, + fillOtcOrder, + fillOtcOrderForEth, + fillOtcOrderWithEth, + fillTakerSignedOtcOrder, + fillTakerSignedOtcOrderForEth, + executeMetaTransaction, + multiplexBatchSellTokenForToken, + multiplexBatchSellTokenForEth, + multiplexBatchSellEthForToken, + multiplexMultiHopSellTokenForToken, + multiplexMultiHopSellEthForToken, + multiplexMultiHopSellTokenForEth, + permitAndCall, + sellToUniswap, + sellTokenForEthToUniswapV3, + sellEthForTokenToUniswapV3, + sellTokenForTokenToUniswapV3, + sellToLiquidityProvider, + sellToPancakeSwap, + transformERC20, + }; + const parser = logParsers[txDescription.name]; + + return parser + ? parser({ txDescription, txReceipt: txReceiptEnriched }) + : null; +} diff --git a/src/parsers/index.ts b/src/parsers/index.ts new file mode 100644 index 0000000..717e6d0 --- /dev/null +++ b/src/parsers/index.ts @@ -0,0 +1,402 @@ +import { WETH_CONTRACT_ADDRESS, ZERO_EX_EXCHANGE_PROXY } from "../constants"; +import { extractTokenInfo } from "../utils"; +import type { EnrichedTxReceipt, TxDescription } from "../types"; + +export function sellToLiquidityProvider({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => from.toLowerCase() === log.from); + const outputLog = logs.find((log) => from.toLowerCase() === log.to); + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function multiplexMultiHopSellTokenForEth({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => from.toLowerCase() === log.from); + const outputLog = logs.find((log) => log.address === WETH_CONTRACT_ADDRESS); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function multiplexMultiHopSellEthForToken({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => log.address === WETH_CONTRACT_ADDRESS); + const outputLog = logs.find((log) => log.to === from.toLowerCase()); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function fillTakerSignedOtcOrder({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const [order] = txDescription.args; + const { logs } = txReceipt; + const { 4: maker, 5: taker } = order as string[]; + if (typeof maker === "string" && typeof taker === "string") { + const inputLog = logs.find((log) => log.from === taker.toLowerCase()); + const outputLog = logs.find((log) => log.from === maker.toLowerCase()); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } + } +} + +export function fillOtcOrder({ txReceipt }: { txReceipt: EnrichedTxReceipt }) { + const { logs, from } = txReceipt; + const fromAddress = from.toLowerCase(); + const inputLog = logs.find((log) => log.from === fromAddress); + const outputLog = logs.find((log) => log.to === fromAddress); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function fillTakerSignedOtcOrderForEth({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs } = txReceipt; + const inputLog = logs.find((log) => log.address !== WETH_CONTRACT_ADDRESS); + const outputLog = logs.find((log) => log.address === WETH_CONTRACT_ADDRESS); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function sellTokenForEthToUniswapV3({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => log.from === from.toLowerCase()); + const outputLog = logs.find((log) => log.from !== from.toLowerCase()); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function sellTokenForTokenToUniswapV3({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => from.toLowerCase() === log.from); + const outputLog = logs.find((log) => from.toLowerCase() === log.to); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function sellEthForTokenToUniswapV3({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => from.toLowerCase() !== log.to); + const outputLog = logs.find((log) => from.toLowerCase() === log.to); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function sellToUniswap({ txReceipt }: { txReceipt: EnrichedTxReceipt }) { + const [inputLog, outputLog] = txReceipt.logs; + + return extractTokenInfo(inputLog, outputLog); +} + +export function transformERC20({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const { logs } = txReceipt; + const { value } = txDescription; + + let inputLog = logs.find((log) => log.from === txReceipt.from.toLowerCase()); // doesn't exist if user sends ETH + const outputLog = logs.find((log) => log.to === txReceipt.from.toLowerCase()); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } + + if (txDescription.value && outputLog) { + // Convert to ether + const divisor = 1000000000000000000n; // 1e18, for conversion from wei to ether + const etherBigInt = value / divisor; + const remainderBigInt = value % divisor; + const ether = + Number(etherBigInt) + Number(remainderBigInt) / Number(divisor); + + return { + tokenIn: { symbol: "ETH", amount: ether.toString() }, + tokenOut: { symbol: outputLog.symbol, amount: outputLog.amount }, + }; + } +} + +export function multiplexMultiHopSellTokenForToken({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { logs, from } = txReceipt; + const inputLog = logs.find((log) => from.toLowerCase() === log.from); + const outputLog = logs.find((log) => from.toLowerCase() === log.to); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function multiplexBatchSellTokenForEth({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const { from, logs } = txReceipt; + const tokenData = { + [from.toLowerCase()]: { amount: "0", symbol: "", address: "" }, + [WETH_CONTRACT_ADDRESS.toLowerCase()]: { + amount: "0", + symbol: "", + address: "", + }, + }; + + logs.forEach(({ address, symbol, amount, from }) => { + const erc20Address = address.toLowerCase(); + if (tokenData[erc20Address]) { + tokenData[erc20Address].amount = String( + Number(tokenData[erc20Address].amount) + Number(amount) + ); + tokenData[erc20Address].symbol = symbol; + tokenData[erc20Address].address = address; + } + if (tokenData[from]) { + tokenData[from].amount = String( + Number(tokenData[from].amount) + Number(amount) + ); + tokenData[from].symbol = symbol; + tokenData[from].address = address; + } + }); + + return { + tokenIn: tokenData[from.toLowerCase()], + tokenOut: tokenData[WETH_CONTRACT_ADDRESS.toLowerCase()], + }; +} + +export function multiplexBatchSellEthForToken({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const { logs } = txReceipt; + const { args, value } = txDescription; + const { 0: outputToken } = args; + // Convert to ether + // TODO: pull into util + const divisor = 1000000000000000000n; // 1e18, for conversion from wei to ether + const etherBigInt = value / divisor; + const remainderBigInt = value % divisor; + const ether = Number(etherBigInt) + Number(remainderBigInt) / Number(divisor); + + const tokenOutAmount = logs.reduce((total, log) => { + return log.address === outputToken ? total + Number(log.amount) : total; + }, 0); + const inputLog = logs.find((log) => log.address === WETH_CONTRACT_ADDRESS); + const outputLog = logs.find((log) => log.address === outputToken); + + if (inputLog && outputLog) { + return { + tokenIn: { + symbol: inputLog.symbol, + amount: Number(ether).toString(), + address: inputLog.address, + }, + tokenOut: { + symbol: outputLog.symbol, + amount: tokenOutAmount.toString(), + address: outputLog.address, + }, + }; + } +} + +export function multiplexBatchSellTokenForToken({ + txDescription, + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const [inputContractAddress, outputContractAddress] = txDescription.args; + + if ( + typeof inputContractAddress === "string" && + typeof outputContractAddress === "string" + ) { + const tokenData = { + [inputContractAddress]: { amount: "0", symbol: "", address: "" }, + [outputContractAddress]: { amount: "0", symbol: "", address: "" }, + }; + + txReceipt.logs.forEach(({ address, symbol, amount }) => { + if (address in tokenData) { + tokenData[address].address = address; + tokenData[address].symbol = symbol; + tokenData[address].amount = ( + Number(tokenData[address].amount) + Number(amount) + ).toString(); + } + }); + + return { + tokenIn: tokenData[inputContractAddress], + tokenOut: tokenData[outputContractAddress], + }; + } +} + +export function sellToPancakeSwap({ + txReceipt, +}: { + txReceipt: EnrichedTxReceipt; +}) { + const from = txReceipt.from.toLowerCase(); + const { logs } = txReceipt; + const exchangeProxy = ZERO_EX_EXCHANGE_PROXY.toLowerCase(); + let inputLog = logs.find((log) => log.from === from); + let outputLog = logs.find((log) => log.from !== from); + + if (inputLog === undefined) { + inputLog = logs.find((log) => log.from === exchangeProxy); + outputLog = logs.find((log) => log.from !== exchangeProxy); + } + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function executeMetaTransaction({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const [metaTransaction] = txDescription.args; + const [from] = metaTransaction as string[]; + const { logs } = txReceipt; + if (typeof from === "string") { + const inputLog = logs.find((log) => log.from === from.toLowerCase()); + const outputLog = logs.find((log) => log.to === from.toLowerCase()); + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } + } +} + +export function fillOtcOrderForEth({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const { logs } = txReceipt; + const [order] = txDescription.args; + const [makerToken, takerToken] = order as string[]; + const inputLog = logs.find((log) => log.address === takerToken); + const outputLog = logs.find((log) => log.address === makerToken); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } +} + +export function fillOtcOrderWithEth({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + return fillOtcOrderForEth({ txReceipt, txDescription }); +} + +export function fillLimitOrder({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const [order] = txDescription.args; + const { 5: maker, 6: taker } = order as string[]; + const { logs } = txReceipt; + if (typeof maker === "string" && typeof taker === "string") { + const inputLog = logs.find((log) => log.from === taker.toLowerCase()); + const outputLog = logs.find((log) => log.from === maker.toLowerCase()); + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } + } +} + +export function permitAndCall({ + txReceipt, + txDescription, +}: { + txReceipt: EnrichedTxReceipt; + txDescription: TxDescription; +}) { + const { 1: owner } = txDescription.args; + const { logs } = txReceipt; + if (typeof owner === "string") { + const inputLog = logs.find((log) => log.from === owner.toLowerCase()); + const outputLog = logs.find((log) => log.to === owner.toLowerCase()); + + if (inputLog && outputLog) { + return extractTokenInfo(inputLog, outputLog); + } + } +} diff --git a/src/tests/executeMetaTransaction.test.ts b/src/tests/executeMetaTransaction.test.ts new file mode 100644 index 0000000..d3ab41f --- /dev/null +++ b/src/tests/executeMetaTransaction.test.ts @@ -0,0 +1,260 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +const RPC_TEST_URL = "https://polygon-rpc.com"; + +// https://polygonscan.com/tx/0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + contractAddress: null, + cumulativeGasUsed: "11523566", + from: "0xEFF023Bb006dA503414507062BB4B86291e8707f", + gasPrice: "95746470026", + gasUsed: "355245", + hash: "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + index: 70, + logs: [ + { + _type: "log", + address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000769a45b377c81000", + index: 275, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000031664cb83f778d7c7b73923d2c7525b3856adea1", + "0x000000000000000000000000db6f1920a889355780af7570773609bd8cb1f498", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000000000000097afdd", + index: 276, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000a374094527e1673a86de625aa59517c5de346d32", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000769a45b377c81000", + index: 277, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000db6f1920a889355780af7570773609bd8cb1f498", + "0x000000000000000000000000a374094527e1673a86de625aa59517c5de346d32", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0xA374094527e1673A86dE625aa59517c5dE346d32", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000769a45b377c81000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6850230000000000000000000000000000000000000000000012195a9f8bea81acd2370000000000000000000000000000000000000000000000023cc1a8a33f0848fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbce88", + index: 278, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x553d3D295e0f695B9228246232eDF400ed3560B5", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x00000000000000000000000000000000000000000000000000115aa5b92dd104", + index: 279, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cca15d926b707119f6b74b559df3aaecc14f2d88", + "0x000000000000000000000000db6f1920a889355780af7570773609bd8cb1f498", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000000000000097afdd", + index: 280, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x000000000000000000000000cca15d926b707119f6b74b559df3aaecc14f2d88", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0xcCA15D926B707119F6B74B559DF3aaeCc14f2D88", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x000000000000000000000000000000000000000000000000000000000097afddffffffffffffffffffffffffffffffffffffffffffffffffffeea55a46d22efc00000000000000000000000000000000000056b7fc4582c781daf3d9e64c7ccd000000000000000000000000000000000000000000000000001a3baafd4c60200000000000000000000000000000000000000000000000000000000000030de6", + index: 281, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x000000000000000000000000db6f1920a889355780af7570773609bd8cb1f498", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0xdB6f1920A889355780aF7570773609Bd8Cb1f498", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000553d3d295e0f695b9228246232edf400ed3560b5000000000000000000000000000000000000000000000000769a45b377c8100000000000000000000000000000000000000000000000000000115aa5b92dd104", + index: 282, + topics: [ + "0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x553d3D295e0f695B9228246232eDF400ed3560B5", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x00000000000000000000000000000000000000000000000000115aa5b92dd104", + index: 283, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000db6f1920a889355780af7570773609bd8cb1f498", + "0x00000000000000000000000031664cb83f778d7c7b73923d2c7525b3856adea1", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000553d3d295e0f695b9228246232edf400ed3560b5000000000000000000000000000000000000000000000000769a45b377c8100000000000000000000000000000000000000000000000000000115aa5b92dd104", + index: 284, + topics: [ + "0x0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b3", + "0x00000000000000000000000031664cb83f778d7c7b73923d2c7525b3856adea1", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x8965801e1ffb5159f46aaa70d496f46652c90fea23373853076b65a88dff6cad00000000000000000000000031664cb83f778d7c7b73923d2c7525b3856adea10000000000000000000000000000000000000000000000000000000000000000", + index: 285, + topics: [ + "0x7f4fe3ff8ae440e1570c558da08440b26f89fb1c1f2910cd91ca6452955f121a", + "0x415565b000000000000000000000000000000000000000000000000000000000", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + { + _type: "log", + address: "0x0000000000000000000000000000000000001010", + blockHash: + "0xc36d68a3fd02de82b5f269e1da00b59484972ff31de481ad7602ce5dd13d9909", + blockNumber: 41158717, + data: "0x00000000000000000000000000000000000000000000000000271fe59507be000000000000000000000000000000000000000000000000006dc321e97d3e0236000000000000000000000000000000000000000000000027a6d282f8cd8f95440000000000000000000000000000000000000000000000006d9c0203e8364436000000000000000000000000000000000000000000000027a6f9a2de62975344", + index: 286, + topics: [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x000000000000000000000000eff023bb006da503414507062bb4b86291e8707f", + "0x000000000000000000000000fb960a9450fc2f5dc8c6b1172932b678e287835f", + ], + transactionHash: + "0xaa61b2058fafae1532565b6acadf47a8fe604518185f535e2780dd28d626e0ef", + transactionIndex: 70, + }, + ], + logsBloom: + "0x00008002400000008200001000000010000000000001000408000000000000000001000000000010000000000000000000008100000020000000000000000000000040000000408800000008800100800000000000000000000100040000000000020000000000000000501000000000000001000008000180000010000800000401000000000000000000000010020000000000000000000000000000200000208000000000420002000000a00001004000000040000000000000000000004001000002000000000001000000000000000040000000000000110000000000000000008400000000200000080000000400000000020000000000000000101800", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for executeMetaTransaction", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "executeMetaTransaction", + value: 0n, + args: [ + [ + "0x31664Cb83F778D7c7b73923d2C7525B3856aDeA1", + "0x0000000000000000000000000000000000000000", + 0n, + 281474976710656n, + 1680667969n, + 79811209246722451623134147689819430775848477880561947478557515978224307364135n, + ], + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WMATIC", + amount: "8.54621988", + address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + }, + tokenOut: { + symbol: "PAXG", + amount: "0.00488474242697242", + address: '0x553d3D295e0f695B9228246232eDF400ed3560B5', + }, + }); +}); diff --git a/src/tests/fillLimitOrder.test.ts b/src/tests/fillLimitOrder.test.ts new file mode 100644 index 0000000..00f7c12 --- /dev/null +++ b/src/tests/fillLimitOrder.test.ts @@ -0,0 +1,114 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xbe734b761ccd45cc60a5b4828eb83da96405d663567a46041b049627dddf347d +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x97a80464d17d1eecbbd18818dfead2dc8ee369b7cccd5ebf9b0a95f29f72563f", + blockNumber: 15929322, + contractAddress: null, + cumulativeGasUsed: "15712504", + from: "0xa3b807A0B8E8Dd237eba760aB25be60349F3BF76", + gasPrice: "12533139833", + gasUsed: "158198", + hash: "0xbe734b761ccd45cc60a5b4828eb83da96405d663567a46041b049627dddf347d", + index: 192, + logs: [ + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x97a80464d17d1eecbbd18818dfead2dc8ee369b7cccd5ebf9b0a95f29f72563f", + blockNumber: 15929322, + data: "0x0000000000000000000000000000000000000000000000000000000000186a00", + index: 366, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000a3b807a0b8e8dd237eba760ab25be60349f3bf76", + "0x00000000000000000000000096d3e863ecc5999e6833e73d807e554bb6cd6488", + ], + transactionHash: + "0xbe734b761ccd45cc60a5b4828eb83da96405d663567a46041b049627dddf347d", + transactionIndex: 192, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x97a80464d17d1eecbbd18818dfead2dc8ee369b7cccd5ebf9b0a95f29f72563f", + blockNumber: 15929322, + data: "0x00000000000000000000000000000000000000000000000000038d7ea4c68000", + index: 367, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000096d3e863ecc5999e6833e73d807e554bb6cd6488", + "0x000000000000000000000000a3b807a0b8e8dd237eba760ab25be60349f3bf76", + ], + transactionHash: + "0xbe734b761ccd45cc60a5b4828eb83da96405d663567a46041b049627dddf347d", + transactionIndex: 192, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x97a80464d17d1eecbbd18818dfead2dc8ee369b7cccd5ebf9b0a95f29f72563f", + blockNumber: 15929322, + data: "0xcfefbae3b29314e9067f2d43524b806bbda7485c8125ba2ad33bcef8c4ae27e900000000000000000000000096d3e863ecc5999e6833e73d807e554bb6cd6488000000000000000000000000a3b807a0b8e8dd237eba760ab25be60349f3bf760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + index: 368, + topics: [ + "0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124", + ], + transactionHash: + "0xbe734b761ccd45cc60a5b4828eb83da96405d663567a46041b049627dddf347d", + transactionIndex: 192, + }, + ], + logsBloom: + "0x00000000000000000000000000000000800000000000000000000000000000000000200000000000200000000000010002000000080000000000000000000000000000000000000000000008000000000000000000000000000001000000000004000000080000000000000000000000000000000000200000000010000000000000000000000000000000000000000000000000000000000000000000100000008000000000000000000080000000000000000000000000000000000000004001000002000000000000000000000000000000000000010000000000000000000020200000000000000000000000000000000000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses fillLimitOrder", async () => { + const order = [ + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + 1000000000000000n, + 1600000n, + 0n, + "0x96d3e863eCc5999e6833E73d807E554Bb6Cd6488", + "0xa3b807A0B8E8Dd237eba760aB25be60349F3BF76", + ]; + const data = await parseSwap({ + txReceipt, + txDescription: { + value: 0n, + name: "fillLimitOrder", + args: [order], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDT", + amount: "1.6", + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + }, + tokenOut: { + symbol: "WETH", + amount: "0.001", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + }); +}); diff --git a/src/tests/fillOtcOrder.test.ts b/src/tests/fillOtcOrder.test.ts new file mode 100644 index 0000000..c2e9da5 --- /dev/null +++ b/src/tests/fillOtcOrder.test.ts @@ -0,0 +1,101 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xc9579b9e3cddebd3d48ccb0a719456d7c46869b2c3a536509ea88685c7a5efbb +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x978b109abda1469e3e6e1a5fd7f522f8482abb25c8627de1af5acd0af721de87", + blockNumber: 16880870, + contractAddress: null, + cumulativeGasUsed: "9377472", + from: "0x055B29979f6BC27669Ebd54182588FeF12ffBFc0", + gasPrice: "11664655136", + gasUsed: "194083", + hash: "0xc9579b9e3cddebd3d48ccb0a719456d7c46869b2c3a536509ea88685c7a5efbb", + index: 88, + logs: [ + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x978b109abda1469e3e6e1a5fd7f522f8482abb25c8627de1af5acd0af721de87", + blockNumber: 16880870, + data: "0x0000000000000000000000000000000000000000000000000000000ba43b7400", + index: 247, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000055b29979f6bc27669ebd54182588fef12ffbfc0", + "0x000000000000000000000000bb289bc97591f70d8216462df40ed713011b968a", + ], + transactionHash: + "0xc9579b9e3cddebd3d48ccb0a719456d7c46869b2c3a536509ea88685c7a5efbb", + transactionIndex: 88, + }, + { + _type: "log", + address: "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32", + blockHash: + "0x978b109abda1469e3e6e1a5fd7f522f8482abb25c8627de1af5acd0af721de87", + blockNumber: 16880870, + data: "0x000000000000000000000000000000000000000000000478f1eefdb98b400000", + index: 248, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000bb289bc97591f70d8216462df40ed713011b968a", + "0x000000000000000000000000055b29979f6bc27669ebd54182588fef12ffbfc0", + ], + transactionHash: + "0xc9579b9e3cddebd3d48ccb0a719456d7c46869b2c3a536509ea88685c7a5efbb", + transactionIndex: 88, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x978b109abda1469e3e6e1a5fd7f522f8482abb25c8627de1af5acd0af721de87", + blockNumber: 16880870, + data: "0x3e1ae2d0a141e6ca72069c001e1371c4d4c52219fd8cb74f4d5cddef128d4d29000000000000000000000000bb289bc97591f70d8216462df40ed713011b968a000000000000000000000000055b29979f6bc27669ebd54182588fef12ffbfc00000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b32000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000478f1eefdb98b4000000000000000000000000000000000000000000000000000000000000ba43b7400", + index: 249, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0xc9579b9e3cddebd3d48ccb0a719456d7c46869b2c3a536509ea88685c7a5efbb", + transactionIndex: 88, + }, + ], + logsBloom: + "0x00000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000010000000000000000000000000200000000000000000000000010000008000000040000000000000000000000000000000001000000000000000000000000000400000000000000000000000010000000000000000000000000000400000000000000000000000000000000002000100000008000000000000000000080000000000000004004000000000000000000004001000002000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for fillOtcOrder", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "fillOtcOrder", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDT", + amount: "50000", + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + }, + tokenOut: { + symbol: "LDO", + amount: "21120.508370504671821824", + address: '0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32', + }, + }); +}); diff --git a/src/tests/fillOtcOrderForEth.test.ts b/src/tests/fillOtcOrderForEth.test.ts new file mode 100644 index 0000000..651d4bf --- /dev/null +++ b/src/tests/fillOtcOrderForEth.test.ts @@ -0,0 +1,128 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xc3f1b620ee5300ea7acac1b6ddaa377616aadc6949f5103e78fee5a728f0119c", + blockNumber: 16887703, + contractAddress: null, + cumulativeGasUsed: "1440675", + from: "0x5Ef3D4F41791f0B9f1CEe6D739d77748f81FCa3A", + gasPrice: "14945943523", + gasUsed: "108287", + hash: "0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7", + index: 9, + logs: [ + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0xc3f1b620ee5300ea7acac1b6ddaa377616aadc6949f5103e78fee5a728f0119c", + blockNumber: 16887703, + data: "0x000000000000000000000000000000000000000000000000000000000d0526a0", + index: 56, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000005ef3d4f41791f0b9f1cee6d739d77748f81fca3a", + "0x000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab927", + ], + transactionHash: + "0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7", + transactionIndex: 9, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xc3f1b620ee5300ea7acac1b6ddaa377616aadc6949f5103e78fee5a728f0119c", + blockNumber: 16887703, + data: "0x00000000000000000000000000000000000000000000000001bda6f1d0fa2e18", + index: 57, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab927", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7", + transactionIndex: 9, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xc3f1b620ee5300ea7acac1b6ddaa377616aadc6949f5103e78fee5a728f0119c", + blockNumber: 16887703, + data: "0x00000000000000000000000000000000000000000000000001bda6f1d0fa2e18", + index: 58, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7", + transactionIndex: 9, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xc3f1b620ee5300ea7acac1b6ddaa377616aadc6949f5103e78fee5a728f0119c", + blockNumber: 16887703, + data: "0xdc6e2ed72927795b58577a1792e88664b554696382148c1901046689ffe9b54c000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab9270000000000000000000000005ef3d4f41791f0b9f1cee6d739d77748f81fca3a000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000001bda6f1d0fa2e18000000000000000000000000000000000000000000000000000000000d0526a0", + index: 59, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0x2c4cee137659650ef486fb46b657ec37c1b4fe18489956a5e058cf5585328fa7", + transactionIndex: 9, + }, + ], + logsBloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010002000000080000000000000200000000000000000000002000000008000000000000200000400040000100000000000000000000000000000000000000000440000000000000040000000010000000000000000000000000000000000000000000000000000000000000000000100000008000000000000000014080000000000000000000000000000000000000004001000002000000000000000000008000000000000000000000000002000000000000200000000020000000000000000000000800000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for fillOtcOrderForEth", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "fillOtcOrderForEth", + value: 0n, + args: [ + [ + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + 125439922159627800n, + 218441376n, + ], + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDT", + amount: "218.441376", + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + }, + tokenOut: { + symbol: "WETH", + amount: "0.1254399221596278", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + }); +}); diff --git a/src/tests/fillOtcOrderWithEth.test.ts b/src/tests/fillOtcOrderWithEth.test.ts new file mode 100644 index 0000000..af82c02 --- /dev/null +++ b/src/tests/fillOtcOrderWithEth.test.ts @@ -0,0 +1,126 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x7979e3b04a458bbaa17530c78243887f3d987f500fc2c9e43151f9ac2a018d95", + blockNumber: 16788305, + contractAddress: null, + cumulativeGasUsed: "10895112", + from: "0xaeDC687fa5376d2Fe9D4B81EbFC8C2bA30ba54aE", + gasPrice: "33567480136", + gasUsed: "123918", + hash: "0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53", + index: 121, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x7979e3b04a458bbaa17530c78243887f3d987f500fc2c9e43151f9ac2a018d95", + blockNumber: 16788305, + data: "0x0000000000000000000000000000000000000000000000000c7d713b49da0000", + index: 286, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53", + transactionIndex: 121, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x7979e3b04a458bbaa17530c78243887f3d987f500fc2c9e43151f9ac2a018d95", + blockNumber: 16788305, + data: "0x0000000000000000000000000000000000000000000000000c7d713b49da0000", + index: 287, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab927", + ], + transactionHash: + "0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53", + transactionIndex: 121, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0x7979e3b04a458bbaa17530c78243887f3d987f500fc2c9e43151f9ac2a018d95", + blockNumber: 16788305, + data: "0x00000000000000000000000000000000000000000000000000000000527f4c9c", + index: 288, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab927", + "0x000000000000000000000000aedc687fa5376d2fe9d4b81ebfc8c2ba30ba54ae", + ], + transactionHash: + "0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53", + transactionIndex: 121, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x7979e3b04a458bbaa17530c78243887f3d987f500fc2c9e43151f9ac2a018d95", + blockNumber: 16788305, + data: "0x91c4c83dd090378cc5f34beab9c2ddf312564ba88c8e6fcc21f0d571c84a1eb3000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab927000000000000000000000000aedc687fa5376d2fe9d4b81ebfc8c2ba30ba54ae000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000527f4c9c0000000000000000000000000000000000000000000000000c7d713b49da0000", + index: 289, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0x68608bec5c30750a6a358b14eb937a07f10f72c84428bdf6eae80f52c27faf53", + transactionIndex: 121, + }, + ], + logsBloom: + "0x00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000080000000000000202000000000000000000002008000008000000000000200000000040000000008000000000000000000000000000000000000440000000000000000000000010000000000000000000000000000000000000000000000001010000000000000000000000008000000000200000004000000000000000000000000000000000000000004001000002000000000000000000008000000000000000000000000000000000000000200000000020000000000000000000000100000000400000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for fillOtcOrderWithEth", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "fillOtcOrderWithEth", + value: 0n, + args: [ + [ + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + ], + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "0.9", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + tokenOut: { + symbol: "USDC", + amount: "1384.074396", + address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + }, + }); +}); diff --git a/src/tests/fillTakerSignedOtcOrder.test.ts b/src/tests/fillTakerSignedOtcOrder.test.ts new file mode 100644 index 0000000..1958a8e --- /dev/null +++ b/src/tests/fillTakerSignedOtcOrder.test.ts @@ -0,0 +1,114 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x7f31ba7cacfda809ea24d4b9f87c44fb4114608666c7dd1c6553986ce88dc92b +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x070cbb43e497e24a0574d56d5414c25a13e323a7dbe74c7e3b0890bbf4335b6e", + blockNumber: 16880528, + contractAddress: null, + cumulativeGasUsed: "1251786", + from: "0xc65f45c3Ac07C57C566341811234c8aA5AfBbb40", + gasPrice: "16244714645", + gasUsed: "100333", + hash: "0x7f31ba7cacfda809ea24d4b9f87c44fb4114608666c7dd1c6553986ce88dc92b", + index: 22, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x070cbb43e497e24a0574d56d5414c25a13e323a7dbe74c7e3b0890bbf4335b6e", + blockNumber: 16880528, + data: "0x0000000000000000000000000000000000000000000000003663856e9aada400", + index: 29, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000086d9dc0fc8bc5ad48373eeefaff4826a081db114", + "0x000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b", + ], + transactionHash: + "0x7f31ba7cacfda809ea24d4b9f87c44fb4114608666c7dd1c6553986ce88dc92b", + transactionIndex: 22, + }, + { + _type: "log", + address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + blockHash: + "0x070cbb43e497e24a0574d56d5414c25a13e323a7dbe74c7e3b0890bbf4335b6e", + blockNumber: 16880528, + data: "0x00000000000000000000000000000000000000000000000000000000017d7840", + index: 30, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b", + "0x00000000000000000000000086d9dc0fc8bc5ad48373eeefaff4826a081db114", + ], + transactionHash: + "0x7f31ba7cacfda809ea24d4b9f87c44fb4114608666c7dd1c6553986ce88dc92b", + transactionIndex: 22, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x070cbb43e497e24a0574d56d5414c25a13e323a7dbe74c7e3b0890bbf4335b6e", + blockNumber: 16880528, + data: "0x05aca59966acd2f559b9dabda84351c49b1ec74d78a42f274680b96a59fcdfa7000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b00000000000000000000000086d9dc0fc8bc5ad48373eeefaff4826a081db1140000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000017d78400000000000000000000000000000000000000000000000003663856e9aada400", + index: 31, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0x7f31ba7cacfda809ea24d4b9f87c44fb4114608666c7dd1c6553986ce88dc92b", + transactionIndex: 22, + }, + ], + logsBloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000080000000000000200000000000000004000000000000008000000000000000040000000000000000000000000000000000000000000000000000400020000000000000000000010000000000000000000400040000000000000000000000000000000000000000000000000018000000000000000000000000000000000000020000000000000000000004001000002000000000000000000008000000000000000000000000000000000000000300000000000000000000000000000200000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for fillTakerSignedOtcOrder", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "fillTakerSignedOtcOrder", + value: 0n, + args: [ + [ + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + 25000000n, + 3919122810830431232n, + "0xAF0B0000f0210D0f421F0009C72406703B50506B", + "0x86D9Dc0fc8BC5aD48373eEefAFF4826a081DB114", + ], + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "3.919122810830431232", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + }, + tokenOut: { + symbol: "WBTC", + amount: "0.25", + address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + }, + }); +}); diff --git a/src/tests/fillTakerSignedOtcOrderForEth.test.ts b/src/tests/fillTakerSignedOtcOrderForEth.test.ts new file mode 100644 index 0000000..3525f8d --- /dev/null +++ b/src/tests/fillTakerSignedOtcOrderForEth.test.ts @@ -0,0 +1,121 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xfa6205c53403d25eddf525559ead37f15aa0f6b458f67a2eb17a8f6312e1d080", + blockNumber: 16880871, + contractAddress: null, + cumulativeGasUsed: "3902065", + from: "0x22c45Fb52C9EF7bfaff34a0DAf4ec9C361bBbE17", + gasPrice: "14160232273", + gasUsed: "129001", + hash: "0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68", + index: 27, + logs: [ + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xfa6205c53403d25eddf525559ead37f15aa0f6b458f67a2eb17a8f6312e1d080", + blockNumber: 16880871, + data: "0x00000000000000000000000000000000000000000000000000000005d21dba00", + index: 34, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000ea1b49ac4a80ce9f2d15e3881a18ffb4bc7556b1", + "0x000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b", + ], + transactionHash: + "0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68", + transactionIndex: 27, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xfa6205c53403d25eddf525559ead37f15aa0f6b458f67a2eb17a8f6312e1d080", + blockNumber: 16880871, + data: "0x000000000000000000000000000000000000000000000000c02f1e12af303000", + index: 35, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68", + transactionIndex: 27, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xfa6205c53403d25eddf525559ead37f15aa0f6b458f67a2eb17a8f6312e1d080", + blockNumber: 16880871, + data: "0x000000000000000000000000000000000000000000000000c02f1e12af303000", + index: 36, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68", + transactionIndex: 27, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xfa6205c53403d25eddf525559ead37f15aa0f6b458f67a2eb17a8f6312e1d080", + blockNumber: 16880871, + data: "0xfa8187f6d6104a3c35185eae7daae79c818cea5cd5b223554f9d49eda2f6a0bb000000000000000000000000af0b0000f0210d0f421f0009c72406703b50506b000000000000000000000000ea1b49ac4a80ce9f2d15e3881a18ffb4bc7556b1000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000c02f1e12af30300000000000000000000000000000000000000000000000000000000005d21dba00", + index: 37, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0x5f0ed4396f68e0321e48d50611cc6663af68bf7cbee6bc8e74ff5c63d90f3b68", + transactionIndex: 27, + }, + ], + logsBloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004002000000080000000000000200000000000000000000002008000008000000000000000040400000000000000000000000000000000000000000000000000440000000000000040000000010000000000000000800000000000000000000000000000000010000000000000000000000008000000000200000004000000000000000000020000000000000000000004001000002000000000000000000008000000000000000000000000002000000000000300000000000000000000001000000000000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for fillTakerSignedOtcOrderForEth", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "fillTakerSignedOtcOrderForEth", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDC", + amount: "25000", + address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + }, + tokenOut: { + symbol: "WETH", + amount: "13.848320444784979968", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + }); +}); diff --git a/src/tests/index.test.ts b/src/tests/index.test.ts new file mode 100644 index 0000000..b75f9d7 --- /dev/null +++ b/src/tests/index.test.ts @@ -0,0 +1,36 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +const txReceiptSuccess = { + from: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", + logs: [], + logsBloom: "0x…", + status: 1, +}; + +const txReceiptReverted = { + ...txReceiptSuccess, + status: 0, +}; + +const rpcUrl = "http://localhost:8545"; + +it("returns null when the smart contract function name is not recognized", async () => { + const data = await parseSwap({ + txReceipt: txReceiptSuccess, + txDescription: { name: "xxsellToUniswap", value: 0n, args: [] }, + rpcUrl, + }); + + expect(data).toBe(null); +}); + +it("returns null when the transaction reverted", async () => { + const data = await parseSwap({ + txReceipt: txReceiptReverted, + txDescription: { name: "sellToUniswap", value: 0n, args: [] }, + rpcUrl, + }); + + expect(data).toBe(null); +}); diff --git a/src/tests/multiplexBatchSellEthForToken.test.ts b/src/tests/multiplexBatchSellEthForToken.test.ts new file mode 100644 index 0000000..47afac4 --- /dev/null +++ b/src/tests/multiplexBatchSellEthForToken.test.ts @@ -0,0 +1,189 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + contractAddress: null, + cumulativeGasUsed: "5771982", + from: "0x2b08A57aC855bda7F0DACD9c4E7867E625645015", + gasPrice: "35143058460", + gasUsed: "197521", + hash: "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + index: 66, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x0000000000000000000000000000000000000000000000008ac7230489e80000", + index: 101, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x0000000000000000000000000000000000000000000000006ac091172f013ac7", + index: 102, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000006033368e4a402605294c91cf5c03d72bd96e7d8d", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0x1E4EDE388cbc9F4b5c79681B7f94d36a11ABEBC9", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x000000000000000000000000000000000000000000000eae5bc272a22c29dc9e", + index: 103, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000006033368e4a402605294c91cf5c03d72bd96e7d8d", + "0x0000000000000000000000002b08a57ac855bda7f0dacd9c4e7867e625645015", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0x6033368e4a402605294c91CF5c03d72bd96E7D8D", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x0000000000000000000000000000000000000000000d5ce8ecba2cdd291f431a0000000000000000000000000000000000000000000000614af7a5d8a43bcfb9", + index: 104, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0x6033368e4a402605294c91CF5c03d72bd96E7D8D", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006ac091172f013ac7000000000000000000000000000000000000000000000eae5bc272a22c29dc9e0000000000000000000000000000000000000000000000000000000000000000", + index: 105, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000002b08a57ac855bda7f0dacd9c4e7867e625645015", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0x1E4EDE388cbc9F4b5c79681B7f94d36a11ABEBC9", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x000000000000000000000000000000000000000000000465b8a128dfcb78fadc", + index: 106, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000063805e5d951398bc1c1bec242d303f59fa7732e3", + "0x0000000000000000000000002b08a57ac855bda7f0dacd9c4e7867e625645015", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0x000000000000000000000000000000000000000000000000200691ed5ae6c539", + index: 107, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000063805e5d951398bc1c1bec242d303f59fa7732e3", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + { + _type: "log", + address: "0x63805e5d951398bC1C1bec242d303f59fA7732E3", + blockHash: + "0xbea03ae9d48736539924c91e30ff82db6b351addafa6797f8c35dca3c1c78c3b", + blockNumber: 16594679, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffb9a475ed72034870524000000000000000000000000000000000000000000000000200691ed5ae6c539000000000000000000000000000000000000000002b0388648044944308a74bd00000000000000000000000000000000000000000000136334196b03e4610deffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9c06", + index: 108, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000002b08a57ac855bda7f0dacd9c4e7867e625645015", + ], + transactionHash: + "0xe59ff84284d7e2ad87f1a6de55d5d6600b0b721242110687847e57b52a045b7d", + transactionIndex: 66, + }, + ], + logsBloom: + "0x00200000000000000000000080000000000100000000000000000000000000000000000000000000000000000000000002000000080020000000000000000000000000000000002800000008000000200000000000010000002000008000000000000000000000000000000000000040000000000000000000000010000810000000000000000000000000000000000000000001000000080000104000000000000000000000000000004000000080000000000000000000000000080000000000000002000000000001000000000000000040001020001000020000000000010000200002000000000000000000000001000000010000400008000800000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexBatchSellEthForToken", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexBatchSellEthForToken", + value: 10000000000000000000n, + args: ["0x1E4EDE388cbc9F4b5c79681B7f94d36a11ABEBC9"], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "10", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + }, + tokenOut: { + symbol: "X2Y2", + amount: "90095.36724488341", + address: "0x1E4EDE388cbc9F4b5c79681B7f94d36a11ABEBC9", + }, + }); +}); diff --git a/src/tests/multiplexBatchSellTokenForEth.test.ts b/src/tests/multiplexBatchSellTokenForEth.test.ts new file mode 100644 index 0000000..e164fcf --- /dev/null +++ b/src/tests/multiplexBatchSellTokenForEth.test.ts @@ -0,0 +1,223 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + contractAddress: null, + cumulativeGasUsed: "11198938", + from: "0x30c5312d9CF0d873994f000e72F1cbf561D0209C", + gasPrice: "34042615780", + gasUsed: "212166", + hash: "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + index: 114, + logs: [ + { + _type: "log", + address: "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x0000000000000000000000000000000000000000000011bdfa8a0d55e15ae277", + index: 266, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000030c5312d9cf0d873994f000e72f1cbf561d0209c", + "0x0000000000000000000000008d9f34af8d66ab7a84ce1241426510dfecea868f", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0xfffffffffffffffffffffffffffffffffffffffffff79baef5b00b82054e6588", + index: 267, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x00000000000000000000000030c5312d9cf0d873994f000e72f1cbf561d0209c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x0000000000000000000000000000000000000000000000000313b8257b2d3755", + index: 268, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000008d9f34af8d66ab7a84ce1241426510dfecea868f", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0x8d9F34af8d66AB7a84cE1241426510DFECEa868F", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x00000000000000000000000000000000000000000002976626dea005d14382b40000000000000000000000000000000000000000000000007050543a7ec349b8", + index: 269, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0x8d9F34af8d66AB7a84cE1241426510DFECEa868F", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x0000000000000000000000000000000000000000000011bdfa8a0d55e15ae277000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000313b8257b2d3755", + index: 270, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x00000000000000000000000000000000000000000000000003969315268b0c62", + index: 271, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000917c52869df752d784ec73fa0881898f9bfd0fd8", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x0000000000000000000000000000000000000000000014b2f9a10f8edc3f5d89", + index: 272, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000030c5312d9cf0d873994f000e72f1cbf561d0209c", + "0x000000000000000000000000917c52869df752d784ec73fa0881898f9bfd0fd8", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0xfffffffffffffffffffffffffffffffffffffffffff786fbfc0efbf3290f07ff", + index: 273, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x00000000000000000000000030c5312d9cf0d873994f000e72f1cbf561d0209c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0x917C52869df752d784eC73fa0881898f9Bfd0fd8", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x0000000000000000000000000000000000000000000014b2f9a10f8edc3f5d89fffffffffffffffffffffffffffffffffffffffffffffffffc696cead974f39e00000000000000000000000000000000000000000069393c21eaf2a708e00a9800000000000000000000000000000000000000000000012b6a4604b4d5b1e721fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe094c", + index: 274, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xdbc82caf05c5fed089e4d36ba615e242f2c047b1e16de3ed49f4cdba13303964", + blockNumber: 16594643, + data: "0x00000000000000000000000000000000000000000000000006aa4b3aa1b843b7", + index: 275, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x0caebae93af96f83c4d2434816d079d1b43e9061dcaca8627bd9e2c0917a3b63", + transactionIndex: 114, + }, + ], + logsBloom: + "0x00200000000000000000000082020000000000000000000002000000400000000000000000000000000000000000000002000000080020000000000000200000000400000000006800000008000000200000000000400000000000100000000000000000000000000000000000000040000000400000040800000010000800000000000000000000000000000000000000000000008000084000004000000800020000000000000000004000000000000000000000000000000000000000000000000002000000000000000000000000000100000000001000000002000200000010200000000000000000040000000000000002000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexBatchSellTokenForEth", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexBatchSellTokenForEth", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "BORING", + amount: "181533.55587344", + address: "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + }, + tokenOut: { + symbol: "WETH", + amount: "0.48027902546177326", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + }, + }); +}); diff --git a/src/tests/multiplexBatchSellTokenForToken.test.ts b/src/tests/multiplexBatchSellTokenForToken.test.ts new file mode 100644 index 0000000..3e38fbf --- /dev/null +++ b/src/tests/multiplexBatchSellTokenForToken.test.ts @@ -0,0 +1,212 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + contractAddress: null, + cumulativeGasUsed: "772926", + from: "0xcb171D302503461C189d0846F4DfF1f5597a1910", + gasPrice: "27947314911", + gasUsed: "290684", + hash: "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + index: 1, + logs: [ + { + _type: "log", + address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x0000000000000000000000000000000000000000000000000000000006e3d048", + index: 9, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000099ac8ca7087fa4a2a1fb6357269965a2014abc35", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x00000000000000000000000000000000000000000000000000000007ace8778f", + index: 10, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + "0x00000000000000000000000099ac8ca7087fa4a2a1fb6357269965a2014abc35", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x99ac8cA7087fA4A2A1FB6357269965A2014ABc35", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffff91c2fb800000000000000000000000000000000000000000000000000000007ace8778f0000000000000000000000000000000000000010de0e508cd99ab2c3b5b03e4e000000000000000000000000000000000000000000000000000002d4d028e8ba000000000000000000000000000000000000000000000000000000000000dcbe", + index: 11, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x000000000000000000000000000000000000000000000008d37aa185e83bcb14", + index: 12, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x00000000000000000000000000000000000000000000000000000045142c33ff", + index: 13, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x00000000000000000000000000000000000000000000000000000045142c33fffffffffffffffffffffffffffffffffffffffffffffffff72c855e7a17c434ec0000000000000000000000000000000000005b876e989ebde8490d035730ea620000000000000000000000000000000000000000000000371f0e418bdd2c120d000000000000000000000000000000000000000000000000000000000003121e", + index: 14, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x000000000000000000000000000000000000000000000000000000003dfe995e", + index: 15, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c0", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0x000000000000000000000000000000000000000000000008d37aa185e83bcb14", + index: 16, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c0", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x4585FE77225b41b697C938B018E2Ac67Ac5a20c0", + blockHash: + "0xfbf9da6e5b4d86634bfbc7ec2e9fa199792ea4efd1c4ab34e62fbc35fa6595cd", + blockNumber: 16877328, + data: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffc20166a2000000000000000000000000000000000000000000000008d37aa185e83bcb140000000000000000000000000000000000060958afa8c1b3d054281a98961abb00000000000000000000000000000000000000000000000012806b4a0e1c5397000000000000000000000000000000000000000000000000000000000003eef0", + index: 17, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000cb171d302503461c189d0846f4dff1f5597a1910", + ], + transactionHash: + "0xb2c5a697a3126af96d2aa20ba6dcd0daaf9ec6baa49de2a76682dfe4258d2e56", + transactionIndex: 1, + }, + ], + logsBloom: + "0x00000000010100000000000000000000000001080000000000000000040000000000000000100000000008000000000002000000080020000000000000000000000000000000002808000208000000000000000000000000000000000000000000080000000002000000080000400040020000000000000000000010000800000020000000000000000000000000000000000000010000000000000000000000010008000000200000004000000000800020000000000000002000000008000000000002000000000000080000000000000000000200000000000000000000000000200000000000000010000000000000200000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexBatchSellTokenForToken", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexBatchSellTokenForToken", + value: 0n, + args: [ + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + amount: "329656.871822", + symbol: "USDC", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + }, + tokenOut: { + amount: "11.5568887", + symbol: "WBTC", + address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + }, + }); +}); diff --git a/src/tests/multiplexMultiHopSellEthForToken.test.ts b/src/tests/multiplexMultiHopSellEthForToken.test.ts new file mode 100644 index 0000000..2832fa1 --- /dev/null +++ b/src/tests/multiplexMultiHopSellEthForToken.test.ts @@ -0,0 +1,213 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + contractAddress: null, + cumulativeGasUsed: "10471794", + from: "0x46F9F8f1AcBB45464fe8F0c48C54944753ea91bF", + gasPrice: "53906673400", + gasUsed: "270604", + hash: "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + index: 128, + logs: [ + { + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x00000000000000000000000000000000000000000000000029a2241af62c0000", + index: 278, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x0000000000000000000000000000000000000000000001166773fa83f70417e3", + index: 279, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000060594a405d53811d3bc4766596efd80fd545a270", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x00000000000000000000000000000000000000000000000029a2241af62c0000", + index: 280, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000060594a405d53811d3bc4766596efd80fd545a270", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x60594a405d53811d3BC4766596EFD80fd545A270", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffee9988c057c08fbe81d00000000000000000000000000000000000000000000000029a2241af62c00000000000000000000000000000000000000000000062fa8dcf119e9368459d17e00000000000000000000000000000000000000000000cef56c86d4fe5a38d9e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedd23", + index: 281, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x000000000000000000000000000000000000000000000000000000013215c4e3", + index: 282, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000005777d92f208679db4b9778590fa3cab3ac9e2168", + "0x0000000000000000000000003fa5db0910afc2a1e6de45039ea217410fb8641d", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x0000000000000000000000000000000000000000000001166773fa83f70417e3", + index: 283, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000005777d92f208679db4b9778590fa3cab3ac9e2168", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x0000000000000000000000000000000000000000000001166773fa83f70417e3fffffffffffffffffffffffffffffffffffffffffffffffffffffffecdea3b1d0000000000000000000000000000000000000000000010c70459c6d6c2567d8e0000000000000000000000000000000000000000000072776df771037d18bcf7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc89c", + index: 284, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000003fa5db0910afc2a1e6de45039ea217410fb8641d", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x7659CE147D0e714454073a5dd7003544234b6Aa0", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x000000000000000000000000000000000000000000000092b0d9884faf40ec09", + index: 285, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000003fa5db0910afc2a1e6de45039ea217410fb8641d", + "0x00000000000000000000000046f9f8f1acbb45464fe8f0c48c54944753ea91bf", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x3fA5db0910Afc2A1E6DE45039eA217410fB8641d", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x0000000000000000000000000000000000000000000059cb4180687c09a19d97000000000000000000000000000000000000000000000000000000bbff64a3c8", + index: 286, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + { + address: "0x3fA5db0910Afc2A1E6DE45039eA217410fB8641d", + blockHash: + "0x71ff985e090210b74e91cdcba943f878b568a87d8db39df4754658d56c7dc24e", + blockNumber: 16919715, + data: "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013215c4e3000000000000000000000000000000000000000000000092b0d9884faf40ec090000000000000000000000000000000000000000000000000000000000000000", + index: 287, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000046f9f8f1acbb45464fe8f0c48c54944753ea91bf", + ], + transactionHash: + "0x00b191d47269265cfbbc94c77a114281ee939463b7a922e8bfbf7de8bc150c5c", + transactionIndex: 128, + }, + ], + logsBloom: + "0x002000000000000000000040a2000000000000000000000000000040000000000000000000000000000000000000000002000000080020000000000001000000000280000000002808000008000000200000000000000000000000008000000010000000100000000000080000000040000000000000002000000010000800000000000000000001400000000000000000000001010000080100804000000000020000000000200000004000004020000000080000000000000000000000000000000002000000020000000000000000000002040000005000000000000000010000280000000000000000000000000000000000000000400000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexMultiHopSellEthForToken", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexMultiHopSellEthForToken", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "3", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + }, + tokenOut: { + symbol: "XCAD", + amount: "2705.968001258040126473", + address: "0x7659CE147D0e714454073a5dd7003544234b6Aa0", + }, + }); +}); diff --git a/src/tests/multiplexMultiHopSellTokenForEth.test.ts b/src/tests/multiplexMultiHopSellTokenForEth.test.ts new file mode 100644 index 0000000..7e5f328 --- /dev/null +++ b/src/tests/multiplexMultiHopSellTokenForEth.test.ts @@ -0,0 +1,245 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + contractAddress: null, + cumulativeGasUsed: "8002583", + from: "0xa9531D3B5483bef6FaE3B4Be62Ccd83697aB92b1", + gasPrice: "43687383816", + gasUsed: "315723", + hash: "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + index: 50, + logs: [ + { + address: "0x3B9BE07d622aCcAEd78f479BC0EDabFd6397E320", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x00000000000000000000000000000000000000000000043fc767caa5e96fdd4c", + index: 192, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000a9531d3b5483bef6fae3b4be62ccd83697ab92b1", + "0x00000000000000000000000062e3c242b5e903071458ad90a160493d84911c77", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x3B9BE07d622aCcAEd78f479BC0EDabFd6397E320", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffbc03898355a169022b3", + index: 193, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x000000000000000000000000a9531d3b5483bef6fae3b4be62ccd83697ab92b1", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000000000000000130edc3eb", + index: 194, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000062e3c242b5e903071458ad90a160493d84911c77", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x62e3C242B5e903071458ad90A160493D84911C77", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x000000000000000000000000000000000000000000014bb124b98994a34fa89c0000000000000000000000000000000000000000000000000000005c10d4e639", + index: 195, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x62e3C242B5e903071458ad90A160493D84911C77", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x00000000000000000000000000000000000000000000043fc767caa5e96fdd4c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000130edc3eb", + index: 196, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000001155e74cc14f507c4a5", + index: 197, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000048da0965ab2d2cbf1c17c09cfb5cbe67ad5b1406", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000000000000000130edc3eb", + index: 198, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000048da0965ab2d2cbf1c17c09cfb5cbe67ad5b1406", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x48DA0965ab2d2cbf1C17C09cFB5Cbe67Ad5B1406", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffeeaa18b33eb0af83b5b0000000000000000000000000000000000000000000000000000000130edc3eb0000000000000000000000000000000000000000000010c6768f588cef97d93c00000000000000000000000000000000000000000000009e14b6c1b0cfff72acfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc899", + index: 199, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000000002de062d4be9f5925", + index: 200, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000060594a405d53811d3bc4766596efd80fd545a270", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000001155e74cc14f507c4a5", + index: 201, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000060594a405d53811d3bc4766596efd80fd545a270", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0x60594a405d53811d3BC4766596EFD80fd545A270", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000001155e74cc14f507c4a5ffffffffffffffffffffffffffffffffffffffffffffffffd21f9d2b4160a6db000000000000000000000000000000000000000006820d7564a8957a420f329f0000000000000000000000000000000000000000000081b9f1aec8314b596b09fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee119", + index: 202, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + { + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x0f7fbc04f4649286a90b0085456e7c0ae975786ce2af5405ebd52dbee68b99fd", + blockNumber: 16594209, + data: "0x0000000000000000000000000000000000000000000000002de062d4be9f5925", + index: 203, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xba3a89b2164e5f169bc81e90a13f8946d110dffe2b53393953ea2a4fede8e81e", + transactionIndex: 50, + }, + ], + logsBloom: + "0x002000000000000000020000a0000001000000000000000000000040000000000200000000000000000000000000010002000000080020000000004000220040000000000000002800000008000000200000000000c00000000100000100000010000000000000000000080000000040000800000000042100004010000800000000000000000000000000000000000000000000000000080000404000100000020000000000000000004080000000000040080000000080000000000000000000000002000000020000000000000000000002000000001000000002000040000010200000000000000000000000000000000000000000000000000040000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexMultiHopSellTokenForEth", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexMultiHopSellTokenForEth", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "LSS", + amount: "20065.979484072366300492", + address: "0x3B9BE07d622aCcAEd78f479BC0EDabFd6397E320", + }, + tokenOut: { + symbol: "WETH", + amount: "3.305750792360646949", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + }, + }); +}); diff --git a/src/tests/multiplexMultiHopSellTokenForToken.test.ts b/src/tests/multiplexMultiHopSellTokenForToken.test.ts new file mode 100644 index 0000000..023fee7 --- /dev/null +++ b/src/tests/multiplexMultiHopSellTokenForToken.test.ts @@ -0,0 +1,207 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + contractAddress: null, + cumulativeGasUsed: "8070380", + from: "0x7204dA7b2fc2278E08702459d1d9Aa56A2E9385e", + gasPrice: "17571938772", + gasUsed: "257191", + hash: "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + index: 82, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x0000000000000000000000000000000000000000000000001bdbae66ba6d021c", + index: 180, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000a6cc3c2531fdaa6ae1a3ca84c2855806728693e8", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0x514910771AF9Ca656af840dff83E8264EcF986CA", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x00000000000000000000000000000000000000000000001b4fcd8c583db27000", + index: 181, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000007204da7b2fc2278e08702459d1d9aa56a2e9385e", + "0x000000000000000000000000a6cc3c2531fdaa6ae1a3ca84c2855806728693e8", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0xa6Cc3C2531FdaA6Ae1A3CA84c2855806728693e8", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x00000000000000000000000000000000000000000000001b4fcd8c583db27000ffffffffffffffffffffffffffffffffffffffffffffffffe42451994592fde40000000000000000000000000000000000000000102ef0c2d24c67aff3014f53000000000000000000000000000000000000000000012136ebf313e73925f9ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2845", + index: 182, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x00000000000000000000000000000000000000000000000000000000d81d13b1", + index: 183, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "0x0000000000000000000000004cd36d6f32586177e36179a810595a33163a20bf", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x0000000000000000000000000000000000000000000000001bdbae66ba6d021c", + index: 184, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff27e2ec4f0000000000000000000000000000000000000000000000001bdbae66ba6d021c0000000000000000000000000000000000005be3c301aadc9706db4179ce4a6b000000000000000000000000000000000000000000000002091ae7c1b1372110000000000000000000000000000000000000000000000000000000000003126d", + index: 185, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000004cd36d6f32586177e36179a810595a33163a20bf", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0x0f51bb10119727a7e5eA3538074fb341F56B09Ad", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x00000000000000000000000000000000000000000000006d305bf905ae384f60", + index: 186, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000004cd36d6f32586177e36179a810595a33163a20bf", + "0x0000000000000000000000007204da7b2fc2278e08702459d1d9aa56a2e9385e", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0x4cd36d6F32586177e36179a810595a33163a20BF", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x000000000000000000000000000000000000000000005fdcfcc2fd8d5d1e614a000000000000000000000000000000000000000000000000000000be0377e0d8", + index: 187, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + { + _type: "log", + address: "0x4cd36d6F32586177e36179a810595a33163a20BF", + blockHash: + "0x346781166e37d92c27d51f900f32d3f5b5bada633be84feccde259d165f2b582", + blockNumber: 16853425, + data: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d81d13b100000000000000000000000000000000000000000000006d305bf905ae384f600000000000000000000000000000000000000000000000000000000000000000", + index: 188, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000007204da7b2fc2278e08702459d1d9aa56a2e9385e", + ], + transactionHash: + "0xf705df9127065ae8a8da3c1939d7096011ea13c81e4a2ed8c59ea1b039f7565d", + transactionIndex: 82, + }, + ], + logsBloom: + "0x00200000011000000000000080001000200000000000000000000000040000000000000000000000000008000000000002000020080020000000000000000000000001000000002848000108000000201000000000000000000000000000800022000000000000400000000000000040800000000000000000800010000800000020000000000000000000000000000000000000010000080000004000000000000000040000200000004000000000000000000000000000002000000008000000000002000000000000000000000006000000000000001000000000000000000000600800000000000010000000000000000100000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for multiplexMultiHopSellTokenForToken", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "multiplexMultiHopSellTokenForToken", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "LINK", + amount: "503.8124966", + address: "0x514910771AF9Ca656af840dff83E8264EcF986CA", + }, + tokenOut: { + symbol: "DAO", + amount: "2014.179756573835415392", + address: "0x0f51bb10119727a7e5eA3538074fb341F56B09Ad", + }, + }); +}); diff --git a/src/tests/permitAndCall.test.ts b/src/tests/permitAndCall.test.ts new file mode 100644 index 0000000..9f742d8 --- /dev/null +++ b/src/tests/permitAndCall.test.ts @@ -0,0 +1,125 @@ +import { expect, it } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xbab6ac1d578990ee04c4da7c74fd25b749e8963abea3a340db558da72fdf32af", + blockNumber: 17289469, + contractAddress: null, + cumulativeGasUsed: "3461948", + from: "0xac844837a2B58db4B4deF35b243ee14c3e36A96b", + gasPrice: "41539807233", + gasUsed: "187372", + hash: "0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241", + index: 40, + logs: [ + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xbab6ac1d578990ee04c4da7c74fd25b749e8963abea3a340db558da72fdf32af", + blockNumber: 17289469, + data: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + index: 115, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x0000000000000000000000008a6bfcae15e729fd1440574108437dea281a9b3e", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241", + transactionIndex: 40, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xbab6ac1d578990ee04c4da7c74fd25b749e8963abea3a340db558da72fdf32af", + blockNumber: 17289469, + data: "0x0000000000000000000000000000000000000000000000000000000001312d00", + index: 116, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000008a6bfcae15e729fd1440574108437dea281a9b3e", + "0x0000000000000000000000002008b6c3d07b061a84f790c035c2f6dc11a0be70", + ], + transactionHash: + "0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241", + transactionIndex: 40, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0xbab6ac1d578990ee04c4da7c74fd25b749e8963abea3a340db558da72fdf32af", + blockNumber: 17289469, + data: "0x00000000000000000000000000000000000000000000000000000000008549c8", + index: 117, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000002008b6c3d07b061a84f790c035c2f6dc11a0be70", + "0x0000000000000000000000008a6bfcae15e729fd1440574108437dea281a9b3e", + ], + transactionHash: + "0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241", + transactionIndex: 40, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xbab6ac1d578990ee04c4da7c74fd25b749e8963abea3a340db558da72fdf32af", + blockNumber: 17289469, + data: "0x8eb8065d50eb9a19232814290678b5f0a19368dab7ebfe744e0bb9f804fbdd860000000000000000000000002008b6c3d07b061a84f790c035c2f6dc11a0be700000000000000000000000008a6bfcae15e729fd1440574108437dea281a9b3e000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000008549c80000000000000000000000000000000000000000000000000000000001312d00", + index: 118, + topics: [ + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + ], + transactionHash: + "0x5eac379185f24ddeba7fcd4414779df77ecfd1102da6ebf6dacf25b01a14b241", + transactionIndex: 40, + }, + ], + logsBloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000200200000000000000000002008000008000000000000000000000000000000000000000000000000000000000000000000000440020000000000000000000010000000000000000000000000800000000000000000000000010000000000000000100000028000000000200000004080000000000000000000000000000000200000004001000002000000000000000000008000000080000000000000008000000000000010000000000000400000000000000000000000000000000000000000000000", + status: 1, + to: "0x1291C02D288de3De7dC25353459489073D11E1Ae", +}; + +it("parses swap from permitAndCall", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "permitAndCall", + value: 0n, + args: [ + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0x8a6BFCae15E729fd1440574108437dEa281A9B3e", + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDC", + amount: "20", + address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + }, + tokenOut: { + symbol: "USDT", + amount: "8.735176", + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + }, + }); +}); diff --git a/src/tests/sellEthForTokenToUniswapV3.test.ts b/src/tests/sellEthForTokenToUniswapV3.test.ts new file mode 100644 index 0000000..007a93d --- /dev/null +++ b/src/tests/sellEthForTokenToUniswapV3.test.ts @@ -0,0 +1,119 @@ +import { expect, it } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xc00feb5cf505e3fda66e10d321ace5899ec3c9f5102c44472e1e78a83a5ab48a", + blockNumber: 16880872, + contractAddress: null, + cumulativeGasUsed: "18839294", + from: "0x43fB70A5474442514E740978C486f583DaFE78Ff", + gasPrice: "12441332320", + gasUsed: "116970", + hash: "0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff", + index: 133, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xc00feb5cf505e3fda66e10d321ace5899ec3c9f5102c44472e1e78a83a5ab48a", + blockNumber: 16880872, + data: "0x0000000000000000000000000000000000000000000000002627fa94666efbd2", + index: 218, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff", + transactionIndex: 133, + }, + { + _type: "log", + address: "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39", + blockHash: + "0xc00feb5cf505e3fda66e10d321ace5899ec3c9f5102c44472e1e78a83a5ab48a", + blockNumber: 16880872, + data: "0x00000000000000000000000000000000000000000000000000000491f8fac229", + index: 219, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000009e0905249ceefffb9605e034b534544684a58be6", + "0x00000000000000000000000043fb70a5474442514e740978c486f583dafe78ff", + ], + transactionHash: + "0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff", + transactionIndex: 133, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xc00feb5cf505e3fda66e10d321ace5899ec3c9f5102c44472e1e78a83a5ab48a", + blockNumber: 16880872, + data: "0x0000000000000000000000000000000000000000000000002627fa94666efbd2", + index: 220, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000009e0905249ceefffb9605e034b534544684a58be6", + ], + transactionHash: + "0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff", + transactionIndex: 133, + }, + { + _type: "log", + address: "0x9e0905249CeEFfFB9605E034b534544684A58BE6", + blockHash: + "0xc00feb5cf505e3fda66e10d321ace5899ec3c9f5102c44472e1e78a83a5ab48a", + blockNumber: 16880872, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffb6e07053dd70000000000000000000000000000000000000000000000002627fa94666efbd200000000000000000000000000000000000002e2ad51d21806741c07ae23d95a000000000000000000000000000000000000000000000000d4e3cc1522e228b30000000000000000000000000000000000000000000000000000000000020407", + index: 221, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x00000000000000000000000043fb70a5474442514e740978c486f583dafe78ff", + ], + transactionHash: + "0xc552e83ef96c5d523f69494ae61b7235a6304ab439e127eb0121d33bbcdaa1ff", + transactionIndex: 133, + }, + ], + logsBloom: + "0x00000004000000000000080000000000000000000000000000000000000000000000000000000000000000000000000002000000080020000000000000000000000000000000002800000028000000000000000000000000000100008000000000000000000000000000000000000040000000000000000000000010000800000000000000000000000000000000000000000001000000000000010000000000000000000000002000004000000000000000000020020000000000000200000000080002000000000000000000000000000000000000000000000000000000001000200000000000000000000000400000000000000000400000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for sellEthForTokenToUniswapV3", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "sellEthForTokenToUniswapV3", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "2.749441612813630418", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + tokenOut: { + symbol: "HEX", + amount: "50249.93952297", + address: '0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39', + }, + }); +}); diff --git a/src/tests/sellToLiquidityProvider.test.ts b/src/tests/sellToLiquidityProvider.test.ts new file mode 100644 index 0000000..8f6caae --- /dev/null +++ b/src/tests/sellToLiquidityProvider.test.ts @@ -0,0 +1,233 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + contractAddress: null, + cumulativeGasUsed: "10472696", + from: "0x4515957DAF1c5a1Cd2E24D000E909A0Ff6bE1975", + gasPrice: "33080143688", + gasUsed: "399281", + hash: "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + index: 115, + logs: [ + { + _type: "log", + address: "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000000000000000000000000031d1a282b7ad55ed9c", + index: 200, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000004515957daf1c5a1cd2e24d000e909a0ff6be1975", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffec6fc8d66fd64ee26c6", + index: 201, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x0000000000000000000000004515957daf1c5a1cd2e24d000e909a0ff6be1975", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000000000000000000000000031d1a282b7ad55ed9c", + index: 202, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + "0x0000000000000000000000003211c6cbef1429da3d0d58494938299c92ad5860", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0xffffffffffffffffffffffffffffffffffffffffffe77c6c296a0d70d5218996", + index: 203, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + "0x0000000000000000000000003211c6cbef1429da3d0d58494938299c92ad5860", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x00000000000000000000000000000000000000000000000000000000294b07b2", + index: 204, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000003211c6cbef1429da3d0d58494938299c92ad5860", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000000000000000000000000000060f6607941d9b40", + index: 205, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000ecb456ea5365865ebab8a2661b0c503410e9b347", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0x3211C6cBeF1429da3D0d58494938299C92Ad5860", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000000000000000000000000000060f6607941d9b40", + index: 206, + topics: [ + "0x6059a38198b1dc42b3791087d1ff0fbd72b3179553c25f678cd246f52ffaaf59", + "0x000000000000000000000000ecb456ea5365865ebab8a2661b0c503410e9b347", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0x3211C6cBeF1429da3D0d58494938299C92Ad5860", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031d1a282b7ad55ed9c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000294b07b2", + index: 207, + topics: [ + "0xb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc98", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0x561B94454b65614aE3db0897B74303f4aCf7cc75", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000031d1a282b7ad55ed9c00000000000000000000000000000000000000000000000000000000294b07b243757276650000000000000000000000000000000000000000000000000000000000000000000000000000003211c6cbef1429da3d0d58494938299c92ad5860000000000000000000000000407b4128e9ecad8769b2332312a9f655cb9f5f3a0000000000000000000000004515957daf1c5a1cd2e24d000e909a0ff6be1975", + index: 208, + topics: [ + "0x83dc79d57dbf7f65897db5b817ef3c45ebb363086f52ba01bb57d0cdef08dace", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x00000000000000000000000000000000000000000000000000000000294b07b2", + index: 209, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc75", + "0x0000000000000000000000004515957daf1c5a1cd2e24d000e909a0ff6be1975", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0xda449ac636042c6c5730e54ade5fd4226e4dfb4339538f6d9fcb733d96ced22c", + blockNumber: 16594568, + data: "0x000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000031d1a282b7ad55ed9c00000000000000000000000000000000000000000000000000000000294b07b2000000000000000000000000561b94454b65614ae3db0897b74303f4acf7cc750000000000000000000000004515957daf1c5a1cd2e24d000e909a0ff6be1975", + index: 210, + topics: [ + "0x40a6ba9513d09e3488135e0e0d10e2d4382b792720155b144cbea89ac9db6d34", + ], + transactionHash: + "0x2a4379d531695dd4f142730edb7720bb9d06dfb405322e0e16acbfd8ba4fcb98", + transactionIndex: 115, + }, + ], + logsBloom: + "0x0000008000120000000000080000000000000000000040000000000800000000000000000000200000000800000000040200000080000000000000000020000000000000000000300a00004800000040000000000000000000000000000000000000400002100000000004000000084000000000000000000000041000000000000000000000000000200000000000000000000001000000000000000000000002800080000020001002400404000400008000002000000000000000000000c001000002000000000000000000001000000000000000001000000000000020000010000000000020008000000080000000000000000000000000000000000040", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for sellToLiquidityProvider", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "sellToLiquidityProvider", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "STG", + amount: "918.996239437320809884", + address: "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + }, + tokenOut: { + symbol: "USDC", + amount: "692.783026", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + }, + }); +}); diff --git a/src/tests/sellToPancakeSwap.test.ts b/src/tests/sellToPancakeSwap.test.ts new file mode 100644 index 0000000..c30faf4 --- /dev/null +++ b/src/tests/sellToPancakeSwap.test.ts @@ -0,0 +1,273 @@ +import { describe, expect, it } from "vitest"; +import { parseSwap } from "../index"; + +const RPC_TEST_URL = "https://bscrpc.com"; + +// https://bscscan.com/tx/0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94 +describe("sellToPancakeSwap tx: 0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", () => { + const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + contractAddress: null, + cumulativeGasUsed: "18442357", + from: "0x1AAfADAE27d7EBaA2A2D0d91C7231b37502F4517", + gasPrice: "5000000000", + gasUsed: "111201", + hash: "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + index: 134, + logs: [ + { + _type: "log", + address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0x00000000000000000000000000000000000000000000003ea288e9601e150000", + index: 453, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000001aafadae27d7ebaa2a2d0d91c7231b37502f4517", + "0x0000000000000000000000001b96b92314c44b159149f7e0303511fb2fc4774f", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + { + _type: "log", + address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0xffffffffffffffffffffffffffffffffffffffffffffffc15d77169fe1eaffff", + index: 454, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x0000000000000000000000001aafadae27d7ebaa2a2d0d91c7231b37502f4517", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + { + _type: "log", + address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0x000000000000000000000000000000000000000000000000194968824ab29ec6", + index: 455, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000001b96b92314c44b159149f7e0303511fb2fc4774f", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + { + _type: "log", + address: "0x1B96B92314C44b159149f7E0303511fB2Fc4774f", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0x000000000000000000000000000000000000000000000587e3cf134216392ef50000000000000000000000000000000000000000000da8dc764e3da0b28843fa", + index: 456, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + { + _type: "log", + address: "0x1B96B92314C44b159149f7E0303511fB2Fc4774f", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ea288e9601e150000000000000000000000000000000000000000000000000000194968824ab29ec60000000000000000000000000000000000000000000000000000000000000000", + index: 457, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + { + _type: "log", + address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + blockHash: + "0x4da8c009c6fe840e9c70d66a3dd866d393f063f954e2be08854023d5c3c32c43", + blockNumber: 7230932, + data: "0x000000000000000000000000000000000000000000000000194968824ab29ec6", + index: 458, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x2076af859a54f5f0c7d4e1cd13b3906169a5e3697d8762b59062052d53466e94", + transactionIndex: 134, + }, + ], + logsBloom: + "0x00200000000000100000000080000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000002000000008000000200000000000400000000400000000000000000000000000000100000000000040000000000000040000000010000000000000000000000000000000000000000000040000000000080000004000000000020000000000000000004000000000000000000000000000002000000000000000000002000000020000000000001000000100000000001000100002000080000010000004000000000000000020002000000000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + }; + + it("parses swap for sellToPancakeSwap", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "sellToPancakeSwap", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "BUSD", + amount: "1155.41", + address: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + }, + tokenOut: { + symbol: "WBNB", + amount: "1.82210243305633351", + address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + }, + }); + }); +}); + +// https://bscscan.com/tx/0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b +describe("sellToPancakeSwap tx: 0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", () => { + const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + contractAddress: null, + cumulativeGasUsed: "6895623", + from: "0x2F9c91660986DeCCB0E1AB2A3957e67cf64db29d", + gasPrice: "10000000000", + gasUsed: "107764", + hash: "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + index: 54, + logs: [ + { + _type: "log", + address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + data: "0x00000000000000000000000000000000000000000000000010a741a462780000", + index: 229, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + transactionIndex: 54, + }, + { + _type: "log", + address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + data: "0x00000000000000000000000000000000000000000000000010a741a462780000", + index: 230, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000001b96b92314c44b159149f7e0303511fb2fc4774f", + ], + transactionHash: + "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + transactionIndex: 54, + }, + { + _type: "log", + address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + data: "0x000000000000000000000000000000000000000000000011578dd90373b2eabe", + index: 231, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000001b96b92314c44b159149f7e0303511fb2fc4774f", + "0x0000000000000000000000002f9c91660986deccb0e1ab2a3957e67cf64db29d", + ], + transactionHash: + "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + transactionIndex: 54, + }, + { + _type: "log", + address: "0x1B96B92314C44b159149f7E0303511fB2Fc4774f", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + data: "0x0000000000000000000000000000000000000000000096295dbf890133f5bbb60000000000000000000000000000000000000000009cd7695feeaef939c30d41", + index: 232, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + transactionIndex: 54, + }, + { + _type: "log", + address: "0x1B96B92314C44b159149f7E0303511fB2Fc4774f", + blockHash: + "0x8dc6404fb09e14956c9d42b8bb0542aa047076aa74815cd40580d0cc2adc9699", + blockNumber: 5893208, + data: "0x00000000000000000000000000000000000000000000000010a741a46278000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011578dd90373b2eabe", + index: 233, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x0000000000000000000000002f9c91660986deccb0e1ab2a3957e67cf64db29d", + ], + transactionHash: + "0x595b1684b8accec5fdd536dbdd9acb4ddcae9cfc21afcd65245d0a51a0e3582b", + transactionIndex: 54, + }, + ], + logsBloom: + "0x00200000000000100000000081000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000008000000200000000000000000000400008000000000000000000000000100000000000040000000000000000000000010000000000000000000000000000000000000000000040001000000080000004000000000000000000000000000004000000000000000000000000000002000000000000000000002000000020000000000001000000100000000001000100000000080000000000004000000000000000000002000000000000000400000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + }; + + it("parses swap for sellToPancakeSwap", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "sellToPancakeSwap", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WBNB", + amount: "1.2", + address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + }, + tokenOut: { + symbol: "BUSD", + amount: "319.903586514927545022", + address: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + }, + }); + }); +}); diff --git a/src/tests/sellToUniswap.test.ts b/src/tests/sellToUniswap.test.ts new file mode 100644 index 0000000..44ff547 --- /dev/null +++ b/src/tests/sellToUniswap.test.ts @@ -0,0 +1,118 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795 +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x431121dedb84415dfa7686d356f58fa2bc029aebfed0b4cecf330c822439007d", + blockNumber: 16877633, + contractAddress: null, + cumulativeGasUsed: "4524989", + from: "0xcb5dFfB24C8f642946D52BFEb6e3AA5f450dCf30", + gasPrice: "22007828429", + gasUsed: "129033", + hash: "0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795", + index: 63, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x431121dedb84415dfa7686d356f58fa2bc029aebfed0b4cecf330c822439007d", + blockNumber: 16877633, + data: "0x000000000000000000000000000000000000000000000000003be492fb270d77", + index: 126, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cb5dffb24c8f642946d52bfeb6e3aa5f450dcf30", + "0x00000000000000000000000006da0fd433c1a5d7a4faa01111c044910a184553", + ], + transactionHash: + "0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795", + transactionIndex: 63, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x431121dedb84415dfa7686d356f58fa2bc029aebfed0b4cecf330c822439007d", + blockNumber: 16877633, + data: "0x0000000000000000000000000000000000000000000000000000000001cc0d6f", + index: 127, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000006da0fd433c1a5d7a4faa01111c044910a184553", + "0x000000000000000000000000cb5dffb24c8f642946d52bfeb6e3aa5f450dcf30", + ], + transactionHash: + "0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795", + transactionIndex: 63, + }, + { + _type: "log", + address: "0x06da0fd433C1A5d7a4faa01111c044910A184553", + blockHash: + "0x431121dedb84415dfa7686d356f58fa2bc029aebfed0b4cecf330c822439007d", + blockNumber: 16877633, + data: "0x00000000000000000000000000000000000000000000017ee5999123c5d780d700000000000000000000000000000000000000000000000000000b85f8d74301", + index: 128, + topics: [ + "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1", + ], + transactionHash: + "0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795", + transactionIndex: 63, + }, + { + _type: "log", + address: "0x06da0fd433C1A5d7a4faa01111c044910A184553", + blockHash: + "0x431121dedb84415dfa7686d356f58fa2bc029aebfed0b4cecf330c822439007d", + blockNumber: 16877633, + data: "0x000000000000000000000000000000000000000000000000003be492fb270d77000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001cc0d6f", + index: 129, + topics: [ + "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000cb5dffb24c8f642946d52bfeb6e3aa5f450dcf30", + ], + transactionHash: + "0xd6a7aeda4a2978c80b03700e3136c6895b48d08cd9c8d4c88dfd19dee0a12795", + transactionIndex: 63, + }, + ], + logsBloom: + "0x00200000000000000000000080000000000000000000080000010000000000000000000000000000000000000000010002000000080000000000000000000000000000000000002000000008000000200000000000000000080000400000000000000000000000000000000000000040000000000000000000000010000000000000000000000000000000000000000000000000200000080000004000100000000000000000000000004080000000000000000000020000000001000000000000400002000000000000000000000000000000000000001000000000002000000000200000000000000000000000000000000000000000000000000000000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for sellToUniswap", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { name: "sellToUniswap", value: 0n, args: [] }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "0.016858343555927415", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + tokenOut: { + symbol: "USDT", + amount: "30.149999", + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + }, + }); +}); diff --git a/src/tests/sellTokenForEthToUniswapV3.test.ts b/src/tests/sellTokenForEthToUniswapV3.test.ts new file mode 100644 index 0000000..bca18bc --- /dev/null +++ b/src/tests/sellTokenForEthToUniswapV3.test.ts @@ -0,0 +1,158 @@ +import { describe, expect, it } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + contractAddress: null, + cumulativeGasUsed: "3133567", + from: "0x745ecE084d3e1868E97Fcd577106Fc5adb7b3800", + gasPrice: "16235667631", + gasUsed: "172294", + hash: "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + index: 36, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0x00000000000000000000000000000000000000000000000003079324f6c0fd86", + index: 67, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000075f4849d3c2088e5599cecf6ee0fdf8addfd124", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + { + _type: "log", + address: "0xD2d8D78087D0E43BC4804B6F946674b2Ee406b80", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0x000000000000000000000000000000000000000000000bed3bc0c6a0fcc21ef1", + index: 68, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000745ece084d3e1868e97fcd577106fc5adb7b3800", + "0x000000000000000000000000075f4849d3c2088e5599cecf6ee0fdf8addfd124", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + { + _type: "log", + address: "0xD2d8D78087D0E43BC4804B6F946674b2Ee406b80", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0x", + index: 69, + topics: [ + "0x81df7148ed3a9aa51bafe04f44371e89b96f47294267fbf6ab28b7aa8c87b386", + "0x000000000000000000000000745ece084d3e1868e97fcd577106fc5adb7b3800", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + { + _type: "log", + address: "0xD2d8D78087D0E43BC4804B6F946674b2Ee406b80", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0xfffffffffffffffffffffffffffffffffffffffffffff412c43f395f033de10e", + index: 70, + topics: [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x000000000000000000000000745ece084d3e1868e97fcd577106fc5adb7b3800", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + { + _type: "log", + address: "0x075F4849d3C2088E5599ceCf6Ee0fdF8AddFD124", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffffffcf86cdb093f027a000000000000000000000000000000000000000000000bed3bc0c6a0fcc21ef100000000000000000000000000000000000005e770e2e952e60501eb291004d500000000000000000000000000000000000000000000000228a1eb196d2dcefa0000000000000000000000000000000000000000000000000000000000023bf7", + index: 71, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x192fc9848b48515f31c8f440e11cc45c84828ee9bb112b17d4737915174c6b99", + blockNumber: 16895393, + data: "0x00000000000000000000000000000000000000000000000003079324f6c0fd86", + index: 72, + topics: [ + "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x822d38c0746b19544cedddd9a1ebaacadd3e5da55dc293738ae135fc595e269b", + transactionIndex: 36, + }, + ], + logsBloom: + "0x00000000000000100000000000000000000000000000000000000000001000000000000000000000000000000000000002000000080020000000000000200000080000000000002800000008000000080000000000400000000000000000000000000040000000000000000000000040000000000000040000000010000800000000000000000004000000000000000000000000000000000000000000000000020000008000000000004000000000000000000000000000000000000000000000000002000000000008000000000000000000000000000000000802000000000218200000000000800000000000000000000000020000000000000000000001", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +describe("parseSwap", () => { + it("parses swap for sellTokenForEthToUniswapV3", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "sellTokenForEthToUniswapV3", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "✺RUG", + amount: "56322.215316673764925169", + address: '0xD2d8D78087D0E43BC4804B6F946674b2Ee406b80', + }, + tokenOut: { + symbol: "WETH", + amount: "0.218304893918707078", + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + }); + }); +}); diff --git a/src/tests/sellTokenForTokenToUniswapV3.test.ts b/src/tests/sellTokenForTokenToUniswapV3.test.ts new file mode 100644 index 0000000..88f8ec1 --- /dev/null +++ b/src/tests/sellTokenForTokenToUniswapV3.test.ts @@ -0,0 +1,158 @@ +import { it, expect } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +// https://etherscan.io/tx/0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a +const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + contractAddress: null, + cumulativeGasUsed: "290258", + from: "0x243706e13823949dca2283Ce5607F618d9D17c31", + gasPrice: "17829966893", + gasUsed: "212725", + hash: "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + index: 1, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x0000000000000000000000000000000000000000000000001ad468a035d04b8c", + index: 4, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x00000000000000000000000000000000000000000000000000000000d09dc300", + index: 5, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000243706e13823949dca2283ce5607f618d9d17c31", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x00000000000000000000000000000000000000000000000000000000d09dc300ffffffffffffffffffffffffffffffffffffffffffffffffe52b975fca2fb4740000000000000000000000000000000000005bd451842e671653a529a49a7f9d000000000000000000000000000000000000000000000000fe4d6fabc9d42c600000000000000000000000000000000000000000000000000000000000031260", + index: 6, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xD533a949740bb3306d119CC777fa900bA034cd52", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x0000000000000000000000000000000000000000000000bd357495a7dd57e0c7", + index: 7, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000919fa96e88d67499339577fa202345436bcdaf79", + "0x000000000000000000000000243706e13823949dca2283ce5607f618d9d17c31", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x0000000000000000000000000000000000000000000000001ad468a035d04b8c", + index: 8, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000919fa96e88d67499339577fa202345436bcdaf79", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x919Fa96e88d67499339577Fa202345436bcDaf79", + blockHash: + "0xdb3566b3f589b4248c96af31bda12b719c0eef7bf27517bd262d0637dbecd0c6", + blockNumber: 16880470, + data: "0x0000000000000000000000000000000000000000000000001ad468a035d04b8cffffffffffffffffffffffffffffffffffffffffffffff42ca8b6a5822a81f39000000000000000000000000000000000000002a8aa984ad0e30aa5e15fc0992000000000000000000000000000000000000000000001f40d35fc2c8bec33fe00000000000000000000000000000000000000000000000000000000000012505", + index: 9, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", + "0x000000000000000000000000243706e13823949dca2283ce5607f618d9d17c31", + ], + transactionHash: + "0x90dbdd630287a0412f88cbc98b0d751bc81c613bb285898dac461b523cd07a5a", + transactionIndex: 1, + }, + ], + logsBloom: + "0x00000000010000000000000000000000000000000000000000000000040000000000000000080000000008000000000002000000080020010000000000000000000000000000002808000008000000000000000000000000000004000000040010000000000000000000000000000040000000000000000000000010000800000000000000000000000000000000000000000000010000000000000000000000000000002000220000004000000000000000000000000000002000000018001000000002000000000000000008000000000000000000000000000000000200000000200000000000000010000000000000000000000000000000000200000000", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", +}; + +it("parses swap for sellTokenForTokenToUniswapV3", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "sellTokenForTokenToUniswapV3", + value: 0n, + args: [], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDC", + amount: "3500", + address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + }, + tokenOut: { + symbol: "CRV", + amount: "3490.286498060619473095", + address: '0xD533a949740bb3306d119CC777fa900bA034cd52', + }, + }); +}); diff --git a/src/tests/transformERC20.test.ts b/src/tests/transformERC20.test.ts new file mode 100644 index 0000000..c151507 --- /dev/null +++ b/src/tests/transformERC20.test.ts @@ -0,0 +1,525 @@ +import { it, expect, describe } from "vitest"; +import { parseSwap } from "../index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +describe("transformERC20 with native input asset", () => { + // https://etherscan.io/tx/0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35 + const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + contractAddress: null, + cumulativeGasUsed: "818466", + from: "0x3F3E305C4Ad49271EBDA489dd43d2c8F027d2D41", + gasPrice: "35265056593", + gasUsed: "483000", + hash: "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + index: 1, + logs: [ + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000001208ab4a2829cba18c", + index: 15, + topics: [ + "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000000000000074ab1feed9", + index: 16, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000001208ab4a2829cba18c", + index: 17, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffff8b54e0112700000000000000000000000000000000000000000000001208ab4a2829cba18c00000000000000000000000000000000000064a64a162e8d56a70cb0ab941613000000000000000000000000000000000000000000000001588920f28bb9d824000000000000000000000000000000000000000000000000000000000003198a", + index: 18, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x22F9dCF4647084d6C31b2765F6910cd85C178C18", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000001208ab4a2829cba18c00000000000000000000000000000000000000000000000000000074ab1feed9", + index: 19, + topics: [ + "0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x000000000000000000000000000000000000000000000000000000746a575fc6", + index: 20, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000c9f93163c99695c6526b799ebca2207fdf7d61ad", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000000000000074ab1feed9", + index: 21, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x000000000000000000000000c9f93163c99695c6526b799ebca2207fdf7d61ad", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000000000000000004c4b43", + index: 22, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000c9f93163c99695c6526b799ebca2207fdf7d61ad", + "0x00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb0", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC9f93163c99695c6526b799EbcA2207Fdf7D61aD", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000004c4b43", + index: 23, + topics: [ + "0xe4fed5362e2669c70e5da5a18942d1e617d8917f6adc0164d9668bd3a6d0cebe", + "0x00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb0", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC9f93163c99695c6526b799EbcA2207Fdf7D61aD", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + index: 24, + topics: [ + "0xa259c93818139b6bc90fb80e8feb75122b42edaae49560f81392cf4e1946726e", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xC9f93163c99695c6526b799EbcA2207Fdf7D61aD", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x000000000000000000000000000000000000000000000000000000746a575fc600000000000000000000000000000000000000000000000000000074ab1feed9", + index: 25, + topics: [ + "0xe93ad76094f247c0dafc1c61adc2187de1ac2738f7a3b49cb20b2263420251a3", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0x22F9dCF4647084d6C31b2765F6910cd85C178C18", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x0000000000000000000000000000000a446f646f000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000074ab1feed9000000000000000000000000000000000000000000000000000000746a575fc6", + index: 26, + topics: [ + "0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x000000000000000000000000000000000000000000000000000000746a575fc6", + index: 27, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x0000000000000000000000003f3e305c4ad49271ebda489dd43d2c8f027d2d41", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x6f35212a8d14d67856cf0f6d20ffa9cee90d2f9a259ed7c5bee83f9c370bc2a3", + blockNumber: 16615554, + data: "0x000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000001208ab4a2829cba18c000000000000000000000000000000000000000000000000000000746a575fc6", + index: 28, + topics: [ + "0x0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b3", + "0x0000000000000000000000003f3e305c4ad49271ebda489dd43d2c8f027d2d41", + ], + transactionHash: + "0x30d015e87dd5481609eec1c54433b8d4679fe641034971baf648d4528a9b0a35", + transactionIndex: 1, + }, + ], + logsBloom: + "0x00000002010000000004001000000000000040000000000000000000040000000001000000004000000008000000010002000000080020000000000000002000000000000001000808008008004000014000000000000000000010008200208000000000800000000000901000000000000000000000000000000010000800000000000000000000000000000000000000000001010000000080000000100000008000000001200000000080800001000000000000000000002000000008004401000002001000000000000000000800000200000000000000004000002000000000200000000400000010000000000400000000000200400000000010001400", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + }; + + it("parses swap for transformERC20", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "transformERC20", + value: 332666067836453233036n, + args: [ + "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + 332666067836453233036n, + 500000000000n, + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "ETH", + amount: "332.66606783645324", + }, + tokenOut: { + symbol: "USDT", + amount: "500000.317382", + }, + }); + }); +}); + +describe("transformERC20 with erc20 input asset", () => { + const txReceipt = { + _type: "TransactionReceipt", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + contractAddress: null, + cumulativeGasUsed: "2204789", + from: "0x707D8Fce670759B51122Fd988AF014bb059df028", + gasPrice: "15127177110", + gasUsed: "342468", + hash: "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + index: 20, + logs: [ + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x0000000000000000000000000000000000000000000000000000000010642ac0", + index: 43, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000707d8fce670759b51122fd988af014bb059df028", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x000000000000000000000000000000000000000000000000021f09e85a9c7520", + index: 44, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f6", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x0000000000000000000000000000000000000000000000000000000010642ac0", + index: 45, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x00000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f6", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0x11b815efB8f581194ae79006d24E0d814B7697F6", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffffffde0f617a5638ae00000000000000000000000000000000000000000000000000000000010642ac000000000000000000000000000000000000000000002c77270a4930cb055e7ba0000000000000000000000000000000000000000000000005a36ff62da119ba2fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffced61", + index: 46, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xA49d7499271aE71cd8aB9Ac515e6694C755d400c", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x000000000000000000000000000000000000000000000009f92610ead258ba45", + index: 47, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000090f13faa11725f4615d43035b9119acfd5c245ee", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x000000000000000000000000000000000000000000000000021f09e85a9c7520", + index: 48, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x00000000000000000000000090f13faa11725f4615d43035b9119acfd5c245ee", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0x90F13FAa11725f4615D43035b9119aCFd5c245eE", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0xfffffffffffffffffffffffffffffffffffffffffffffff606d9ef152da745bb000000000000000000000000000000000000000000000000021f09e85a9c75200000000000000000000000000000000000000000075a122a22ec9c6902ad5f1600000000000000000000000000000000000000000000006ae1e914ce780a533dfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeea9f", + index: 49, + topics: [ + "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0x22F9dCF4647084d6C31b2765F6910cd85C178C18", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x00000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a49d7499271ae71cd8ab9ac515e6694c755d400c0000000000000000000000000000000000000000000000000000000010642ac0000000000000000000000000000000000000000000000009f92610ead258ba45", + index: 50, + topics: [ + "0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xA49d7499271aE71cd8aB9Ac515e6694C755d400c", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x0000000000000000000000000000000000000000000000000c9340e6feacd9ac", + index: 51, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x0000000000000000000000004a183b7ed67b9e14b3f45abfb2cf44ed22c29e54", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xA49d7499271aE71cd8aB9Ac515e6694C755d400c", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x000000000000000000000000000000000000000000000009ec92d003d3abe099", + index: 52, + topics: [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18", + "0x000000000000000000000000707d8fce670759b51122fd988af014bb059df028", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + { + _type: "log", + address: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + blockHash: + "0x1b772c3c35d168bf58cc7c212b8acbd526b546757362efdf606ab8230868c137", + blockNumber: 16880821, + data: "0x000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a49d7499271ae71cd8ab9ac515e6694c755d400c0000000000000000000000000000000000000000000000000000000010642ac0000000000000000000000000000000000000000000000009ec92d003d3abe099", + index: 53, + topics: [ + "0x0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b3", + "0x000000000000000000000000707d8fce670759b51122fd988af014bb059df028", + ], + transactionHash: + "0x4db5b7168686cdfb1469b47a67f03fb6199aa81f3d2a26c4a05835b8752d152d", + transactionIndex: 20, + }, + ], + logsBloom: + "0x00000002000000015000001000000000000000000000000000000000000000000001040000000000000000000000010002000000080020000000000000000000000000000040000800000008004000000000000000002000000010000000020000000000000000040001101000000000020000000000000010000090000808000000000000000000000000000080000000000000000000000400000000100000008000000000000000000080800001000000000000000000000004000000004001000002001100000000000000000400000000000000000000004000000000000000200000000400000000000000000400000000000000000008001010001400", + status: 1, + to: "0xDef1C0ded9bec7F1a1670819833240f027b25EfF", + }; + + it("parses swap for transformERC20", async () => { + const data = await parseSwap({ + txReceipt, + txDescription: { + name: "transformERC20", + value: 332666067836453233036n, + args: [ + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0xA49d7499271aE71cd8aB9Ac515e6694C755d400c", + 275000000n, + 181227862178199637786n, + ], + }, + rpcUrl: RPC_TEST_URL, + }); + + expect(data).toEqual({ + tokenIn: { + symbol: "USDT", + amount: "275", + address: "0xdAC17F958D2ee523a2206206994597C13D831ec7" + }, + tokenOut: { + symbol: "MUTE", + amount: "183.067612917791449241", + address: '0xA49d7499271aE71cd8aB9Ac515e6694C755d400c', + }, + }); + }); +}); diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..ffef363 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,69 @@ +export interface ProcessedLog { + to: string; + from: string; + symbol: string; + amount: string; + address: string; + decimals: number; +} + +export interface EnrichedTxReceipt { + logs: ProcessedLog[]; + from: string; +} + +export enum TransactionStatus { + REVERTED = 0, + SUCCESSFUL = 1, +} + +export interface Log { + transactionIndex: number; + blockNumber: number; + transactionHash: string; + address: string; + data: string; + logIndex?: number; + blockHash: string; + topics: readonly string[]; +} + +export interface EnrichedLogWithoutAmount extends Log { + symbol: string; + decimals: number; + from?: string; +} + +export interface TransactionReceipt { + logs: readonly Log[]; + from: string; + status: number | null; +} + +// generic here. +export interface TxDescription { + value: bigint; + name: string; + args: (string | bigint)[] | (string | bigint)[][]; + fragment?: { + inputs: readonly any[]; + } +} + +export interface ParseSwapArgs { + txReceipt: TransactionReceipt; + txDescription: TxDescription; + rpcUrl: string; +} + +type ParserFunction = (params: { + txDescription: TxDescription; + txReceipt: EnrichedTxReceipt; +}) => { + tokenIn: { symbol: string; amount: string }; + tokenOut: { symbol: string; amount: string }; +} | undefined; + +export interface LogParsers { + [key: string]: ParserFunction; +} diff --git a/src/utils/index.test.ts b/src/utils/index.test.ts new file mode 100644 index 0000000..c5dd74f --- /dev/null +++ b/src/utils/index.test.ts @@ -0,0 +1,47 @@ +import { describe, expect, it } from "vitest"; +import { erc20Rpc, formatUnits, parseHexDataToString } from "./index"; + +require("dotenv").config(); + +const RPC_TEST_URL = process.env.RPC_TEST_URL; + +if (!RPC_TEST_URL) { + throw new Error("Missing environment variable `RPC_TEST_URL`"); +} + +describe("utils", () => { + describe("erc20Rpc", () => { + it("retrieves the correct token symbol", async () => { + expect( + await erc20Rpc.getSymbol( + "0x6b175474e89094c44da98b954eedeac495271d0f", + RPC_TEST_URL + ) + ).toBe("DAI"); + }); + }); + + describe("formatUnits", () => { + it("formats units, and parses hex data to string", async () => { + expect(formatUnits("1000000000000000000", 18)).toBe("1"); + }); + }); + + describe("parseHexDataToString", () => { + it("parses hex data and returns the corresponding string", async () => { + expect( + parseHexDataToString( + "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000045745544800000000000000000000000000000000000000000000000000000000" + ) + ).toBe("WETH"); + }); + + it("parses zero hex data and returns an empty string", async () => { + expect( + parseHexDataToString( + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456789ABCDEF" + ) + ).toBe(""); + }); + }); +}); diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..50373a4 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,94 @@ +import type { ProcessedLog } from "../types"; + +export function convertHexToAddress(hexString: string): string { + return `0x${hexString.slice(-40)}`; +} + +export function parseHexDataToString(hexData: string) { + const dataLength = parseInt(hexData.slice(66, 130), 16); + const data = hexData.slice(130, 130 + dataLength * 2); + const bytes: Uint8Array = new Uint8Array( + data.match(/.{1,2}/g)?.map((byte: string) => parseInt(byte, 16)) ?? [] + ); + const textDecoder = new TextDecoder(); + const utf8String = textDecoder.decode(bytes); + + return utf8String; +} + +export function formatUnits(data: string, decimals: number) { + const bigIntData = BigInt(data); + const bigIntDecimals = BigInt(10 ** decimals); + const wholePart = bigIntData / bigIntDecimals; + const fractionalPart = bigIntData % bigIntDecimals; + const paddedFractionalPart = String(fractionalPart).padStart(decimals, "0"); + const formattedFractionalPart = paddedFractionalPart.replace(/0+$/, ""); + + return formattedFractionalPart.length > 0 + ? `${wholePart}.${formattedFractionalPart}` + : wholePart.toString(); +} + +async function rpcCall({ + rpcUrl, + method, + params = [], +}: { + rpcUrl: string; + method: string; + params?: unknown[]; +}) { + const response = await fetch(rpcUrl, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + jsonrpc: "2.0", + id: 1, + method, + params, + }), + }); + + return await response.json(); +} + +export const erc20Rpc = { + getSymbol: async function (contractAddress: string, rpcUrl: string) { + const SYMBOL_FUNCTION_HASH = "0x95d89b41"; + const { result } = await rpcCall({ + rpcUrl, + method: "eth_call", + params: [{ to: contractAddress, data: SYMBOL_FUNCTION_HASH }, "latest"], + }); + + return parseHexDataToString(result); + }, + getDecimals: async function (contractAddress: string, rpcUrl: string) { + const DECIMALS_FUNCTION_HASH = "0x313ce567"; + const { result } = await rpcCall({ + rpcUrl, + method: "eth_call", + params: [{ to: contractAddress, data: DECIMALS_FUNCTION_HASH }, "latest"], + }); + + return Number(BigInt(result)); + }, +}; + +export function extractTokenInfo( + inputLog: ProcessedLog, + outputLog: ProcessedLog +) { + return { + tokenIn: { + symbol: inputLog.symbol, + amount: inputLog.amount, + address: inputLog.address, + }, + tokenOut: { + symbol: outputLog.symbol, + amount: outputLog.amount, + address: outputLog.address, + }, + }; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6df518f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "esnext", + "lib": ["esnext", "dom"], + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "esModuleInterop": true, + "moduleResolution": "node", + "outDir": "dist", + "resolveJsonModule": true, + "skipLibCheck": true, + "emitDeclarationOnly": true + }, + "exclude": [ + "dist", + "node_modules", + ] +} \ No newline at end of file