forked from telosnetwork/app-telos-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request telosnetwork#330 from telosnetwork/develop
feat: testnet faucet for evm only
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script> | ||
export default { | ||
name: 'LogoLayout', | ||
}; | ||
</script> | ||
|
||
<template> | ||
<q-layout view="hHh lpR fFf"> | ||
<q-header class="bg-white"> | ||
<q-toolbar> | ||
<q-toolbar-title class="flex items-center"> | ||
<a href="https://telos.net"> | ||
<img class="toolbar-img" src="branding/telos-logo-dark.png" /> | ||
</a> | ||
</q-toolbar-title> | ||
</q-toolbar> | ||
</q-header> | ||
|
||
<q-page-container> | ||
<router-view /> | ||
</q-page-container> | ||
</q-layout> | ||
</template> | ||
|
||
<style> | ||
.toolbar-img { | ||
max-height: 30px; | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script> | ||
import { mapActions } from 'vuex'; | ||
import { Notify } from 'quasar'; | ||
export default { | ||
name: 'TestnetEvmFaucet', | ||
data() { | ||
return { | ||
form: { | ||
send_to: null, | ||
account_name: null, | ||
owner_key: null, | ||
active_key: null, | ||
}, | ||
transactionId: null, | ||
submitting: false, | ||
}; | ||
}, | ||
methods: { | ||
...mapActions('testnet', ['evmFaucet']), | ||
async onEvmFaucet() { | ||
this.submitting = true; | ||
const result = await this.evmFaucet(this.form.send_to_evm); | ||
if (result) { | ||
Notify.create({ | ||
message: result instanceof Object ? 'Success!' : result, | ||
position: 'top', | ||
color: 'primary', | ||
textColor: 'white', | ||
actions: [{ label: 'Dismiss', color: 'white' }], | ||
}); | ||
this.transactionId = result.transactionId; | ||
} | ||
this.submitting = false; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<template lang="pug"> | ||
q-page.flex.flex-center | ||
q-card | ||
q-card-section | ||
div.center.text-h4 Testnet faucet | ||
q-card-section | ||
q-input.q-mb-lg( | ||
ref="send_to_evm" | ||
v-model="form.send_to_evm" | ||
color="accent" | ||
label="Send to EVM address" | ||
:rules="[ val => /^0x[a-fA-F0-9]{40}$/.test(val) || 'Please provide a valid EVM address with 0x prefix']" | ||
outlined | ||
) | ||
q-btn.full-width( | ||
color="primary" | ||
label="Send testnet EVM TLOS" | ||
size="lg" | ||
unelevated | ||
:loading="submitting" | ||
@click="onEvmFaucet" | ||
) | ||
q-card-section(v-if="transactionId") | ||
a( | ||
:href="`https://telos-test.bloks.io/transaction/${transactionId}`" | ||
target="_blank" | ||
) Trx explorer | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters