-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1912 from blockscout/fe-1802
Multi chain balance button
- Loading branch information
Showing
84 changed files
with
389 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Feature } from './types'; | ||
import type { MultichainProviderConfig } from 'types/client/multichainProviderConfig'; | ||
|
||
import { getEnvValue, parseEnvJson } from '../utils'; | ||
import marketplace from './marketplace'; | ||
|
||
const value = parseEnvJson<MultichainProviderConfig>(getEnvValue('NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG')); | ||
|
||
const title = 'Multichain balance'; | ||
|
||
const config: Feature<{name: string; logoUrl?: string; urlTemplate: string; dappId?: string }> = (() => { | ||
if (value) { | ||
return Object.freeze({ | ||
title, | ||
isEnabled: true, | ||
name: value.name, | ||
logoUrl: value.logo, | ||
urlTemplate: value.url_template, | ||
dappId: marketplace.isEnabled ? value.dapp_id : undefined, | ||
}); | ||
} | ||
|
||
return Object.freeze({ | ||
title, | ||
isEnabled: false, | ||
}); | ||
})(); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type MultichainProviderConfig = { | ||
name: string; | ||
dapp_id?: string; | ||
url_template: string; | ||
logo?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+138 Bytes
(100%)
ui/address/__screenshots__/AddressDetails.pw.tsx_default_contract-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+68 Bytes
(100%)
ui/address/__screenshots__/AddressDetails.pw.tsx_default_mobile-contract-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+66 Bytes
(100%)
ui/address/__screenshots__/AddressDetails.pw.tsx_default_mobile-validator-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+160 Bytes
(100%)
ui/address/__screenshots__/AddressDetails.pw.tsx_default_validator-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
|
||
import * as addressMock from 'mocks/address/address'; | ||
import * as tokensMock from 'mocks/address/tokens'; | ||
import { test, expect } from 'playwright/lib'; | ||
|
||
import AddressNetWorth from './AddressNetWorth'; | ||
|
||
const ADDRESS_HASH = addressMock.hash; | ||
const ICON_URL = 'https://localhost:3000/my-icon.png'; | ||
|
||
test.beforeEach(async({ mockApiResponse }) => { | ||
await mockApiResponse('address_tokens', tokensMock.erc20List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-20' } }); | ||
await mockApiResponse('address_tokens', tokensMock.erc721List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-721' } }); | ||
await mockApiResponse('address_tokens', tokensMock.erc1155List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-1155' } }); | ||
await mockApiResponse('address_tokens', tokensMock.erc404List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-404' } }); | ||
}); | ||
|
||
test('base view', async({ render }) => { | ||
const component = await render(<AddressNetWorth addressData={ addressMock.token } addressHash={ ADDRESS_HASH }/>); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('with multichain button internal +@dark-mode', async({ render, mockEnvs, mockAssetResponse }) => { | ||
await mockEnvs([ | ||
[ | ||
'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG', | ||
`{"name": "duck", "dapp_id": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"}` ], | ||
]); | ||
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg'); | ||
|
||
const component = await render(<AddressNetWorth addressData={ addressMock.token } addressHash={ ADDRESS_HASH }/>); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('with multichain button external', async({ render, mockEnvs, mockAssetResponse }) => { | ||
await mockEnvs([ | ||
[ 'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG', `{"name": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"}` ], | ||
]); | ||
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg'); | ||
|
||
const component = await render(<AddressNetWorth addressData={ addressMock.token } addressHash={ ADDRESS_HASH }/>); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
}); |
Oops, something went wrong.