新增钱包地址模块微调
This commit is contained in:
parent
8fa974f0b5
commit
5e3bfec173
|
|
@ -1,8 +1,8 @@
|
|||
import React, { useRef, useState } from 'react';
|
||||
import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||
import { Modal, Spin, message } from 'antd';
|
||||
import { initWeb3, walletSign } from '../../../../utils/web3';
|
||||
import DetailPageContainer from '@/components/DetailPageContainer';
|
||||
import md5 from 'js-md5';
|
||||
import {
|
||||
Form,
|
||||
FormItem,
|
||||
|
|
@ -31,23 +31,6 @@ const Address: React.FC = () => {
|
|||
const [visible, setVisible] = useState(false);
|
||||
const form = createForm({});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const state = {
|
||||
formRef: null,
|
||||
confirmKey: '',
|
||||
tokenList: [],
|
||||
token: '',
|
||||
form: {
|
||||
coin_type: 'tron',
|
||||
alias: '',
|
||||
key: '',
|
||||
num: 1,
|
||||
},
|
||||
queryForm: {
|
||||
page: 1,
|
||||
size: 20,
|
||||
coinType: 'tron',
|
||||
},
|
||||
};
|
||||
const SchemaField = createSchemaField({
|
||||
components: {
|
||||
FormItem,
|
||||
|
|
@ -67,19 +50,15 @@ const Address: React.FC = () => {
|
|||
const handleSubmit = async (val) => {
|
||||
const params = { ...val };
|
||||
setLoading(true);
|
||||
params.cointype = 'tron';
|
||||
params.key = md5(params.key);
|
||||
const res = await creatTronAddress(params);
|
||||
// if(res.code == 200){
|
||||
|
||||
// }
|
||||
await initWeb3();
|
||||
const signInfo = await walletSign();
|
||||
params.key = signInfo.raw;
|
||||
params.sign = signInfo.sign;
|
||||
params.coinType = 'tron';
|
||||
await creatTronAddress(params);
|
||||
tableRef.current?.reload();
|
||||
message.success('操作成功');
|
||||
setLoading(false);
|
||||
// history.back();
|
||||
// } catch (e) {
|
||||
// setLoading(false);
|
||||
// }
|
||||
};
|
||||
// const save = async () => {
|
||||
// const res = await makeTronAddress(state.form);
|
||||
|
|
@ -152,14 +131,6 @@ const Address: React.FC = () => {
|
|||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
/>
|
||||
<SchemaField.String
|
||||
name="key"
|
||||
title="密码"
|
||||
required
|
||||
x-component-props={{ maxLength: 100, showCount: true }}
|
||||
x-decorator="FormItem"
|
||||
x-component="Input.TextArea"
|
||||
/>
|
||||
<SchemaField.Number
|
||||
name="num"
|
||||
title="数量"
|
||||
|
|
|
|||
|
|
@ -1,81 +1,71 @@
|
|||
import React, { useRef } from 'react';
|
||||
import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||
import { Button } from 'antd';
|
||||
import { Link } from 'umi';
|
||||
import RoutePath from '@/routes/routePath';
|
||||
import { fetchTronTableData } from '@/utils/table';
|
||||
import { getTronRecord } from '@/services/address';
|
||||
import { PlusCircleOutlined } from '@ant-design/icons';
|
||||
const Address: React.FC = () => {
|
||||
const tableRef = useRef<ActionType>();
|
||||
const addAddress = () => {};
|
||||
const columns: ProColumns<any>[] = [
|
||||
{
|
||||
title: '交易哈希',
|
||||
dataIndex: 'tx',
|
||||
width: '10%',
|
||||
dataIndex: 'txHash',
|
||||
// width: '10%',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '金额',
|
||||
dataIndex: 'amount',
|
||||
hideInSearch: true,
|
||||
width: '20%',
|
||||
// width: '20%',
|
||||
},
|
||||
|
||||
{
|
||||
title: '链名称',
|
||||
dataIndex: 'chain',
|
||||
ellipsis: true,
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '转换后的数量',
|
||||
dataIndex: 'symbol',
|
||||
width: 150,
|
||||
dataIndex: 'blockNumber',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '位数',
|
||||
dataIndex: 'rpcUrl',
|
||||
width: 150,
|
||||
dataIndex: 'decimals',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '发送地址',
|
||||
dataIndex: 'decimals',
|
||||
width: 150,
|
||||
dataIndex: 'from',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '通知地址',
|
||||
dataIndex: 'browser',
|
||||
width: 150,
|
||||
dataIndex: 'to',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '时间',
|
||||
dataIndex: 'timesTamp',
|
||||
width: 150,
|
||||
dataIndex: 'timeStamp',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '合约地址',
|
||||
dataIndex: 'toAddress',
|
||||
width: 150,
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: 'Token名称',
|
||||
dataIndex: 'contract',
|
||||
width: 150,
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'contract',
|
||||
width: 150,
|
||||
hideInSearch: true,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<Button type="primary" icon={<PlusCircleOutlined />} onClick={addAddress}>
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
// indexColumn
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useRef, useState } from 'react';
|
||||
import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||
import { Button, Modal, Spin, message } from 'antd';
|
||||
import { PlusCircleOutlined } from '@ant-design/icons';
|
||||
import { Modal, Spin, message } from 'antd';
|
||||
import { createSchemaField } from '@formily/react';
|
||||
import { createForm } from '@formily/core';
|
||||
import DetailPageContainer from '@/components/DetailPageContainer';
|
||||
|
|
@ -22,10 +21,8 @@ import {
|
|||
NumberPicker,
|
||||
} from '@formily/antd';
|
||||
|
||||
// import { useIntl, history, FormattedMessage, useModel } from 'umi';
|
||||
const Address: React.FC = () => {
|
||||
const tableRef = useRef<ActionType>();
|
||||
const addAddress = () => {};
|
||||
const form = createForm({});
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
|
@ -42,13 +39,13 @@ const Address: React.FC = () => {
|
|||
Editable,
|
||||
},
|
||||
});
|
||||
const state = {
|
||||
queryForm: {
|
||||
page: 1,
|
||||
size: 20,
|
||||
coin_type: 'tron',
|
||||
},
|
||||
};
|
||||
// const state = {
|
||||
// queryForm: {
|
||||
// page: 1,
|
||||
// size: 20,
|
||||
// coin_type: 'tron',
|
||||
// },
|
||||
// };
|
||||
const columns: ProColumns<any>[] = [
|
||||
{
|
||||
title: '网络名称',
|
||||
|
|
@ -66,31 +63,36 @@ const Address: React.FC = () => {
|
|||
{
|
||||
title: 'API Key',
|
||||
dataIndex: 'apiKey',
|
||||
ellipsis: true,
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '代币符号',
|
||||
dataIndex: 'symbol',
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: 'RPC URL',
|
||||
dataIndex: 'rpcUrl',
|
||||
width: 150,
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '精度',
|
||||
dataIndex: 'decimals',
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '区块浏览器',
|
||||
dataIndex: 'browser',
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '代币合约地址',
|
||||
dataIndex: 'contract',
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
},
|
||||
];
|
||||
|
|
@ -112,11 +114,6 @@ const Address: React.FC = () => {
|
|||
};
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<Button type="primary" icon={<PlusCircleOutlined />} onClick={addAddress}>
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
// indexColumn
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ export const fetchTronTableData = async (
|
|||
params.page = params.page;
|
||||
params.size = params.size;
|
||||
params.coinType = 'tron';
|
||||
// delete params.current;
|
||||
// delete params.pageSize;
|
||||
const res = (await fetch(params)) || {};
|
||||
const data = res;
|
||||
|
||||
data.forEach((n: any) => {
|
||||
// n.balance = getTronBalance(n.address);
|
||||
console.log(n.address);
|
||||
});
|
||||
data?.forEach((n: any) => {
|
||||
for (const key in formatObj) {
|
||||
n[key] = n[formatObj[key]];
|
||||
n.balance = getTronBalance(n.address);
|
||||
console.log(n.balance);
|
||||
}
|
||||
});
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue