wallet flow; new faucet; placing chart orders works!
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<phone-card v-if="s.mockenv && s.vault" class="maxw">
|
||||
<!-- <div>-->
|
||||
<!--
|
||||
<v-card-title><v-icon icon="mdi-faucet"/> Testnet Faucet</v-card-title>
|
||||
<v-card-text>The Dexorder testnet faucet will send 1 TETH (Testnet ETH) to your account, plus 10 MEH (Mock Ethernet Hardfork) and 10,000 USXD (Joke Currency XD) to your vault.</v-card-text>
|
||||
<v-card-text>Click below to get free test tokens: </v-card-text>
|
||||
<v-card-item>
|
||||
-->
|
||||
<!--
|
||||
<v-table plain>
|
||||
<tbody>
|
||||
@@ -14,9 +16,9 @@
|
||||
</tbody>
|
||||
</v-table>
|
||||
-->
|
||||
<btn icon='mdi-plus' color="green" :disabled="disabled" @click="gib">GIB!</btn>
|
||||
</v-card-item>
|
||||
</phone-card>
|
||||
<btn icon='mdi-plus' color="green" :disabled="disabled" @click="gib" :text="text"/>
|
||||
<!-- </v-card-item>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -28,7 +30,11 @@ import {pendTransaction} from "@/blockchain/wallet.js";
|
||||
import {mockErc20Abi} from "@/blockchain/abi.js";
|
||||
import Btn from "@/components/Btn.vue";
|
||||
import {socket} from "@/socket.js";
|
||||
import {metadata} from "@/version.js";
|
||||
|
||||
const props = defineProps({
|
||||
text: {default:'GIB!'},
|
||||
})
|
||||
const s = useStore()
|
||||
|
||||
/*
|
||||
@@ -45,12 +51,37 @@ function gib(token) {
|
||||
|
||||
const disabled = ref(false)
|
||||
|
||||
const FAUCET_CONFIG = {
|
||||
'': 1, // native coin
|
||||
MEH: 1,
|
||||
USXD: 1000,
|
||||
WETH: 1,
|
||||
ARB: 1000,
|
||||
USDC: 1000,
|
||||
}
|
||||
|
||||
function gib() {
|
||||
const s = useStore()
|
||||
if( s.account ) {
|
||||
disabled.value = true
|
||||
socket.emit('faucet', s.chainId.value, s.account)
|
||||
setTimeout(()=>disabled.value=false, 60*1000)
|
||||
const chainId = s.chainId
|
||||
const tokenAmounts = {}
|
||||
const tmd = metadata[chainId].t // token metadata
|
||||
for (const [symbol, amount] of Object.entries(FAUCET_CONFIG)) {
|
||||
for (const t of tmd) {
|
||||
if (t.s===symbol) {
|
||||
if (t.x?.mock===true) {
|
||||
tokenAmounts[t.a] = BigInt(Math.trunc(10 ** t.d * amount))
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('gib', s.chainId, s.account, s.vault, tokenAmounts )
|
||||
if (Object.keys(tokenAmounts).length>0) {
|
||||
disabled.value = true
|
||||
socket.emit('gib', s.chainId, s.account, s.vault, tokenAmounts )
|
||||
setTimeout(()=>disabled.value=false, 1*1000) // todo disable longer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user