Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
9d6bd245
Commit
9d6bd245
authored
Apr 23, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add metadata service feature
parent
2744d971
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
125 additions
and
2 deletions
+125
-2
addressMetadata.ts
configs/app/features/addressMetadata.ts
+27
-0
index.ts
configs/app/features/index.ts
+1
-0
.env.base
configs/envs/.env.base
+3
-2
.env.eth_sepolia
configs/envs/.env.eth_sepolia
+1
-0
schema.ts
deploy/tools/envs-validator/schema.ts
+1
-0
.env.base
deploy/tools/envs-validator/test/.env.base
+1
-0
values.yaml.gotmpl
deploy/values/review/values.yaml.gotmpl
+1
-0
ENVS.md
docs/ENVS.md
+11
-0
resources.ts
lib/api/resources.ts
+12
-0
address.ts
mocks/metadata/address.ts
+36
-0
metadata.ts
types/api/metadata.ts
+16
-0
Address.tsx
ui/pages/Address.tsx
+15
-0
No files found.
configs/app/features/addressMetadata.ts
0 → 100644
View file @
9d6bd245
import
type
{
Feature
}
from
'
./types
'
;
import
{
getEnvValue
}
from
'
../utils
'
;
const
apiHost
=
getEnvValue
(
'
NEXT_PUBLIC_METADATA_SERVICE_API_HOST
'
);
const
title
=
'
Address metadata
'
;
const
config
:
Feature
<
{
api
:
{
endpoint
:
string
;
basePath
:
string
}
}
>
=
(()
=>
{
if
(
apiHost
)
{
return
Object
.
freeze
({
title
,
isEnabled
:
true
,
api
:
{
endpoint
:
apiHost
,
basePath
:
''
,
},
});
}
return
Object
.
freeze
({
title
,
isEnabled
:
false
,
});
})();
export
default
config
;
configs/app/features/index.ts
View file @
9d6bd245
export
{
default
as
account
}
from
'
./account
'
;
export
{
default
as
account
}
from
'
./account
'
;
export
{
default
as
addressVerification
}
from
'
./addressVerification
'
;
export
{
default
as
addressVerification
}
from
'
./addressVerification
'
;
export
{
default
as
addressMetadata
}
from
'
./addressMetadata
'
;
export
{
default
as
adsBanner
}
from
'
./adsBanner
'
;
export
{
default
as
adsBanner
}
from
'
./adsBanner
'
;
export
{
default
as
adsText
}
from
'
./adsText
'
;
export
{
default
as
adsText
}
from
'
./adsText
'
;
export
{
default
as
beaconChain
}
from
'
./beaconChain
'
;
export
{
default
as
beaconChain
}
from
'
./beaconChain
'
;
...
...
configs/envs/.env.base
View file @
9d6bd245
...
@@ -17,8 +17,8 @@ NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE=validation
...
@@ -17,8 +17,8 @@ NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE=validation
NEXT_PUBLIC_NETWORK_RPC_URL=https://mainnet.base.org/
NEXT_PUBLIC_NETWORK_RPC_URL=https://mainnet.base.org/
# api configuration
# api configuration
NEXT_
NEXT_
PUBLIC_API_HOST=base.blockscout.com
NEXT_PUBLIC_API_HOST=base.blockscout.com
NEXT_
NEXT_
PUBLIC_API_BASE_PATH=/
NEXT_PUBLIC_API_BASE_PATH=/
# ui config
# ui config
## homepage
## homepage
...
@@ -55,6 +55,7 @@ NEXT_PUBLIC_AD_BANNER_ADDITIONAL_PROVIDER=adbutler
...
@@ -55,6 +55,7 @@ NEXT_PUBLIC_AD_BANNER_ADDITIONAL_PROVIDER=adbutler
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_DESKTOP={'id':'728301','width':'728','height':'90'}
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_DESKTOP={'id':'728301','width':'728','height':'90'}
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_MOBILE={'id':'728301','width':'320','height':'100'}
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_MOBILE={'id':'728301','width':'320','height':'100'}
NEXT_PUBLIC_NAME_SERVICE_API_HOST=https://bens.services.blockscout.com
NEXT_PUBLIC_NAME_SERVICE_API_HOST=https://bens.services.blockscout.com
NEXT_PUBLIC_METADATA_SERVICE_API_HOST=https://metadata.services.blockscout.com
NEXT_PUBLIC_SWAP_BUTTON_URL=aerodrome
NEXT_PUBLIC_SWAP_BUTTON_URL=aerodrome
NEXT_PUBLIC_MARKETPLACE_ENABLED=true
NEXT_PUBLIC_MARKETPLACE_ENABLED=true
NEXT_PUBLIC_MARKETPLACE_CATEGORIES_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace-categories/default.json
NEXT_PUBLIC_MARKETPLACE_CATEGORIES_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace-categories/default.json
...
...
configs/envs/.env.eth_sepolia
View file @
9d6bd245
...
@@ -60,6 +60,7 @@ NEXT_PUBLIC_AD_BANNER_PROVIDER=getit
...
@@ -60,6 +60,7 @@ NEXT_PUBLIC_AD_BANNER_PROVIDER=getit
NEXT_PUBLIC_DATA_AVAILABILITY_ENABLED=true
NEXT_PUBLIC_DATA_AVAILABILITY_ENABLED=true
NEXT_PUBLIC_SAFE_TX_SERVICE_URL=https://safe-transaction-sepolia.safe.global
NEXT_PUBLIC_SAFE_TX_SERVICE_URL=https://safe-transaction-sepolia.safe.global
NEXT_PUBLIC_NAME_SERVICE_API_HOST=https://bens-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_NAME_SERVICE_API_HOST=https://bens-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_METADATA_SERVICE_API_HOST=https://metadata-test.k8s-dev.blockscout.com
#meta
#meta
NEXT_PUBLIC_OG_IMAGE_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/sepolia-testnet.png
NEXT_PUBLIC_OG_IMAGE_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/sepolia-testnet.png
deploy/tools/envs-validator/schema.ts
View file @
9d6bd245
...
@@ -583,6 +583,7 @@ const schema = yup
...
@@ -583,6 +583,7 @@ const schema = yup
NEXT_PUBLIC_VISUALIZE_API_BASE_PATH
:
yup
.
string
(),
NEXT_PUBLIC_VISUALIZE_API_BASE_PATH
:
yup
.
string
(),
NEXT_PUBLIC_CONTRACT_INFO_API_HOST
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_CONTRACT_INFO_API_HOST
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NAME_SERVICE_API_HOST
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NAME_SERVICE_API_HOST
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_METADATA_SERVICE_API_HOST
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_GRAPHIQL_TRANSACTION
:
yup
.
string
().
matches
(
regexp
.
HEX_REGEXP
),
NEXT_PUBLIC_GRAPHIQL_TRANSACTION
:
yup
.
string
().
matches
(
regexp
.
HEX_REGEXP
),
NEXT_PUBLIC_WEB3_WALLETS
:
yup
NEXT_PUBLIC_WEB3_WALLETS
:
yup
.
mixed
()
.
mixed
()
...
...
deploy/tools/envs-validator/test/.env.base
View file @
9d6bd245
...
@@ -25,6 +25,7 @@ NEXT_PUBLIC_GAS_TRACKER_ENABLED=true
...
@@ -25,6 +25,7 @@ NEXT_PUBLIC_GAS_TRACKER_ENABLED=true
NEXT_PUBLIC_GAS_TRACKER_UNITS=['gwei']
NEXT_PUBLIC_GAS_TRACKER_UNITS=['gwei']
NEXT_PUBLIC_IS_TESTNET=true
NEXT_PUBLIC_IS_TESTNET=true
NEXT_PUBLIC_MAINTENANCE_ALERT_MESSAGE='<a href="#">Hello</a>'
NEXT_PUBLIC_MAINTENANCE_ALERT_MESSAGE='<a href="#">Hello</a>'
NEXT_PUBLIC_METADATA_SERVICE_API_HOST=https://example.com
NEXT_PUBLIC_METASUITES_ENABLED=true
NEXT_PUBLIC_METASUITES_ENABLED=true
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether
...
...
deploy/values/review/values.yaml.gotmpl
View file @
9d6bd245
...
@@ -59,6 +59,7 @@ frontend:
...
@@ -59,6 +59,7 @@ frontend:
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://contracts-info-test.k8s-dev.blockscout.com
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://contracts-info-test.k8s-dev.blockscout.com
NEXT_PUBLIC_ADMIN_SERVICE_API_HOST: https://admin-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_ADMIN_SERVICE_API_HOST: https://admin-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_NAME_SERVICE_API_HOST: https://bens-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_NAME_SERVICE_API_HOST: https://bens-rs-test.k8s-dev.blockscout.com
NEXT_PUBLIC_METADATA_SERVICE_API_HOST: https://metadata-test.k8s-dev.blockscout.com
NEXT_PUBLIC_AUTH_URL: https://blockscout-main.k8s-dev.blockscout.com
NEXT_PUBLIC_AUTH_URL: https://blockscout-main.k8s-dev.blockscout.com
NEXT_PUBLIC_MARKETPLACE_ENABLED: true
NEXT_PUBLIC_MARKETPLACE_ENABLED: true
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL: https://raw.githubusercontent.com/blockscout/frontend-configs/dev/configs/marketplace/eth-goerli.json
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL: https://raw.githubusercontent.com/blockscout/frontend-configs/dev/configs/marketplace/eth-goerli.json
...
...
docs/ENVS.md
View file @
9d6bd245
...
@@ -49,6 +49,7 @@ Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will
...
@@ -49,6 +49,7 @@ Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will
-
[
Transaction interpretation
](
ENVS.md#transaction-interpretation
)
-
[
Transaction interpretation
](
ENVS.md#transaction-interpretation
)
-
[
Verified tokens info
](
ENVS.md#verified-tokens-info
)
-
[
Verified tokens info
](
ENVS.md#verified-tokens-info
)
-
[
Name service integration
](
ENVS.md#name-service-integration
)
-
[
Name service integration
](
ENVS.md#name-service-integration
)
-
[
Metadata service integration
](
ENVS.md#metadata-service-integration
)
-
[
Bridged tokens
](
ENVS.md#bridged-tokens
)
-
[
Bridged tokens
](
ENVS.md#bridged-tokens
)
-
[
Safe{Core} address tags
](
ENVS.md#safecore-address-tags
)
-
[
Safe{Core} address tags
](
ENVS.md#safecore-address-tags
)
-
[
SUAVE chain
](
ENVS.md#suave-chain
)
-
[
SUAVE chain
](
ENVS.md#suave-chain
)
...
@@ -550,6 +551,16 @@ This feature allows resolving blockchain addresses using human-readable domain n
...
@@ -550,6 +551,16 @@ This feature allows resolving blockchain addresses using human-readable domain n
### Metadata service integration
This feature allows name tags and other public tags for addresses.
| Variable | Type| Description | Compulsoriness | Default value | Example value |
| --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_METADATA_SERVICE_API_HOST |
`string`
| Metadata Service API endpoint url | Required | - |
`https://metadata.services.blockscout.com`
|
### Data Availability
### Data Availability
This feature enables views related to blob transactions (EIP-4844), such as the Blob Txns tab on the Transactions page and the Blob details page.
This feature enables views related to blob transactions (EIP-4844), such as the Blob Txns tab on the Transactions page and the Blob details page.
...
...
lib/api/resources.ts
View file @
9d6bd245
...
@@ -237,6 +237,18 @@ export const RESOURCES = {
...
@@ -237,6 +237,18 @@ export const RESOURCES = {
filterFields
:
[
'
name
'
as
const
,
'
only_active
'
as
const
],
filterFields
:
[
'
name
'
as
const
,
'
only_active
'
as
const
],
},
},
// METADATA SERVICE
address_metadata_info
:
{
path
:
'
/api/v1/metadata
'
,
endpoint
:
getFeaturePayload
(
config
.
features
.
addressMetadata
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
addressMetadata
)?.
api
.
basePath
,
},
address_metadata_tag_search
:
{
path
:
'
/api/v1/tags:search
'
,
endpoint
:
getFeaturePayload
(
config
.
features
.
addressMetadata
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
addressMetadata
)?.
api
.
basePath
,
},
// VISUALIZATION
// VISUALIZATION
visualize_sol2uml
:
{
visualize_sol2uml
:
{
path
:
'
/api/v1/solidity
\\
:visualize-contracts
'
,
path
:
'
/api/v1/solidity
\\
:visualize-contracts
'
,
...
...
mocks/metadata/address.ts
0 → 100644
View file @
9d6bd245
import
type
{
AddressMetadataInfo
,
AddressMetadataTag
}
from
'
types/api/metadata
'
;
import
{
hash
}
from
'
../address/address
'
;
export
const
nameTag1
:
AddressMetadataTag
=
{
slug
:
'
ethermineru
'
,
name
:
'
Ethermine.ru
'
,
tagType
:
'
name
'
,
ordinal
:
0
,
meta
:
{},
};
export
const
genericTag1
:
AddressMetadataTag
=
{
slug
:
'
ethermine.ru
'
,
name
:
'
Ethermine.ru
'
,
tagType
:
'
generic
'
,
ordinal
:
0
,
meta
:
{},
};
export
const
protocolTag1
:
AddressMetadataTag
=
{
slug
:
'
aerodrome
'
,
name
:
'
Aerodrome
'
,
tagType
:
'
protocol
'
,
ordinal
:
0
,
meta
:
{},
};
export
const
baseInfo
:
AddressMetadataInfo
=
{
addresses
:
{
[
hash
]:
{
tags
:
[
nameTag1
,
genericTag1
,
protocolTag1
],
reputation
:
null
,
},
},
};
types/api/metadata.ts
0 → 100644
View file @
9d6bd245
export
interface
AddressMetadataInfo
{
addresses
:
Record
<
string
,
{
tags
:
Array
<
AddressMetadataTag
>
;
reputation
:
number
|
null
;
}
>
;
}
export
type
AddressMetadataTagType
=
'
name
'
|
'
generic
'
|
'
classifier
'
|
'
information
'
|
'
note
'
|
'
protocol
'
;
export
interface
AddressMetadataTag
{
slug
:
string
;
name
:
string
;
tagType
:
AddressMetadataTagType
;
ordinal
:
number
;
meta
:
Record
<
string
,
unknown
>
;
}
ui/pages/Address.tsx
View file @
9d6bd245
...
@@ -69,6 +69,21 @@ const AddressPageContent = () => {
...
@@ -69,6 +69,21 @@ const AddressPageContent = () => {
},
},
});
});
// TEST EXAMPLE OF METADATA API USAGE
// useApiQuery('address_metadata_info', {
// fetchParams: {
// method: 'POST',
// body: {
// addresses: [ hash ],
// chainId: config.chain.id,
// tags: { limit: '10' },
// },
// },
// queryOptions: {
// enabled: Boolean(hash) && config.features.addressMetadata.isEnabled,
// },
// });
const
isSafeAddress
=
useIsSafeAddress
(
!
addressQuery
.
isPlaceholderData
&&
addressQuery
.
data
?.
is_contract
?
hash
:
undefined
);
const
isSafeAddress
=
useIsSafeAddress
(
!
addressQuery
.
isPlaceholderData
&&
addressQuery
.
data
?.
is_contract
?
hash
:
undefined
);
const
safeIconColor
=
useColorModeValue
(
'
black
'
,
'
white
'
);
const
safeIconColor
=
useColorModeValue
(
'
black
'
,
'
white
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment