Add test wallets
This commit is contained in:
@@ -11,7 +11,7 @@ public class UserService : IUserService
|
|||||||
private readonly IUserRepository _userRepository;
|
private readonly IUserRepository _userRepository;
|
||||||
private readonly IAccountService _accountService;
|
private readonly IAccountService _accountService;
|
||||||
|
|
||||||
private string[] authorizedAddresses = new string[] { "0x6781920674dA695aa5120d95D80c4B1788046806" };
|
private string[] authorizedAddresses = ["0x6781920674dA695aa5120d95D80c4B1788046806", "0xA2B43AFF0992a47838DF2e6099A8439981f0B717"];
|
||||||
|
|
||||||
public UserService(
|
public UserService(
|
||||||
IEvmManager evmManager,
|
IEvmManager evmManager,
|
||||||
|
|||||||
@@ -8,21 +8,24 @@ import { UserClient } from '../../../generated/ManagingApi'
|
|||||||
import type { ILoginFormInput } from '../../../global/type'
|
import type { ILoginFormInput } from '../../../global/type'
|
||||||
import useCookie from '../../../hooks/useCookie'
|
import useCookie from '../../../hooks/useCookie'
|
||||||
import { SecondaryNavbar } from '../NavBar/NavBar'
|
import { SecondaryNavbar } from '../NavBar/NavBar'
|
||||||
|
import Toast from '../Toast/Toast'
|
||||||
|
|
||||||
const LogIn = () => {
|
const LogIn = () => {
|
||||||
const { apiUrl } = useApiUrlStore()
|
const { apiUrl } = useApiUrlStore()
|
||||||
const { register, handleSubmit } = useForm<ILoginFormInput>()
|
const { register, handleSubmit } = useForm<ILoginFormInput>()
|
||||||
const { disconnect } = useDisconnect()
|
const { disconnect } = useDisconnect()
|
||||||
const { address } = useAccount()
|
const { address } = useAccount()
|
||||||
const { isLoading, signMessageAsync } = useSignMessage({})
|
const { signMessageAsync } = useSignMessage({})
|
||||||
const { setCookie } = useCookie()
|
const { setCookie } = useCookie()
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<ILoginFormInput> = async (form) => {
|
const onSubmit: SubmitHandler<ILoginFormInput> = async (form) => {
|
||||||
const message = 'wagmi'
|
const message = 'wagmi'
|
||||||
const signature = await signMessageAsync({ message })
|
const signature = await signMessageAsync({ message })
|
||||||
|
const t = new Toast('Creating token')
|
||||||
|
|
||||||
if (signature && address) {
|
if (signature && address) {
|
||||||
const userClient = new UserClient({}, apiUrl)
|
const userClient = new UserClient({}, apiUrl)
|
||||||
|
|
||||||
await userClient
|
await userClient
|
||||||
.user_CreateToken({
|
.user_CreateToken({
|
||||||
address: address.toString(),
|
address: address.toString(),
|
||||||
@@ -34,11 +37,11 @@ const LogIn = () => {
|
|||||||
setCookie('token', data, 1)
|
setCookie('token', data, 1)
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err: any) => {
|
||||||
// eslint-disable-next-line no-console
|
t.update('error', 'Error :' + err.message)
|
||||||
console.error(err)
|
|
||||||
})
|
})
|
||||||
} else {
|
}else{
|
||||||
|
t.update('error', 'Error : No signature')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +80,6 @@ const LogIn = () => {
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isLoading}
|
|
||||||
className="btn bg-primary w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
className="btn bg-primary w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
||||||
>
|
>
|
||||||
Sign and login
|
Sign and login
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ const baseOptions: UpdateOptions = {
|
|||||||
class Toast {
|
class Toast {
|
||||||
private id: Id
|
private id: Id
|
||||||
|
|
||||||
constructor(content: string) {
|
constructor(content: string, isLoading = true) {
|
||||||
this.id = toast.loading(content)
|
if (!isLoading) {
|
||||||
|
this.id = toast(content)
|
||||||
|
}else{
|
||||||
|
this.id = toast.loading(content)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update(type: TypeOptions, content: string, opts?: any) {
|
update(type: TypeOptions, content: string, opts?: any) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ColorSwatchIcon, TrashIcon, XIcon } from '@heroicons/react/solid'
|
import { ColorSwatchIcon, TrashIcon, XIcon } from '@heroicons/react/solid'
|
||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import React, { useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import 'react-toastify/dist/ReactToastify.css'
|
import 'react-toastify/dist/ReactToastify.css'
|
||||||
import useApiUrlStore from '../../app/store/apiStore'
|
import useApiUrlStore from '../../app/store/apiStore'
|
||||||
@@ -17,14 +17,17 @@ const BacktestScanner: React.FC = () => {
|
|||||||
const { apiUrl } = useApiUrlStore()
|
const { apiUrl } = useApiUrlStore()
|
||||||
const client = new BacktestClient({}, apiUrl)
|
const client = new BacktestClient({}, apiUrl)
|
||||||
|
|
||||||
const { isLoading, refetch } = useQuery({
|
const { isLoading, refetch, data: backtests } = useQuery({
|
||||||
onSuccess: (data) => {
|
|
||||||
setBacktest(data)
|
|
||||||
},
|
|
||||||
queryFn: () => client.backtest_Backtests(),
|
queryFn: () => client.backtest_Backtests(),
|
||||||
queryKey: ['backtests'],
|
queryKey: ['backtests'],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (backtests) {
|
||||||
|
setBacktest(backtests)
|
||||||
|
}
|
||||||
|
}, [backtests])
|
||||||
|
|
||||||
function deleteAllBacktests() {
|
function deleteAllBacktests() {
|
||||||
const t = new Toast('Deleting all backtests')
|
const t = new Toast('Deleting all backtests')
|
||||||
client
|
client
|
||||||
@@ -114,7 +117,7 @@ const BacktestScanner: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BacktestTable list={backtestingResult} isFetching={isLoading} />
|
<BacktestTable list={backtestingResult} isFetching={isLoading} setBacktests={setBacktest} />
|
||||||
|
|
||||||
<BacktestModal
|
<BacktestModal
|
||||||
showModal={showModal}
|
showModal={showModal}
|
||||||
|
|||||||
Reference in New Issue
Block a user