diff --git a/.env b/.env index 16dc854865..45c6a8b344 100644 --- a/.env +++ b/.env @@ -7,7 +7,7 @@ REACT_APP_E2E_TEST=1 REACT_APP_META_CSP= EXTENSION_CSP= -REACT_APP_BACKEND=oasisscan +REACT_APP_BACKEND=oasisscanV2 REACT_APP_TRANSAK_URL=https://global-stg.transak.com # Our staging API key from transak dashboard REACT_APP_TRANSAK_PARTNER_ID=3566e9e3-d3b7-493c-a33e-91d33c5c32cb diff --git a/.github/dump_validators.sh b/.github/dump_validators.sh index c9e46ffe85..e2e0125ece 100755 --- a/.github/dump_validators.sh +++ b/.github/dump_validators.sh @@ -1,6 +1,6 @@ #!/bin/sh -curl -s https://api.oasisscan.com/mainnet/validator/list?pageSize=500 | +curl -s https://api.oasisscan.com/v2/mainnet/validator/list?pageSize=500 | jq '{ dump_timestamp: (now * 1000 | floor), dump_timestamp_iso: (now | strftime("%Y-%m-%dT%H:%M:%SZ")), diff --git a/cypress/e2e/api-transaction-methods.cy.ts b/cypress/e2e/api-transaction-methods.cy.ts index c78fccca34..4b2a57d120 100644 --- a/cypress/e2e/api-transaction-methods.cy.ts +++ b/cypress/e2e/api-transaction-methods.cy.ts @@ -18,7 +18,7 @@ describe('check all transaction methods from API are mapped in transactionMethod ignoreTimeoutError() // Ignore if API is not responding cy.request({ - url: 'https://api.oasisscan.com/mainnet/chain/methods', // does not include consensus methods + url: 'https://api.oasisscan.com/v2/mainnet/chain/methods', // does not include consensus methods retryOnNetworkFailure: false, failOnStatusCode: false, timeout: 5000, diff --git a/playwright/tests/refreshing-balance.spec.ts b/playwright/tests/refreshing-balance.spec.ts index 9be7883037..fa5ef7753e 100644 --- a/playwright/tests/refreshing-balance.spec.ts +++ b/playwright/tests/refreshing-balance.spec.ts @@ -38,7 +38,7 @@ test('Accounts page should continuously refresh balance', async ({ page }) => { await expect(page.getByTestId('account-balance-summary')).toContainText('123.0') await expect(page.getByTestId('account-choice')).toContainText('123.0') await mockApi(page, 456) - await page.waitForRequest('**/chain/account/info/*', { timeout: 60_000 }) + await page.waitForRequest('**/account/info/*', { timeout: 60_000 }) await page.waitForRequest('**/chain/transactions*', { timeout: 60_000 }) await expect(page.getByTestId('account-balance-summary')).toContainText('456.0') await expect(page.getByTestId('account-choice')).toContainText('456.0') diff --git a/playwright/tests/syncTabs.spec.ts b/playwright/tests/syncTabs.spec.ts index 29933ede0e..056df6dd6b 100644 --- a/playwright/tests/syncTabs.spec.ts +++ b/playwright/tests/syncTabs.spec.ts @@ -12,7 +12,7 @@ import { } from '../../src/utils/__fixtures__/test-inputs' import { addPersistedStorageV1, clearPersistedStorage } from '../utils/storage' import { fillPrivateKeyWithoutPassword, fillPrivateKeyAndPassword } from '../utils/fillPrivateKey' -import type { AccountsRow } from '../../src/vendors/oasisscan/index' +import type { AccountInfoResponse } from '../../src/vendors/oasisscan-v2/index' test.beforeEach(async ({ context, page }) => { await warnSlowApi(context) @@ -312,7 +312,7 @@ test.describe('syncTabs', () => { // Delay getAccountBalanceWithFallback so addWallet is called after wallet is locked. let apiBalance: Route - await context.route('**/chain/account/info/*', route => (apiBalance = route)) + await context.route('**/account/info/*', route => (apiBalance = route)) await page.getByPlaceholder('Enter your private key here').fill(privateKey2) await page.keyboard.press('Enter') @@ -321,7 +321,6 @@ test.describe('syncTabs', () => { body: JSON.stringify({ code: 0, data: { - rank: 0, address: '', available: '0', escrow: '0', @@ -329,7 +328,7 @@ test.describe('syncTabs', () => { total: '0', nonce: 1, allowances: [], - } satisfies AccountsRow, + } satisfies AccountInfoResponse, }), }) await page.waitForTimeout(100) diff --git a/playwright/utils/mockApi.ts b/playwright/utils/mockApi.ts index a2f8e3f210..7cbbd24a56 100644 --- a/playwright/utils/mockApi.ts +++ b/playwright/utils/mockApi.ts @@ -1,37 +1,35 @@ import { BrowserContext, Page } from '@playwright/test' +import type { OperationsRowMethodEnum } from '../../src/vendors/oasisscan/index' import type { - AccountsRow, - DelegationRow, - OperationsRow, - OperationsRowMethodEnum, - RuntimeTransactionInfoRow, - ValidatorRow, -} from '../../src/vendors/oasisscan/index' + AccountInfoResponse, + AccountDelegationsInfo, + ChainTransactionInfoResponse, + ValidatorInfo, +} from '../../src/vendors/oasisscan-v2/index' export async function mockApi(context: BrowserContext | Page, balance: number) { - await context.route('**/chain/account/info/*', route => { + await context.route('**/account/info/*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { - rank: 0, - address: route.request().url().split('/chain/account/info/')[1], + address: route.request().url().split('/account/info/')[1], available: balance.toString(), escrow: '0', debonding: '0', total: balance.toString(), nonce: 1, allowances: [], - } satisfies AccountsRow, + } satisfies AccountInfoResponse, }), }) }) - await context.route('**/chain/account/delegations?*', route => { + await context.route('**/account/delegations?*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { list: [], page: 1, size: 500, maxPage: 0, totalSize: 0 } }), }) }) - await context.route('**/chain/account/debonding?*', route => { + await context.route('**/account/debonding?*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { list: [], page: 1, size: 500, maxPage: 0, totalSize: 0 } }), }) @@ -111,39 +109,37 @@ export async function mockApi(context: BrowserContext | Page, balance: number) { export async function mockApiMoreData(context: BrowserContext | Page) { await mockApi(context, 0) - await context.route('**/chain/account/info/*', route => { + await context.route('**/account/info/*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { - rank: 0, - address: route.request().url().split('/chain/account/info/')[1], + address: route.request().url().split('/account/info/')[1], available: '23.239060788', escrow: '100.996756163', debonding: '0', total: '124.235816951', nonce: 70, allowances: [], - } satisfies AccountsRow, + } satisfies AccountInfoResponse, }), }) }) - await context.route('**/chain/account/delegations?*', route => { + await context.route('**/account/delegations?*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { list: [ { - validatorAddress: 'oasis1qpn83e8hm3gdhvpfv66xj3qsetkj3ulmkugmmxn3', + entityAddress: 'oasis1qpn83e8hm3gdhvpfv66xj3qsetkj3ulmkugmmxn3', validatorName: 'Chorus One', icon: 'https://s3.amazonaws.com/keybase_processed_uploads/3a844f583b686ec5285403694b738a05_360_360.jpg', - entityAddress: null, shares: '71.939343766', amount: '100.996756163', active: true, }, - ] as DelegationRow[], + ] as AccountDelegationsInfo[], page: 1, size: 500, maxPage: 0, @@ -152,7 +148,7 @@ export async function mockApiMoreData(context: BrowserContext | Page) { }), }) }) - await context.route('**/chain/account/debonding?*', route => { + await context.route('**/account/debonding?*', route => { route.fulfill({ body: JSON.stringify({ code: 0, data: { list: [], page: 1, size: 500, maxPage: 0, totalSize: 0 } }), }) @@ -169,13 +165,14 @@ export async function mockApiMoreData(context: BrowserContext | Page) { method: 'staking.AddEscrow' as OperationsRowMethodEnum, fee: '0', amount: '100.00', - shares: '0.00', - add: true, timestamp: 1642862677, time: 81860045, status: true, from: new URL(route.request().url()).searchParams.get('address')!, to: 'oasis1qq3xrq0urs8qcffhvmhfhz4p0mu7ewc8rscnlwxe', + nonce: 2, + raw: '', + errorMessage: '', }, { txHash: '9d5a9eb4e82633e7847989d3e84bce6a51b18434dea83e7f038091dbbb5c8bd5', @@ -183,15 +180,16 @@ export async function mockApiMoreData(context: BrowserContext | Page) { method: 'staking.Transfer' as OperationsRowMethodEnum, fee: '0', amount: '119.90', - shares: null, - add: true, timestamp: 1642862287, time: 81860435, status: true, from: 'oasis1qprje45lh2qqrsy4rcvgx4zpnpzkhkqcm58emr3l', to: new URL(route.request().url()).searchParams.get('address')!, + nonce: 2, + raw: '', + errorMessage: '', }, - ] satisfies (OperationsRow | RuntimeTransactionInfoRow)[], + ] satisfies ChainTransactionInfoResponse[], page: 1, size: 20, maxPage: 1, @@ -215,10 +213,10 @@ export async function mockApiMoreData(context: BrowserContext | Page) { name: 'Mars Staking | Long term fee 1%', icon: 'https://s3.amazonaws.com/keybase_processed_uploads/f30f9b2207b7d83ef05219ca483b6f05_360_360.jpg', website: 'https://linktr.ee/marssuper', - twitter: null, + twitter: 'marssuper', keybase: 'marssuper', email: 'marssuper@outlook.com', - description: null, + description: '', escrow: '134193743.56', escrowChange24: '-1097851.50', escrowPercent: 0.0326, @@ -229,15 +227,9 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nonce: 0, score: 20912186, delegators: 23446, - nodes: null, uptime: '100%', active: true, commission: 0.01, - bound: null, - rates: null, - bounds: null, - escrowSharesStatus: null, - escrowAmountStatus: null, status: true, }, { @@ -252,7 +244,7 @@ export async function mockApiMoreData(context: BrowserContext | Page) { twitter: 'stakefish', keybase: 'bflabs', email: 'hi@stake.fish', - description: null, + description: '', escrow: '185814524.64', escrowChange24: '-206667.72', escrowPercent: 0.0452, @@ -263,15 +255,9 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nonce: 0, score: 21933228, delegators: 8756, - nodes: null, uptime: '100%', active: true, commission: 0.05, - bound: null, - rates: null, - bounds: null, - escrowSharesStatus: null, - escrowAmountStatus: null, status: true, }, { @@ -281,12 +267,12 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nodeId: '6wbL5/OxvFGxi55o7AxcwKmfjXbXGC1hw4lfnEZxBXA=', nodeAddress: 'oasis1qqp0h2h92eev7nsxgqctvuegt8ge3vyg0qyluc4k', name: 'BinanceStaking', - icon: null, + icon: 'https://s3.amazonaws.com/keybase_processed_uploads/e1378cd4d5203ded716906687ad53905_360_360.jpg', website: 'https://www.binance.com', - twitter: null, - keybase: null, - email: null, - description: null, + twitter: 'binance', + keybase: 'binance', + email: 'binance', + description: '', escrow: '131080178.79', escrowChange24: '-7133.04', escrowPercent: 0.0319, @@ -297,15 +283,9 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nonce: 0, score: 20933210, delegators: 7988, - nodes: null, uptime: '100%', active: true, commission: 0.1, - bound: null, - rates: null, - bounds: null, - escrowSharesStatus: null, - escrowAmountStatus: null, status: true, }, { @@ -319,8 +299,8 @@ export async function mockApiMoreData(context: BrowserContext | Page) { website: 'https://www.stake5labs.com', twitter: 'stake5labs', keybase: 'stake5labs', - email: null, - description: null, + email: 'stake5labs', + description: '', escrow: '40029484.50', escrowChange24: '2718.71', escrowPercent: 0.0097, @@ -331,15 +311,9 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nonce: 0, score: 20640813, delegators: 5120, - nodes: null, uptime: '100%', active: true, commission: 0.2, - bound: null, - rates: null, - bounds: null, - escrowSharesStatus: null, - escrowAmountStatus: null, status: true, }, { @@ -352,9 +326,9 @@ export async function mockApiMoreData(context: BrowserContext | Page) { icon: 'https://s3.amazonaws.com/keybase_processed_uploads/3a844f583b686ec5285403694b738a05_360_360.jpg', website: 'https://chorus.one', twitter: 'ChorusOne', - keybase: null, - email: null, - description: null, + keybase: 'ChorusOne', + email: 'ChorusOne', + description: '', escrow: '135556888.36', escrowChange24: '3137.73', escrowPercent: 0.033, @@ -365,18 +339,12 @@ export async function mockApiMoreData(context: BrowserContext | Page) { nonce: 0, score: 21753374, delegators: 2360, - nodes: null, uptime: '100%', active: true, commission: 0.05, - bound: null, - rates: null, - bounds: null, - escrowSharesStatus: null, - escrowAmountStatus: null, status: true, }, - ] satisfies ValidatorRow[], + ] satisfies ValidatorInfo[], active: 120, delegators: 49619, inactive: 82, diff --git a/src/app/components/Footer/__tests__/__snapshots__/index.test.tsx.snap b/src/app/components/Footer/__tests__/__snapshots__/index.test.tsx.snap index 4883a3f577..33e57aac54 100644 --- a/src/app/components/Footer/__tests__/__snapshots__/index.test.tsx.snap +++ b/src/app/components/Footer/__tests__/__snapshots__/index.test.tsx.snap @@ -171,7 +171,7 @@ exports[`