Skip to content

Commit

Permalink
Merge pull request #1238 from edenia/dev
Browse files Browse the repository at this point in the history
Production Release
  • Loading branch information
xavier506 committed Jul 15, 2023
2 parents 8fa9060 + 7bac190 commit 3a641ab
Show file tree
Hide file tree
Showing 16 changed files with 278 additions and 121 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/deploy-libre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
REACT_APP_DEFAULT_PRODUCER_LOGO: 'https://antelope.tools/images/libre.png'
REACT_APP_FOOTER_LINKS: '[{ "text": "Libre Website", "src": "https://libre.org/" },{ "text": "Libre Block Explorer", "src": "https://www.libreblocks.io/" },{"text": "Documentation","src": "https://libre-chain.gitbook.io/"},{"text": "Libre Network Monitor","src": "https://libre.antelope.tools"}]'
REACT_APP_EOS_RATE_LINK: ''
REACT_APP_USE_REWARDS: 'false'
REACT_APP_USE_VOTES: 'false'
REACT_APP_USE_REWARDS: 'true'
REACT_APP_USE_VOTES: 'true'
REACT_APP_HASURA_URL: 'https://graphql-libre.antelope.tools/v1/graphql'
REACT_APP_EOS_API_NETWORK_NAME: 'libre'
REACT_APP_EOS_API_NETWORK_LABEL: 'Libre Mainnet'
Expand All @@ -56,9 +56,9 @@ jobs:
REACT_APP_SYNC_TOLERANCE_INTERVAL: 180000
REACT_APP_TOKEN_SYMBOL: 'LIBRE'
REACT_APP_NETWORK_URL: '[{"label":"EOS","value":"https://eos.antelope.tools","mainnet":true,"pair":"eos","icon":"eos","order":1},{"label":"Proton","value":"https://proton.antelope.tools","mainnet":true,"pair":"proton","icon":"proton","order":2},{"label":"WAX","value":"https://wax.antelope.tools","mainnet":true,"pair":"wax","icon":"wax","order":3},{"label":"Telos","value":"https://telos.antelope.tools","mainnet":true,"pair":"telos","icon":"telos","order":4},{"label":"Libre","value":"https://libre.antelope.tools","mainnet":true,"pair":"libre","icon":"libre","order":5},{"label":"LACChain EOSIO","value":"https://lacchain.antelope.tools","mainnet":true,"pair":null,"icon":"lacchain","order":6},{"label":"Jungle4 Testnet","value":"https://jungle.antelope.tools","mainnet":false,"pair":"eos","icon":"jungle","order":1},{"label":"Proton Testnet","value":"https://proton-testnet.antelope.tools","mainnet":false,"pair":"proton","icon":"proton","order":2},{"label":"WAX Testnet","value":"https://wax-testnet.antelope.tools","mainnet":false,"pair":"wax","icon":"wax","order":3},{"label":"Telos Testnet","value":"https://telos-testnet.antelope.tools","mainnet":false,"pair":"telos","icon":"telos","order":4},{"label":"Libre Testnet","value":"https://libre-testnet.antelope.tools","mainnet":false,"pair":"libre","icon":"libre","order":5},{"label":"Ultra Testnet","value":"https://ultra-testnet.antelope.tools","mainnet":false,"pair":"ultra","icon":"ultra","order":6}]'
REACT_APP_DISABLED_MENU_ITEMS: '["/missed-blocks","/block-distribution","/stress-test"]'
REACT_APP_DISABLED_MENU_ITEMS: '["/missed-blocks","/stress-test"]'
REACT_APP_BLOCK_EXPLORER_URL: 'https://www.libreblocks.io/tx/(transaction)'
REACT_APP_STATE_HISTORY_ENABLED=: 'false'
REACT_APP_STATE_HISTORY_ENABLED: 'true'
REACT_APP_GOOGLE_ANALITIC_PAGE_ID: 'G-E6Y0EC9FT8'
REACT_APP_PUBLIC_RE_CAPTCHA_KEY: ${{ secrets.REACT_APP_PUBLIC_RE_CAPTCHA_KEY }}

Expand All @@ -82,6 +82,11 @@ jobs:
# hapi
HAPI_EOS_API_NETWORK_NAME: libre
HAPI_EOS_API_ENDPOINTS: '["https://libre.edenia.cloud","https://libre.eosusa.io","https://api.libre.cryptolions.io"]'
HAPI_EOS_STATE_HISTORY_PLUGIN_ENDPOINT: 'ws://api-node.libre:8080'
HAPI_EOS_MISSED_BLOCKS_ENABLED: 'false'
HAPI_EOS_BLOCK_HISTORY_DAYS: 90
HAPI_EOS_MAX_CPU_BLOCK: 100000
HAPI_EOS_MAX_NET_BLOCK: 1048576
HAPI_EOS_API_CHAIN_ID: 38b1d7815474d0c60683ecbea321d723e83f5da6ae5f1c1f9fecc69d9ba96465
HAPI_EOS_BASE_ACCOUNT: ${{ secrets.HAPI_EOS_BASE_ACCOUNT }}
HAPI_EOS_BASE_ACCOUNT_PASSWORD: ${{ secrets.HAPI_EOS_BASE_ACCOUNT_PASSWORD }}
Expand All @@ -104,6 +109,7 @@ jobs:
HAPI_SYNC_PRODUCER_CPU_INTERVAL: '6'
HAPI_SYNC_PRODUCER_INFO_INTERVAL: '1'
HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL: 86400
HAPI_SYNC_STATS_INTERVAL: 3600
HAPI_EOS_EXCHANGE_RATE_API: 'https://dashboard-api.libre.org/exchange-rates'
HAPI_COINGECKO_API_TOKEN_ID: LIBRE
HAPI_REWARDS_TOKEN: LIBRE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-wax-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
REACT_APP_DEFAULT_PRODUCER_LOGO: 'https://antelope.tools/images/wax.jpg'
REACT_APP_FOOTER_LINKS: '[{ "text": "WAX Website", "src": "https://www.wax.io/" },{ "text": "WAX Block Explorer", "src": "https://wax-test.bloks.io/" },{"text": "Developer Guidelines","src": "https://developer.wax.io/"},{"text": "WAX Network Monitor","src": "https://antelope.tools"}]'
REACT_APP_EOS_RATE_LINK: ''
REACT_APP_USE_REWARDS: 'false'
REACT_APP_USE_REWARDS: 'true'
REACT_APP_USE_VOTES: 'true'
REACT_APP_HASURA_URL: 'https://graphql-wax-testnet.antelope.tools/v1/graphql'
REACT_APP_EOS_API_NETWORK_NAME: 'wax-testnet'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-wax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
REACT_APP_DEFAULT_PRODUCER_LOGO: 'https://antelope.tools/images/wax.jpg'
REACT_APP_FOOTER_LINKS: '[{ "text": "WAX Website", "src": "https://www.wax.io/" },{ "text": "WAX Block Explorer", "src": "https://wax.bloks.io" },{"text": "Developer Guidelines","src": "https://developer.wax.io/"},{"text": "WAX Network Monitor","src": "https://antelope.tools"}]'
REACT_APP_EOS_RATE_LINK: ''
REACT_APP_USE_REWARDS: 'false'
REACT_APP_USE_REWARDS: 'true'
REACT_APP_USE_VOTES: 'true'
REACT_APP_HASURA_URL: 'https://graphql-wax.antelope.tools/v1/graphql'
REACT_APP_EOS_API_NETWORK_NAME: 'wax'
Expand Down
35 changes: 23 additions & 12 deletions hapi/src/routes/create-faucet-account.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const {
eosUtil,
axiosUtil,
googleRecaptchaEnterpriseUtil,
getCreateAccountDataUtil
getCreateAccountDataUtil,
sleepFor
} = require('../utils')

