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
57f86b50
Commit
57f86b50
authored
Apr 06, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
form submit
parent
bf7d2e2c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
3 deletions
+82
-3
resources.ts
lib/api/resources.ts
+7
-0
account.ts
types/api/account.ts
+29
-0
TokenInfoForm.tsx
ui/tokenInfo/TokenInfoForm.tsx
+15
-3
utils.ts
ui/tokenInfo/utils.ts
+31
-0
No files found.
lib/api/resources.ts
View file @
57f86b50
...
...
@@ -118,6 +118,13 @@ export const RESOURCES = {
basePath
:
appConfig
.
adminServiceApi
.
basePath
,
},
token_info_application
:
{
path
:
'
/api/v1/chains/:chainId/token-info-submissions
'
,
pathParams
:
[
'
chainId
'
as
const
],
endpoint
:
appConfig
.
adminServiceApi
.
endpoint
,
basePath
:
appConfig
.
adminServiceApi
.
basePath
,
},
// STATS
stats_counters
:
{
path
:
'
/api/v1/counters
'
,
...
...
types/api/account.ts
View file @
57f86b50
...
...
@@ -175,3 +175,32 @@ export interface VerifiedAddressResponse {
export
interface
TokenInfoApplicationConfig
{
projectSectors
:
Array
<
string
>
;
}
export
interface
TokenInfoApplication
{
coinGeckoTicker
?:
string
;
coinMarketCapTicker
?:
string
;
defiLlamaTicker
?:
string
;
discord
?:
string
;
docs
?:
string
;
facebook
?:
string
;
github
?:
string
;
iconUrl
:
string
;
id
:
string
;
linkedin
?:
string
;
medium
?:
string
;
openSea
?:
string
;
projectDescription
?:
string
;
projectEmail
:
string
;
projectName
?:
string
;
projectSector
?:
string
;
projectWebsite
:
string
;
reddit
?:
string
;
requesterEmail
:
string
;
requesterName
:
string
;
slack
?:
string
;
status
:
'
STATUS_UNKNOWN
'
|
'
IN_PROCESS
'
|
'
APPROVED
'
|
'
REJECTED
'
|
'
UPDATE_REQUIRED
'
;
support
?:
string
;
telegram
?:
string
;
tokenAddress
:
string
;
twitter
?:
string
;
}
ui/tokenInfo/TokenInfoForm.tsx
View file @
57f86b50
...
...
@@ -6,6 +6,7 @@ import { useForm } from 'react-hook-form';
import
type
{
Fields
}
from
'
./types
'
;
import
appConfig
from
'
configs/app/config
'
;
import
useApiFetch
from
'
lib/api/useApiFetch
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
ContentLoader
from
'
ui/shared/ContentLoader
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
...
...
@@ -24,6 +25,7 @@ import TokenInfoFieldRequesterName from './fields/TokenInfoFieldRequesterName';
import
TokenInfoFieldSocialLink
from
'
./fields/TokenInfoFieldSocialLink
'
;
import
TokenInfoFieldSupport
from
'
./fields/TokenInfoFieldSupport
'
;
import
TokenInfoFormSectionHeader
from
'
./TokenInfoFormSectionHeader
'
;
import
{
prepareRequestBody
}
from
'
./utils
'
;
interface
Props
{
address
:
string
;
...
...
@@ -31,6 +33,8 @@ interface Props {
const
TokenInfoForm
=
({
address
}:
Props
)
=>
{
const
apiFetch
=
useApiFetch
();
const
configQuery
=
useApiQuery
(
'
token_info_application_config
'
,
{
pathParams
:
{
chainId
:
appConfig
.
network
.
id
},
});
...
...
@@ -44,9 +48,17 @@ const TokenInfoForm = ({ address }: Props) => {
const
{
handleSubmit
,
formState
,
control
,
trigger
}
=
formApi
;
const
onFormSubmit
:
SubmitHandler
<
Fields
>
=
React
.
useCallback
(
async
(
data
)
=>
{
// eslint-disable-next-line no-console
console
.
log
(
'
__>__
'
,
data
);
},
[
]);
try
{
const
submission
=
prepareRequestBody
(
data
);
await
apiFetch
(
'
token_info_application
'
,
{
pathParams
:
{
chainId
:
appConfig
.
network
.
id
},
fetchParams
:
{
method
:
'
POST
'
,
body
:
{
submission
},
},
});
}
catch
(
error
)
{}
},
[
apiFetch
]);
const
onSubmit
=
handleSubmit
(
onFormSubmit
);
...
...
ui/tokenInfo/utils.ts
0 → 100644
View file @
57f86b50
import
type
{
Fields
}
from
'
./types
'
;
import
type
{
TokenInfoApplication
}
from
'
types/api/account
'
;
export
function
prepareRequestBody
(
data
:
Fields
):
Omit
<
TokenInfoApplication
,
'
id
'
|
'
status
'
>
{
return
{
coinGeckoTicker
:
data
.
ticker_coin_gecko
,
coinMarketCapTicker
:
data
.
ticker_coin_market_cap
,
defiLlamaTicker
:
data
.
ticker_defi_llama
,
discord
:
data
.
discord
,
docs
:
data
.
docs
,
facebook
:
data
.
facebook
,
github
:
data
.
github
,
iconUrl
:
data
.
icon_url
,
linkedin
:
data
.
linkedin
,
medium
:
data
.
medium
,
openSea
:
data
.
opensea
,
projectDescription
:
data
.
project_description
,
projectEmail
:
data
.
project_email
,
projectName
:
data
.
project_name
,
projectSector
:
data
.
project_sector
?.
value
,
projectWebsite
:
data
.
project_website
,
reddit
:
data
.
reddit
,
requesterEmail
:
data
.
requester_email
,
requesterName
:
data
.
requester_name
,
slack
:
data
.
slack
,
support
:
data
.
support
,
telegram
:
data
.
telegram
,
tokenAddress
:
data
.
address
,
twitter
:
data
.
twitter
,
};
}
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