From 63851c9d055d5afa84e04762e615e9ea3cddd805 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 3 Jun 2024 18:01:29 -0230 Subject: [PATCH] test: Enable type checking of tests (#24844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Most tests were not being type-checked by the `yarn lint:tsc` command because they were omitted from `tsconfig.json`. `tsconfig.json` has been updated to include tests, and all affected files were updated to fix resulting ESLint and type errors. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24844?quickstart=1) ## **Related issues** N/A ## **Manual testing steps** N/A ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../controllers/encryption-public-key.test.ts | 6 +- .../process-onchain-notifications.test.ts | 3 +- .../user-storage-controller.test.ts | 66 +- .../AccountIdentitiesPetnamesBridge.test.ts | 9 +- .../lib/keyring-snaps-permissions.test.ts | 4 +- .../createUnsupportedMethodMiddleware.test.ts | 3 +- .../snap-keyring/utils/isBlockedUrl.test.ts | 1 + app/scripts/migrations/095.test.ts | 3 +- test/data/confirmations/personal_sign.ts | 3 +- test/e2e/accounts/remove-account-snap.spec.ts | 2 +- test/e2e/flask/user-operations.spec.ts | 3 - .../custodian-hooks/ICustodianTestClient.ts | 4 +- test/e2e/mmi/custodian-hooks/hooks.ts | 26 +- test/e2e/mmi/helpers/custodian-helper.ts | 2 + test/e2e/mmi/helpers/dapps-helpers.ts | 4 +- .../mmi/pageObjects/mmi-accountMenu-page.ts | 26 +- test/e2e/mmi/pageObjects/mmi-main-page.ts | 4 +- test/e2e/mmi/pageObjects/mmi-mainMenu-page.ts | 9 +- test/e2e/mmi/specs/navigation.spec.ts | 1 - test/e2e/mmi/specs/qrCode.spec.ts | 1 - test/e2e/mmi/specs/transactions.spec.ts | 9 +- test/e2e/seeder/ganache.ts | 6 +- test/e2e/tests/confirmations/helpers.ts | 20 +- .../confirmations/signatures/permit.spec.ts | 45 +- .../signatures/personal-sign.spec.ts | 35 +- .../signatures/sign-typed-data-v3.spec.ts | 40 +- .../signatures/sign-typed-data-v4.spec.ts | 40 +- .../signatures/sign-typed-data.spec.ts | 25 +- test/e2e/tests/ppom/mocks/json-rpc-result.ts | 6 +- .../tests/ppom/mocks/mock-server-json-rpc.ts | 6 + .../tests/settings/change-language.spec.ts | 13 +- .../mock-request-buy-erc1155.ts | 635 +++---- .../mock-request-buy-erc20.ts | 1495 +++++++++-------- .../mock-request-buy-erc721.ts | 639 +++---- .../mock-request-error-insuffient-gas.ts | 45 +- ...ock-request-error-malformed-transaction.ts | 43 +- .../mock-request-no-changes.ts | 110 +- .../mock-request-send-eth.ts | 124 +- .../simulation-details.spec.ts | 285 ++-- test/e2e/tests/simulation-details/types.ts | 14 +- test/e2e/tests/swap-send/mocks/erc20-data.ts | 2 +- test/e2e/tests/swap-send/mocks/eth-data.ts | 6 +- .../tests/swap-send/swap-send-erc20.spec.ts | 11 +- .../e2e/tests/swap-send/swap-send-eth.spec.ts | 7 +- .../tests/swap-send/swap-send-test-utils.ts | 28 +- tsconfig.json | 11 +- ui/components/app/alert-system/utils.test.ts | 6 +- ui/components/app/name/name.test.tsx | 52 +- ui/ducks/locale/locale.test.ts | 12 +- .../simulation-details/amount-pill.test.tsx | 36 +- .../simulation-details/asset-pill.test.tsx | 41 +- .../simulation-details/fiat-display.test.tsx | 30 +- .../simulation-details/formatAmount.test.ts | 6 +- .../sortBalanceChanges.test.ts | 9 +- .../useSimulationMetrics.test.ts | 176 +- .../confirmations/hooks/alerts/utils.test.ts | 14 +- 56 files changed, 2420 insertions(+), 1842 deletions(-) diff --git a/app/scripts/controllers/encryption-public-key.test.ts b/app/scripts/controllers/encryption-public-key.test.ts index 274f0c67d7e9..5ac41fd28a90 100644 --- a/app/scripts/controllers/encryption-public-key.test.ts +++ b/app/scripts/controllers/encryption-public-key.test.ts @@ -214,6 +214,7 @@ describe('EncryptionPublicKeyController', () => { }); describe('newRequestEncryptionPublicKey', () => { + // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ['Ledger', KeyringType.ledger], ['Trezor', KeyringType.trezor], @@ -221,7 +222,10 @@ describe('EncryptionPublicKeyController', () => { ['QR hardware', KeyringType.qr], ])( 'throws if keyring is not supported', - async (keyringName, keyringType) => { + async ( + keyringName: string, + keyringType: (typeof KeyringType)[keyof typeof KeyringType], + ) => { getAccountKeyringTypeMock.mockResolvedValueOnce(keyringType); await expect( diff --git a/app/scripts/controllers/metamask-notifications/processors/process-onchain-notifications.test.ts b/app/scripts/controllers/metamask-notifications/processors/process-onchain-notifications.test.ts index cd2159a9fb01..8c703c0bedda 100644 --- a/app/scripts/controllers/metamask-notifications/processors/process-onchain-notifications.test.ts +++ b/app/scripts/controllers/metamask-notifications/processors/process-onchain-notifications.test.ts @@ -41,9 +41,10 @@ const rawNotificationTestSuite = rawNotifications.map( ); describe('process-onchain-notifications - processOnChainNotification()', () => { + // @ts-expect-error This is missing from the Mocha type definitions test.each(rawNotificationTestSuite)( 'Converts Raw On-Chain Notification (%s) to a shared Notification Type', - (_, rawNotification) => { + (_: string, rawNotification: OnChainRawNotification) => { const result = processOnChainNotification(rawNotification); expect(result.id).toBe(rawNotification.id); expect(result.type).toBe(rawNotification.type); diff --git a/app/scripts/controllers/user-storage/user-storage-controller.test.ts b/app/scripts/controllers/user-storage/user-storage-controller.test.ts index b7006554365e..471f82cbbd58 100644 --- a/app/scripts/controllers/user-storage/user-storage-controller.test.ts +++ b/app/scripts/controllers/user-storage/user-storage-controller.test.ts @@ -73,6 +73,7 @@ describe('user-storage/user-storage-controller - performGetStorage() tests', () ).rejects.toThrow(); }); + // @ts-expect-error This is missing from the Mocha type definitions test.each([ [ 'fails when no bearer token is found (auth errors)', @@ -88,18 +89,26 @@ describe('user-storage/user-storage-controller - performGetStorage() tests', () new Error('MOCK FAILURE'), ), ], - ])('rejects on auth failure - %s', async (_, arrangeFailureCase) => { - const { messengerMocks } = arrangeMocks(); - arrangeFailureCase(messengerMocks); - const controller = new UserStorageController({ - messenger: messengerMocks.messenger, - getMetaMetricsState: () => true, - }); - - await expect( - controller.performGetStorage('notification_settings'), - ).rejects.toThrow(); - }); + ])( + 'rejects on auth failure - %s', + async ( + _: string, + arrangeFailureCase: ( + messengerMocks: ReturnType, + ) => void, + ) => { + const { messengerMocks } = arrangeMocks(); + arrangeFailureCase(messengerMocks); + const controller = new UserStorageController({ + messenger: messengerMocks.messenger, + getMetaMetricsState: () => true, + }); + + await expect( + controller.performGetStorage('notification_settings'), + ).rejects.toThrow(); + }, + ); function arrangeMocks() { return { @@ -137,6 +146,7 @@ describe('user-storage/user-storage-controller - performSetStorage() tests', () ).rejects.toThrow(); }); + // @ts-expect-error This is missing from the Mocha type definitions test.each([ [ 'fails when no bearer token is found (auth errors)', @@ -152,18 +162,26 @@ describe('user-storage/user-storage-controller - performSetStorage() tests', () new Error('MOCK FAILURE'), ), ], - ])('rejects on auth failure - %s', async (_, arrangeFailureCase) => { - const { messengerMocks } = arrangeMocks(); - arrangeFailureCase(messengerMocks); - const controller = new UserStorageController({ - messenger: messengerMocks.messenger, - getMetaMetricsState: () => true, - }); - - await expect( - controller.performSetStorage('notification_settings', 'new data'), - ).rejects.toThrow(); - }); + ])( + 'rejects on auth failure - %s', + async ( + _: string, + arrangeFailureCase: ( + messengerMocks: ReturnType, + ) => void, + ) => { + const { messengerMocks } = arrangeMocks(); + arrangeFailureCase(messengerMocks); + const controller = new UserStorageController({ + messenger: messengerMocks.messenger, + getMetaMetricsState: () => true, + }); + + await expect( + controller.performSetStorage('notification_settings', 'new data'), + ).rejects.toThrow(); + }, + ); test('rejects if api call fails', async () => { const { messengerMocks } = arrangeMocks({ diff --git a/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts b/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts index b7ac979f3a1c..7e1a23a5902e 100644 --- a/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts +++ b/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts @@ -205,6 +205,7 @@ describe('AccountIdentitiesPetnamesBridge', () => { }); describe('shouldSyncPetname', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ { origin: NameOrigin.ACCOUNT_IDENTITY, @@ -216,7 +217,13 @@ describe('AccountIdentitiesPetnamesBridge', () => { }, ])( 'returns $expectedReturn if origin is $origin', - ({ origin, expectedReturn }) => { + ({ + origin, + expectedReturn, + }: { + origin: NameOrigin; + expectedReturn: boolean; + }) => { class TestBridge extends AccountIdentitiesPetnamesBridge { public shouldSyncPetname(entry: PetnameEntry): boolean { return super.shouldSyncPetname(entry); diff --git a/app/scripts/lib/keyring-snaps-permissions.test.ts b/app/scripts/lib/keyring-snaps-permissions.test.ts index 3e457df2e258..bd48d78cd6bb 100644 --- a/app/scripts/lib/keyring-snaps-permissions.test.ts +++ b/app/scripts/lib/keyring-snaps-permissions.test.ts @@ -71,6 +71,7 @@ describe('keyringSnapPermissionsBuilder', () => { expect(permissions()).toStrictEqual([]); }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ '', 'null', @@ -84,7 +85,7 @@ describe('keyringSnapPermissionsBuilder', () => { 1, 0, -1, - ])('"%s" cannot call any methods', (origin) => { + ])('"%s" cannot call any methods', (origin: unknown) => { const permissions = keyringSnapPermissionsBuilder( mockController, // TODO: Replace `any` with type @@ -96,6 +97,7 @@ describe('keyringSnapPermissionsBuilder', () => { }); describe('isProtocolAllowed', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['http://some-dapp.com', true], ['https://some-dapp.com', true], diff --git a/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts b/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts index 432f4bf92614..e50c86d13268 100644 --- a/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts +++ b/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts @@ -21,9 +21,10 @@ describe('createUnsupportedMethodMiddleware', () => { expect(endMock).not.toHaveBeenCalled(); }); + // @ts-expect-error This function is missing from the Mocha type definitions it.each([...UNSUPPORTED_RPC_METHODS.keys()])( 'ends requests for methods that are on the list of unsupported methods: %s', - (method) => { + (method: string) => { const middleware = createUnsupportedMethodMiddleware(); const nextMock = jest.fn(); const endMock = jest.fn(); diff --git a/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts b/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts index 3a493b764b35..ba7ef745ffa5 100644 --- a/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts +++ b/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts @@ -27,6 +27,7 @@ describe('isBlockedUrl', () => { }, }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['http://metamask.io', false], ['https://metamask.io', false], diff --git a/app/scripts/migrations/095.test.ts b/app/scripts/migrations/095.test.ts index d4858de9066f..988f59b8f5f8 100644 --- a/app/scripts/migrations/095.test.ts +++ b/app/scripts/migrations/095.test.ts @@ -156,12 +156,13 @@ describe('migration #95', () => { }); }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['undefined', undefined], ['empty', {}], ])( 'does nothing if incoming transactions %s', - async (_title, incomingTransactions) => { + async (_title: string, incomingTransactions: unknown) => { const oldData = { some: 'data', IncomingTransactionsController: { diff --git a/test/data/confirmations/personal_sign.ts b/test/data/confirmations/personal_sign.ts index b022949076f6..e0c9d093d78c 100644 --- a/test/data/confirmations/personal_sign.ts +++ b/test/data/confirmations/personal_sign.ts @@ -1,4 +1,5 @@ -export const PERSONAL_SIGN_SENDER_ADDRESS = '0x8eeee1781fd885ff5ddef7789486676961873d12'; +export const PERSONAL_SIGN_SENDER_ADDRESS = + '0x8eeee1781fd885ff5ddef7789486676961873d12'; export const unapprovedPersonalSignMsg = { id: '0050d5b0-c023-11ee-a0cb-3390a510a0ab', diff --git a/test/e2e/accounts/remove-account-snap.spec.ts b/test/e2e/accounts/remove-account-snap.spec.ts index 688cd5983a05..f4b8e025c62d 100644 --- a/test/e2e/accounts/remove-account-snap.spec.ts +++ b/test/e2e/accounts/remove-account-snap.spec.ts @@ -1,4 +1,4 @@ -const { strict: assert } = require('assert'); +import { strict as assert } from 'assert'; import { Suite } from 'mocha'; import FixtureBuilder from '../fixture-builder'; import { WINDOW_TITLES, defaultGanacheOptions, withFixtures } from '../helpers'; diff --git a/test/e2e/flask/user-operations.spec.ts b/test/e2e/flask/user-operations.spec.ts index b239c426d1cf..6b6904071aed 100644 --- a/test/e2e/flask/user-operations.spec.ts +++ b/test/e2e/flask/user-operations.spec.ts @@ -1,10 +1,7 @@ -import { TransactionParams } from '@metamask/transaction-controller'; import { withFixtures, unlockWallet, - openDapp, switchToNotificationWindow, - DAPP_URL, WINDOW_TITLES, sendTransaction, convertETHToHexGwei, diff --git a/test/e2e/mmi/custodian-hooks/ICustodianTestClient.ts b/test/e2e/mmi/custodian-hooks/ICustodianTestClient.ts index 2ea67946b525..00565e5d85b5 100644 --- a/test/e2e/mmi/custodian-hooks/ICustodianTestClient.ts +++ b/test/e2e/mmi/custodian-hooks/ICustodianTestClient.ts @@ -1,6 +1,6 @@ import { type BrowserContext } from '@playwright/test'; -export interface ICustodianTestClient { +export type ICustodianTestClient = { /** This method is expected to be used for initial test setup and to keep the context object in order to manage extra screen actions */ setup: (context?: BrowserContext) => Promise; @@ -36,4 +36,4 @@ export interface ICustodianTestClient { /** This method should return the list of account titles to be selected when MMI custodian is connected */ getSelectedAccounts: () => Promise; -} +}; diff --git a/test/e2e/mmi/custodian-hooks/hooks.ts b/test/e2e/mmi/custodian-hooks/hooks.ts index e41910d3cdbe..a012f5633224 100644 --- a/test/e2e/mmi/custodian-hooks/hooks.ts +++ b/test/e2e/mmi/custodian-hooks/hooks.ts @@ -134,6 +134,8 @@ export class CustodianTestClient implements ICustodianTestClient { const maxRetries = 3; const retryInterval = 3000; let retries = 0; + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any let transaction: any; while (retries < maxRetries) { try { @@ -154,7 +156,7 @@ export class CustodianTestClient implements ICustodianTestClient { console.log(`Retrying in ${retryInterval / 1000} seconds...`); await new Promise((resolve) => setTimeout(resolve, retryInterval)); } else { - throw error( + throw new Error( `👎 Max retries (${maxRetries}) reached. Saturn tx not found.`, ); } @@ -193,6 +195,8 @@ export class CustodianTestClient implements ICustodianTestClient { try { const transactions = await this.getEIP721TransactionStatusCreated(); const { id } = transactions.find( + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any (transaction: any) => transaction?.payload?.message?.contents === signedTransactionTime, ); @@ -260,7 +264,7 @@ export class CustodianTestClient implements ICustodianTestClient { const diffTime = transactions.map((tx: { createdAt: string }) => Math.abs( new Date(tx.createdAt).getTime() - - parseInt(signedTransactionTime, 10), + parseInt(signedTransactionTime, 10), ), ); const min = Math.min(...diffTime); @@ -295,6 +299,8 @@ export class CustodianTestClient implements ICustodianTestClient { return transactions[index]; } + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any async getPersonalSignatureTransactionStatusCreated(): Promise { const authorization = this.bearerToken; return await axios @@ -317,6 +323,8 @@ export class CustodianTestClient implements ICustodianTestClient { }); } + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any async getEIP721TransactionStatusCreated(): Promise { const authorization = this.bearerToken; return await axios @@ -347,13 +355,19 @@ export class CustodianTestClient implements ICustodianTestClient { return txId; } + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any public async postConnectionRequest(data: any) { return (await axios - .post("https://neptune-custody.dev.metamask-institutional.io/qrcode/connection-request", data, { - headers: { - 'Content-Type': 'application/json', + .post( + 'https://neptune-custody.dev.metamask-institutional.io/qrcode/connection-request', + data, + { + headers: { + 'Content-Type': 'application/json', + }, }, - }) + ) .then(function (response) { expect(response.status).toBe(200); return response.data; diff --git a/test/e2e/mmi/helpers/custodian-helper.ts b/test/e2e/mmi/helpers/custodian-helper.ts index eab47957aba2..a45e5a7e84c3 100644 --- a/test/e2e/mmi/helpers/custodian-helper.ts +++ b/test/e2e/mmi/helpers/custodian-helper.ts @@ -6,6 +6,8 @@ export async function getCustodianInfoByName(name: string) { // First get an admin token try { const { custodians } = (await axios.get(`${MMI_E2E_MMI_CONFIG_URL}`)).data; + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any return custodians.filter(function (custodian: any) { return custodian.name === name; }); diff --git a/test/e2e/mmi/helpers/dapps-helpers.ts b/test/e2e/mmi/helpers/dapps-helpers.ts index 04492ab56ace..0cf01ec3f47d 100644 --- a/test/e2e/mmi/helpers/dapps-helpers.ts +++ b/test/e2e/mmi/helpers/dapps-helpers.ts @@ -74,6 +74,6 @@ export async function callTestDappBtn( ); return { dummyDApp, - signedTransactionTime - } + signedTransactionTime, + }; } diff --git a/test/e2e/mmi/pageObjects/mmi-accountMenu-page.ts b/test/e2e/mmi/pageObjects/mmi-accountMenu-page.ts index 5d34402662d8..83a8f2a91e2d 100644 --- a/test/e2e/mmi/pageObjects/mmi-accountMenu-page.ts +++ b/test/e2e/mmi/pageObjects/mmi-accountMenu-page.ts @@ -1,7 +1,7 @@ import { type Locator, type Page, test, expect } from '@playwright/test'; import { getCustodianInfoByName } from '../helpers/custodian-helper'; -import { MMISaturnUIPage } from './mmi-saturn-ui-page'; import { CustodianTestClient } from '../custodian-hooks/hooks'; +import { MMISaturnUIPage } from './mmi-saturn-ui-page'; export class MMIAccountMenuPage { readonly page: Page; @@ -78,16 +78,21 @@ export class MMIAccountMenuPage { let data = await spanElement.getAttribute('data-value'); while (!data) { - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); data = await spanElement.getAttribute('data-value'); } const client = new CustodianTestClient(); await client.setup(); await client.postConnectionRequest(data); - await this.page.getByTestId('select-all-accounts-selected-false').click(); + await this.page + .getByTestId('select-all-accounts-selected-false') + .click(); await this.page.getByRole('button', { name: /connect/iu }).click(); - await this.page.getByRole('button', { name: /close/iu }).first().click(); + await this.page + .getByRole('button', { name: /close/iu }) + .first() + .click(); } } else { await expect( @@ -96,7 +101,9 @@ export class MMIAccountMenuPage { if (visual) { await test.expect .soft(this.page) - .toHaveScreenshot('custodian_connection_info.png', { fullPage: true }); + .toHaveScreenshot('custodian_connection_info.png', { + fullPage: true, + }); } const pagePromise = this.page.context().waitForEvent('page'); @@ -109,7 +116,6 @@ export class MMIAccountMenuPage { await this.page.getByRole('button', { name: /cancel/iu }).click(); await this.page.getByRole('button', { name: /back/iu }).click(); } - } async selectCustodyAccount(account: string) { @@ -128,11 +134,9 @@ export class MMIAccountMenuPage { '.multichain-account-list-item__content', ); - await test.expect - .soft(dialog) - .toHaveScreenshot(screenshotName, { - mask: [accountsFunds, networkBanner], - }); + await test.expect.soft(dialog).toHaveScreenshot(screenshotName, { + mask: [accountsFunds, networkBanner], + }); } async removeTokenScreenshot(accountToRemoveName: string) { diff --git a/test/e2e/mmi/pageObjects/mmi-main-page.ts b/test/e2e/mmi/pageObjects/mmi-main-page.ts index c6c06b544a2c..6d3ab315488f 100644 --- a/test/e2e/mmi/pageObjects/mmi-main-page.ts +++ b/test/e2e/mmi/pageObjects/mmi-main-page.ts @@ -27,7 +27,9 @@ export class MMIMainPage { async finishOnboarding() { await this.page.getByRole('button', { name: /continue/iu }).click(); - await this.page.getByRole('button', { name: /continue to wallet/iu }).click(); + await this.page + .getByRole('button', { name: /continue to wallet/iu }) + .click(); } async checkLastTransactionStatus(status: string | RegExp) { diff --git a/test/e2e/mmi/pageObjects/mmi-mainMenu-page.ts b/test/e2e/mmi/pageObjects/mmi-mainMenu-page.ts index af93c7f5b56e..7780c2ce8893 100644 --- a/test/e2e/mmi/pageObjects/mmi-mainMenu-page.ts +++ b/test/e2e/mmi/pageObjects/mmi-mainMenu-page.ts @@ -89,16 +89,19 @@ export class MMIMainMenuPage { } async fillPassword() { - await this.page.getByTestId('unlock-password').fill(process.env.MMI_E2E_MMI_PASSWORD as string); + await this.page + .getByTestId('unlock-password') + .fill(process.env.MMI_E2E_MMI_PASSWORD as string); await this.page.getByRole('button', { name: /unlock/iu }).click(); } async finishOnboarding() { await this.page.getByRole('button', { name: /continue/iu }).click(); - await this.page.getByRole('button', { name: /continue to wallet/iu }).click(); + await this.page + .getByRole('button', { name: /continue to wallet/iu }) + .click(); } - async switchTestNetwork() { await this.page .locator( diff --git a/test/e2e/mmi/specs/navigation.spec.ts b/test/e2e/mmi/specs/navigation.spec.ts index ee5d3e34503f..b1c8c896d31f 100644 --- a/test/e2e/mmi/specs/navigation.spec.ts +++ b/test/e2e/mmi/specs/navigation.spec.ts @@ -11,7 +11,6 @@ import { Auth0Page } from '../pageObjects/mmi-auth0-page'; import { MMIMainPage } from '../pageObjects/mmi-main-page'; const portfolio = `${process.env.MMI_E2E_MMI_DASHBOARD_URL}/portfolio`; -const swap = `${process.env.MMI_E2E_MMI_DASHBOARD_URL}/swap`; const stake = `${process.env.MMI_E2E_MMI_DASHBOARD_URL}/stake`; const support = 'https://mmi-support.metamask.io/hc/en-us'; const supportContactUs = diff --git a/test/e2e/mmi/specs/qrCode.spec.ts b/test/e2e/mmi/specs/qrCode.spec.ts index 5db3e97f6ecc..64d977459403 100644 --- a/test/e2e/mmi/specs/qrCode.spec.ts +++ b/test/e2e/mmi/specs/qrCode.spec.ts @@ -1,4 +1,3 @@ -import { type Page, type BrowserContext } from '@playwright/test'; import { test } from '../helpers/extension-loader'; import { ChromeExtensionPage } from '../pageObjects/mmi-extension-page'; import { MMIMainMenuPage } from '../pageObjects/mmi-mainMenu-page'; diff --git a/test/e2e/mmi/specs/transactions.spec.ts b/test/e2e/mmi/specs/transactions.spec.ts index b9b6b06cce99..5eabb8298dc7 100644 --- a/test/e2e/mmi/specs/transactions.spec.ts +++ b/test/e2e/mmi/specs/transactions.spec.ts @@ -115,12 +115,8 @@ test.describe('MMI send', () => { const client = new CustodianTestClient(); await client.setup(); const repeatTx = true; - const { mainPage, custodianTxId, secondCustodianTxId } = await sendTransaction( - page, - context, - client, - repeatTx, - ); + const { mainPage, custodianTxId, secondCustodianTxId } = + await sendTransaction(page, context, client, repeatTx); // Sign and submit const statusName = await client.submitTransactionById(custodianTxId); @@ -131,7 +127,6 @@ test.describe('MMI send', () => { } }); - test('Send a transaction from one account to another and abort it from custody', async ({ page, context, diff --git a/test/e2e/seeder/ganache.ts b/test/e2e/seeder/ganache.ts index f838dcde028d..e7eab2461a86 100644 --- a/test/e2e/seeder/ganache.ts +++ b/test/e2e/seeder/ganache.ts @@ -14,6 +14,8 @@ const defaultOptions = { export class Ganache { #server: Server | undefined; + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any async start(opts: any) { const options = { ...defaultOptions, ...opts }; @@ -36,7 +38,7 @@ export class Ganache { const accounts = await this.getAccounts(); const provider = await this.getProvider(); - if (!accounts || !accounts[0] || !provider) { + if (!accounts?.[0] || !provider) { console.log('No accounts found'); return 0; } @@ -67,6 +69,8 @@ export class Ganache { } try { await this.#server.close(); + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { // We can safely ignore the EBUSY error if (e.code !== 'EBUSY') { diff --git a/test/e2e/tests/confirmations/helpers.ts b/test/e2e/tests/confirmations/helpers.ts index 22ef90799a7f..b6a19a6b95a9 100644 --- a/test/e2e/tests/confirmations/helpers.ts +++ b/test/e2e/tests/confirmations/helpers.ts @@ -1,18 +1,20 @@ -import { strict as assert } from 'assert'; import FixtureBuilder from '../../fixture-builder'; -import { - defaultGanacheOptions, - withFixtures, -} from '../../helpers'; +import { defaultGanacheOptions, withFixtures } from '../../helpers'; import { Driver } from '../../webdriver/driver'; -export async function scrollAndConfirmAndAssertConfirm (driver: Driver) { - const confirmButton = await driver.findElement({ xpath: '//button[@data-testid="confirm-footer-button"]'}); +export async function scrollAndConfirmAndAssertConfirm(driver: Driver) { await driver.clickElement('.confirm-scroll-to-bottom__button'); await driver.clickElement('[data-testid="confirm-footer-button"]'); } -export function withRedesignConfirmationFixtures (title: string = '', testFunction: Function) { +export function withRedesignConfirmationFixtures( + // Default params first is discouraged because it makes it hard to call the function without the + // optional parameters. But it doesn't apply here because we're always passing in a variable for + // title. It's optional because it's sometimes unset. + // eslint-disable-next-line @typescript-eslint/default-param-last + title: string = '', + testFunction: Parameters[1], +) { return withFixtures( { dapp: true, @@ -32,4 +34,4 @@ export function withRedesignConfirmationFixtures (title: string = '', testFuncti }, testFunction, ); -} \ No newline at end of file +} diff --git a/test/e2e/tests/confirmations/signatures/permit.spec.ts b/test/e2e/tests/confirmations/signatures/permit.spec.ts index e0bbef3a481a..5afe288f869b 100644 --- a/test/e2e/tests/confirmations/signatures/permit.spec.ts +++ b/test/e2e/tests/confirmations/signatures/permit.spec.ts @@ -1,6 +1,9 @@ import { strict as assert } from 'assert'; import { Suite } from 'mocha'; -import { scrollAndConfirmAndAssertConfirm, withRedesignConfirmationFixtures } from '../helpers'; +import { + scrollAndConfirmAndAssertConfirm, + withRedesignConfirmationFixtures, +} from '../helpers'; import { DAPP_HOST_ADDRESS, WINDOW_TITLES, @@ -12,12 +15,20 @@ import { Ganache } from '../../../seeder/ganache'; import { Driver } from '../../../webdriver/driver'; describe('Confirmation Signature - Permit', function (this: Suite) { - if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { return; } + if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { + return; + } it('initiates and confirms', async function () { await withRedesignConfirmationFixtures( this.test?.fullTitle(), - async ({ driver, ganacheServer }: { driver: Driver, ganacheServer: Ganache }) => { + async ({ + driver, + ganacheServer, + }: { + driver: Driver; + ganacheServer: Ganache; + }) => { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses?.[0] as string; @@ -42,7 +53,9 @@ describe('Confirmation Signature - Permit', function (this: Suite) { await driver.clickElement('#signPermit'); await switchToNotificationWindow(driver); - await driver.clickElement('[data-testid="confirm-footer-cancel-button"]'); + await driver.clickElement( + '[data-testid="confirm-footer-cancel-button"]', + ); await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); @@ -66,7 +79,10 @@ async function assertInfoValues(driver: Driver) { const primaryType = driver.findElement({ text: 'Permit' }); const owner = driver.findElement({ css: '.name__name', text: 'Account 1' }); - const spender = driver.findElement({ css: '.name__value', text: '0x5B38D...eddC4' }); + const spender = driver.findElement({ + css: '.name__value', + text: '0x5B38D...eddC4', + }); const value = driver.findElement({ text: '3000' }); const nonce = driver.findElement({ text: '0' }); const deadline = driver.findElement({ text: '50000000000' }); @@ -95,11 +111,22 @@ async function assertVerifiedResults(driver: Driver, publicAddress: string) { css: '#signPermitVerifyResult', text: publicAddress, }); - const verifyRecoverAddress = await driver.findElement('#signPermitVerifyResult'); + const verifyRecoverAddress = await driver.findElement( + '#signPermitVerifyResult', + ); - assert.equal(await verifyResult.getText(), '0x0a396f89ee073214f7e055e700048abd7b4aba6ecca0352937d6a2ebb7176f2f43c63097ad7597632e34d6a801695702ba603d5872a33ee7d7562fcdb9e816ee1c'); - assert.equal(await verifyResultR.getText(), 'r: 0x0a396f89ee073214f7e055e700048abd7b4aba6ecca0352937d6a2ebb7176f2f'); - assert.equal(await verifyResultS.getText(), 's: 0x43c63097ad7597632e34d6a801695702ba603d5872a33ee7d7562fcdb9e816ee'); + assert.equal( + await verifyResult.getText(), + '0x0a396f89ee073214f7e055e700048abd7b4aba6ecca0352937d6a2ebb7176f2f43c63097ad7597632e34d6a801695702ba603d5872a33ee7d7562fcdb9e816ee1c', + ); + assert.equal( + await verifyResultR.getText(), + 'r: 0x0a396f89ee073214f7e055e700048abd7b4aba6ecca0352937d6a2ebb7176f2f', + ); + assert.equal( + await verifyResultS.getText(), + 's: 0x43c63097ad7597632e34d6a801695702ba603d5872a33ee7d7562fcdb9e816ee', + ); assert.equal(await verifyResultV.getText(), 'v: 28'); assert.equal(await verifyRecoverAddress.getText(), publicAddress); } diff --git a/test/e2e/tests/confirmations/signatures/personal-sign.spec.ts b/test/e2e/tests/confirmations/signatures/personal-sign.spec.ts index 8a5cb50d4856..175f7459d467 100644 --- a/test/e2e/tests/confirmations/signatures/personal-sign.spec.ts +++ b/test/e2e/tests/confirmations/signatures/personal-sign.spec.ts @@ -12,12 +12,20 @@ import { Ganache } from '../../../seeder/ganache'; import { Driver } from '../../../webdriver/driver'; describe('Confirmation Signature - Personal Sign', function (this: Suite) { - if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { return; } + if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { + return; + } it('initiates and confirms', async function () { await withRedesignConfirmationFixtures( this.test?.fullTitle(), - async ({ driver, ganacheServer }: { driver: Driver, ganacheServer: Ganache }) => { + async ({ + driver, + ganacheServer, + }: { + driver: Driver; + ganacheServer: Ganache; + }) => { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses?.[0] as string; @@ -31,7 +39,7 @@ describe('Confirmation Signature - Personal Sign', function (this: Suite) { await driver.clickElement('[data-testid="confirm-footer-button"]'); await assertVerifiedPersonalMessage(driver, publicAddress); - } + }, ); }); @@ -44,7 +52,9 @@ describe('Confirmation Signature - Personal Sign', function (this: Suite) { await driver.clickElement('#personalSign'); await switchToNotificationWindow(driver); - await driver.clickElement('[data-testid="confirm-footer-cancel-button"]'); + await driver.clickElement( + '[data-testid="confirm-footer-cancel-button"]', + ); await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); @@ -61,23 +71,32 @@ describe('Confirmation Signature - Personal Sign', function (this: Suite) { async function assertInfoValues(driver: Driver) { const origin = driver.findElement({ text: DAPP_HOST_ADDRESS }); - const message = driver.findElement({ text: 'Example `personal_sign` message' }); + const message = driver.findElement({ + text: 'Example `personal_sign` message', + }); assert.ok(await origin); assert.ok(await message); } -async function assertVerifiedPersonalMessage(driver: Driver, publicAddress: string) { +async function assertVerifiedPersonalMessage( + driver: Driver, + publicAddress: string, +) { await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); await driver.clickElement('#personalSignVerify'); - const verifySigUtil = await driver.findElement('#personalSignVerifySigUtilResult'); + const verifySigUtil = await driver.findElement( + '#personalSignVerifySigUtilResult', + ); await driver.waitForSelector({ css: '#personalSignVerifyECRecoverResult', text: publicAddress, }); - const verifyECRecover = await driver.findElement('#personalSignVerifyECRecoverResult'); + const verifyECRecover = await driver.findElement( + '#personalSignVerifyECRecoverResult', + ); assert.equal(await verifySigUtil.getText(), publicAddress); assert.equal(await verifyECRecover.getText(), publicAddress); diff --git a/test/e2e/tests/confirmations/signatures/sign-typed-data-v3.spec.ts b/test/e2e/tests/confirmations/signatures/sign-typed-data-v3.spec.ts index 1f3da6c4aeba..4dfdb9851b2a 100644 --- a/test/e2e/tests/confirmations/signatures/sign-typed-data-v3.spec.ts +++ b/test/e2e/tests/confirmations/signatures/sign-typed-data-v3.spec.ts @@ -1,6 +1,9 @@ import { strict as assert } from 'assert'; import { Suite } from 'mocha'; -import { scrollAndConfirmAndAssertConfirm, withRedesignConfirmationFixtures } from '../helpers'; +import { + scrollAndConfirmAndAssertConfirm, + withRedesignConfirmationFixtures, +} from '../helpers'; import { DAPP_HOST_ADDRESS, WINDOW_TITLES, @@ -12,12 +15,20 @@ import { Ganache } from '../../../seeder/ganache'; import { Driver } from '../../../webdriver/driver'; describe('Confirmation Signature - Sign Typed Data V3', function (this: Suite) { - if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { return; } + if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { + return; + } it('initiates and confirms', async function () { await withRedesignConfirmationFixtures( this.test?.fullTitle(), - async ({ driver, ganacheServer }: { driver: Driver, ganacheServer: Ganache }) => { + async ({ + driver, + ganacheServer, + }: { + driver: Driver; + ganacheServer: Ganache; + }) => { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses?.[0] as string; @@ -42,7 +53,9 @@ describe('Confirmation Signature - Sign Typed Data V3', function (this: Suite) { await driver.clickElement('#signTypedDataV3'); await switchToNotificationWindow(driver); - await driver.clickElement('[data-testid="confirm-footer-cancel-button"]'); + await driver.clickElement( + '[data-testid="confirm-footer-cancel-button"]', + ); await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); @@ -66,9 +79,15 @@ async function assertInfoValues(driver: Driver) { const primaryType = driver.findElement({ text: 'Mail' }); const fromName = driver.findElement({ text: 'Cow' }); - const fromAddress = driver.findElement({ css: '.name__value', text: '0xCD2a3...DD826' }); + const fromAddress = driver.findElement({ + css: '.name__value', + text: '0xCD2a3...DD826', + }); const toName = driver.findElement({ text: 'Bob' }); - const toAddress = driver.findElement({ css: '.name__value', text: '0xbBbBB...bBBbB' }); + const toAddress = driver.findElement({ + css: '.name__value', + text: '0xbBbBB...bBBbB', + }); const contents = driver.findElement({ text: 'Hello, Bob!' }); assert.ok(await origin, 'origin'); @@ -91,8 +110,13 @@ async function assertVerifiedResults(driver: Driver, publicAddress: string) { css: '#signTypedDataV3VerifyResult', text: publicAddress, }); - const verifyRecoverAddress = await driver.findElement('#signTypedDataV3VerifyResult'); + const verifyRecoverAddress = await driver.findElement( + '#signTypedDataV3VerifyResult', + ); - assert.equal(await verifyResult.getText(), '0x0a22f7796a2a70c8dc918e7e6eb8452c8f2999d1a1eb5ad714473d36270a40d6724472e5609948c778a07216bd082b60b6f6853d6354c731fd8ccdd3a2f4af261b'); + assert.equal( + await verifyResult.getText(), + '0x0a22f7796a2a70c8dc918e7e6eb8452c8f2999d1a1eb5ad714473d36270a40d6724472e5609948c778a07216bd082b60b6f6853d6354c731fd8ccdd3a2f4af261b', + ); assert.equal(await verifyRecoverAddress.getText(), publicAddress); } diff --git a/test/e2e/tests/confirmations/signatures/sign-typed-data-v4.spec.ts b/test/e2e/tests/confirmations/signatures/sign-typed-data-v4.spec.ts index 2ca76ab23b4e..5c5101d5e018 100644 --- a/test/e2e/tests/confirmations/signatures/sign-typed-data-v4.spec.ts +++ b/test/e2e/tests/confirmations/signatures/sign-typed-data-v4.spec.ts @@ -1,6 +1,9 @@ import { strict as assert } from 'assert'; import { Suite } from 'mocha'; -import { scrollAndConfirmAndAssertConfirm, withRedesignConfirmationFixtures } from '../helpers'; +import { + scrollAndConfirmAndAssertConfirm, + withRedesignConfirmationFixtures, +} from '../helpers'; import { DAPP_HOST_ADDRESS, WINDOW_TITLES, @@ -12,12 +15,20 @@ import { Ganache } from '../../../seeder/ganache'; import { Driver } from '../../../webdriver/driver'; describe('Confirmation Signature - Sign Typed Data V4', function (this: Suite) { - if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { return; } + if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { + return; + } it('initiates and confirms', async function () { await withRedesignConfirmationFixtures( this.test?.fullTitle(), - async ({ driver, ganacheServer }: { driver: Driver, ganacheServer: Ganache }) => { + async ({ + driver, + ganacheServer, + }: { + driver: Driver; + ganacheServer: Ganache; + }) => { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses?.[0] as string; @@ -42,7 +53,9 @@ describe('Confirmation Signature - Sign Typed Data V4', function (this: Suite) { await driver.clickElement('#signTypedDataV4'); await switchToNotificationWindow(driver); - await driver.clickElement('[data-testid="confirm-footer-cancel-button"]'); + await driver.clickElement( + '[data-testid="confirm-footer-cancel-button"]', + ); await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); @@ -67,9 +80,15 @@ async function assertInfoValues(driver: Driver) { const primaryType = driver.findElement({ text: 'Mail' }); const contents = driver.findElement({ text: 'Hello, Bob!' }); const fromName = driver.findElement({ text: 'Cow' }); - const fromAddressNum0 = driver.findElement({ css: '.name__value', text: '0xCD2a3...DD826' }); + const fromAddressNum0 = driver.findElement({ + css: '.name__value', + text: '0xCD2a3...DD826', + }); const toName = driver.findElement({ text: 'Bob' }); - const toAddressNum2 = driver.findElement({ css: '.name__value', text: '0xB0B0b...00000' }); + const toAddressNum2 = driver.findElement({ + css: '.name__value', + text: '0xB0B0b...00000', + }); const attachment = driver.findElement({ text: '0x' }); assert.ok(await origin, 'origin'); @@ -93,8 +112,13 @@ async function assertVerifiedResults(driver: Driver, publicAddress: string) { css: '#signTypedDataV4VerifyResult', text: publicAddress, }); - const verifyRecoverAddress = await driver.findElement('#signTypedDataV4VerifyResult'); + const verifyRecoverAddress = await driver.findElement( + '#signTypedDataV4VerifyResult', + ); - assert.equal(await verifyResult.getText(), '0xcd2f9c55840f5e1bcf61812e93c1932485b524ca673b36355482a4fbdf52f692684f92b4f4ab6f6c8572dacce46bd107da154be1c06939b855ecce57a1616ba71b'); + assert.equal( + await verifyResult.getText(), + '0xcd2f9c55840f5e1bcf61812e93c1932485b524ca673b36355482a4fbdf52f692684f92b4f4ab6f6c8572dacce46bd107da154be1c06939b855ecce57a1616ba71b', + ); assert.equal(await verifyRecoverAddress.getText(), publicAddress); } diff --git a/test/e2e/tests/confirmations/signatures/sign-typed-data.spec.ts b/test/e2e/tests/confirmations/signatures/sign-typed-data.spec.ts index 3d3fe5faaa5b..01f807397a97 100644 --- a/test/e2e/tests/confirmations/signatures/sign-typed-data.spec.ts +++ b/test/e2e/tests/confirmations/signatures/sign-typed-data.spec.ts @@ -12,12 +12,20 @@ import { Ganache } from '../../../seeder/ganache'; import { Driver } from '../../../webdriver/driver'; describe('Confirmation Signature - Sign Typed Data', function (this: Suite) { - if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { return; } + if (!process.env.ENABLE_CONFIRMATION_REDESIGN) { + return; + } it('initiates and confirms', async function () { await withRedesignConfirmationFixtures( this.test?.fullTitle(), - async ({ driver, ganacheServer }: { driver: Driver, ganacheServer: Ganache }) => { + async ({ + driver, + ganacheServer, + }: { + driver: Driver; + ganacheServer: Ganache; + }) => { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses?.[0] as string; @@ -44,7 +52,9 @@ describe('Confirmation Signature - Sign Typed Data', function (this: Suite) { await driver.clickElement('#signTypedData'); await switchToNotificationWindow(driver); - await driver.clickElement('[data-testid="confirm-footer-cancel-button"]'); + await driver.clickElement( + '[data-testid="confirm-footer-cancel-button"]', + ); await driver.waitUntilXWindowHandles(2); await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); @@ -77,8 +87,13 @@ async function assertVerifiedResults(driver: Driver, publicAddress: string) { css: '#signTypedDataVerifyResult', text: publicAddress, }); - const verifyRecoverAddress = await driver.findElement('#signTypedDataVerifyResult'); + const verifyRecoverAddress = await driver.findElement( + '#signTypedDataVerifyResult', + ); - assert.equal(await result.getText(), '0x32791e3c41d40dd5bbfb42e66cf80ca354b0869ae503ad61cd19ba68e11d4f0d2e42a5835b0bfd633596b6a7834ef7d36033633a2479dacfdb96bda360d51f451b'); + assert.equal( + await result.getText(), + '0x32791e3c41d40dd5bbfb42e66cf80ca354b0869ae503ad61cd19ba68e11d4f0d2e42a5835b0bfd633596b6a7834ef7d36033633a2479dacfdb96bda360d51f451b', + ); assert.equal(await verifyRecoverAddress.getText(), publicAddress); } diff --git a/test/e2e/tests/ppom/mocks/json-rpc-result.ts b/test/e2e/tests/ppom/mocks/json-rpc-result.ts index 9fe4fa7dc301..775e049e02b7 100644 --- a/test/e2e/tests/ppom/mocks/json-rpc-result.ts +++ b/test/e2e/tests/ppom/mocks/json-rpc-result.ts @@ -1,8 +1,10 @@ const MOCK_BLOCK_NUMBER = '0x1'; -export interface mockJsonRpcResultType { +export type mockJsonRpcResultType = { + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any [methodName: string]: { [arbitraryVariantName: string]: any }; -} +}; export const mockJsonRpcResult: mockJsonRpcResultType = { eth_blockNumber: { diff --git a/test/e2e/tests/ppom/mocks/mock-server-json-rpc.ts b/test/e2e/tests/ppom/mocks/mock-server-json-rpc.ts index f539df033b02..2c560c20c522 100644 --- a/test/e2e/tests/ppom/mocks/mock-server-json-rpc.ts +++ b/test/e2e/tests/ppom/mocks/mock-server-json-rpc.ts @@ -7,8 +7,12 @@ type RequestConfig = [ /** optional arbitrary method variant name to return various result values */ methodResultVariant?: string; /** optional params value for JSON request used in withJsonBodyIncluding() */ + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any params?: any; /** optional result value returned in JSON response */ + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any result?: any; }, ]; @@ -53,6 +57,8 @@ async function mockServerJsonRpc( await mockServer .forPost() .withJsonBodyIncluding(params ? { method, params } : { method }) + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any .thenCallback(async (req: any) => { return { statusCode: 200, diff --git a/test/e2e/tests/settings/change-language.spec.ts b/test/e2e/tests/settings/change-language.spec.ts index 3e69209e0804..9560991194f3 100644 --- a/test/e2e/tests/settings/change-language.spec.ts +++ b/test/e2e/tests/settings/change-language.spec.ts @@ -1,12 +1,13 @@ -const { strict: assert } = require('assert'); +import { strict as assert } from 'assert'; import { Suite } from 'mocha'; -const { + +import { Driver } from '../../webdriver/driver'; +import { defaultGanacheOptions, withFixtures, unlockWallet, -} = require('../../helpers'); -const FixtureBuilder = require('../../fixture-builder'); -import { Driver } from '../../webdriver/driver'; +} from '../../helpers'; +import FixtureBuilder from '../../fixture-builder'; const selectors = { accountOptionsMenuButton: '[data-testid="account-options-menu-button"]', @@ -255,4 +256,4 @@ describe('Settings - general tab @no-mmi', function (this: Suite) { }, ); }); -}); \ No newline at end of file +}); diff --git a/test/e2e/tests/simulation-details/mock-request-buy-erc1155.ts b/test/e2e/tests/simulation-details/mock-request-buy-erc1155.ts index 4c9e0b0e06bf..8925264cf10b 100644 --- a/test/e2e/tests/simulation-details/mock-request-buy-erc1155.ts +++ b/test/e2e/tests/simulation-details/mock-request-buy-erc1155.ts @@ -1,393 +1,414 @@ -import { MockRequestResponse, SENDER_ADDRESS_MOCK, SENDER_ADDRESS_NO_0x_MOCK } from "./types"; +import { + MockRequestResponse, + SENDER_ADDRESS_MOCK, + SENDER_ADDRESS_NO_0X_MOCK, +} from './types'; export const BUY_ERC1155_TRANSACTION_MOCK = { - "data": "0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe", - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "value": "0x19945ca262000" + data: '0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe', + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + value: '0x19945ca262000', }; export const BUY_ERC1155_REQUEST_1_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [BUY_ERC1155_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [BUY_ERC1155_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x0000000000000000000000000000000000000000000000000000000000000001", - "status": "0x1", - "gasUsed": "0x25f36", - "gasLimit": "0x2759d", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000001', + status: '0x1', + gasUsed: '0x25f36', + gasLimit: '0x2759d', + fees: [ { - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "balanceNeeded": "0x19945ca262000", - "currentBalance": "0x32795c83616e692", - "error": "" - } + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + balanceNeeded: '0x19945ca262000', + currentBalance: '0x32795c83616e692', + error: '', + }, ], - "stateDiff": { - "post": { - "0x00000000000000adc04c56bf30ac9d3c0aaf14dc": { - "storage": { - "0x4c72287b4ec27ed52187d8d12dd2efcc80b62258ecd302f3a49cc31b5e309c12": "0x0000000000000000000000000000040000000000000000000000000000010001" - } + stateDiff: { + post: { + '0x00000000000000adc04c56bf30ac9d3c0aaf14dc': { + storage: { + '0x4c72287b4ec27ed52187d8d12dd2efcc80b62258ecd302f3a49cc31b5e309c12': + '0x0000000000000000000000000000040000000000000000000000000000010001', + }, }, - "0x0000a26b00c1f0df003000390027140000faa719": { - "balance": "0x366ca9f378bea7f25" + '0x0000a26b00c1f0df003000390027140000faa719': { + balance: '0x366ca9f378bea7f25', }, - "0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd": { - "balance": "0x2866997b0e4edc141" + '0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd': { + balance: '0x2866997b0e4edc141', }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x325fc826bf0c692", - "nonce": "0x3bc" - }, - "0x76be3b62873462d2142405439777e971754e8e77": { - "storage": { - "0x3796904d67106d2573261f46f55a01017a279e51efbe4fc47d78ed4f984f2c79": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445": "0x0000000000000000000000000000000000000000000000000000000000000003" - } - }, - "0xa0d884d99316d14d7727a6a9223a8266a4595468": { - "balance": "0xd1563f4a6c5a8" - } + balance: '0x325fc826bf0c692', + nonce: '0x3bc', + }, + '0x76be3b62873462d2142405439777e971754e8e77': { + storage: { + '0x3796904d67106d2573261f46f55a01017a279e51efbe4fc47d78ed4f984f2c79': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445': + '0x0000000000000000000000000000000000000000000000000000000000000003', + }, + }, + '0xa0d884d99316d14d7727a6a9223a8266a4595468': { + balance: '0xd1563f4a6c5a8', + }, }, - "pre": { - "0x00000000000000adc04c56bf30ac9d3c0aaf14dc": { - "balance": "0x0", - "nonce": "0x1" + pre: { + '0x00000000000000adc04c56bf30ac9d3c0aaf14dc': { + balance: '0x0', + nonce: '0x1', }, - "0x0000a26b00c1f0df003000390027140000faa719": { - "balance": "0x366ca94fc33a98b25", - "nonce": "0x1" + '0x0000a26b00c1f0df003000390027140000faa719': { + balance: '0x366ca94fc33a98b25', + nonce: '0x1', }, - "0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd": { - "balance": "0x286696ec383e9f141", - "nonce": "0x18" + '0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd': { + balance: '0x286696ec383e9f141', + nonce: '0x18', }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x32795c83616e692", - "nonce": "0x3bb" - }, - "0x76be3b62873462d2142405439777e971754e8e77": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445": "0x0000000000000000000000000000000000000000000000000000000000000004" - } - }, - "0xa0d884d99316d14d7727a6a9223a8266a4595468": { - "balance": "0xbaf46e3c569a8", - "nonce": "0x12fc" - } - } + balance: '0x32795c83616e692', + nonce: '0x3bb', + }, + '0x76be3b62873462d2142405439777e971754e8e77': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445': + '0x0000000000000000000000000000000000000000000000000000000000000004', + }, + }, + '0xa0d884d99316d14d7727a6a9223a8266a4595468': { + balance: '0xbaf46e3c569a8', + nonce: '0x12fc', + }, + }, }, - "callTrace": { - "from": SENDER_ADDRESS_MOCK, - "to": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "type": "CALL", - "gas": "0x1dcd6500", - "gasUsed": "0x25f36", - "value": "0x19945ca262000", - "input": "0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": [ + callTrace: { + from: SENDER_ADDRESS_MOCK, + to: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + type: 'CALL', + gas: '0x1dcd6500', + gasUsed: '0x25f36', + value: '0x19945ca262000', + input: + '0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: [ { - "from": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "to": "0x0000000000000000000000000000000000000001", - "type": "STATICCALL", - "gas": "0x1d557faf", - "gasUsed": "0xbb8", - "value": null, - "input": "0x0ed016b9310bbb571c96e8b4b9fa9758005b6b990c2d7a77993a345d522a9d51000000000000000000000000000000000000000000000000000000000000001b100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e4976", - "output": "0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468", - "error": "", - "calls": null + from: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + to: '0x0000000000000000000000000000000000000001', + type: 'STATICCALL', + gas: '0x1d557faf', + gasUsed: '0xbb8', + value: null, + input: + '0x0ed016b9310bbb571c96e8b4b9fa9758005b6b990c2d7a77993a345d522a9d51000000000000000000000000000000000000000000000000000000000000001b100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e4976', + output: + '0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468', + error: '', + calls: null, }, { - "from": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "to": "0xa0d884d99316d14d7727a6a9223a8266a4595468", - "type": "CALL", - "gas": "0x1d54ee52", - "gasUsed": "0x0", - "value": "0x1661d10e15c00", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + from: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + to: '0xa0d884d99316d14d7727a6a9223a8266a4595468', + type: 'CALL', + gas: '0x1d54ee52', + gasUsed: '0x0', + value: '0x1661d10e15c00', + input: '0x', + output: '0x', + error: '', + calls: null, }, { - "from": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "to": "0x0000a26b00c1f0df003000390027140000faa719", - "type": "CALL", - "gas": "0x1d54c690", - "gasUsed": "0x55", - "value": "0xa3b5840f400", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + from: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + to: '0x0000a26b00c1f0df003000390027140000faa719', + type: 'CALL', + gas: '0x1d54c690', + gasUsed: '0x55', + value: '0xa3b5840f400', + input: '0x', + output: '0x', + error: '', + calls: null, }, { - "from": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "to": "0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd", - "type": "CALL", - "gas": "0x1d549e7b", - "gasUsed": "0x0", - "value": "0x28ed6103d000", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + from: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + to: '0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd', + type: 'CALL', + gas: '0x1d549e7b', + gasUsed: '0x0', + value: '0x28ed6103d000', + input: '0x', + output: '0x', + error: '', + calls: null, }, { - "from": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "to": "0x1e0049783f008a0085193e00003d00cd54003c71", - "type": "CALL", - "gas": "0x1d549301", - "gasUsed": "0x9ea5", - "value": "0x0", - "input": `0x4ce34aa200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000000000000028640000000000000000000000000000000000000000000000000000000000000001`, - "output": "0x4ce34aa200000000000000000000000000000000000000000000000000000000", - "error": "", - "calls": [ + from: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + to: '0x1e0049783f008a0085193e00003d00cd54003c71', + type: 'CALL', + gas: '0x1d549301', + gasUsed: '0x9ea5', + value: '0x0', + input: `0x4ce34aa200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000000000000028640000000000000000000000000000000000000000000000000000000000000001`, + output: + '0x4ce34aa200000000000000000000000000000000000000000000000000000000', + error: '', + calls: [ { - "from": "0x1e0049783f008a0085193e00003d00cd54003c71", - "to": "0x76be3b62873462d2142405439777e971754e8e77", - "type": "CALL", - "gas": "0x1cdf28f7", - "gasUsed": "0x8602", - "value": "0x0", - "input": `0xf242432a000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}0000000000000000000000000000000000000000000000000000000000002864000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000`, - "output": "0x", - "error": "", - "calls": null, - "logs": [ + from: '0x1e0049783f008a0085193e00003d00cd54003c71', + to: '0x76be3b62873462d2142405439777e971754e8e77', + type: 'CALL', + gas: '0x1cdf28f7', + gasUsed: '0x8602', + value: '0x0', + input: `0xf242432a000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}0000000000000000000000000000000000000000000000000000000000002864000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000`, + output: '0x', + error: '', + calls: null, + logs: [ { - "address": "0x76be3b62873462d2142405439777e971754e8e77", - "topics": [ - "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62", - "0x0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71", - "0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468", - `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}` + address: '0x76be3b62873462d2142405439777e971754e8e77', + topics: [ + '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', + '0x0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71', + '0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468', + `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, ], - "data": "0x00000000000000000000000000000000000000000000000000000000000028640000000000000000000000000000000000000000000000000000000000000001" - } - ] - } - ] - } + data: '0x00000000000000000000000000000000000000000000000000000000000028640000000000000000000000000000000000000000000000000000000000000001', + }, + ], + }, + ], + }, ], - "logs": [ + logs: [ { - "address": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "topics": [ - "0x9d9af8e38d66c62e2c12f0225249fd9d721c54b83f48d9352c97c6cacdcb6f31", - "0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468", - "0x000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c00" + address: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + topics: [ + '0x9d9af8e38d66c62e2c12f0225249fd9d721c54b83f48d9352c97c6cacdcb6f31', + '0x000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468', + '0x000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c00', ], - "data": `0x6ea6470ec24d1cbb4feec79a3bd903fa824925509bf6e1d658be4da525b7d8c9000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e770000000000000000000000000000000000000000000000000000000000002864000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001661d10e15c00000000000000000000000000a0d884d99316d14d7727a6a9223a8266a459546800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000000a26b00c1f0df003000390027140000faa719000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd` - } - ] + data: `0x6ea6470ec24d1cbb4feec79a3bd903fa824925509bf6e1d658be4da525b7d8c9000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e770000000000000000000000000000000000000000000000000000000000002864000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001661d10e15c00000000000000000000000000a0d884d99316d14d7727a6a9223a8266a459546800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000000a26b00c1f0df003000390027140000faa719000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd`, + }, + ], }, - "feeEstimate": 6631084132695242, - "baseFeePerGas": 42658441727 - } + feeEstimate: 6631084132695242, + baseFeePerGas: 42658441727, + }, ], - "blockNumber": "0x12967f2", - "id": "e51ab092-77f2-40f5-9161-c883694ab092" + blockNumber: '0x12967f2', + id: 'e51ab092-77f2-40f5-9161-c883694ab092', }, - "id": "0" + id: '0', }, }; export const BUY_ERC1155_REQUEST_2_MOCK = { request: { - "id": "1", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '1', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [ + transactions: [ { - "from": SENDER_ADDRESS_MOCK, - "to": "0x76be3b62873462d2142405439777e971754e8e77", - "data": `0x00fdd58e000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}0000000000000000000000000000000000000000000000000000000000002864` + from: SENDER_ADDRESS_MOCK, + to: '0x76be3b62873462d2142405439777e971754e8e77', + data: `0x00fdd58e000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}0000000000000000000000000000000000000000000000000000000000002864`, }, { - "chainId": "0x1", - "from": SENDER_ADDRESS_MOCK, - "to": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", - "value": "0x19945ca262000", - "data": "0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe" + chainId: '0x1', + from: SENDER_ADDRESS_MOCK, + to: '0x00000000000000adc04c56bf30ac9d3c0aaf14dc', + value: '0x19945ca262000', + data: '0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006200000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000580000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000065e517b200000000000000000000000000000000000000000000000000000000660de8220000000000000000000000000000000000000000000000000000000000000000360c6ebe0000000000000000000000000000000000000000187d7f63de4580450000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000076be3b62873462d2142405439777e971754e8e77000000000000000000000000000000000000000000000000000000000000286400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059874438570000000000000000000000000000000000000000000000000000005987443857000000000000000000000000000a0d884d99316d14d7727a6a9223a8266a4595468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000000000000000000000000000000028ed6103d0000000000000000000000000000000a26b00c1f0df003000390027140000faa7190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a3b5840f40000000000000000000000000000000000000000000000000000000a3b5840f4000000000000000000000000000157e23d3e68ac6f99334b8b0fe71f0eb844911dd0000000000000000000000000000000000000000000000000000000000000040100fc5b608d71976e87680aa0b785ae11ac8b9004316b9721222a5d6bea2c7a346d74d85776450c82d2ee3e4fa24eb8d612f5975a577789ad2b58dfc6a6e49760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360c6ebe', }, { - "from": SENDER_ADDRESS_MOCK, - "to": "0x76be3b62873462d2142405439777e971754e8e77", - "data": `0x00fdd58e000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}0000000000000000000000000000000000000000000000000000000000002864` - } - ] - } - ] + from: SENDER_ADDRESS_MOCK, + to: '0x76be3b62873462d2142405439777e971754e8e77', + data: `0x00fdd58e000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}0000000000000000000000000000000000000000000000000000000000002864`, + }, + ], + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x0000000000000000000000000000000000000000000000000000000000000000", - "status": "0x1", - "gasUsed": "0x6014", - "gasLimit": "0x6167", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000000', + status: '0x1', + gasUsed: '0x6014', + gasLimit: '0x6167', + fees: [ { - "maxFeePerGas": "0xfebde1167", - "maxPriorityFeePerGas": "0x30c3be3", - "balanceNeeded": "0x60ec70af168d8", - "currentBalance": "0x32795c83616e692", - "error": "" - } + maxFeePerGas: '0xfebde1167', + maxPriorityFeePerGas: '0x30c3be3', + balanceNeeded: '0x60ec70af168d8', + currentBalance: '0x32795c83616e692', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x3bc" - } + nonce: '0x3bc', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x32795c83616e692", - "nonce": "0x3bb" - } - } + balance: '0x32795c83616e692', + nonce: '0x3bb', + }, + }, }, - "feeEstimate": 1049251628741888, - "baseFeePerGas": 42658441727 + feeEstimate: 1049251628741888, + baseFeePerGas: 42658441727, }, { - "return": "0x0000000000000000000000000000000000000000000000000000000000000001", - "status": "0x1", - "gasUsed": "0x25f36", - "gasLimit": "0x2759d", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000001', + status: '0x1', + gasUsed: '0x25f36', + gasLimit: '0x2759d', + fees: [ { - "maxFeePerGas": "0xfebde1167", - "maxPriorityFeePerGas": "0x30c3be3", - "balanceNeeded": "0x28c192121b54c8", - "currentBalance": "0x32187012b257dba", - "error": "" - } + maxFeePerGas: '0xfebde1167', + maxPriorityFeePerGas: '0x30c3be3', + balanceNeeded: '0x28c192121b54c8', + currentBalance: '0x32187012b257dba', + error: '', + }, ], - "stateDiff": { - "post": { - "0x00000000000000adc04c56bf30ac9d3c0aaf14dc": { - "storage": { - "0x4c72287b4ec27ed52187d8d12dd2efcc80b62258ecd302f3a49cc31b5e309c12": "0x0000000000000000000000000000040000000000000000000000000000010001" - } + stateDiff: { + post: { + '0x00000000000000adc04c56bf30ac9d3c0aaf14dc': { + storage: { + '0x4c72287b4ec27ed52187d8d12dd2efcc80b62258ecd302f3a49cc31b5e309c12': + '0x0000000000000000000000000000040000000000000000000000000000010001', + }, }, - "0x0000a26b00c1f0df003000390027140000faa719": { - "balance": "0x366ca9f378bea7f25" + '0x0000a26b00c1f0df003000390027140000faa719': { + balance: '0x366ca9f378bea7f25', }, - "0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd": { - "balance": "0x2866997b0e4edc141" + '0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd': { + balance: '0x2866997b0e4edc141', }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x325fc826bf0c692", - "nonce": "0x3bd" - }, - "0x76be3b62873462d2142405439777e971754e8e77": { - "storage": { - "0x3796904d67106d2573261f46f55a01017a279e51efbe4fc47d78ed4f984f2c79": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445": "0x0000000000000000000000000000000000000000000000000000000000000003" - } - }, - "0xa0d884d99316d14d7727a6a9223a8266a4595468": { - "balance": "0xd1563f4a6c5a8" - } + balance: '0x325fc826bf0c692', + nonce: '0x3bd', + }, + '0x76be3b62873462d2142405439777e971754e8e77': { + storage: { + '0x3796904d67106d2573261f46f55a01017a279e51efbe4fc47d78ed4f984f2c79': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445': + '0x0000000000000000000000000000000000000000000000000000000000000003', + }, + }, + '0xa0d884d99316d14d7727a6a9223a8266a4595468': { + balance: '0xd1563f4a6c5a8', + }, }, - "pre": { - "0x00000000000000adc04c56bf30ac9d3c0aaf14dc": { - "balance": "0x0", - "nonce": "0x1" + pre: { + '0x00000000000000adc04c56bf30ac9d3c0aaf14dc': { + balance: '0x0', + nonce: '0x1', }, - "0x0000a26b00c1f0df003000390027140000faa719": { - "balance": "0x366ca94fc33a98b25", - "nonce": "0x1" + '0x0000a26b00c1f0df003000390027140000faa719': { + balance: '0x366ca94fc33a98b25', + nonce: '0x1', }, - "0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd": { - "balance": "0x286696ec383e9f141", - "nonce": "0x18" + '0x157e23d3e68ac6f99334b8b0fe71f0eb844911dd': { + balance: '0x286696ec383e9f141', + nonce: '0x18', }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x32795c83616e692", - "nonce": "0x3bc" - }, - "0x76be3b62873462d2142405439777e971754e8e77": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445": "0x0000000000000000000000000000000000000000000000000000000000000004" - } - }, - "0xa0d884d99316d14d7727a6a9223a8266a4595468": { - "balance": "0xbaf46e3c569a8", - "nonce": "0x12fc" - } - } + balance: '0x32795c83616e692', + nonce: '0x3bc', + }, + '0x76be3b62873462d2142405439777e971754e8e77': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x55052ce5c7ff3ae88fff66c1ed7bba5d2e8349a1787d18f50854e16e886b2445': + '0x0000000000000000000000000000000000000000000000000000000000000004', + }, + }, + '0xa0d884d99316d14d7727a6a9223a8266a4595468': { + balance: '0xbaf46e3c569a8', + nonce: '0x12fc', + }, + }, }, - "feeEstimate": 6631239578850688, - "baseFeePerGas": 42658441727 + feeEstimate: 6631239578850688, + baseFeePerGas: 42658441727, }, { - "return": "0x0000000000000000000000000000000000000000000000000000000000000001", - "status": "0x1", - "gasUsed": "0x6014", - "gasLimit": "0x6167", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000001', + status: '0x1', + gasUsed: '0x6014', + gasLimit: '0x6167', + fees: [ { - "maxFeePerGas": "0xfebde1167", - "maxPriorityFeePerGas": "0x30c3be3", - "balanceNeeded": "0x60ec70af168d8", - "currentBalance": "0x2f8c56f190a28f2", - "error": "" - } + maxFeePerGas: '0xfebde1167', + maxPriorityFeePerGas: '0x30c3be3', + balanceNeeded: '0x60ec70af168d8', + currentBalance: '0x2f8c56f190a28f2', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x3be" - } + nonce: '0x3be', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x325fc826bf0c692", - "nonce": "0x3bd" - } - } + balance: '0x325fc826bf0c692', + nonce: '0x3bd', + }, + }, }, - "feeEstimate": 1049251628741888, - "baseFeePerGas": 42658441727 - } + feeEstimate: 1049251628741888, + baseFeePerGas: 42658441727, + }, ], - "blockNumber": "0x12967f2", - "id": "bcf1a9f6-3f97-456c-a2d9-2ec7d5893bcb" + blockNumber: '0x12967f2', + id: 'bcf1a9f6-3f97-456c-a2d9-2ec7d5893bcb', }, - "id": "1" + id: '1', }, }; diff --git a/test/e2e/tests/simulation-details/mock-request-buy-erc20.ts b/test/e2e/tests/simulation-details/mock-request-buy-erc20.ts index 769401ccc928..d8e6870618fe 100644 --- a/test/e2e/tests/simulation-details/mock-request-buy-erc20.ts +++ b/test/e2e/tests/simulation-details/mock-request-buy-erc20.ts @@ -1,579 +1,660 @@ -import { MockRequestResponse, SENDER_ADDRESS_MOCK, SENDER_ADDRESS_NO_0x_MOCK } from "./types"; +import { + MockRequestResponse, + SENDER_ADDRESS_MOCK, + SENDER_ADDRESS_NO_0X_MOCK, +} from './types'; export const BUY_ERC20_TRANSACTION = { - "data": `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`, - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "value": "0x71afd498d0000" + data: `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`, + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + value: '0x71afd498d0000', }; export const BUY_ERC20_REQUEST_1_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [BUY_ERC20_TRANSACTION], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [BUY_ERC20_TRANSACTION], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9", - "status": "0x1", - "gasUsed": "0x4628e", - "gasLimit": "0x53cc5", - "fees": [ + return: + '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9', + status: '0x1', + gasUsed: '0x4628e', + gasLimit: '0x53cc5', + fees: [ { - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "balanceNeeded": "0x71afd498d0000", - "currentBalance": "0x77f9fd8d99e7e0", - "error": "" - } + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + balanceNeeded: '0x71afd498d0000', + currentBalance: '0x77f9fd8d99e7e0', + error: '', + }, ], - "stateDiff": { - "post": { - "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000b000b000302f9f6000000000000432ff2e932894fe0874ac6a384b0", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000000000441ce10709c0a0992095e8e5cd95ea470de", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000013a0b298f9b81d1e0000000000000000000000012aa0e421" - } - }, - "0x22832de1178e7f4a8d868411422c720220ddf3d2": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x00000000000000000000000000007708590f241159371f6dd86140347968995f", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3f0700000000000000037a742348f5c5c152" - } + stateDiff: { + post: { + '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000b000b000302f9f6000000000000432ff2e932894fe0874ac6a384b0', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000000000441ce10709c0a0992095e8e5cd95ea470de', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000013a0b298f9b81d1e0000000000000000000000012aa0e421', + }, + }, + '0x22832de1178e7f4a8d868411422c720220ddf3d2': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x00000000000000000000000000007708590f241159371f6dd86140347968995f', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3f0700000000000000037a742348f5c5c152', + }, }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x70df00440ce7e0", - "nonce": "0x4" - }, - "0x6b175474e89094c44da98b954eedeac495271d0f": { - "storage": { - "0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9": "0x00000000000000000000000000000000000000000000026a5b2c87ebb8bb8d1c", - "0xd5dc93f3552cd59356296ab764be72c9bd93d66c2b8576cd18a4677f92be097d": "0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9" - } - }, - "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000ef30a346933b4bd99d3bccde01f6d16e1452c", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3f070000000000000000015eea78185df6b5" - } - }, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": { - "storage": { - "0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374": "0x00000000000000000000000000000000000000000000000000000077a52fa7b8", - "0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee": "0x000000000000000000000000000000000000000000000000000000203d220011" - } - }, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { - "balance": "0x27c965cfc53bf0f2c70b6", - "storage": { - "0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0": "0x00000000000000000000000000000000000000000000000bd3875ff74244a952" - } - }, - "0xd9e497bd8f491fe163b42a62c296fb54caea74b7": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000100010000fbc89c0000000000000000000010c700afe76cb29923e8", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000f1e2d8a8f477b67ef05de74c", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000000013ec29600000000000000011e28c9f4ab7ce8e4" - } - } + balance: '0x70df00440ce7e0', + nonce: '0x4', + }, + '0x6b175474e89094c44da98b954eedeac495271d0f': { + storage: { + '0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9': + '0x00000000000000000000000000000000000000000000026a5b2c87ebb8bb8d1c', + '0xd5dc93f3552cd59356296ab764be72c9bd93d66c2b8576cd18a4677f92be097d': + '0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9', + }, + }, + '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000ef30a346933b4bd99d3bccde01f6d16e1452c', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3f070000000000000000015eea78185df6b5', + }, + }, + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': { + storage: { + '0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374': + '0x00000000000000000000000000000000000000000000000000000077a52fa7b8', + '0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee': + '0x000000000000000000000000000000000000000000000000000000203d220011', + }, + }, + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': { + balance: '0x27c965cfc53bf0f2c70b6', + storage: { + '0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0': + '0x00000000000000000000000000000000000000000000000bd3875ff74244a952', + }, + }, + '0xd9e497bd8f491fe163b42a62c296fb54caea74b7': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000100010000fbc89c0000000000000000000010c700afe76cb29923e8', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x0000000000000000000000000000000000000000f1e2d8a8f477b67ef05de74c', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000000000000013ec29600000000000000011e28c9f4ab7ce8e4', + }, + }, }, - "pre": { - "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000b000b000302f9f6000000000000432fedbb64e891ccc2a450f04080", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000000000441ce10008cb545e85f10ea6254adf2328d", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000013a0b249d023d51e0000000000000000000000012aa0e421" - } - }, - "0x22832de1178e7f4a8d868411422c720220ddf3d2": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000077084f83018a34e0b30b6c5cbbecc5beadbe", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fa28c700000000000000037a742348f5c5c152" - } + pre: { + '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000b000b000302f9f6000000000000432fedbb64e891ccc2a450f04080', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000000000441ce10008cb545e85f10ea6254adf2328d', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000013a0b249d023d51e0000000000000000000000012aa0e421', + }, + }, + '0x22832de1178e7f4a8d868411422c720220ddf3d2': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000077084f83018a34e0b30b6c5cbbecc5beadbe', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fa28c700000000000000037a742348f5c5c152', + }, }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x77f9fd8d99e7e0", - "nonce": "0x3" - }, - "0x6b175474e89094c44da98b954eedeac495271d0f": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9": "0x00000000000000000000000000000000000000000000026ab8efb321467489e5" - } - }, - "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000ef2efd2b96a4061ac9c50b8d33ded38fd6e81", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3d870000000000000000015eea78185df6b5" - } - }, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374": "0x00000000000000000000000000000000000000000000000000000077a596c28e", - "0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee": "0x000000000000000000000000000000000000000000000000000000203cbae53b" - } - }, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { - "balance": "0x27c965cf538c1c59f70b6", - "nonce": "0x1", - "storage": { - "0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0": "0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952" - } - }, - "0xd9e497bd8f491fe163b42a62c296fb54caea74b7": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000100010000fbc89c0000000000000000000010c7009243db83250922", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000f1e2d826b87f89c78bd2b02f", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000000013ec1b700000000000000011e28c9f4ab7ce8e4" - } - } - } + balance: '0x77f9fd8d99e7e0', + nonce: '0x3', + }, + '0x6b175474e89094c44da98b954eedeac495271d0f': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9': + '0x00000000000000000000000000000000000000000000026ab8efb321467489e5', + }, + }, + '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000ef2efd2b96a4061ac9c50b8d33ded38fd6e81', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3d870000000000000000015eea78185df6b5', + }, + }, + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374': + '0x00000000000000000000000000000000000000000000000000000077a596c28e', + '0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee': + '0x000000000000000000000000000000000000000000000000000000203cbae53b', + }, + }, + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': { + balance: '0x27c965cf538c1c59f70b6', + nonce: '0x1', + storage: { + '0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0': + '0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952', + }, + }, + '0xd9e497bd8f491fe163b42a62c296fb54caea74b7': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000100010000fbc89c0000000000000000000010c7009243db83250922', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x0000000000000000000000000000000000000000f1e2d826b87f89c78bd2b02f', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000000000000013ec1b700000000000000011e28c9f4ab7ce8e4', + }, + }, + }, }, - "callTrace": { - "from": SENDER_ADDRESS_MOCK, - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "type": "CALL", - "gas": "0x1dcd6500", - "gasUsed": "0x4628e", - "value": "0x71afd498d0000", - "input": `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`, - "output": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9", - "error": "", - "calls": [ + callTrace: { + from: SENDER_ADDRESS_MOCK, + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + type: 'CALL', + gas: '0x1dcd6500', + gasUsed: '0x4628e', + value: '0x71afd498d0000', + input: `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`, + output: + '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9', + error: '', + calls: [ { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "type": "DELEGATECALL", - "gas": "0x1d55cb99", - "gasUsed": "0x4b605", - "value": "0x71afd498d0000", - "input": `0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000`, - "output": "0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9", - "error": "", - "calls": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + type: 'DELEGATECALL', + gas: '0x1d55cb99', + gasUsed: '0x4b605', + value: '0x71afd498d0000', + input: `0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000`, + output: + '0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9', + error: '', + calls: [ { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xdaecee3c08e953bd5f89a5cc90ac560413d709e3", - "type": "DELEGATECALL", - "gas": "0x1ce04a20", - "gasUsed": "0x6ec", - "value": "0x71afd498d0000", - "input": "0x4e6c8ed800000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4", - "output": "0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "error": "", - "calls": null + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xdaecee3c08e953bd5f89a5cc90ac560413d709e3', + type: 'DELEGATECALL', + gas: '0x1ce04a20', + gasUsed: '0x6ec', + value: '0x71afd498d0000', + input: + '0x4e6c8ed800000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4', + output: + '0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + error: '', + calls: null, }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "type": "CALL", - "gas": "0x1ce031ca", - "gasUsed": "0x284c3", - "value": "0x0", - "input": `0x128acb0800000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000`, - "output": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000", - "error": "", - "calls": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + type: 'CALL', + gas: '0x1ce031ca', + gasUsed: '0x284c3', + value: '0x0', + input: `0x128acb0800000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000`, + output: + '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000', + error: '', + calls: [ { - "from": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "to": "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381", - "type": "CALL", - "gas": "0x1c6c7478", - "gasUsed": "0x6469", - "value": "0x0", - "input": "0x214a6fe20000000000000000000000000000000000000000000000000000000065fb3f07", - "output": "0x", - "error": "", - "calls": [ + from: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + to: '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381', + type: 'CALL', + gas: '0x1c6c7478', + gasUsed: '0x6469', + value: '0x0', + input: + '0x214a6fe20000000000000000000000000000000000000000000000000000000065fb3f07', + output: '0x', + error: '', + calls: [ { - "from": "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381", - "to": "0x556b9306565093c855aea9ae92a594704c2cd59e", - "type": "STATICCALL", - "gas": "0x1bfaade4", - "gasUsed": "0x2cb0", - "value": null, - "input": "0xa15ea89f0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "output": "0x000000000000000000000000000000000000000015ed3b13ee249a07ec6465fb0000000000000000000000000000000000000000000000000000000065fc2307", - "error": "", - "calls": null - } - ] + from: '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381', + to: '0x556b9306565093c855aea9ae92a594704c2cd59e', + type: 'STATICCALL', + gas: '0x1bfaade4', + gasUsed: '0x2cb0', + value: null, + input: + '0xa15ea89f0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + output: + '0x000000000000000000000000000000000000000015ed3b13ee249a07ec6465fb0000000000000000000000000000000000000000000000000000000065fc2307', + error: '', + calls: null, + }, + ], }, { - "from": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "type": "CALL", - "gas": "0x1c6ba4b3", - "gasUsed": "0x9ecc", - "value": "0x0", - "input": "0xa9059cbb00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000000000000671ad6", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": [ + from: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + to: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + type: 'CALL', + gas: '0x1c6ba4b3', + gasUsed: '0x9ecc', + value: '0x0', + input: + '0xa9059cbb00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000000000000671ad6', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: [ { - "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "to": "0x43506849d7c04f9138d1a2050bbf3a0c054402dd", - "type": "DELEGATECALL", - "gas": "0x1bf9da45", - "gasUsed": "0x8253", - "value": "0x0", - "input": "0xa9059cbb00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000000000000671ad6", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": null, - "logs": [ + from: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + to: '0x43506849d7c04f9138d1a2050bbf3a0c054402dd', + type: 'DELEGATECALL', + gas: '0x1bf9da45', + gasUsed: '0x8253', + value: '0x0', + input: + '0xa9059cbb00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000000000000671ad6', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: null, + logs: [ { - "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4" + address: + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + topics: [ + '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + '0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', ], - "data": "0x0000000000000000000000000000000000000000000000000000000000671ad6" - } - ] - } - ] + data: '0x0000000000000000000000000000000000000000000000000000000000671ad6', + }, + ], + }, + ], }, { - "from": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "type": "STATICCALL", - "gas": "0x1c6afb5f", - "gasUsed": "0x9e6", - "value": null, - "input": "0x70a082310000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "output": "0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952", - "error": "", - "calls": null + from: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + type: 'STATICCALL', + gas: '0x1c6afb5f', + gasUsed: '0x9e6', + value: null, + input: + '0x70a082310000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + output: + '0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952', + error: '', + calls: null, }, { - "from": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "type": "CALL", - "gas": "0x1c6aee8b", - "gasUsed": "0xa5b3", - "value": "0x0", - "input": `0x23a69e75ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000`, - "output": "0x", - "error": "", - "calls": [ + from: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + type: 'CALL', + gas: '0x1c6aee8b', + gasUsed: '0xa5b3', + value: '0x0', + input: `0x23a69e75ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000`, + output: '0x', + error: '', + calls: [ { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xdaecee3c08e953bd5f89a5cc90ac560413d709e3", - "type": "DELEGATECALL", - "gas": "0x1bf939da", - "gasUsed": "0x7c8", - "value": "0x0", - "input": "0x8bdb192500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4", - "output": "0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "error": "", - "calls": null + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xdaecee3c08e953bd5f89a5cc90ac560413d709e3', + type: 'DELEGATECALL', + gas: '0x1bf939da', + gasUsed: '0x7c8', + value: '0x0', + input: + '0x8bdb192500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4', + output: + '0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + error: '', + calls: null, }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "type": "CALL", - "gas": "0x1bf9157a", - "gasUsed": "0x5da6", - "value": "0x71afd498d0000", - "input": "0xd0e30db0", - "output": "0x", - "error": "", - "calls": null, - "logs": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + type: 'CALL', + gas: '0x1bf9157a', + gasUsed: '0x5da6', + value: '0x71afd498d0000', + input: '0xd0e30db0', + output: '0x', + error: '', + calls: null, + logs: [ { - "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "topics": [ - "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4" + address: + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + topics: [ + '0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', ], - "data": "0x00000000000000000000000000000000000000000000000000071afd498d0000" - } - ] + data: '0x00000000000000000000000000000000000000000000000000071afd498d0000', + }, + ], }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "type": "CALL", - "gas": "0x1bf8b790", - "gasUsed": "0x17ae", - "value": "0x0", - "input": "0xa9059cbb0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d3600000000000000000000000000000000000000000000000000071afd498d0000", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": null, - "logs": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + type: 'CALL', + gas: '0x1bf8b790', + gasUsed: '0x17ae', + value: '0x0', + input: + '0xa9059cbb0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d3600000000000000000000000000000000000000000000000000071afd498d0000', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: null, + logs: [ { - "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4", - "0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36" + address: + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + topics: [ + '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', + '0x0000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', ], - "data": "0x00000000000000000000000000000000000000000000000000071afd498d0000" - } - ] - } - ] + data: '0x00000000000000000000000000000000000000000000000000071afd498d0000', + }, + ], + }, + ], }, { - "from": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "type": "STATICCALL", - "gas": "0x1c6a48f7", - "gasUsed": "0x216", - "value": null, - "input": "0x70a082310000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36", - "output": "0x00000000000000000000000000000000000000000000000bd3875ff74244a952", - "error": "", - "calls": null - } + from: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + type: 'STATICCALL', + gas: '0x1c6a48f7', + gasUsed: '0x216', + value: null, + input: + '0x70a082310000000000000000000000001ac1a8feaaea1900c4166deeed0c11cc10669d36', + output: + '0x00000000000000000000000000000000000000000000000bd3875ff74244a952', + error: '', + calls: null, + }, ], - "logs": [ + logs: [ { - "address": "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36", - "topics": [ - "0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4" + address: '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36', + topics: [ + '0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000432ff2e932894fe0874ac6a384b0000000000000000000000000000000000000000000000000015f0dcf64944869000000000000000000000000000000000000000000000000000000000002f9f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004f29944800" - } - ] + data: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98e52a00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000432ff2e932894fe0874ac6a384b0000000000000000000000000000000000000000000000000015f0dcf64944869000000000000000000000000000000000000000000000000000000000002f9f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004f29944800', + }, + ], }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xdaecee3c08e953bd5f89a5cc90ac560413d709e3", - "type": "DELEGATECALL", - "gas": "0x1cddaccb", - "gasUsed": "0x6ec", - "value": "0x71afd498d0000", - "input": "0x4e6c8ed800000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000064", - "output": "0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "error": "", - "calls": null + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xdaecee3c08e953bd5f89a5cc90ac560413d709e3', + type: 'DELEGATECALL', + gas: '0x1cddaccb', + gasUsed: '0x6ec', + value: '0x71afd498d0000', + input: + '0x4e6c8ed800000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000064', + output: + '0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + error: '', + calls: null, }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "type": "CALL", - "gas": "0x1cdd9474", - "gasUsed": "0x1c824", - "value": "0x0", - "input": `0x128acb08000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000671ad6000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000`, - "output": "0xffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad6", - "error": "", - "calls": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + type: 'CALL', + gas: '0x1cdd9474', + gasUsed: '0x1c824', + value: '0x0', + input: `0x128acb08000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000671ad6000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000`, + output: + '0xffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad6', + error: '', + calls: [ { - "from": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "to": "0x22832de1178e7f4a8d868411422c720220ddf3d2", - "type": "CALL", - "gas": "0x1c69e198", - "gasUsed": "0x4335", - "value": "0x0", - "input": "0x214a6fe20000000000000000000000000000000000000000000000000000000065fb3f07", - "output": "0x", - "error": "", - "calls": [ + from: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + to: '0x22832de1178e7f4a8d868411422c720220ddf3d2', + type: 'CALL', + gas: '0x1c69e198', + gasUsed: '0x4335', + value: '0x0', + input: + '0x214a6fe20000000000000000000000000000000000000000000000000000000065fb3f07', + output: '0x', + error: '', + calls: [ { - "from": "0x22832de1178e7f4a8d868411422c720220ddf3d2", - "to": "0x556b9306565093c855aea9ae92a594704c2cd59e", - "type": "STATICCALL", - "gas": "0x1bf82eec", - "gasUsed": "0x1540", - "value": null, - "input": "0xa15ea89f000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "output": "0x0000000000000000000000000000000000000000001bc9cc2365913cdef3d2e10000000000000000000000000000000000000000000000000000000065fc2307", - "error": "", - "calls": null - } - ] + from: '0x22832de1178e7f4a8d868411422c720220ddf3d2', + to: '0x556b9306565093c855aea9ae92a594704c2cd59e', + type: 'STATICCALL', + gas: '0x1bf82eec', + gasUsed: '0x1540', + value: null, + input: + '0xa15ea89f000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + output: + '0x0000000000000000000000000000000000000000001bc9cc2365913cdef3d2e10000000000000000000000000000000000000000000000000000000065fc2307', + error: '', + calls: null, + }, + ], }, { - "from": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "to": "0x6b175474e89094c44da98b954eedeac495271d0f", - "type": "CALL", - "gas": "0x1c69330d", - "gasUsed": "0x75de", - "value": "0x0", - "input": `0xa9059cbb000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}0000000000000000000000000000000000000000000000005dc32b358db8fcc9`, - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": null, - "logs": [ + from: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + to: '0x6b175474e89094c44da98b954eedeac495271d0f', + type: 'CALL', + gas: '0x1c69330d', + gasUsed: '0x75de', + value: '0x0', + input: `0xa9059cbb000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}0000000000000000000000000000000000000000000000005dc32b358db8fcc9`, + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: null, + logs: [ { - "address": "0x6b175474e89094c44da98b954eedeac495271d0f", - "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}` + address: + '0x6b175474e89094c44da98b954eedeac495271d0f', + topics: [ + '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + '0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, ], - "data": "0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9" - } - ] + data: '0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9', + }, + ], }, { - "from": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "type": "STATICCALL", - "gas": "0x1c68bba0", - "gasUsed": "0xd0b", - "value": null, - "input": "0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "output": "0x000000000000000000000000000000000000000000000000000000203cbae53b", - "error": "", - "calls": [ + from: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + to: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + type: 'STATICCALL', + gas: '0x1c68bba0', + gasUsed: '0xd0b', + value: null, + input: + '0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + output: + '0x000000000000000000000000000000000000000000000000000000203cbae53b', + error: '', + calls: [ { - "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "to": "0x43506849d7c04f9138d1a2050bbf3a0c054402dd", - "type": "DELEGATECALL", - "gas": "0x1bf715d8", - "gasUsed": "0x9f9", - "value": "0x0", - "input": "0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "output": "0x000000000000000000000000000000000000000000000000000000203cbae53b", - "error": "", - "calls": null - } - ] + from: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + to: '0x43506849d7c04f9138d1a2050bbf3a0c054402dd', + type: 'DELEGATECALL', + gas: '0x1bf715d8', + gasUsed: '0x9f9', + value: '0x0', + input: + '0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + output: + '0x000000000000000000000000000000000000000000000000000000203cbae53b', + error: '', + calls: null, + }, + ], }, { - "from": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "type": "CALL", - "gas": "0x1c68abb4", - "gasUsed": "0x373e", - "value": "0x0", - "input": "0x23a69e75ffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad6000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000", - "output": "0x", - "error": "", - "calls": [ + from: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + type: 'CALL', + gas: '0x1c68abb4', + gasUsed: '0x373e', + value: '0x0', + input: + '0x23a69e75ffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad6000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000', + output: '0x', + error: '', + calls: [ { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xdaecee3c08e953bd5f89a5cc90ac560413d709e3", - "type": "DELEGATECALL", - "gas": "0x1bf7000e", - "gasUsed": "0x7c8", - "value": "0x0", - "input": "0x8bdb192500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000064", - "output": "0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "error": "", - "calls": null + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xdaecee3c08e953bd5f89a5cc90ac560413d709e3', + type: 'DELEGATECALL', + gas: '0x1bf7000e', + gasUsed: '0x7c8', + value: '0x0', + input: + '0x8bdb192500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000064', + output: + '0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + error: '', + calls: null, }, { - "from": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "type": "CALL", - "gas": "0x1bf6f3a5", - "gasUsed": "0x203c", - "value": "0x0", - "input": "0xa9059cbb000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b70000000000000000000000000000000000000000000000000000000000671ad6", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": [ + from: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + to: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + type: 'CALL', + gas: '0x1bf6f3a5', + gasUsed: '0x203c', + value: '0x0', + input: + '0xa9059cbb000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b70000000000000000000000000000000000000000000000000000000000671ad6', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: [ { - "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "to": "0x43506849d7c04f9138d1a2050bbf3a0c054402dd", - "type": "DELEGATECALL", - "gas": "0x1b8714fa", - "gasUsed": "0x1d27", - "value": "0x0", - "input": "0xa9059cbb000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b70000000000000000000000000000000000000000000000000000000000671ad6", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001", - "error": "", - "calls": null, - "logs": [ + from: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + to: '0x43506849d7c04f9138d1a2050bbf3a0c054402dd', + type: 'DELEGATECALL', + gas: '0x1b8714fa', + gasUsed: '0x1d27', + value: '0x0', + input: + '0xa9059cbb000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b70000000000000000000000000000000000000000000000000000000000671ad6', + output: + '0x0000000000000000000000000000000000000000000000000000000000000001', + error: '', + calls: null, + logs: [ { - "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4", - "0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7" + address: + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + topics: [ + '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', + '0x000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', ], - "data": "0x0000000000000000000000000000000000000000000000000000000000671ad6" - } - ] - } - ] - } - ] + data: '0x0000000000000000000000000000000000000000000000000000000000671ad6', + }, + ], + }, + ], + }, + ], }, { - "from": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "type": "STATICCALL", - "gas": "0x1c6872db", - "gasUsed": "0x53b", - "value": null, - "input": "0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "output": "0x000000000000000000000000000000000000000000000000000000203d220011", - "error": "", - "calls": [ + from: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + to: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + type: 'STATICCALL', + gas: '0x1c6872db', + gasUsed: '0x53b', + value: null, + input: + '0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + output: + '0x000000000000000000000000000000000000000000000000000000203d220011', + error: '', + calls: [ { - "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "to": "0x43506849d7c04f9138d1a2050bbf3a0c054402dd", - "type": "DELEGATECALL", - "gas": "0x1bf6ce36", - "gasUsed": "0x229", - "value": "0x0", - "input": "0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7", - "output": "0x000000000000000000000000000000000000000000000000000000203d220011", - "error": "", - "calls": null - } - ] - } + from: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + to: '0x43506849d7c04f9138d1a2050bbf3a0c054402dd', + type: 'DELEGATECALL', + gas: '0x1bf6ce36', + gasUsed: '0x229', + value: '0x0', + input: + '0x70a08231000000000000000000000000d9e497bd8f491fe163b42a62c296fb54caea74b7', + output: + '0x000000000000000000000000000000000000000000000000000000203d220011', + error: '', + calls: null, + }, + ], + }, ], - "logs": [ + logs: [ { - "address": "0xd9e497bd8f491fe163b42a62c296fb54caea74b7", - "topics": [ - "0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83", - "0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4", - `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}` + address: '0xd9e497bd8f491fe163b42a62c296fb54caea74b7', + topics: [ + '0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83', + '0x00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4', + `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad60000000000000000000000000000000000000000000010c700afe76cb29923e80000000000000000000000000000000000000000000000037a74fbab94f3e0d1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc89c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000df" - } - ] - } - ] - } - ] + data: '0xffffffffffffffffffffffffffffffffffffffffffffffffa23cd4ca724703370000000000000000000000000000000000000000000000000000000000671ad60000000000000000000000000000000000000000000010c700afe76cb29923e80000000000000000000000000000000000000000000000037a74fbab94f3e0d1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc89c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000df', + }, + ], + }, + ], + }, + ], }, - "feeEstimate": 11633709217510676, - "baseFeePerGas": 40482817574 - } + feeEstimate: 11633709217510676, + baseFeePerGas: 40482817574, + }, ], - "blockNumber": "0x1293669", - "id": "9e8034c8-b9b2-4aff-ba5b-13ddc0c2a7e6" + blockNumber: '0x1293669', + id: '9e8034c8-b9b2-4aff-ba5b-13ddc0c2a7e6', }, - "id": "0" + id: '0', }, }; @@ -582,232 +663,264 @@ export const BUY_ERC20_REQUEST_1_MOCK: MockRequestResponse = { // for the user's wallet. This is what the second request accomplishes. export const BUY_ERC20_REQUEST_2_MOCK: MockRequestResponse = { request: { - "id": "1", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '1', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [ + transactions: [ { - "from": SENDER_ADDRESS_MOCK, - "to": "0x6b175474e89094c44da98b954eedeac495271d0f", - "data": `0x70a08231000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}` + from: SENDER_ADDRESS_MOCK, + to: '0x6b175474e89094c44da98b954eedeac495271d0f', + data: `0x70a08231000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, }, { - "chainId": "0x1", - "from": SENDER_ADDRESS_MOCK, - "to": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", - "value": "0x71afd498d0000", - "data": `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000` + chainId: '0x1', + from: SENDER_ADDRESS_MOCK, + to: '0x13f4ea83d0bd40e75c8222255bc855a974568dd4', + value: '0x71afd498d0000', + data: `0x5ae401dc0000000000000000000000000000000000000000000000000000000065fb43ab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000124b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000005d4bc0025786653d0000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`, }, { - "from": SENDER_ADDRESS_MOCK, - "to": "0x6b175474e89094c44da98b954eedeac495271d0f", - "data": `0x70a08231000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}` - } - ] - } - ] + from: SENDER_ADDRESS_MOCK, + to: '0x6b175474e89094c44da98b954eedeac495271d0f', + data: `0x70a08231000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, + }, + ], + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x0000000000000000000000000000000000000000000000000000000000000000", - "status": "0x1", - "gasUsed": "0x5de2", - "gasLimit": "0x5f34", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000000', + status: '0x1', + gasUsed: '0x5de2', + gasLimit: '0x5f34', + fees: [ { - "maxFeePerGas": "0xf19b9f48d", - "maxPriorityFeePerGas": "0x9febc9", - "balanceNeeded": "0x59d9d3b865ed8", - "currentBalance": "0x77f9fd8d99e7e0", - "error": "" - } + maxFeePerGas: '0xf19b9f48d', + maxPriorityFeePerGas: '0x9febc9', + balanceNeeded: '0x59d9d3b865ed8', + currentBalance: '0x77f9fd8d99e7e0', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x4" - } + nonce: '0x4', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x77f9fd8d99e7e0", - "nonce": "0x3" - } - } + balance: '0x77f9fd8d99e7e0', + nonce: '0x3', + }, + }, }, - "feeEstimate": 972988071597550, - "baseFeePerGas": 40482817574 + feeEstimate: 972988071597550, + baseFeePerGas: 40482817574, }, { - "return": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9", - "status": "0x1", - "gasUsed": "0x4628e", - "gasLimit": "0x53cc5", - "fees": [ + return: + '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000005dc32b358db8fcc9', + status: '0x1', + gasUsed: '0x4628e', + gasLimit: '0x53cc5', + fees: [ { - "maxFeePerGas": "0xf19b9f48d", - "maxPriorityFeePerGas": "0x9febc9", - "balanceNeeded": "0x56314571bd7946", - "currentBalance": "0x725c6052138908", - "error": "" - } + maxFeePerGas: '0xf19b9f48d', + maxPriorityFeePerGas: '0x9febc9', + balanceNeeded: '0x56314571bd7946', + currentBalance: '0x725c6052138908', + error: '', + }, ], - "stateDiff": { - "post": { - "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000b000b000302f9f6000000000000432ff2e932894fe0874ac6a384b0", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000000000441ce10709c0a0992095e8e5cd95ea470de", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000013a0b298f9b81d1e0000000000000000000000012aa0e421" - } - }, - "0x22832de1178e7f4a8d868411422c720220ddf3d2": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x00000000000000000000000000007708590f241159371f6dd86140347968995f", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3f0700000000000000037a742348f5c5c152" - } + stateDiff: { + post: { + '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000b000b000302f9f6000000000000432ff2e932894fe0874ac6a384b0', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000000000441ce10709c0a0992095e8e5cd95ea470de', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000013a0b298f9b81d1e0000000000000000000000012aa0e421', + }, + }, + '0x22832de1178e7f4a8d868411422c720220ddf3d2': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x00000000000000000000000000007708590f241159371f6dd86140347968995f', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3f0700000000000000037a742348f5c5c152', + }, }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x70df00440ce7e0", - "nonce": "0x5" - }, - "0x6b175474e89094c44da98b954eedeac495271d0f": { - "storage": { - "0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9": "0x00000000000000000000000000000000000000000000026a5b2c87ebb8bb8d1c", - "0xd5dc93f3552cd59356296ab764be72c9bd93d66c2b8576cd18a4677f92be097d": "0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9" - } - }, - "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000ef30a346933b4bd99d3bccde01f6d16e1452c", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3f070000000000000000015eea78185df6b5" - } - }, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": { - "storage": { - "0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374": "0x00000000000000000000000000000000000000000000000000000077a52fa7b8", - "0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee": "0x000000000000000000000000000000000000000000000000000000203d220011" - } - }, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { - "balance": "0x27c965cfc53bf0f2c70b6", - "storage": { - "0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0": "0x00000000000000000000000000000000000000000000000bd3875ff74244a952" - } - }, - "0xd9e497bd8f491fe163b42a62c296fb54caea74b7": { - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000100010000fbc89c0000000000000000000010c700afe76cb29923e8", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000f1e2d8a8f477b67ef05de74c", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000000013ec29600000000000000011e28c9f4ab7ce8e4" - } - } + balance: '0x70df00440ce7e0', + nonce: '0x5', + }, + '0x6b175474e89094c44da98b954eedeac495271d0f': { + storage: { + '0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9': + '0x00000000000000000000000000000000000000000000026a5b2c87ebb8bb8d1c', + '0xd5dc93f3552cd59356296ab764be72c9bd93d66c2b8576cd18a4677f92be097d': + '0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9', + }, + }, + '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000ef30a346933b4bd99d3bccde01f6d16e1452c', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3f070000000000000000015eea78185df6b5', + }, + }, + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': { + storage: { + '0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374': + '0x00000000000000000000000000000000000000000000000000000077a52fa7b8', + '0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee': + '0x000000000000000000000000000000000000000000000000000000203d220011', + }, + }, + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': { + balance: '0x27c965cfc53bf0f2c70b6', + storage: { + '0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0': + '0x00000000000000000000000000000000000000000000000bd3875ff74244a952', + }, + }, + '0xd9e497bd8f491fe163b42a62c296fb54caea74b7': { + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000100010000fbc89c0000000000000000000010c700afe76cb29923e8', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x0000000000000000000000000000000000000000f1e2d8a8f477b67ef05de74c', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000000000000013ec29600000000000000011e28c9f4ab7ce8e4', + }, + }, }, - "pre": { - "0x1ac1a8feaaea1900c4166deeed0c11cc10669d36": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000b000b000302f9f6000000000000432fedbb64e891ccc2a450f04080", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000000000441ce10008cb545e85f10ea6254adf2328d", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000013a0b249d023d51e0000000000000000000000012aa0e421" - } - }, - "0x22832de1178e7f4a8d868411422c720220ddf3d2": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000077084f83018a34e0b30b6c5cbbecc5beadbe", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fa28c700000000000000037a742348f5c5c152" - } + pre: { + '0x1ac1a8feaaea1900c4166deeed0c11cc10669d36': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000b000b000302f9f6000000000000432fedbb64e891ccc2a450f04080', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000000000441ce10008cb545e85f10ea6254adf2328d', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000013a0b249d023d51e0000000000000000000000012aa0e421', + }, + }, + '0x22832de1178e7f4a8d868411422c720220ddf3d2': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000077084f83018a34e0b30b6c5cbbecc5beadbe', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fa28c700000000000000037a742348f5c5c152', + }, }, [SENDER_ADDRESS_MOCK]: { - "balance": "0x77f9fd8d99e7e0", - "nonce": "0x4" - }, - "0x6b175474e89094c44da98b954eedeac495271d0f": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9": "0x00000000000000000000000000000000000000000000026ab8efb321467489e5" - } - }, - "0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000ef2efd2b96a4061ac9c50b8d33ded38fd6e81", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000165fb3d870000000000000000015eea78185df6b5" - } - }, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374": "0x00000000000000000000000000000000000000000000000000000077a596c28e", - "0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee": "0x000000000000000000000000000000000000000000000000000000203cbae53b" - } - }, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { - "balance": "0x27c965cf538c1c59f70b6", - "nonce": "0x1", - "storage": { - "0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0": "0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952" - } - }, - "0xd9e497bd8f491fe163b42a62c296fb54caea74b7": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000100010000fbc89c0000000000000000000010c7009243db83250922", - "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000f1e2d826b87f89c78bd2b02f", - "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000000013ec1b700000000000000011e28c9f4ab7ce8e4" - } - } - } + balance: '0x77f9fd8d99e7e0', + nonce: '0x4', + }, + '0x6b175474e89094c44da98b954eedeac495271d0f': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x930de7bb643d1647fc9c859fcc7a7c7bdd0a4a0c3a4bbd02f09ca0cc743567a9': + '0x00000000000000000000000000000000000000000000026ab8efb321467489e5', + }, + }, + '0x86e9bd5e42a9afde8d9c2594e84e49cc7718f381': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x000000000000000000000000000ef2efd2b96a4061ac9c50b8d33ded38fd6e81', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x00000000000000000000000165fb3d870000000000000000015eea78185df6b5', + }, + }, + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x32b8c3e0163a3eceb0dd8f4a69ff6a8f786c1f0b2824e29def2a833031a4d374': + '0x00000000000000000000000000000000000000000000000000000077a596c28e', + '0x3dc5bf0351aa60e0f5e0c2094c7bce3615793f84804cfb4ae4169d81e5d802ee': + '0x000000000000000000000000000000000000000000000000000000203cbae53b', + }, + }, + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': { + balance: '0x27c965cf538c1c59f70b6', + nonce: '0x1', + storage: { + '0x83f8975b25917b7df8ba465bc82d6b4472b7883d2ee49412f33c76db8bf49be0': + '0x00000000000000000000000000000000000000000000000bd38044f9f8b7a952', + }, + }, + '0xd9e497bd8f491fe163b42a62c296fb54caea74b7': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x000000000100010000fbc89c0000000000000000000010c7009243db83250922', + '0x0000000000000000000000000000000000000000000000000000000000000003': + '0x0000000000000000000000000000000000000000f1e2d826b87f89c78bd2b02f', + '0x0000000000000000000000000000000000000000000000000000000000000004': + '0x000000000000000000000000013ec1b700000000000000011e28c9f4ab7ce8e4', + }, + }, + }, }, - "feeEstimate": 11633996591798050, - "baseFeePerGas": 40482817574 + feeEstimate: 11633996591798050, + baseFeePerGas: 40482817574, }, { - "return": "0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9", - "status": "0x1", - "gasUsed": "0x5de2", - "gasLimit": "0x5f34", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000005dc32b358db8fcc9', + status: '0x1', + gasUsed: '0x5de2', + gasLimit: '0x5f34', + fees: [ { - "maxFeePerGas": "0xf19b9f48d", - "maxPriorityFeePerGas": "0x9febc9", - "balanceNeeded": "0x59d9d3b865ed8", - "currentBalance": "0x1c2b1ae0560fc2", - "error": "" - } + maxFeePerGas: '0xf19b9f48d', + maxPriorityFeePerGas: '0x9febc9', + balanceNeeded: '0x59d9d3b865ed8', + currentBalance: '0x1c2b1ae0560fc2', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x6" - } + nonce: '0x6', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x70df00440ce7e0", - "nonce": "0x5" - } - } + balance: '0x70df00440ce7e0', + nonce: '0x5', + }, + }, }, - "feeEstimate": 972988071597550, - "baseFeePerGas": 40482817574 - } + feeEstimate: 972988071597550, + baseFeePerGas: 40482817574, + }, ], - "blockNumber": "0x1293669", - "id": "faaab4c5-edf5-4077-ac75-8d26278ca2c5" + blockNumber: '0x1293669', + id: 'faaab4c5-edf5-4077-ac75-8d26278ca2c5', }, - "id": "1" + id: '1', }, }; diff --git a/test/e2e/tests/simulation-details/mock-request-buy-erc721.ts b/test/e2e/tests/simulation-details/mock-request-buy-erc721.ts index 42f4e8dbfade..fd71e42559aa 100644 --- a/test/e2e/tests/simulation-details/mock-request-buy-erc721.ts +++ b/test/e2e/tests/simulation-details/mock-request-buy-erc721.ts @@ -1,393 +1,426 @@ -import { MockRequestResponse, SENDER_ADDRESS_MOCK, SENDER_ADDRESS_NO_0x_MOCK } from "./types"; +import { + MockRequestResponse, + SENDER_ADDRESS_MOCK, + SENDER_ADDRESS_NO_0X_MOCK, +} from './types'; export const BUY_ERC721_TRANSACTION_MOCK = { - "data": "0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "value": "0x31bced02db0000" + data: '0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + value: '0x31bced02db0000', }; export const BUY_ERC721_REQUEST_1_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [BUY_ERC721_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [BUY_ERC721_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x", - "status": "0x1", - "gasUsed": "0x2a000", - "gasLimit": "0x2d2a6", - "fees": [ + return: '0x', + status: '0x1', + gasUsed: '0x2a000', + gasLimit: '0x2d2a6', + fees: [ { - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "balanceNeeded": "0x31bced02db0000", - "currentBalance": "0x3374df8f3ee8d4c", - "error": "" - } + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + balanceNeeded: '0x31bced02db0000', + currentBalance: '0x3374df8f3ee8d4c', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x305910bf1138d4c", - "nonce": "0x3bd" + balance: '0x305910bf1138d4c', + nonce: '0x3bd', + }, + '0xdef1c0ded9bec7f1a1670819833240f027b25eff': { + storage: { + '0xeccd0aa0b0cae8a0393c4fcec180bedb48844984d6ea85756283f2a84cf37e42': + '0x0000000000000000000000000000000000000000000000020000000000000000', + }, }, - "0xdef1c0ded9bec7f1a1670819833240f027b25eff": { - "storage": { - "0xeccd0aa0b0cae8a0393c4fcec180bedb48844984d6ea85756283f2a84cf37e42": "0x0000000000000000000000000000000000000000000000020000000000000000" - } + '0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32': { + balance: '0x171e213c2748203', }, - "0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32": { - "balance": "0x171e213c2748203" + '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e': { + storage: { + '0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4': + '0x0000000000000000000000000000000000000000000000000000000000001077', + '0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88': + '0x0000000000000000000000000000000000000000000000000000000000000003', + '0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1': `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, + '0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67': + '0x0000000000000000000000000000000000000000000000000000000000000002', + '0xe7bc4be1d73122b60587e3436277f212112d1ea05407d1ba62e996ce0e1ec828': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0xea81aa3597df52a22f198dc4d5802c492ddd6c108c03ad22e53ba5bbb9666352': + '0x00000000000000000000000000000000000000000000000000000000000002cf', + }, }, - "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e": { - "storage": { - "0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4": "0x0000000000000000000000000000000000000000000000000000000000001077", - "0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88": "0x0000000000000000000000000000000000000000000000000000000000000003", - "0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1": `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}`, - "0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67": "0x0000000000000000000000000000000000000000000000000000000000000002", - "0xe7bc4be1d73122b60587e3436277f212112d1ea05407d1ba62e996ce0e1ec828": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xea81aa3597df52a22f198dc4d5802c492ddd6c108c03ad22e53ba5bbb9666352": "0x00000000000000000000000000000000000000000000000000000000000002cf" - } + '0xff900d7067a24874264ced8198cc87ebd7c1c53d': { + balance: '0x4c8ba807b58e46', }, - "0xff900d7067a24874264ced8198cc87ebd7c1c53d": { - "balance": "0x4c8ba807b58e46" - } }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x3374df8f3ee8d4c", - "nonce": "0x3bc" + balance: '0x3374df8f3ee8d4c', + nonce: '0x3bc', }, - "0xdef1c0ded9bec7f1a1670819833240f027b25eff": { - "balance": "0x130e736d76ea3d", - "nonce": "0x4" + '0xdef1c0ded9bec7f1a1670819833240f027b25eff': { + balance: '0x130e736d76ea3d', + nonce: '0x4', }, - "0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32": { - "balance": "0x16e271b9570e203", - "nonce": "0x41" + '0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32': { + balance: '0x16e271b9570e203', + nonce: '0x41', }, - "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4": "0x00000000000000000000000000000000000000000000000000000000000002cf", - "0x6210cdd80d7ed64c147610e636f3f5346cfa1e04fd82b95c61224b5d32099a6f": "0x0000000000000000000000000000000000000000000000000000000000001077", - "0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88": "0x0000000000000000000000000000000000000000000000000000000000000004", - "0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1": "0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d", - "0x9cbc963b226fe1134324ceb97d43b5ed9e3a4de61c920f075df835dd1d138cef": "0x0000000000000000000000000000000000000000000000000000000000000002", - "0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67": "0x0000000000000000000000000000000000000000000000000000000000000003" - } + '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4': + '0x00000000000000000000000000000000000000000000000000000000000002cf', + '0x6210cdd80d7ed64c147610e636f3f5346cfa1e04fd82b95c61224b5d32099a6f': + '0x0000000000000000000000000000000000000000000000000000000000001077', + '0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88': + '0x0000000000000000000000000000000000000000000000000000000000000004', + '0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1': + '0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d', + '0x9cbc963b226fe1134324ceb97d43b5ed9e3a4de61c920f075df835dd1d138cef': + '0x0000000000000000000000000000000000000000000000000000000000000002', + '0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67': + '0x0000000000000000000000000000000000000000000000000000000000000003', + }, }, - "0xff900d7067a24874264ced8198cc87ebd7c1c53d": { - "balance": "0x1e89b331de2e46", - "nonce": "0x1c" - } - } + '0xff900d7067a24874264ced8198cc87ebd7c1c53d': { + balance: '0x1e89b331de2e46', + nonce: '0x1c', + }, + }, }, - "callTrace": { - "from": SENDER_ADDRESS_MOCK, - "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "type": "CALL", - "gas": "0x1dcd6500", - "gasUsed": "0x2a000", - "value": "0x31bced02db0000", - "input": "0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "output": "0x", - "error": "", - "calls": [ + callTrace: { + from: SENDER_ADDRESS_MOCK, + to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + type: 'CALL', + gas: '0x1dcd6500', + gasUsed: '0x2a000', + value: '0x31bced02db0000', + input: + '0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + output: '0x', + error: '', + calls: [ { - "from": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "to": "0x4af649ffde640ceb34b1afaba3e0bb8e9698cb01", - "type": "DELEGATECALL", - "gas": "0x1d55b33e", - "gasUsed": "0x246ef", - "value": "0x31bced02db0000", - "input": "0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "output": "0x", - "error": "", - "calls": [ + from: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + to: '0x4af649ffde640ceb34b1afaba3e0bb8e9698cb01', + type: 'DELEGATECALL', + gas: '0x1d55b33e', + gasUsed: '0x246ef', + value: '0x31bced02db0000', + input: + '0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + output: '0x', + error: '', + calls: [ { - "from": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "to": "0x0000000000000000000000000000000000000001", - "type": "STATICCALL", - "gas": "0x1ce0362d", - "gasUsed": "0xbb8", - "value": null, - "input": "0xcecc68f79868cc3c883e5eb9975d469f1f43b9b991a7a7559e7230b7e5e834f0000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f", - "output": "0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d", - "error": "", - "calls": null + from: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + to: '0x0000000000000000000000000000000000000001', + type: 'STATICCALL', + gas: '0x1ce0362d', + gasUsed: '0xbb8', + value: null, + input: + '0xcecc68f79868cc3c883e5eb9975d469f1f43b9b991a7a7559e7230b7e5e834f0000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f', + output: + '0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d', + error: '', + calls: null, }, { - "from": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "to": "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e", - "type": "CALL", - "gas": "0x1cdfcf6a", - "gasUsed": "0x15add", - "value": "0x0", - "input": `0x23b872dd000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}00000000000000000000000000000000000000000000000000000000000002cf`, - "output": "0x", - "error": "", - "calls": null, - "logs": [ + from: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + to: '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e', + type: 'CALL', + gas: '0x1cdfcf6a', + gasUsed: '0x15add', + value: '0x0', + input: `0x23b872dd000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}00000000000000000000000000000000000000000000000000000000000002cf`, + output: '0x', + error: '', + calls: null, + logs: [ { - "address": "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e", - "topics": [ - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", - "0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x00000000000000000000000000000000000000000000000000000000000002cf" + address: '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e', + topics: [ + '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', + '0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d', + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x00000000000000000000000000000000000000000000000000000000000002cf', ], - "data": "0x" + data: '0x', }, { - "address": "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e", - "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d", - `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}`, - "0x00000000000000000000000000000000000000000000000000000000000002cf" + address: '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e', + topics: [ + '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + '0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d', + `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, + '0x00000000000000000000000000000000000000000000000000000000000002cf', ], - "data": "0x" - } - ] + data: '0x', + }, + ], }, { - "from": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "to": "0xff900d7067a24874264ced8198cc87ebd7c1c53d", - "type": "CALL", - "gas": "0x1cde5550", - "gasUsed": "0x0", - "value": "0x2e01f4d5d76000", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + from: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + to: '0xff900d7067a24874264ced8198cc87ebd7c1c53d', + type: 'CALL', + gas: '0x1cde5550', + gasUsed: '0x0', + value: '0x2e01f4d5d76000', + input: '0x', + output: '0x', + error: '', + calls: null, }, { - "from": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "to": "0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32", - "type": "CALL", - "gas": "0x1cde2e8a", - "gasUsed": "0x0", - "value": "0x3baf82d03a000", - "input": "0x", - "output": "0x", - "error": "", - "calls": null - } + from: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + to: '0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32', + type: 'CALL', + gas: '0x1cde2e8a', + gasUsed: '0x0', + value: '0x3baf82d03a000', + input: '0x', + output: '0x', + error: '', + calls: null, + }, ], - "logs": [ + logs: [ { - "address": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "topics": [ - "0x50273fa02273cceea9cf085b42de5c8af60624140168bd71357db833535877af" + address: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + topics: [ + '0x50273fa02273cceea9cf085b42de5c8af60624140168bd71357db833535877af', ], - "data": `0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d76000000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf0000000000000000000000000000000000000000000000000000000000000000` - } - ] - } - ] + data: `0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d76000000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf0000000000000000000000000000000000000000000000000000000000000000`, + }, + ], + }, + ], }, - "feeEstimate": 7243125887434752, - "baseFeePerGas": 42103363836 - } + feeEstimate: 7243125887434752, + baseFeePerGas: 42103363836, + }, ], - "blockNumber": "0x129689d", - "id": "3ea521e3-e0c5-44af-81af-321221bebc95" + blockNumber: '0x129689d', + id: '3ea521e3-e0c5-44af-81af-321221bebc95', }, - "id": "0" + id: '0', }, }; export const BUY_ERC721_REQUEST_2_MOCK: MockRequestResponse = { request: { - "id": "1", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '1', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [ + transactions: [ { - "from": SENDER_ADDRESS_MOCK, - "to": "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e", - "data": `0x6352211e00000000000000000000000000000000000000000000000000000000000002cf` + from: SENDER_ADDRESS_MOCK, + to: '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e', + data: `0x6352211e00000000000000000000000000000000000000000000000000000000000002cf`, }, { - "chainId": "0x1", - "from": SENDER_ADDRESS_MOCK, - "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", - "value": "0x31bced02db0000", - "data": "0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + chainId: '0x1', + from: SENDER_ADDRESS_MOCK, + to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', + value: '0x31bced02db0000', + data: '0xfbee349d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ccc7b6351d59f42bbb85f1fcc89cd4ac31c69cfa0681c900c46ddb7ad3f3c690f1006752ecedda5ee83902884f78ae85a3a1996bc56dc30f6aba0004ddc87699f00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006669f99b0000000000000000000000000000000024081bbd5ce9458a998286f53a873a41000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000002e01f4d5d760000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e00000000000000000000000000000000000000000000000000000000000002cf000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e9ba8fa0222fc76e8bcaa13e4258f749bb92af320000000000000000000000000000000000000000000000000003baf82d03a0000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', }, { - "from": SENDER_ADDRESS_MOCK, - "to": "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e", - "data": `0x6352211e00000000000000000000000000000000000000000000000000000000000002cf` - } - ] - } - ] + from: SENDER_ADDRESS_MOCK, + to: '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e', + data: `0x6352211e00000000000000000000000000000000000000000000000000000000000002cf`, + }, + ], + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x0000000000000000000000000000000000000000000000000000000000000000", - "status": "0x1", - "gasUsed": "0x5f66", - "gasLimit": "0x60b9", - "fees": [ + return: + '0x0000000000000000000000000000000000000000000000000000000000000000', + status: '0x1', + gasUsed: '0x5f66', + gasLimit: '0x60b9', + fees: [ { - "maxFeePerGas": "0xfb65bc42d", - "maxPriorityFeePerGas": "0x288f0c5", - "balanceNeeded": "0x5efbd31e2053e", - "currentBalance": "0x3374df8f3ee8d4c", - "error": "" - } + maxFeePerGas: '0xfb65bc42d', + maxPriorityFeePerGas: '0x288f0c5', + balanceNeeded: '0x5efbd31e2053e', + currentBalance: '0x3374df8f3ee8d4c', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x3bd" - } + nonce: '0x3bd', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x3374df8f3ee8d4c", - "nonce": "0x3bc" - } - } + balance: '0x3374df8f3ee8d4c', + nonce: '0x3bc', + }, + }, }, - "feeEstimate": 1028248351627214, - "baseFeePerGas": 42103363836 + feeEstimate: 1028248351627214, + baseFeePerGas: 42103363836, }, { - "return": "0x", - "status": "0x1", - "gasUsed": "0x2a000", - "gasLimit": "0x2d2a6", - "fees": [ + return: '0x', + status: '0x1', + gasUsed: '0x2a000', + gasLimit: '0x2d2a6', + fees: [ { - "maxFeePerGas": "0xfb65bc42d", - "maxPriorityFeePerGas": "0x288f0c5", - "balanceNeeded": "0x5e176c11a5f1d4", - "currentBalance": "0x3315e3bc20c880e", - "error": "" - } + maxFeePerGas: '0xfb65bc42d', + maxPriorityFeePerGas: '0x288f0c5', + balanceNeeded: '0x5e176c11a5f1d4', + currentBalance: '0x3315e3bc20c880e', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x305910bf1138d4c", - "nonce": "0x3be" + balance: '0x305910bf1138d4c', + nonce: '0x3be', }, - "0xdef1c0ded9bec7f1a1670819833240f027b25eff": { - "storage": { - "0xeccd0aa0b0cae8a0393c4fcec180bedb48844984d6ea85756283f2a84cf37e42": "0x0000000000000000000000000000000000000000000000020000000000000000" - } + '0xdef1c0ded9bec7f1a1670819833240f027b25eff': { + storage: { + '0xeccd0aa0b0cae8a0393c4fcec180bedb48844984d6ea85756283f2a84cf37e42': + '0x0000000000000000000000000000000000000000000000020000000000000000', + }, }, - "0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32": { - "balance": "0x171e213c2748203" + '0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32': { + balance: '0x171e213c2748203', }, - "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e": { - "storage": { - "0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4": "0x0000000000000000000000000000000000000000000000000000000000001077", - "0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88": "0x0000000000000000000000000000000000000000000000000000000000000003", - "0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1": `0x000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}`, - "0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67": "0x0000000000000000000000000000000000000000000000000000000000000002", - "0xe7bc4be1d73122b60587e3436277f212112d1ea05407d1ba62e996ce0e1ec828": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xea81aa3597df52a22f198dc4d5802c492ddd6c108c03ad22e53ba5bbb9666352": "0x00000000000000000000000000000000000000000000000000000000000002cf" - } + '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e': { + storage: { + '0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4': + '0x0000000000000000000000000000000000000000000000000000000000001077', + '0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88': + '0x0000000000000000000000000000000000000000000000000000000000000003', + '0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1': `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, + '0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67': + '0x0000000000000000000000000000000000000000000000000000000000000002', + '0xe7bc4be1d73122b60587e3436277f212112d1ea05407d1ba62e996ce0e1ec828': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0xea81aa3597df52a22f198dc4d5802c492ddd6c108c03ad22e53ba5bbb9666352': + '0x00000000000000000000000000000000000000000000000000000000000002cf', + }, + }, + '0xff900d7067a24874264ced8198cc87ebd7c1c53d': { + balance: '0x4c8ba807b58e46', }, - "0xff900d7067a24874264ced8198cc87ebd7c1c53d": { - "balance": "0x4c8ba807b58e46" - } }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x3374df8f3ee8d4c", - "nonce": "0x3bd" + balance: '0x3374df8f3ee8d4c', + nonce: '0x3bd', + }, + '0xdef1c0ded9bec7f1a1670819833240f027b25eff': { + balance: '0x130e736d76ea3d', + nonce: '0x4', }, - "0xdef1c0ded9bec7f1a1670819833240f027b25eff": { - "balance": "0x130e736d76ea3d", - "nonce": "0x4" + '0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32': { + balance: '0x16e271b9570e203', + nonce: '0x41', }, - "0xe9ba8fa0222fc76e8bcaa13e4258f749bb92af32": { - "balance": "0x16e271b9570e203", - "nonce": "0x41" + '0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e': { + balance: '0x0', + nonce: '0x1', + storage: { + '0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4': + '0x00000000000000000000000000000000000000000000000000000000000002cf', + '0x6210cdd80d7ed64c147610e636f3f5346cfa1e04fd82b95c61224b5d32099a6f': + '0x0000000000000000000000000000000000000000000000000000000000001077', + '0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88': + '0x0000000000000000000000000000000000000000000000000000000000000004', + '0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1': + '0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d', + '0x9cbc963b226fe1134324ceb97d43b5ed9e3a4de61c920f075df835dd1d138cef': + '0x0000000000000000000000000000000000000000000000000000000000000002', + '0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67': + '0x0000000000000000000000000000000000000000000000000000000000000003', + }, }, - "0xef9c21e3ba31a74910fc7e7cb3fc814ad842ad6e": { - "balance": "0x0", - "nonce": "0x1", - "storage": { - "0x3440dd3ee3ca5de61d4ee92cfe26c447934bd6b8480a62ce27fbb9ed18f73cd4": "0x00000000000000000000000000000000000000000000000000000000000002cf", - "0x6210cdd80d7ed64c147610e636f3f5346cfa1e04fd82b95c61224b5d32099a6f": "0x0000000000000000000000000000000000000000000000000000000000001077", - "0x65534a61afb536dbc0061b7dbeb0f72092486077fcdfc4d28d70b226ed847a88": "0x0000000000000000000000000000000000000000000000000000000000000004", - "0x7147429d9c36092cffc563112aac67146541c751f01a33e802076e13916cced1": "0x000000000000000000000000ff900d7067a24874264ced8198cc87ebd7c1c53d", - "0x9cbc963b226fe1134324ceb97d43b5ed9e3a4de61c920f075df835dd1d138cef": "0x0000000000000000000000000000000000000000000000000000000000000002", - "0xa3dd05d36cfa40690563b0b3f6b1b0603d431d1c3573682cff963d848b558c67": "0x0000000000000000000000000000000000000000000000000000000000000003" - } + '0xff900d7067a24874264ced8198cc87ebd7c1c53d': { + balance: '0x1e89b331de2e46', + nonce: '0x1c', }, - "0xff900d7067a24874264ced8198cc87ebd7c1c53d": { - "balance": "0x1e89b331de2e46", - "nonce": "0x1c" - } - } + }, }, - "feeEstimate": 7243125887606784, - "baseFeePerGas": 42103363836 + feeEstimate: 7243125887606784, + baseFeePerGas: 42103363836, }, { - "return": `0x00000000000000000000000000000000${SENDER_ADDRESS_NO_0x_MOCK}`, - "status": "0x1", - "gasUsed": "0x5f66", - "gasLimit": "0x60b9", - "fees": [ + return: `0x00000000000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, + status: '0x1', + gasUsed: '0x5f66', + gasLimit: '0x60b9', + fees: [ { - "maxFeePerGas": "0xfb65bc42d", - "maxPriorityFeePerGas": "0x288f0c5", - "balanceNeeded": "0x5efbd31e2053e", - "currentBalance": "0x2d346cfb066963a", - "error": "" - } + maxFeePerGas: '0xfb65bc42d', + maxPriorityFeePerGas: '0x288f0c5', + balanceNeeded: '0x5efbd31e2053e', + currentBalance: '0x2d346cfb066963a', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x3bf" - } + nonce: '0x3bf', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x305910bf1138d4c", - "nonce": "0x3be" - } - } + balance: '0x305910bf1138d4c', + nonce: '0x3be', + }, + }, }, - "feeEstimate": 1028248351627214, - "baseFeePerGas": 42103363836 - } + feeEstimate: 1028248351627214, + baseFeePerGas: 42103363836, + }, ], - "blockNumber": "0x129689d", - "id": "486d2d6f-76ff-4d59-a5db-4217cbeb5463" + blockNumber: '0x129689d', + id: '486d2d6f-76ff-4d59-a5db-4217cbeb5463', }, - "id": "1" + id: '1', }, -}; \ No newline at end of file +}; diff --git a/test/e2e/tests/simulation-details/mock-request-error-insuffient-gas.ts b/test/e2e/tests/simulation-details/mock-request-error-insuffient-gas.ts index 5396740c7c8c..806e4cd8d5f1 100644 --- a/test/e2e/tests/simulation-details/mock-request-error-insuffient-gas.ts +++ b/test/e2e/tests/simulation-details/mock-request-error-insuffient-gas.ts @@ -1,32 +1,37 @@ -import { RECIPIENT_ADDRESS_MOCK, MockRequestResponse, SENDER_ADDRESS_MOCK, SENDER_ADDRESS_NO_0x_MOCK } from "./types"; +import { + RECIPIENT_ADDRESS_MOCK, + MockRequestResponse, + SENDER_ADDRESS_MOCK, +} from './types'; export const INSUFFICIENT_GAS_TRANSACTION_MOCK = { - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": RECIPIENT_ADDRESS_MOCK, - "value": "0x6BC75E2D63100000" + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: RECIPIENT_ADDRESS_MOCK, + value: '0x6BC75E2D63100000', }; export const INSUFFICIENT_GAS_REQUEST_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [INSUFFICIENT_GAS_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [INSUFFICIENT_GAS_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "error": { - "code": -32000, - "message": "debug_traceCall failed: w3: 3 calls failed:\ncall[0]: tracing failed: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000\ncall[1]: tracing failed: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000\ncall[2]: failed with 500000000 gas: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000" + jsonrpc: '2.0', + error: { + code: -32000, + message: + 'debug_traceCall failed: w3: 3 calls failed:\ncall[0]: tracing failed: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000\ncall[1]: tracing failed: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000\ncall[2]: failed with 500000000 gas: insufficient funds for gas * price + value: address 0x5cfe73b6021e818b776b421b1c4db2474086a7e1 have 0 want 100000000000000000000', }, - "id": "1" + id: '1', }, }; diff --git a/test/e2e/tests/simulation-details/mock-request-error-malformed-transaction.ts b/test/e2e/tests/simulation-details/mock-request-error-malformed-transaction.ts index 286375c7161b..04e98b2de589 100644 --- a/test/e2e/tests/simulation-details/mock-request-error-malformed-transaction.ts +++ b/test/e2e/tests/simulation-details/mock-request-error-malformed-transaction.ts @@ -1,33 +1,34 @@ -import { MockRequestResponse, SENDER_ADDRESS_MOCK } from "./types"; +import { MockRequestResponse, SENDER_ADDRESS_MOCK } from './types'; export const MALFORMED_TRANSACTION_MOCK = { - "data": "0x0323498273498729872340897234087q", - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": "0xe18035bf8712672935fdb4e5e431b1a0183d2dfc", - "value": "0x0" + data: '0x0323498273498729872340897234087q', + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: '0xe18035bf8712672935fdb4e5e431b1a0183d2dfc', + value: '0x0', }; export const MALFORMED_TRANSACTION_REQUEST_MOCK: MockRequestResponse = { request: { - "id": "21", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '21', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [MALFORMED_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [MALFORMED_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "error": { - "code": -32000, - "message": "failed to decode param in array[0] json: cannot unmarshal invalid hex string into Go struct field Transaction.transactions.data of type hexutil.Bytes" + jsonrpc: '2.0', + error: { + code: -32000, + message: + 'failed to decode param in array[0] json: cannot unmarshal invalid hex string into Go struct field Transaction.transactions.data of type hexutil.Bytes', }, - "id": "21" + id: '21', }, }; diff --git a/test/e2e/tests/simulation-details/mock-request-no-changes.ts b/test/e2e/tests/simulation-details/mock-request-no-changes.ts index d93c99c06573..59b7fc9b8b3d 100644 --- a/test/e2e/tests/simulation-details/mock-request-no-changes.ts +++ b/test/e2e/tests/simulation-details/mock-request-no-changes.ts @@ -1,76 +1,76 @@ -import { MockRequestResponse, SENDER_ADDRESS_MOCK } from "./types"; +import { MockRequestResponse, SENDER_ADDRESS_MOCK } from './types'; export const NO_CHANGES_TRANSACTION_MOCK = { - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": SENDER_ADDRESS_MOCK, - "value": "0x38d7ea4c68000" + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: SENDER_ADDRESS_MOCK, + value: '0x38d7ea4c68000', }; export const NO_CHANGES_REQUEST_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [NO_CHANGES_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [NO_CHANGES_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x", - "status": "0x1", - "gasUsed": "0x5208", - "gasLimit": "0x5208", - "fees": [ + return: '0x', + status: '0x1', + gasUsed: '0x5208', + gasLimit: '0x5208', + fees: [ { - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "balanceNeeded": "0x38d7ea4c68000", - "currentBalance": "0x3185e67a46d9066", - "error": "" - } + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + balanceNeeded: '0x38d7ea4c68000', + currentBalance: '0x3185e67a46d9066', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "nonce": "0x3c0" - } + nonce: '0x3c0', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x3185e67a46d9066", - "nonce": "0x3bf" - } - } + balance: '0x3185e67a46d9066', + nonce: '0x3bf', + }, + }, }, - "callTrace": { - "from": SENDER_ADDRESS_MOCK, - "to": SENDER_ADDRESS_MOCK, - "type": "CALL", - "gas": "0x1dcd6500", - "gasUsed": "0x5208", - "value": "0x38d7ea4c68000", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + callTrace: { + from: SENDER_ADDRESS_MOCK, + to: SENDER_ADDRESS_MOCK, + type: 'CALL', + gas: '0x1dcd6500', + gasUsed: '0x5208', + value: '0x38d7ea4c68000', + input: '0x', + output: '0x', + error: '', + calls: null, }, - "feeEstimate": 766968100542000, - "baseFeePerGas": 36522290502 - } + feeEstimate: 766968100542000, + baseFeePerGas: 36522290502, + }, ], - "blockNumber": "0x1296901", - "id": "964ce072-84c7-4f1e-a972-ff00ce84a6c8" + blockNumber: '0x1296901', + id: '964ce072-84c7-4f1e-a972-ff00ce84a6c8', }, - "id": "0" + id: '0', }, }; diff --git a/test/e2e/tests/simulation-details/mock-request-send-eth.ts b/test/e2e/tests/simulation-details/mock-request-send-eth.ts index 40d92310498f..0c4ea8ae3d01 100644 --- a/test/e2e/tests/simulation-details/mock-request-send-eth.ts +++ b/test/e2e/tests/simulation-details/mock-request-send-eth.ts @@ -1,84 +1,88 @@ -import { RECIPIENT_ADDRESS_MOCK, MockRequestResponse, SENDER_ADDRESS_MOCK } from "./types"; +import { + RECIPIENT_ADDRESS_MOCK, + MockRequestResponse, + SENDER_ADDRESS_MOCK, +} from './types'; export const SEND_ETH_TRANSACTION_MOCK = { - "data": "0x", - "from": SENDER_ADDRESS_MOCK, - "maxFeePerGas": "0x0", - "maxPriorityFeePerGas": "0x0", - "to": RECIPIENT_ADDRESS_MOCK, - "value": "0x38d7ea4c68000" + data: '0x', + from: SENDER_ADDRESS_MOCK, + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + to: RECIPIENT_ADDRESS_MOCK, + value: '0x38d7ea4c68000', }; export const SEND_ETH_REQUEST_MOCK: MockRequestResponse = { request: { - "id": "0", - "jsonrpc": "2.0", - "method": "infura_simulateTransactions", - "params": [ + id: '0', + jsonrpc: '2.0', + method: 'infura_simulateTransactions', + params: [ { - "transactions": [SEND_ETH_TRANSACTION_MOCK], - "withCallTrace": true, - "withLogs": true - } - ] + transactions: [SEND_ETH_TRANSACTION_MOCK], + withCallTrace: true, + withLogs: true, + }, + ], }, response: { - "jsonrpc": "2.0", - "result": { - "transactions": [ + jsonrpc: '2.0', + result: { + transactions: [ { - "return": "0x", - "status": "0x1", - "gasUsed": "0x5208", - "gasLimit": "0x5208", - "fees": [ + return: '0x', + status: '0x1', + gasUsed: '0x5208', + gasLimit: '0x5208', + fees: [ { - "maxFeePerGas": "0x22ae4b8bcb", - "maxPriorityFeePerGas": "0x59682f04", - "balanceNeeded": "0xeaa6849ea3660", - "currentBalance": "0x2386f26fc1000000", - "error": "" - } + maxFeePerGas: '0x22ae4b8bcb', + maxPriorityFeePerGas: '0x59682f04', + balanceNeeded: '0xeaa6849ea3660', + currentBalance: '0x2386f26fc1000000', + error: '', + }, ], - "stateDiff": { - "post": { + stateDiff: { + post: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x238364f11c398000", - "nonce": "0x1" + balance: '0x238364f11c398000', + nonce: '0x1', }, [RECIPIENT_ADDRESS_MOCK]: { - "balance": "0x38d7ea4c68000" - } + balance: '0x38d7ea4c68000', + }, }, - "pre": { + pre: { [SENDER_ADDRESS_MOCK]: { - "balance": "0x2386f26fc1000000" + balance: '0x2386f26fc1000000', }, [RECIPIENT_ADDRESS_MOCK]: { - "balance": "0x0", - "nonce": "0x24" - } - } + balance: '0x0', + nonce: '0x24', + }, + }, }, - "callTrace": { - "from": SENDER_ADDRESS_MOCK, - "to": RECIPIENT_ADDRESS_MOCK, - "type": "CALL", - "gas": "0x1dcd6500", - "gasUsed": "0x5208", - "value": "0x38d7ea4c68000", - "input": "0x", - "output": "0x", - "error": "", - "calls": null + callTrace: { + from: SENDER_ADDRESS_MOCK, + to: RECIPIENT_ADDRESS_MOCK, + type: 'CALL', + gas: '0x1dcd6500', + gasUsed: '0x5208', + value: '0x38d7ea4c68000', + input: '0x', + output: '0x', + error: '', + calls: null, }, - "feeEstimate": 1954138800138000, - "baseFeePerGas": 92054228577 - } + feeEstimate: 1954138800138000, + baseFeePerGas: 92054228577, + }, ], - "blockNumber": "0x53afbb", - "id": "09156630-b754-4bb8-bfc4-3390d934cec6" + blockNumber: '0x53afbb', + id: '09156630-b754-4bb8-bfc4-3390d934cec6', }, - "id": 42 - } + id: 42, + }, }; diff --git a/test/e2e/tests/simulation-details/simulation-details.spec.ts b/test/e2e/tests/simulation-details/simulation-details.spec.ts index 65e21b5d9ab2..e74ae74505a6 100644 --- a/test/e2e/tests/simulation-details/simulation-details.spec.ts +++ b/test/e2e/tests/simulation-details/simulation-details.spec.ts @@ -1,35 +1,72 @@ -import FixtureBuilder from "../../fixture-builder"; -import { unlockWallet, withFixtures, createDappTransaction, switchToNotificationWindow } from "../../helpers"; +import { Mockttp, MockttpServer } from 'mockttp'; +import { hexToNumber } from '@metamask/utils'; +import FixtureBuilder from '../../fixture-builder'; +import { + unlockWallet, + withFixtures, + createDappTransaction, + switchToNotificationWindow, +} from '../../helpers'; import { Driver } from '../../webdriver/driver'; -import { CHAIN_IDS } from "../../../../shared/constants/network"; -import { Mockttp, MockttpServer } from "mockttp"; -import { SEND_ETH_REQUEST_MOCK, SEND_ETH_TRANSACTION_MOCK } from "./mock-request-send-eth"; -import { BUY_ERC20_TRANSACTION, BUY_ERC20_REQUEST_1_MOCK, BUY_ERC20_REQUEST_2_MOCK } from "./mock-request-buy-erc20"; -import { MockRequestResponse } from "./types"; -import { INSUFFICIENT_GAS_REQUEST_MOCK, INSUFFICIENT_GAS_TRANSACTION_MOCK } from "./mock-request-error-insuffient-gas"; -import { BUY_ERC1155_REQUEST_1_MOCK, BUY_ERC1155_REQUEST_2_MOCK, BUY_ERC1155_TRANSACTION_MOCK } from "./mock-request-buy-erc1155"; -import { BUY_ERC721_REQUEST_1_MOCK, BUY_ERC721_REQUEST_2_MOCK, BUY_ERC721_TRANSACTION_MOCK } from "./mock-request-buy-erc721"; -import { NO_CHANGES_REQUEST_MOCK, NO_CHANGES_TRANSACTION_MOCK } from "./mock-request-no-changes"; -import { hexToNumber } from "@metamask/utils"; -import { MALFORMED_TRANSACTION_MOCK, MALFORMED_TRANSACTION_REQUEST_MOCK } from "./mock-request-error-malformed-transaction"; - -const TX_SENTINEL_URL = 'https://tx-sentinel-ethereum-mainnet.api.cx.metamask.io/'; +import { CHAIN_IDS } from '../../../../shared/constants/network'; +import { + SEND_ETH_REQUEST_MOCK, + SEND_ETH_TRANSACTION_MOCK, +} from './mock-request-send-eth'; +import { + BUY_ERC20_TRANSACTION, + BUY_ERC20_REQUEST_1_MOCK, + BUY_ERC20_REQUEST_2_MOCK, +} from './mock-request-buy-erc20'; +import { MockRequestResponse } from './types'; +import { + INSUFFICIENT_GAS_REQUEST_MOCK, + INSUFFICIENT_GAS_TRANSACTION_MOCK, +} from './mock-request-error-insuffient-gas'; +import { + BUY_ERC1155_REQUEST_1_MOCK, + BUY_ERC1155_REQUEST_2_MOCK, + BUY_ERC1155_TRANSACTION_MOCK, +} from './mock-request-buy-erc1155'; +import { + BUY_ERC721_REQUEST_1_MOCK, + BUY_ERC721_REQUEST_2_MOCK, + BUY_ERC721_TRANSACTION_MOCK, +} from './mock-request-buy-erc721'; +import { + NO_CHANGES_REQUEST_MOCK, + NO_CHANGES_TRANSACTION_MOCK, +} from './mock-request-no-changes'; +import { + MALFORMED_TRANSACTION_MOCK, + MALFORMED_TRANSACTION_REQUEST_MOCK, +} from './mock-request-error-malformed-transaction'; + +const TX_SENTINEL_URL = + 'https://tx-sentinel-ethereum-mainnet.api.cx.metamask.io/'; const mockNetworkRequest = async (mockServer: Mockttp) => { - await mockServer.forGet(`${TX_SENTINEL_URL}/networks`).thenJson(200,{ - "1": { name: "Mainnet", confirmations: true }, + await mockServer.forGet(`${TX_SENTINEL_URL}/networks`).thenJson(200, { + '1': { name: 'Mainnet', confirmations: true }, }); }; type TestArgs = { driver: Driver; - mockServer: MockttpServer + mockServer: MockttpServer; }; async function withFixturesForSimulationDetails( - { title, inputChainId = CHAIN_IDS.MAINNET, mockRequests }: - { title?: string; inputChainId?: string, mockRequests: (mockServer: MockttpServer) => Promise }, - test: (args: TestArgs) => Promise + { + title, + inputChainId = CHAIN_IDS.MAINNET, + mockRequests, + }: { + title?: string; + inputChainId?: string; + mockRequests: (mockServer: MockttpServer) => Promise; + }, + test: (args: TestArgs) => Promise, ) { const testSpecificMock = async (mockServer: MockttpServer) => { await mockNetworkRequest(mockServer); @@ -51,7 +88,7 @@ async function withFixturesForSimulationDetails( async ({ driver, mockServer }: TestArgs) => { await unlockWallet(driver); await test({ driver, mockServer }); - } + }, ); } @@ -83,133 +120,169 @@ async function expectBalanceChange( export async function mockRequest( server: Mockttp, - {request, response}: MockRequestResponse, - ) { - await server.forPost(TX_SENTINEL_URL) - .withJsonBody(request) - .thenJson(200, response); - } - + { request, response }: MockRequestResponse, +) { + await server + .forPost(TX_SENTINEL_URL) + .withJsonBody(request) + .thenJson(200, response); +} describe('Simulation Details', () => { it('renders send eth transaction', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, SEND_ETH_REQUEST_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver }) => { - await createDappTransaction(driver, SEND_ETH_TRANSACTION_MOCK); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }) => { + await createDappTransaction(driver, SEND_ETH_TRANSACTION_MOCK); - await switchToNotificationWindow(driver); - await expectBalanceChange(driver, true, 0, '- 0.001', 'ETH'); - }); + await switchToNotificationWindow(driver); + await expectBalanceChange(driver, true, 0, '- 0.001', 'ETH'); + }, + ); }); it('renders buy ERC20 transaction', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, BUY_ERC20_REQUEST_1_MOCK); await mockRequest(mockServer, BUY_ERC20_REQUEST_2_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver, mockServer }: TestArgs) => { - await createDappTransaction(driver, BUY_ERC20_TRANSACTION); - - await switchToNotificationWindow(driver); - await expectBalanceChange(driver, true, 0, '- 0.002', 'ETH'); - await expectBalanceChange(driver, false, 0, '+ 6.756', 'DAI'); - }); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }: TestArgs) => { + await createDappTransaction(driver, BUY_ERC20_TRANSACTION); + + await switchToNotificationWindow(driver); + await expectBalanceChange(driver, true, 0, '- 0.002', 'ETH'); + await expectBalanceChange(driver, false, 0, '+ 6.756', 'DAI'); + }, + ); }); it('renders buy ERC721 transaction', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, BUY_ERC721_REQUEST_1_MOCK); await mockRequest(mockServer, BUY_ERC721_REQUEST_2_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver, mockServer }: TestArgs) => { - await createDappTransaction(driver, BUY_ERC721_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await expectBalanceChange(driver, true, 0, '- 0.014', 'ETH'); - await expectBalanceChange(driver, false, 0, '+ #719', '0xEF9c2...2AD6e'); - }); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }: TestArgs) => { + await createDappTransaction(driver, BUY_ERC721_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await expectBalanceChange(driver, true, 0, '- 0.014', 'ETH'); + await expectBalanceChange( + driver, + false, + 0, + '+ #719', + '0xEF9c2...2AD6e', + ); + }, + ); }); it('renders buy ERC1155 transaction', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, BUY_ERC1155_REQUEST_1_MOCK); await mockRequest(mockServer, BUY_ERC1155_REQUEST_2_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver, mockServer }: TestArgs) => { - await createDappTransaction(driver, BUY_ERC1155_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await expectBalanceChange(driver, true, 0, '- 0.00045', 'ETH'); - await expectBalanceChange(driver, false, 0, '+ 1 #10340', '0x76BE3...E8E77'); - }); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }: TestArgs) => { + await createDappTransaction(driver, BUY_ERC1155_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await expectBalanceChange(driver, true, 0, '- 0.00045', 'ETH'); + await expectBalanceChange( + driver, + false, + 0, + '+ 1 #10340', + '0x76BE3...E8E77', + ); + }, + ); }); it('renders no changes transaction', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, NO_CHANGES_REQUEST_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver }) => { - await createDappTransaction(driver, NO_CHANGES_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await driver.findElement({ - css: '[data-testid="simulation-details-layout"]', - text: 'No changes predicted for your wallet', - }); - }); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }) => { + await createDappTransaction(driver, NO_CHANGES_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await driver.findElement({ + css: '[data-testid="simulation-details-layout"]', + text: 'No changes predicted for your wallet', + }); + }, + ); }); it('displays error message if transaction will fail or revert', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, INSUFFICIENT_GAS_REQUEST_MOCK); - } - await withFixturesForSimulationDetails({ title: this.test?.fullTitle(), mockRequests }, async ({ driver }) => { - await createDappTransaction(driver, INSUFFICIENT_GAS_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await driver.findElement({ - css: '[data-testid="simulation-details-layout"]', - text: 'This transaction is likely to fail', - }); - }); + }; + await withFixturesForSimulationDetails( + { title: this.test?.fullTitle(), mockRequests }, + async ({ driver }) => { + await createDappTransaction(driver, INSUFFICIENT_GAS_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await driver.findElement({ + css: '[data-testid="simulation-details-layout"]', + text: 'This transaction is likely to fail', + }); + }, + ); }); it('does not display if chain is not supported', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, SEND_ETH_REQUEST_MOCK); - } - await withFixturesForSimulationDetails({ - title: this.test?.fullTitle(), - inputChainId: CHAIN_IDS.LOCALHOST, // Localhost chain is not supported. - mockRequests, - }, async ({ driver }) => { - await createDappTransaction(driver, SEND_ETH_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await driver.assertElementNotPresent( - '[data-testid="simulation-details-layout"]', - { waitAtLeastGuard: 1000 }, - ); - }); + }; + await withFixturesForSimulationDetails( + { + title: this.test?.fullTitle(), + inputChainId: CHAIN_IDS.LOCALHOST, // Localhost chain is not supported. + mockRequests, + }, + async ({ driver }) => { + await createDappTransaction(driver, SEND_ETH_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await driver.assertElementNotPresent( + '[data-testid="simulation-details-layout"]', + { waitAtLeastGuard: 1000 }, + ); + }, + ); }); it('displays generic error message', async function (this: Mocha.Context) { const mockRequests = async (mockServer: MockttpServer) => { await mockRequest(mockServer, MALFORMED_TRANSACTION_REQUEST_MOCK); - } - await withFixturesForSimulationDetails({ - title: this.test?.fullTitle(), - mockRequests, - }, async ({ driver }) => { - await createDappTransaction(driver, MALFORMED_TRANSACTION_MOCK); - - await switchToNotificationWindow(driver); - await driver.findElement({ - css: '[data-testid="simulation-details-layout"]', - text: 'There was an error loading your estimation', - }); - }); + }; + await withFixturesForSimulationDetails( + { + title: this.test?.fullTitle(), + mockRequests, + }, + async ({ driver }) => { + await createDappTransaction(driver, MALFORMED_TRANSACTION_MOCK); + + await switchToNotificationWindow(driver); + await driver.findElement({ + css: '[data-testid="simulation-details-layout"]', + text: 'There was an error loading your estimation', + }); + }, + ); }); }); diff --git a/test/e2e/tests/simulation-details/types.ts b/test/e2e/tests/simulation-details/types.ts index e4bff2c9c549..8f80a65ce254 100644 --- a/test/e2e/tests/simulation-details/types.ts +++ b/test/e2e/tests/simulation-details/types.ts @@ -1,8 +1,14 @@ -export const SENDER_ADDRESS_NO_0x_MOCK = '5cfe73b6021e818b776b421b1c4db2474086a7e1'; -export const SENDER_ADDRESS_MOCK = `0x${SENDER_ADDRESS_NO_0x_MOCK}`; -export const RECIPIENT_ADDRESS_MOCK = '0xe18035bf8712672935fdb4e5e431b1a0183d2dfc'; +export const SENDER_ADDRESS_NO_0X_MOCK = + '5cfe73b6021e818b776b421b1c4db2474086a7e1'; +export const SENDER_ADDRESS_MOCK = `0x${SENDER_ADDRESS_NO_0X_MOCK}`; +export const RECIPIENT_ADDRESS_MOCK = + '0xe18035bf8712672935fdb4e5e431b1a0183d2dfc'; export type MockRequestResponse = { + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any request: any; + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any response: any; -} +}; diff --git a/test/e2e/tests/swap-send/mocks/erc20-data.ts b/test/e2e/tests/swap-send/mocks/erc20-data.ts index 9d2586122f5c..ba9e79758b97 100644 --- a/test/e2e/tests/swap-send/mocks/erc20-data.ts +++ b/test/e2e/tests/swap-send/mocks/erc20-data.ts @@ -1,4 +1,4 @@ -export const swapSendQuotesResponse_TST_ETH = [ +export const SWAP_SEND_QUOTES_RESPONSE_TST_ETH = [ { aggregator: 'ZeroX', aggregatorType: 'AGG', diff --git a/test/e2e/tests/swap-send/mocks/eth-data.ts b/test/e2e/tests/swap-send/mocks/eth-data.ts index e6063e2ba449..6cba4ef549be 100644 --- a/test/e2e/tests/swap-send/mocks/eth-data.ts +++ b/test/e2e/tests/swap-send/mocks/eth-data.ts @@ -1,4 +1,4 @@ -export const swapSendQuotesResponse_ETH_TST = [ +export const SWAP_SEND_QUOTES_RESPONSE_ETH_TST = [ { aggregator: 'ZeroX', aggregatorType: 'AGG', @@ -22,6 +22,8 @@ export const swapSendQuotesResponse_ETH_TST = [ gasMultiplier: 1, }, fee: 0.875, + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any approvalNeeded: null as any, priceSlippage: { bucket: null, @@ -58,6 +60,8 @@ export const swapSendQuotesResponse_ETH_TST = [ gasMultiplier: 1, }, fee: 0.875, + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any approvalNeeded: null as any, priceSlippage: { bucket: null, diff --git a/test/e2e/tests/swap-send/swap-send-erc20.spec.ts b/test/e2e/tests/swap-send/swap-send-erc20.spec.ts index e4045b4e069a..3e2fdc1f7b41 100644 --- a/test/e2e/tests/swap-send/swap-send-erc20.spec.ts +++ b/test/e2e/tests/swap-send/swap-send-erc20.spec.ts @@ -1,15 +1,16 @@ +import { Suite } from 'mocha'; import { withFixtures, openActionMenuAndStartSendFlow, logInWithBalanceValidation, } from '../../helpers'; -import { Suite } from 'mocha'; +import type { Ganache } from '../../seeder/ganache'; import { NATIVE_TOKEN_SYMBOL, SwapSendPage, getSwapSendFixtures, } from './swap-send-test-utils'; -import { swapSendQuotesResponse_TST_ETH } from './mocks/erc20-data'; +import { SWAP_SEND_QUOTES_RESPONSE_TST_ETH } from './mocks/erc20-data'; const RECIPIENT_ADDRESS = '0xc427D562164062a23a5cFf596A4a3208e72Acd28'; @@ -19,14 +20,16 @@ describe('Swap-Send ERC20', function () { await withFixtures( getSwapSendFixtures( this.test?.fullTitle(), - swapSendQuotesResponse_TST_ETH, + SWAP_SEND_QUOTES_RESPONSE_TST_ETH, ), async ({ driver, ganacheServer, }: { + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any driver: any; - ganacheServer: any; + ganacheServer: Ganache; }) => { const swapSendPage = new SwapSendPage(driver); await logInWithBalanceValidation(driver, ganacheServer); diff --git a/test/e2e/tests/swap-send/swap-send-eth.spec.ts b/test/e2e/tests/swap-send/swap-send-eth.spec.ts index 5a326f9c4e81..b1e40543150f 100644 --- a/test/e2e/tests/swap-send/swap-send-eth.spec.ts +++ b/test/e2e/tests/swap-send/swap-send-eth.spec.ts @@ -1,9 +1,10 @@ +import { Suite } from 'mocha'; import { withFixtures, openActionMenuAndStartSendFlow, logInWithBalanceValidation, } from '../../helpers'; -import { Suite } from 'mocha'; +import type { Ganache } from '../../seeder/ganache'; import { NATIVE_TOKEN_SYMBOL, SwapSendPage, @@ -23,8 +24,10 @@ describe('Swap-Send ETH', function () { driver, ganacheServer, }: { + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any driver: any; - ganacheServer: any; + ganacheServer: Ganache; }) => { const swapSendPage = new SwapSendPage(driver); await logInWithBalanceValidation(driver, ganacheServer); diff --git a/test/e2e/tests/swap-send/swap-send-test-utils.ts b/test/e2e/tests/swap-send/swap-send-test-utils.ts index 9818b1ffa604..cdf9b4f11904 100644 --- a/test/e2e/tests/swap-send/swap-send-test-utils.ts +++ b/test/e2e/tests/swap-send/swap-send-test-utils.ts @@ -1,16 +1,20 @@ import { strict as assert } from 'assert'; -import FixtureBuilder from '../../fixture-builder'; import { Mockttp } from 'mockttp'; +import FixtureBuilder from '../../fixture-builder'; import { SWAPS_API_V2_BASE_URL } from '../../../../shared/constants/swaps'; -import { swapSendQuotesResponse_ETH_TST } from './mocks/eth-data'; import { defaultGanacheOptions } from '../../helpers'; import { SMART_CONTRACTS } from '../../seeder/smart-contracts'; +import { SWAP_SEND_QUOTES_RESPONSE_ETH_TST } from './mocks/eth-data'; export const NATIVE_TOKEN_SYMBOL = 'ETH'; export class SwapSendPage { + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any driver: any; + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(driver: any) { this.driver = driver; } @@ -27,9 +31,11 @@ export class SwapSendPage { location: 'src' | 'dest' = 'src', ) => { const isDest = location === 'dest'; - await (( - await this.driver.findElements('[data-testid="asset-picker-button"]') - )?.[isDest ? 1 : 0]).click(); + const buttons = await this.driver.findElements( + '[data-testid="asset-picker-button"]', + ); + const indexOfButtonToClick = isDest ? 1 : 0; + await buttons[indexOfButtonToClick].click(); await this.driver.waitForSelector( '[data-testid="asset-picker-modal-search-input"]', ); @@ -82,6 +88,8 @@ export class SwapSendPage { const inputAmounts = await this.driver.findElements('.asset-picker-amount'); assert.equal(inputAmounts.length, 2); await Promise.all( + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any inputAmounts.map(async (e: any, index: number) => { await this.driver.delay(delayInMs); const i = await e.nestedFindElement('input'); @@ -89,7 +97,9 @@ export class SwapSendPage { const v = await i.getProperty('value'); assert.equal(v, expectedInputValues[index]); const isDisabled = !(await i.isEnabled()); - if (index > 0) assert.ok(isDisabled); + if (index > 0) { + assert.ok(isDisabled); + } }), ); }; @@ -123,7 +133,7 @@ export class SwapSendPage { switchPrimaryCurrency = async ( initialParams: string[][], - expectedParams: string[][], + _expectedParams: string[][], ) => { await this.verifyAssetSymbolsAndAmounts(initialParams[0], initialParams[1]); @@ -221,7 +231,7 @@ export class SwapSendPage { } export const mockSwapsApi = - (quotes = swapSendQuotesResponse_ETH_TST) => + (quotes = SWAP_SEND_QUOTES_RESPONSE_ETH_TST) => async (mockServer: Mockttp) => { return await mockServer .forGet(`${SWAPS_API_V2_BASE_URL}/v2/networks/1337/quotes`) @@ -236,7 +246,7 @@ export const mockSwapsApi = export const getSwapSendFixtures = ( title?: string, - swapsQuotes = swapSendQuotesResponse_ETH_TST, + swapsQuotes = SWAP_SEND_QUOTES_RESPONSE_ETH_TST, ) => { const ETH_CONVERSION_RATE_USD = 3010; return { diff --git a/tsconfig.json b/tsconfig.json index c59ed55ce022..82f043235c6d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,5 +29,14 @@ ], // this should match our node version in .nvmrc "extends": "@tsconfig/node20/tsconfig.json", - "include": ["app", "development", "shared", "types", "ui", "offscreen"] + "include": [ + "app", + "development", + "offscreen", + "shared", + "test", + "types", + "ui", + "*.ts" + ] } diff --git a/ui/components/app/alert-system/utils.test.ts b/ui/components/app/alert-system/utils.test.ts index b6dbb3ebc0ea..fea2e95d80d1 100644 --- a/ui/components/app/alert-system/utils.test.ts +++ b/ui/components/app/alert-system/utils.test.ts @@ -37,6 +37,7 @@ describe('Utils', () => { { key: 'key 2', message: 'mocked message', severity: Severity.Danger }, ]; + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ `when the highest severity is ${Severity.Danger}`, @@ -53,7 +54,7 @@ describe('Utils', () => { [alertsMock[0]], Severity.Info, ], - ])('%s', (_desc, alerts, expected) => { + ])('%s', (_desc: string, alerts: Alert[], expected: Severity) => { const result = getHighestSeverity(alerts); expect(result).toBe(expected); }); @@ -61,11 +62,12 @@ describe('Utils', () => { }); describe('getBannerAlertSeverity', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [Severity.Danger, 'danger'], [Severity.Warning, 'warning'], [Severity.Info, 'info'], - ])('maps %s to %s', (inputSeverity, expectedSeverity) => { + ])('maps %s to %s', (inputSeverity: Severity, expectedSeverity: string) => { expect(getBannerAlertSeverity(inputSeverity)).toBe(expectedSeverity); }); }); diff --git a/ui/components/app/name/name.test.tsx b/ui/components/app/name/name.test.tsx index c1746395fdc6..b56c62e5fc2a 100644 --- a/ui/components/app/name/name.test.tsx +++ b/ui/components/app/name/name.test.tsx @@ -70,32 +70,36 @@ describe('Name', () => { }); describe('metrics', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['saved', ADDRESS_SAVED_NAME_MOCK, true], ['not saved', ADDRESS_NO_SAVED_NAME_MOCK, false], - ])('sends displayed event with %s name', async (_, value, hasPetname) => { - const trackEventMock = jest.fn(); - - useDisplayNameMock.mockReturnValue({ - name: hasPetname ? SAVED_NAME_MOCK : null, - hasPetname, - }); - - renderWithProvider( - - - , - store, - ); - - expect(trackEventMock).toHaveBeenCalledWith({ - event: MetaMetricsEventName.PetnameDisplayed, - category: MetaMetricsEventCategory.Petnames, - properties: { - petname_category: NameType.ETHEREUM_ADDRESS, - has_petname: hasPetname, - }, - }); - }); + ])( + 'sends displayed event with %s name', + async (_: string, value: string, hasPetname: boolean) => { + const trackEventMock = jest.fn(); + + useDisplayNameMock.mockReturnValue({ + name: hasPetname ? SAVED_NAME_MOCK : null, + hasPetname, + }); + + renderWithProvider( + + + , + store, + ); + + expect(trackEventMock).toHaveBeenCalledWith({ + event: MetaMetricsEventName.PetnameDisplayed, + category: MetaMetricsEventCategory.Petnames, + properties: { + petname_category: NameType.ETHEREUM_ADDRESS, + has_petname: hasPetname, + }, + }); + }, + ); }); }); diff --git a/ui/ducks/locale/locale.test.ts b/ui/ducks/locale/locale.test.ts index 7bb4d2b8e344..17abc6547d0a 100644 --- a/ui/ducks/locale/locale.test.ts +++ b/ui/ducks/locale/locale.test.ts @@ -18,9 +18,13 @@ describe('getIntlLocale', () => { expect(() => getIntlLocale(mockState)).toThrow(); }); - it.each(locales)('handles all supported locales – "%s"', (locale) => { - const mockState = createMockStateWithLocale(locale.code); + // @ts-expect-error This is missing from the Mocha type definitions + it.each(locales)( + 'handles all supported locales – "%s"', + (locale: { code: string; name: string }) => { + const mockState = createMockStateWithLocale(locale.code); - expect(() => getIntlLocale(mockState)).not.toThrow(); - }); + expect(() => getIntlLocale(mockState)).not.toThrow(); + }, + ); }); diff --git a/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx b/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx index c35b090fda84..dce1b74372e2 100644 --- a/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx @@ -104,18 +104,32 @@ describe('AmountPill', () => { ]; describe('Native', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each(nativeAndErc20Cases)( 'renders the correct sign and amount for $amount', - ({ amount, expected }) => { + ({ + amount, + expected, + }: { + amount: BigNumber; + expected: { text: string; tooltip: string }; + }) => { renderAndExpect(NATIVE_ASSET_IDENTIFIER, amount, expected); }, ); }); describe('ERC20', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each(nativeAndErc20Cases)( 'renders the correct sign and amount for $amount', - ({ amount, expected }) => { + ({ + amount, + expected, + }: { + amount: BigNumber; + expected: { text: string; tooltip: string }; + }) => { renderAndExpect(ERC20_ASSET_MOCK, amount, expected); }, ); @@ -139,9 +153,16 @@ describe('AmountPill', () => { }, ]; + // @ts-expect-error This is missing from the Mocha type definitions it.each(cases)( 'renders the token ID with just a plus or minus for $expected.text', - ({ amount, expected }) => { + ({ + amount, + expected, + }: { + amount: BigNumber; + expected: { text: string; tooltip: string }; + }) => { renderAndExpect(ERC721_ASSET_MOCK, amount, expected); }, ); @@ -172,9 +193,16 @@ describe('AmountPill', () => { }, ]; + // @ts-expect-error This is missing from the Mocha type definitions it.each(cases)( 'renders the correct sign, amount, and token ID for $expected.text', - ({ amount, expected }) => { + ({ + amount, + expected, + }: { + amount: BigNumber; + expected: { text: string; tooltip: string }; + }) => { renderAndExpect(ERC1155_ASSET_MOCK, amount, expected); }, ); diff --git a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx index 334c79f372c9..57ec93f0883d 100644 --- a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx @@ -43,23 +43,36 @@ describe('AssetPill', () => { }, ]; - it.each(cases)('renders chain $chainId', ({ chainId, expected }) => { - const store = configureStore({ - metamask: { providerConfig: { chainId, ticker: expected.ticker } }, - }); + // @ts-expect-error This is missing from the Mocha type definitions + it.each(cases)( + 'renders chain $chainId', + ({ + chainId, + expected, + }: { + chainId: (typeof CHAIN_IDS)[keyof typeof CHAIN_IDS]; + expected: { ticker: string; imgSrc: string }; + }) => { + const store = configureStore({ + metamask: { providerConfig: { chainId, ticker: expected.ticker } }, + }); - renderWithProvider(, store); + renderWithProvider( + , + store, + ); - expect(screen.getByText(expected.ticker)).toBeInTheDocument(); + expect(screen.getByText(expected.ticker)).toBeInTheDocument(); - expect(AvatarNetwork).toHaveBeenCalledWith( - expect.objectContaining({ - name: expected.ticker, - src: expected.imgSrc, - }), - {}, - ); - }); + expect(AvatarNetwork).toHaveBeenCalledWith( + expect.objectContaining({ + name: expected.ticker, + src: expected.imgSrc, + }), + {}, + ); + }, + ); }); it('renders Name component with correct props when asset standard is not none', () => { diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx index c34749f04411..5716e22e5747 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx @@ -13,27 +13,35 @@ jest.mock('../../../../hooks/useFiatFormatter'); (useFiatFormatter as jest.Mock).mockReturnValue((value: number) => `$${value}`); describe('IndividualFiatDisplay', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [FIAT_UNAVAILABLE, 'Not Available'], [100, '$100'], [-100, '$100'], - ])('when fiatAmount is %s it renders %s', (fiatAmount, expected) => { - renderWithProvider( - , - store, - ); - expect(screen.getByText(expected)).toBeInTheDocument(); - }); + ])( + 'when fiatAmount is %s it renders %s', + (fiatAmount: number | null, expected: string) => { + renderWithProvider( + , + store, + ); + expect(screen.getByText(expected)).toBeInTheDocument(); + }, + ); }); describe('TotalFiatDisplay', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [[FIAT_UNAVAILABLE, FIAT_UNAVAILABLE], 'Not Available'], [[], 'Not Available'], [[100, 200, FIAT_UNAVAILABLE, 300], 'Total = $600'], [[-100, -200, FIAT_UNAVAILABLE, -300], 'Total = $600'], - ])('when fiatAmounts is %s it renders %s', (fiatAmounts, expected) => { - renderWithProvider(, store); - expect(screen.getByText(expected)).toBeInTheDocument(); - }); + ])( + 'when fiatAmounts is %s it renders %s', + (fiatAmounts: (number | null)[], expected: string) => { + renderWithProvider(, store); + expect(screen.getByText(expected)).toBeInTheDocument(); + }, + ); }); diff --git a/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts b/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts index 8a226ddca4f7..acb0265468a1 100644 --- a/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts +++ b/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts @@ -12,6 +12,7 @@ describe('formatAmount', () => { expect(formatAmount(locale, new BigNumber(0.0000009))).toBe('<0.000001'); }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [0.0000456, '0.000046'], [0.0004567, '0.000457'], @@ -20,11 +21,12 @@ describe('formatAmount', () => { [0.125456, '0.125'], ])( 'formats amount less than 1 with maximum significant digits (%s => %s)', - (amount, expected) => { + (amount: number, expected: string) => { expect(formatAmount(locale, new BigNumber(amount))).toBe(expected); }, ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [1.0034, '1.003'], [1.034, '1.034'], @@ -37,7 +39,7 @@ describe('formatAmount', () => { ['1213098292340944.5', '1,213,098,292,340,945'], ])( 'formats amount greater than or equal to 1 with appropriate decimal precision (%s => %s)', - (amount, expected) => { + (amount: number, expected: string) => { expect(formatAmount(locale, new BigNumber(amount))).toBe(expected); }, ); diff --git a/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts b/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts index 92a55f514839..9496c1855f80 100644 --- a/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts +++ b/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts @@ -13,6 +13,7 @@ describe('sortBalanceChanges', () => { asset: { standard }, } as BalanceChange); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ { criteria: 'fiat amount', @@ -65,7 +66,13 @@ describe('sortBalanceChanges', () => { }, ])( 'should sort balance changes based on $criteria', - ({ balanceChanges, expectedOrder }) => { + ({ + balanceChanges, + expectedOrder, + }: { + balanceChanges: BalanceChange[]; + expectedOrder: BalanceChange[]; + }) => { const sorted = sortBalanceChanges(balanceChanges); expect(sorted).toEqual(expectedOrder); }, diff --git a/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts b/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts index 789a3846ab8c..ec5857431f6b 100644 --- a/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts +++ b/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts @@ -167,6 +167,7 @@ describe('useSimulationMetrics', () => { jest.restoreAllMocks(); }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['in progress', undefined, 'simulation_in_progress'], [ @@ -179,7 +180,11 @@ describe('useSimulationMetrics', () => { ['changes', { tokenBalanceChanges: [{}] }, 'balance_change'], ])( 'with simulation response if %s', - (_, simulationData, simulationResponse) => { + ( + _: string, + simulationData: Record, + simulationResponse: string, + ) => { useDisplayNamesMock.mockReset(); useDisplayNamesMock.mockReturnValue([]); @@ -196,27 +201,32 @@ describe('useSimulationMetrics', () => { }, ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['receiving', false, 'simulation_receiving_assets_quantity'], ['sending', true, 'simulation_sending_assets_quantity'], - ])('with asset quantity if %s', (_, isNegative, property) => { - const balanceChange = { - ...BALANCE_CHANGE_MOCK, - amount: new BigNumber(isNegative ? -1 : 1), - }; + ])( + 'with asset quantity if %s', + (_: string, isNegative: boolean, property: string) => { + const balanceChange = { + ...BALANCE_CHANGE_MOCK, + amount: new BigNumber(isNegative ? -1 : 1), + }; - expectUpdateTransactionEventFragmentCalled( - { - balanceChanges: [balanceChange, balanceChange, balanceChange], - }, - expect.objectContaining({ - properties: expect.objectContaining({ - [property]: 3, + expectUpdateTransactionEventFragmentCalled( + { + balanceChanges: [balanceChange, balanceChange, balanceChange], + }, + expect.objectContaining({ + properties: expect.objectContaining({ + [property]: 3, + }), }), - }), - ); - }); + ); + }, + ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving ERC-20', @@ -274,25 +284,35 @@ describe('useSimulationMetrics', () => { 'simulation_sending_assets_type', [AssetType.Native], ], - ])('with asset type if %s', (_, standard, isNegative, property, value) => { - expectUpdateTransactionEventFragmentCalled( - { - balanceChanges: [ - { - ...BALANCE_CHANGE_MOCK, - asset: { ...BALANCE_CHANGE_MOCK.asset, standard }, - amount: new BigNumber(isNegative ? -1 : 1), - } as BalanceChange, - ], - }, - expect.objectContaining({ - properties: expect.objectContaining({ - [property]: value, + ])( + 'with asset type if %s', + ( + _: string, + standard: TokenStandard, + isNegative: boolean, + property: string, + value: AssetType[], + ) => { + expectUpdateTransactionEventFragmentCalled( + { + balanceChanges: [ + { + ...BALANCE_CHANGE_MOCK, + asset: { ...BALANCE_CHANGE_MOCK.asset, standard }, + amount: new BigNumber(isNegative ? -1 : 1), + } as BalanceChange, + ], + }, + expect.objectContaining({ + properties: expect.objectContaining({ + [property]: value, + }), }), - }), - ); - }); + ); + }, + ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving and available', @@ -324,7 +344,13 @@ describe('useSimulationMetrics', () => { ], ])( 'with asset value if %s', - (_, fiatAmount, isNegative, property, expected) => { + ( + _: string, + fiatAmount: number | null, + isNegative: boolean, + property: string, + expected: FiatType, + ) => { const balanceChange = { ...BALANCE_CHANGE_MOCK, amount: new BigNumber(isNegative ? -1 : 1), @@ -344,6 +370,7 @@ describe('useSimulationMetrics', () => { }, ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving and native', @@ -411,7 +438,14 @@ describe('useSimulationMetrics', () => { ], ])( 'with asset petname if %s', - (_, isNegative, standard, displayName, property, expected) => { + ( + _: string, + isNegative: boolean, + standard: TokenStandard, + displayName: Record, + property: string, + expected: PetnameType, + ) => { useDisplayNamesMock.mockReturnValue([ displayName as UseDisplayNameResponse, ]); @@ -435,32 +469,36 @@ describe('useSimulationMetrics', () => { }, ); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['receiving', false, 'simulation_receiving_assets_total_value'], ['sending', true, 'simulation_sending_assets_total_value'], - ])('with asset total value if %s', (_, isNegative, property) => { - const balanceChange1 = { - ...BALANCE_CHANGE_MOCK, - amount: new BigNumber(isNegative ? -1 : 1), - fiatAmount: 1.23, - }; + ])( + 'with asset total value if %s', + (_: string, isNegative: boolean, property: string) => { + const balanceChange1 = { + ...BALANCE_CHANGE_MOCK, + amount: new BigNumber(isNegative ? -1 : 1), + fiatAmount: 1.23, + }; - const balanceChange2 = { - ...balanceChange1, - fiatAmount: 1.23, - }; + const balanceChange2 = { + ...balanceChange1, + fiatAmount: 1.23, + }; - expectUpdateTransactionEventFragmentCalled( - { - balanceChanges: [balanceChange1, balanceChange2], - }, - expect.objectContaining({ - sensitiveProperties: expect.objectContaining({ - [property]: 2.46, + expectUpdateTransactionEventFragmentCalled( + { + balanceChanges: [balanceChange1, balanceChange2], + }, + expect.objectContaining({ + sensitiveProperties: expect.objectContaining({ + [property]: 2.46, + }), }), - }), - ); - }); + ); + }, + ); }); describe('creates incomplete asset event', () => { @@ -516,6 +554,7 @@ describe('useSimulationMetrics', () => { }); }); + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'simulation disabled', @@ -528,15 +567,22 @@ describe('useSimulationMetrics', () => { { error: { code: SimulationErrorCode.ChainNotSupported } }, ], ['metrics not enabled', false, undefined], - ])('does not update fragment if %s', (_, enableMetrics, simulationData) => { - useSimulationMetrics({ - enableMetrics, - balanceChanges: [BALANCE_CHANGE_MOCK], - simulationData: simulationData as SimulationData, - loading: false, - transactionId: TRANSACTION_ID_MOCK, - }); + ])( + 'does not update fragment if %s', + ( + _: string, + enableMetrics: boolean, + simulationData: { error: { code: SimulationErrorCode } } | undefined, + ) => { + useSimulationMetrics({ + enableMetrics, + balanceChanges: [BALANCE_CHANGE_MOCK], + simulationData: simulationData as SimulationData, + loading: false, + transactionId: TRANSACTION_ID_MOCK, + }); - expect(updateTransactionEventFragmentMock).not.toHaveBeenCalled(); - }); + expect(updateTransactionEventFragmentMock).not.toHaveBeenCalled(); + }, + ); }); diff --git a/ui/pages/confirmations/hooks/alerts/utils.test.ts b/ui/pages/confirmations/hooks/alerts/utils.test.ts index 4499d5a8361a..292adc5ed142 100644 --- a/ui/pages/confirmations/hooks/alerts/utils.test.ts +++ b/ui/pages/confirmations/hooks/alerts/utils.test.ts @@ -5,15 +5,19 @@ import { getProviderAlertSeverity, normalizeProviderAlert } from './utils'; describe('Utils', () => { describe('getProviderAlertSeverity', () => { + // @ts-expect-error This is missing from the Mocha type definitions it.each([ [BlockaidResultType.Malicious, Severity.Danger], [BlockaidResultType.Warning, Severity.Warning], ['Other', Severity.Info], - ])('maps %s to %s', (inputSeverity, expectedSeverity) => { - expect( - getProviderAlertSeverity(inputSeverity as BlockaidResultType), - ).toBe(expectedSeverity); - }); + ])( + 'maps %s to %s', + (inputSeverity: BlockaidResultType, expectedSeverity: Severity) => { + expect( + getProviderAlertSeverity(inputSeverity as BlockaidResultType), + ).toBe(expectedSeverity); + }, + ); }); describe('normalizeProviderAlert', () => {