Skip to content

Commit

Permalink
feat: upgrade api layer
Browse files Browse the repository at this point in the history
  • Loading branch information
He1DAr committed Nov 22, 2024
1 parent ea80e0d commit affec16
Show file tree
Hide file tree
Showing 73 changed files with 937 additions and 1,843 deletions.
30 changes: 11 additions & 19 deletions e2e/filters.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { test, expect } from '@playwright/test';
import { GetTransactionListTypeEnum } from '@stacks/blockchain-api-client';
import { expect, test } from '@playwright/test';

import { txs } from './mocks';

test.describe('Transaction page', () => {
test.beforeEach(async ({ page, context }) => {
test.beforeEach(async ({ page }) => {
await page.route('**/extended/v1/tx**', route =>
route.fulfill({
status: 200,
Expand All @@ -22,31 +22,23 @@ test.describe('Transaction page', () => {
await page.waitForTimeout(1000);

// smart_contract filter
await page.click(`[data-test=${GetTransactionListTypeEnum.smart_contract}]`);
await expect(
page.locator(`[data-test=${GetTransactionListTypeEnum.smart_contract}-transaction]`)
).toBeHidden();
await page.click(`[data-test=smart_contract]`);
await expect(page.locator(`[data-test=smart_contract-transaction]`)).toBeHidden();
await page.waitForTimeout(1000);

// contract_call filter
await page.click(`[data-test=${GetTransactionListTypeEnum.contract_call}]`);
await expect(
page.locator(`[data-test=${GetTransactionListTypeEnum.contract_call}-transaction]`)
).toBeHidden();
await page.click(`[data-test=contract_call]`);
await expect(page.locator(`[data-test=contract_call-transaction]`)).toBeHidden();
await page.waitForTimeout(1000);

// token_transfer filter
await page.click(`[data-test=${GetTransactionListTypeEnum.token_transfer}]`);
await expect(
page.locator(`[data-test=${GetTransactionListTypeEnum.token_transfer}-transaction]`)
).toBeHidden();
await page.click(`[data-test=token_transfer]`);
await expect(page.locator(`[data-test=token_transfer-transaction]`)).toBeHidden();
await page.waitForTimeout(1000);

// coinbase filter
await page.click(`[data-test=${GetTransactionListTypeEnum.coinbase}]`);
await expect(
page.locator(`[data-test=${GetTransactionListTypeEnum.coinbase}-transaction]`)
).toBeHidden();
await page.click(`[data-test=coinbase]`);
await expect(page.locator(`[data-test=coinbase-transaction]`)).toBeHidden();
await page.waitForTimeout(1000);
});
});
Expand Down
10 changes: 4 additions & 6 deletions e2e/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { GetTransactionListTypeEnum } from '@stacks/blockchain-api-client';

export const txs = [
{
tx_id: '0x1',
sender_address: 'SP1',
tx_type: GetTransactionListTypeEnum.contract_call,
tx_type: 'contract_call',
contract_call: {
contract_id: 'SP1.contract1',
function_name: 'transaction-1',
Expand All @@ -13,19 +11,19 @@ export const txs = [
{
tx_id: '0x2',
sender_address: 'SP1',
tx_type: GetTransactionListTypeEnum.token_transfer,
tx_type: 'token_transfer',
token_transfer: {
amount: 1,
},
},
{
tx_id: '0x3',
sender_address: 'SP1',
tx_type: GetTransactionListTypeEnum.coinbase,
tx_type: 'coinbase',
},
{
tx_id: '0x4',
sender_address: 'SP1',
tx_type: GetTransactionListTypeEnum.smart_contract,
tx_type: 'smart_contract',
},
];
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const customJestConfig = {
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
coveragePathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
testPathIgnorePatterns: ['<rootDir>/e2e/', '<rootDir>/node_modules/', '<rootDir>/.next/'],
setupFiles: ['<rootDir>/setup-jest.js'],
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@reduxjs/toolkit": "1.9.7",
"@sentry/nextjs": "8.26.0",
"@stacks/auth": "6.15.0",
"@stacks/blockchain-api-client": "7.12.0",
"@stacks/blockchain-api-client": "8.2.2",
"@stacks/common": "6.15.1-pr.0bcf867e.0+0bcf867e",
"@stacks/connect": "7.7.1",
"@stacks/connect-react": "22.4.2",
Expand Down Expand Up @@ -85,6 +85,8 @@
"next": "14.2.13",
"nookies": "2.5.2",
"onigasm": "2.2.5",
"openapi-fetch": "^0.13.0",
"openapi-typescript-helpers": "^0.0.15",
"pluralize": "8.0.0",
"preact-render-to-string": "5.1.19",
"prismjs": "1.29.0",
Expand Down Expand Up @@ -164,7 +166,8 @@
"react-test-renderer": "18.2.0",
"storybook": "8.3.5",
"ts-unused-exports": "8.0.0",
"typescript": "5.3.2"
"typescript": "5.3.2",
"whatwg-fetch": "3.6.20"
},
"homepage": "https://explorer.hiro.so",
"license": "MIT",
Expand Down
Loading

0 comments on commit affec16

Please sign in to comment.