From 5e3bfec173d354e0391ee69a6d88a4b41d30746e Mon Sep 17 00:00:00 2001 From: vancekk Date: Mon, 20 Jun 2022 17:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=92=B1=E5=8C=85=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=A8=A1=E5=9D=97=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Tron/Address/List/index.tsx | 43 +++++--------------------- src/pages/Tron/Record/List/index.tsx | 44 +++++++++++---------------- src/pages/Tron/Token/List/index.tsx | 31 +++++++++---------- src/utils/table.ts | 8 ++--- 4 files changed, 42 insertions(+), 84 deletions(-) diff --git a/src/pages/Tron/Address/List/index.tsx b/src/pages/Tron/Address/List/index.tsx index d92e3fc..334ed1e 100644 --- a/src/pages/Tron/Address/List/index.tsx +++ b/src/pages/Tron/Address/List/index.tsx @@ -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" /> - { const tableRef = useRef(); - const addAddress = () => {}; const columns: ProColumns[] = [ { 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 (
-
- -
{ const tableRef = useRef(); - 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[] = [ { 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 (
-
- -
{ + // 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 {