Add test wallets

This commit is contained in:
2024-06-02 15:56:52 +07:00
parent 45c71b3ddf
commit 897ff94a66
4 changed files with 25 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ public class UserService : IUserService
private readonly IUserRepository _userRepository;
private readonly IAccountService _accountService;
private string[] authorizedAddresses = new string[] { "0x6781920674dA695aa5120d95D80c4B1788046806" };
private string[] authorizedAddresses = ["0x6781920674dA695aa5120d95D80c4B1788046806", "0xA2B43AFF0992a47838DF2e6099A8439981f0B717"];
public UserService(
IEvmManager evmManager,

View File

@@ -8,21 +8,24 @@ import { UserClient } from '../../../generated/ManagingApi'
import type { ILoginFormInput } from '../../../global/type'
import useCookie from '../../../hooks/useCookie'
import { SecondaryNavbar } from '../NavBar/NavBar'
import Toast from '../Toast/Toast'
const LogIn = () => {
const { apiUrl } = useApiUrlStore()
const { register, handleSubmit } = useForm<ILoginFormInput>()
const { disconnect } = useDisconnect()
const { address } = useAccount()
const { isLoading, signMessageAsync } = useSignMessage({})
const { signMessageAsync } = useSignMessage({})
const { setCookie } = useCookie()
const onSubmit: SubmitHandler<ILoginFormInput> = async (form) => {
const message = 'wagmi'
const signature = await signMessageAsync({ message })
const t = new Toast('Creating token')
if (signature && address) {
const userClient = new UserClient({}, apiUrl)
await userClient
.user_CreateToken({
address: address.toString(),
@@ -34,11 +37,11 @@ const LogIn = () => {
setCookie('token', data, 1)
location.reload()
})
.catch((err) => {
// eslint-disable-next-line no-console
console.error(err)
.catch((err: any) => {
t.update('error', 'Error :' + err.message)
})
} else {
}else{
t.update('error', 'Error : No signature')
}
}
@@ -77,7 +80,6 @@ const LogIn = () => {
</div>
<button
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"
>
Sign and login

View File

@@ -15,9 +15,13 @@ const baseOptions: UpdateOptions = {
class Toast {
private id: Id
constructor(content: string) {
constructor(content: string, isLoading = true) {
if (!isLoading) {
this.id = toast(content)
}else{
this.id = toast.loading(content)
}
}
update(type: TypeOptions, content: string, opts?: any) {
const options = { ...baseOptions, ...opts }

View File

@@ -1,6 +1,6 @@
import { ColorSwatchIcon, TrashIcon, XIcon } from '@heroicons/react/solid'
import { useQuery } from '@tanstack/react-query'
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
import 'react-toastify/dist/ReactToastify.css'
import useApiUrlStore from '../../app/store/apiStore'
@@ -17,14 +17,17 @@ const BacktestScanner: React.FC = () => {
const { apiUrl } = useApiUrlStore()
const client = new BacktestClient({}, apiUrl)
const { isLoading, refetch } = useQuery({
onSuccess: (data) => {
setBacktest(data)
},
const { isLoading, refetch, data: backtests } = useQuery({
queryFn: () => client.backtest_Backtests(),
queryKey: ['backtests'],
})
useEffect(() => {
if (backtests) {
setBacktest(backtests)
}
}, [backtests])
function deleteAllBacktests() {
const t = new Toast('Deleting all backtests')
client
@@ -114,7 +117,7 @@ const BacktestScanner: React.FC = () => {
</button>
</div>
<BacktestTable list={backtestingResult} isFetching={isLoading} />
<BacktestTable list={backtestingResult} isFetching={isLoading} setBacktests={setBacktest} />
<BacktestModal
showModal={showModal}