module.exports = {
Expand All @@ -21,7 +22,7 @@ module.exports = {
throw Boom.badRequest('Are you a human?')
}

await eosUtil.transact(
const transaction = await eosUtil.transact(
[
{
authorization: [
Expand All @@ -43,25 +44,35 @@ module.exports = {
eosConfig.faucet.password
)

await sleepFor(1)

const {
data: { account_name: account, permissions }
data: { accounts }
} = await axiosUtil.instance.post(
`${eosConfig.apiEndpoint}/v1/chain/get_account`,
`${eosConfig.apiEndpoint}/v1/chain/get_accounts_by_authorizers`,
{
account_name: input.name
keys: [input.public_key]
}
)

const keys = permissions[0]?.required_auth?.keys || []
const key = keys[0]?.key

if (account === input.name && key === input.public_key) {
return { account }
if (!input.name) {
input.name = transaction?.processed?.action_traces[0]?.act?.data?.name
}

return Boom.badData('Wrong key format')
const newAccount = accounts.find(
(account) => account.account_name === input.name || !input.name
)

if (!newAccount) throw new Error('Account creation failed')

return { account: newAccount.account_name }
} catch (err) {
throw Boom.badRequest(err.message)
const errorDetail =
err?.response?.data?.error?.details[0]?.message?.substring(0, 11)

return errorDetail === 'unknown key'
? Boom.badRequest('Account creation failed')
: Boom.badRequest(err.message)
}
},
options: {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/ContractActionForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const ContractActionForm = ({ accountName, action, abi, onSubmitAction }) => {
InputProps={{
endAdornment: (
<InputAdornment position="end">
<Chip label={t(field.type)} />
<Chip label={field.type} />
</InputAdornment>
),
}}
Expand Down
175 changes: 121 additions & 54 deletions webapp/src/components/ContractTables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import React, { useState, useEffect, useCallback } from 'react'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import { makeStyles } from '@mui/styles'
import MenuItem from '@mui/material/MenuItem'
import Select from '@mui/material/Select'
import FormControl from '@mui/material/FormControl'
import Autocomplete from '@mui/material/Autocomplete'
import Checkbox from '@mui/material/Checkbox'
import FormControlLabel from '@mui/material/FormControlLabel'
import TextField from '@mui/material/TextField'
import InputLabel from '@mui/material/InputLabel'
import Button from '@mui/material/Button'
import RefreshIcon from '@mui/icons-material/Refresh'

Expand All @@ -24,26 +23,42 @@ const ContractTables = ({
onGetTableRows,
tableName,
}) => {
const keysTypes = [
'i64',
'i128',
'i256',
'float64',
'float128',
'sha256',
'ripemd160',
'name',
]
const initData = {
table: '',
scope: '',
index: '',
keyType: keysTypes[0],
lowerBound: null,
upperBound: null,
limit: 10,
reverse: false,
}
const formFields = [
{ name: 'scope', type: 'text' },
{ name: 'lowerBound', type: 'number' },
{ name: 'upperBound', type: 'number' },
{ name: 'index', type: 'text' },
{ name: 'keyType', type: 'text', component: 'select', options: keysTypes },
{ name: 'lowerBound', type: 'text' },
{ name: 'upperBound', type: 'text' },
{ name: 'limit', type: 'number' },
]
const DELAY = 300
const DELAY = 500

const { t } = useTranslation('contractTablesComponent')
const classes = useStyles()
const [tables, setTables] = useState([])
const [fields, setFields] = useState([])
const [filters, setFilters] = useState(initData)
const [selectedTable, setSelectedTable] = useState(tableName)
const debouncedFilter = useDebounceState(filters, DELAY)

const getValidValue = (value, type) => {
Expand Down Expand Up @@ -78,6 +93,9 @@ const ContractTables = ({
table: filters.table,
code: accountName,
json: true,
key_type: filters.keyType,
index_position: filters.index,
reverse: filters.reverse,
lower_bound: nextKey || filters.lowerBound,
upper_bound: filters.upperBound,
loadMore: !!nextKey,
Expand All @@ -86,6 +104,19 @@ const ContractTables = ({
[accountName, onGetTableRows, filters],
)

const handleTableSelect = (_event, value) => {
setSelectedTable(value || '')
if (tables.includes(value)) {
handleTableChange(value)
}
}

const handleFilterSelect = (newValue, name, type) => {
handleOnChange({
target: { name, type, value: newValue || '' },
})
}

useEffect(() => {
if (!abi) {
setTables([])
Expand All @@ -103,10 +134,12 @@ const ContractTables = ({
return
}

setSelectedTable(filters.table)

const tableType = abi.tables.find(
(item) => item.name === filters.table,
item => item.name === filters.table,
)?.type
const struct = abi.structs.find((struct) => struct.name === tableType)
const struct = abi.structs.find(struct => struct.name === tableType)
setFields(struct?.fields || [])
}, [filters.table, abi])

Expand All @@ -127,60 +160,94 @@ const ContractTables = ({
}, [debouncedFilter])

return (
<div>
<>
<div className={classes.form}>
<FormControl
variant="outlined"
className={`${classes.formControl} ${classes.tableEmpty}`}
>
<InputLabel id="tableLabel">{t('table')}</InputLabel>
<Select
labelId="tableLabel"
id="table"
value={filters.table}
onChange={(event) => handleTableChange(event.target.value)}
label={t('table')}
>
{tables.map((item) => (
<MenuItem key={`table-menu-item-${item}`} value={item}>
{item}
</MenuItem>
))}
</Select>
</FormControl>

{formFields.map(({ name, type }, index) => (
<TextField
key={`field-${name}-${index}`}
label={t(name)}
name={name}
type={type}
variant="outlined"
className={classes.formControl}
value={filters[name] ?? ''}
onChange={(event) => handleOnChange(event)}
<div className={classes.fieldsContainer}>
<Autocomplete
className={classes.textField}
options={tables}
value={selectedTable}
inputValue={selectedTable}
onChange={handleTableSelect}
onInputChange={handleTableSelect}
renderInput={params => (
<TextField {...params} label={t('table')} />
)}
noOptionsText={t('noOptions')}
/>
))}

{filters.table && (
<Button
variant="contained"
color="primary"
className={classes.refreshButton}
onClick={() => handleSubmit()}
>
<RefreshIcon />
{t('refreshData')}
</Button>
)}

{formFields.map(({ name, type, component, options }, index) =>
component === 'select' ? (
<Autocomplete
className={classes.textField}
key={`field-${name}-${index}`}
options={options}
value={filters[name] ?? ''}
inputValue={filters[name] ?? ''}
onChange={(_e, value) => {
handleFilterSelect(value, name, type)
}}
onInputChange={(_e, value) => {
handleFilterSelect(value, name, type)
}}
renderInput={params => (
<TextField {...params} label={t(name)} />
)}
noOptionsText={t('noOptions')}
/>
) : (
<TextField
className={classes.textField}
key={`field-${name}-${index}`}
label={t(name)}
name={name}
type={type}
variant="outlined"
value={filters[name] ?? ''}
onChange={event => handleOnChange(event)}
/>
),
)}

<FormControlLabel
className={classes.checkBox}
control={
<Checkbox
checked={filters.reverse}
onChange={event => {
setFilters(prev => ({
...prev,
reverse: event.target.checked,
}))
}}
/>
}
label={t('reverse')}
labelPlacement="top"
/>
</div>

<div>
{filters.table && (
<Button
variant="contained"
color="primary"
className={classes.refreshButton}
onClick={() => handleSubmit()}
>
<RefreshIcon />
{t('refreshData')}
</Button>
)}
</div>
</div>

<TableData
tableData={tableData}
fields={fields}
handleSubmit={handleSubmit}
/>
</div>
</>
)
}

Expand Down
Loading

0 comments on commit 3a641ab

Please sign in to comment.