|
|
@@ -48,6 +48,15 @@
|
|
|
USDC
|
|
|
<ElButton class="ml-2" type="primary" @click="swapExactOut" :loading="swaping"> SWAP </ElButton>
|
|
|
</div>
|
|
|
+ <div class="flex items-center mt-4">
|
|
|
+ <ElInput class="!w-20 mr-2" v-model="exactInAmount" />
|
|
|
+ USDC
|
|
|
+ <ElIcon class="ml-2 mr-2">
|
|
|
+ <ArrowNarrowRight />
|
|
|
+ </ElIcon>
|
|
|
+ ETH
|
|
|
+ <ElButton class="ml-2" type="primary" @click="swapExactIn" :loading="swaping"> SWAP </ElButton>
|
|
|
+ </div>
|
|
|
<div class="flex items-center mt-4">
|
|
|
<ElButton type="primary" @click="mint" :loading="minting">mint</ElButton>
|
|
|
</div>
|
|
|
@@ -72,6 +81,9 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</ElTableColumn>
|
|
|
+ <ElTableColumn prop="ethBalance" label="ETH余额" min-width="160" />
|
|
|
+ <ElTableColumn prop="zkBalance" label="ETH余额(ZK)" min-width="160"/>
|
|
|
+ <ElTableColumn prop="zkUsdcBalance" label="USDC余额(ZK)" min-width="160"/>
|
|
|
<ElTableColumn width="80" fixed="right">
|
|
|
<template #default="{ row }">
|
|
|
<ElButton type="danger" size="small" @click="deleteAccount(row)">删除</ElButton>
|
|
|
@@ -352,6 +364,32 @@ function swapExactOut() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const exactInAmount = ref('')
|
|
|
+function swapExactIn() {
|
|
|
+ if (table.value.getSelectionRows().length === 0) {
|
|
|
+ ElMessage.error('请选择账号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!exactInAmount.value) {
|
|
|
+ ElMessage.error('请输入金额')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ swaping.value = true
|
|
|
+ http.post('/web3/swap-exact-in', {
|
|
|
+ accountId: table.value.getSelectionRows()[0].id,
|
|
|
+ amount: exactInAmount.value,
|
|
|
+ network: network.value
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success('成功')
|
|
|
+ swaping.value = false
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ swaping.value = false
|
|
|
+ ElMessage.error(e.message)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
const minting = ref(false)
|
|
|
async function mint() {
|
|
|
if (table.value.getSelectionRows().length === 0) {
|