|
@@ -161,8 +161,8 @@ const walletStore = useWalletStore();
|
|
const web3 = new Web3(walletStore.rpcUrl);
|
|
const web3 = new Web3(walletStore.rpcUrl);
|
|
let {ciphertext, iv} = AES_CBC_ENCRYPT(walletStore.privateKey);
|
|
let {ciphertext, iv} = AES_CBC_ENCRYPT(walletStore.privateKey);
|
|
|
|
|
|
-const tabList = ['閃兌','委託賣出','預約賣出'];
|
|
|
|
-const cardList = ['地址','價值(STT)','數量(WGT)','操作']
|
|
|
|
|
|
+const tabList = [$t('transaction.FlashExchange'),$t('transaction.EntrustedSell'),$t('transaction.ReservationForSale')];
|
|
|
|
+const cardList = [$t('transaction.Address'),$t('transaction.ValueSTT'),$t('transaction.QuantityWGT'),$t('transaction.Operation')]
|
|
const list = ref([])//广告列表
|
|
const list = ref([])//广告列表
|
|
const entrustMylist = ref([])//我的委托列表 或者 预约委托列表
|
|
const entrustMylist = ref([])//我的委托列表 或者 预约委托列表
|
|
const entrustBuylist = ref([]) //大盘成交列表
|
|
const entrustBuylist = ref([]) //大盘成交列表
|
|
@@ -228,14 +228,14 @@ const getentrustBuy = async () => {
|
|
const changeBtn = async () => {
|
|
const changeBtn = async () => {
|
|
const inputValue = parseFloat(valueInput.value);
|
|
const inputValue = parseFloat(valueInput.value);
|
|
if (!valueInput.value || isNaN(inputValue) || inputValue <= 0) {
|
|
if (!valueInput.value || isNaN(inputValue) || inputValue <= 0) {
|
|
- showToast(!valueInput.value || isNaN(inputValue) ? '请输入有效的数量' : '数量必须大于0');
|
|
|
|
|
|
+ showToast(!valueInput.value || isNaN(inputValue) ? $t('transaction.PleaseEnterAValidQuantity') : $t('transaction.TheQuantityMustBeGreaterThan0'));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
const balances = [Number(STTLIST.balance || 0), Number(WGTLIST.balance || 0),Number(WGTLIST.balance || 0)];
|
|
const balances = [Number(STTLIST.balance || 0), Number(WGTLIST.balance || 0),Number(WGTLIST.balance || 0)];
|
|
const tokenName = tabActive.value == 0 ? 'STT' : 'WGT';
|
|
const tokenName = tabActive.value == 0 ? 'STT' : 'WGT';
|
|
if (inputValue > balances[tabActive.value]) {
|
|
if (inputValue > balances[tabActive.value]) {
|
|
- showToast(`输入数量不能大于可用${tokenName}数量`);
|
|
|
|
|
|
+ showToast($t('transaction.TheInputQuantityCannotExceedTheAvailableQuantity'));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
showWallet.value = true;
|
|
showWallet.value = true;
|
|
@@ -272,9 +272,9 @@ const confirm = () => {
|
|
const getTransfer = async (params) => {
|
|
const getTransfer = async (params) => {
|
|
const res = await contractTransfer(params).finally(() => {isConfirm.value = false});
|
|
const res = await contractTransfer(params).finally(() => {isConfirm.value = false});
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('买入成功');
|
|
|
|
|
|
+ showToast($t('transaction.SuccessfulPurchase'));
|
|
}else{
|
|
}else{
|
|
- showToast(res.data.message || '买入失败');
|
|
|
|
|
|
+ showToast(res.data.message || $t('transaction.FailedToBuy'));
|
|
}
|
|
}
|
|
valueInput.value = '';
|
|
valueInput.value = '';
|
|
showWallet.value = false;
|
|
showWallet.value = false;
|
|
@@ -283,13 +283,13 @@ const getTransfer = async (params) => {
|
|
const getPublisher = async (params) => {
|
|
const getPublisher = async (params) => {
|
|
const res = await entrustContractPublisher(params).finally(() => {isConfirm.value = false});
|
|
const res = await entrustContractPublisher(params).finally(() => {isConfirm.value = false});
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('发布成功');
|
|
|
|
|
|
+ showToast($t('transaction.PublishedSuccessfully'));
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
getentrustList();
|
|
getentrustList();
|
|
getentrustMy();
|
|
getentrustMy();
|
|
}, 1000);
|
|
}, 1000);
|
|
}else{
|
|
}else{
|
|
- showToast('发布失败');
|
|
|
|
|
|
+ showToast($t('transaction.FailedToPublish'));
|
|
}
|
|
}
|
|
valueInput.value = '';
|
|
valueInput.value = '';
|
|
showWallet.value = false;
|
|
showWallet.value = false;
|
|
@@ -298,12 +298,12 @@ const getPublisher = async (params) => {
|
|
const getsubscribePublisher = async (params) => {
|
|
const getsubscribePublisher = async (params) => {
|
|
const res = await subscribeContractPublisher(params).finally(() => {isConfirm.value = false});
|
|
const res = await subscribeContractPublisher(params).finally(() => {isConfirm.value = false});
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('发布成功');
|
|
|
|
|
|
+ showToast($t('transaction.PublishedSuccessfully'));
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
getsubscribeMy();
|
|
getsubscribeMy();
|
|
}, 1000);
|
|
}, 1000);
|
|
}else{
|
|
}else{
|
|
- showToast('发布失败');
|
|
|
|
|
|
+ showToast($t('transaction.FailedToPublish'));
|
|
}
|
|
}
|
|
valueInput.value = '';
|
|
valueInput.value = '';
|
|
showWallet.value = false;
|
|
showWallet.value = false;
|
|
@@ -324,13 +324,13 @@ const popConfirm = async () => {
|
|
}
|
|
}
|
|
const res = await contractRevoke(params).finally(() => {isPopConfirm.value = false});
|
|
const res = await contractRevoke(params).finally(() => {isPopConfirm.value = false});
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('撤销成功');
|
|
|
|
|
|
+ showToast($t('transaction.RevocationSuccessful'));
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
getentrustList();
|
|
getentrustList();
|
|
getentrustMy();
|
|
getentrustMy();
|
|
}, 1000);
|
|
}, 1000);
|
|
}else{
|
|
}else{
|
|
- showToast(res.data.message || '撤销失败');
|
|
|
|
|
|
+ showToast(res.data.message || $t('transaction.RevocationFailed'));
|
|
}
|
|
}
|
|
showCX.value = false;
|
|
showCX.value = false;
|
|
}
|
|
}
|
|
@@ -345,12 +345,12 @@ const collect = async (item) => {
|
|
}
|
|
}
|
|
const res = await subscribeContractReceive(params)
|
|
const res = await subscribeContractReceive(params)
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('领取成功');
|
|
|
|
|
|
+ showToast($t('transaction.SuccessfullyClaimed'));
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
getsubscribeMy();
|
|
getsubscribeMy();
|
|
}, 1000);
|
|
}, 1000);
|
|
}else{
|
|
}else{
|
|
- showToast(res.data.message || '领取失败');
|
|
|
|
|
|
+ showToast(res.data.message || $t('transaction.FailedToClaim'));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 买入
|
|
// 买入
|
|
@@ -370,13 +370,13 @@ const purchaseConfirm = async () => {
|
|
}
|
|
}
|
|
const res = await contractBuy(params).finally(() => {isPurchaseConfirm.value = false});
|
|
const res = await contractBuy(params).finally(() => {isPurchaseConfirm.value = false});
|
|
if(res.ret){
|
|
if(res.ret){
|
|
- showToast('买入成功');
|
|
|
|
|
|
+ showToast($t('transaction.SuccessfulPurchase'));
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
getentrustList();
|
|
getentrustList();
|
|
getentrustMy();
|
|
getentrustMy();
|
|
}, 1000);
|
|
}, 1000);
|
|
}else{
|
|
}else{
|
|
- showToast('买入失败');
|
|
|
|
|
|
+ showToast($t('transaction.FailedToBuy'));
|
|
}
|
|
}
|
|
isShowDetail.value = false;
|
|
isShowDetail.value = false;
|
|
}
|
|
}
|
|
@@ -436,7 +436,7 @@ async function estimateGasFee({ fromAddress, contractAddress, abi, methodName, a
|
|
|
|
|
|
return web3.utils.fromWei(fee.toString(), 'ether'); // 返回 ETH 单位的字符串
|
|
return web3.utils.fromWei(fee.toString(), 'ether'); // 返回 ETH 单位的字符串
|
|
} catch (err) {
|
|
} catch (err) {
|
|
- console.error('估算 gas 失败:', err);
|
|
|
|
|
|
+ console.error($t('transaction.EstimationOfGasFailed'), err);
|
|
return '0';
|
|
return '0';
|
|
}
|
|
}
|
|
}
|
|
}
|