Skip to content

Commit

Permalink
Update Staking UI (hacky)
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou authored and mraveux committed Nov 26, 2024
1 parent 6344ff4 commit b2660d2
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 118 deletions.
20 changes: 20 additions & 0 deletions src/components/staking/StakingGraphPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ export default defineComponent({
);
const txs = await sendStaking({
transaction: transaction.serialize(),
recipientLabel: 'name' in activeValidator.value! ? activeValidator.value.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorImageUrl: 'logo' in activeValidator.value!
&& !activeValidator.value.hasDefaultLogo
? activeValidator.value.logo
: undefined,
}).catch((error) => {
throw new Error(error.data);
});
Expand Down Expand Up @@ -188,6 +194,13 @@ export default defineComponent({
);
const txs = await sendStaking({
transaction: transaction.serialize(),
recipientLabel: 'name' in activeValidator.value! ? activeValidator.value.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorAddress: activeValidator.value!.address,
validatorImageUrl: ('logo' in activeValidator.value!
&& !activeValidator.value.hasDefaultLogo)
? activeValidator.value.logo
: undefined,
}).catch((error) => {
throw new Error(error.data);
});
Expand Down Expand Up @@ -230,6 +243,13 @@ export default defineComponent({
);
const txs = await sendStaking({
transaction: transaction.serialize(),
recipientLabel: 'name' in activeValidator.value! ? activeValidator.value.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorAddress: activeValidator.value!.address,
validatorImageUrl: 'logo' in activeValidator.value! && !activeValidator.value.hasDefaultLogo
? activeValidator.value.logo
: undefined,
amount: Math.abs(stakeDelta.value),
}).catch((error) => {
throw new Error(error.data);
});
Expand Down
14 changes: 14 additions & 0 deletions src/components/staking/StakingInfoPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
>
<a href="#" slot="unstakeLink" @click="deactivateAll">{{ $t('un-stake all') }}</a>
</i18n>
<div v-else class="switch-validator"></div>

<!-- <button class="nq-button-s rewards-history" @click="$emit('next')">
{{ $t('Rewards history') }} &gt;
Expand Down Expand Up @@ -280,6 +281,13 @@ export default defineComponent({
const txs = await sendStaking({
transaction: transaction.serialize(),
recipientLabel: 'name' in validator.value! ? validator.value.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorAddress: validator.value!.address,
validatorImageUrl: 'logo' in validator.value! && !validator.value.hasDefaultLogo
? validator.value.logo
: undefined,
amount: Math.abs(stake.value.activeBalance),
});
if (!txs) {
Expand Down Expand Up @@ -359,6 +367,12 @@ export default defineComponent({
const txs = await sendStaking({
transaction: transactions.map((tx) => tx.serialize()),
recipientLabel: 'name' in validator.value! ? validator.value.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorAddress: validator.value!.address,
validatorImageUrl: 'logo' in validator.value! && !validator.value.hasDefaultLogo
? validator.value.logo
: undefined,
});
if (!txs) {
Expand Down
14 changes: 13 additions & 1 deletion src/components/staking/ValidatorDetailsOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default defineComponent({
},
setup(props, context) {
const { activeAddress } = useAddressStore();
const { activeStake, setStake } = useStakingStore();
const { activeStake, setStake, activeValidator } = useStakingStore();
async function selectValidator() {
const validatorLabelOrAddress = 'name' in props.validator
Expand Down Expand Up @@ -127,6 +127,18 @@ export default defineComponent({
const txs = await sendStaking({
transaction: transaction.serialize(),
senderLabel: 'name' in activeValidator.value! ? activeValidator.value.name : 'Validator',
recipientLabel: 'name' in props.validator ? props.validator.name : 'Validator',
// @ts-expect-error Not typed yet in Hub
validatorAddress: props.validator.address,
validatorImageUrl: 'logo' in props.validator && !props.validator.hasDefaultLogo
? props.validator.logo
: undefined,
fromValidatorAddress: activeValidator.value!.address,
fromValidatorImageUrl: 'logo' in activeValidator.value! && !activeValidator.value.hasDefaultLogo
? activeValidator.value.logo
: undefined,
amount: activeStake.value.inactiveBalance,
}).catch((error) => {
throw new Error(error.data);
});
Expand Down
26 changes: 13 additions & 13 deletions src/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ msgstr "Krypto-Swaps werden derzeit gewartet."
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:264
#: src/components/staking/StakingInfoPage.vue:265
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2429,7 +2429,7 @@ msgid "Send, receive and hold BTC in your wallet."
msgstr "Sende, empfange und verwahre BTC in deiner Wallet."

#: src/components/staking/StakingGraphPage.vue:139
#: src/components/staking/StakingGraphPage.vue:221
#: src/components/staking/StakingGraphPage.vue:234
msgid "Sending Staking Transaction"
msgstr ""

Expand All @@ -2439,7 +2439,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr "Transaktion wird versendet"

#: src/components/staking/StakingInfoPage.vue:327
#: src/components/staking/StakingInfoPage.vue:335
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2583,10 +2583,10 @@ msgstr "Überspringen"
#: src/components/modals/SendModal.vue:636
#: src/components/modals/SendModal.vue:821
#: src/components/modals/StablecoinSendModal.vue:677
#: src/components/staking/StakingGraphPage.vue:275
#: src/components/staking/StakingInfoPage.vue:314
#: src/components/staking/StakingInfoPage.vue:391
#: src/components/staking/ValidatorDetailsOverlay.vue:163
#: src/components/staking/StakingGraphPage.vue:295
#: src/components/staking/StakingInfoPage.vue:322
#: src/components/staking/StakingInfoPage.vue:405
#: src/components/staking/ValidatorDetailsOverlay.vue:175
msgid "Something went wrong"
msgstr "Etwas ging schief"

Expand Down Expand Up @@ -2656,27 +2656,27 @@ msgstr ""
msgid "Store of value, got it"
msgstr "Wertaufbewahrung, verstanden"

#: src/components/staking/StakingGraphPage.vue:208
#: src/components/staking/StakingGraphPage.vue:221
msgid "Successfully added {amount} NIM to your stake with {validator}"
msgstr ""

#: src/components/staking/ValidatorDetailsOverlay.vue:147
#: src/components/staking/ValidatorDetailsOverlay.vue:159
msgid "Successfully changed validator to {validator}"
msgstr "Validator erfolgreich geändert zu {validator}"

#: src/components/staking/StakingInfoPage.vue:298
#: src/components/staking/StakingInfoPage.vue:306
msgid "Successfully deactivated {amount} NIM"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:250
#: src/components/staking/StakingGraphPage.vue:270
msgid "Successfully deactivated {amount} NIM from your stake with {validator}"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:171
#: src/components/staking/StakingGraphPage.vue:177
msgid "Successfully staked {amount} NIM with {validator}"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:377
#: src/components/staking/StakingInfoPage.vue:391
msgid "Successfully unstaked {amount} NIM"
msgstr ""

Expand Down
26 changes: 13 additions & 13 deletions src/i18n/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ msgstr ""
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:264
#: src/components/staking/StakingInfoPage.vue:265
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2222,7 +2222,7 @@ msgid "Send, receive and hold BTC in your wallet."
msgstr ""

#: src/components/staking/StakingGraphPage.vue:139
#: src/components/staking/StakingGraphPage.vue:221
#: src/components/staking/StakingGraphPage.vue:234
msgid "Sending Staking Transaction"
msgstr ""

Expand All @@ -2232,7 +2232,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:327
#: src/components/staking/StakingInfoPage.vue:335
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2375,10 +2375,10 @@ msgstr ""
#: src/components/modals/SendModal.vue:636
#: src/components/modals/SendModal.vue:821
#: src/components/modals/StablecoinSendModal.vue:677
#: src/components/staking/StakingGraphPage.vue:275
#: src/components/staking/StakingInfoPage.vue:314
#: src/components/staking/StakingInfoPage.vue:391
#: src/components/staking/ValidatorDetailsOverlay.vue:163
#: src/components/staking/StakingGraphPage.vue:295
#: src/components/staking/StakingInfoPage.vue:322
#: src/components/staking/StakingInfoPage.vue:405
#: src/components/staking/ValidatorDetailsOverlay.vue:175
msgid "Something went wrong"
msgstr ""

Expand Down Expand Up @@ -2448,27 +2448,27 @@ msgstr ""
msgid "Store of value, got it"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:208
#: src/components/staking/StakingGraphPage.vue:221
msgid "Successfully added {amount} NIM to your stake with {validator}"
msgstr ""

#: src/components/staking/ValidatorDetailsOverlay.vue:147
#: src/components/staking/ValidatorDetailsOverlay.vue:159
msgid "Successfully changed validator to {validator}"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:298
#: src/components/staking/StakingInfoPage.vue:306
msgid "Successfully deactivated {amount} NIM"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:250
#: src/components/staking/StakingGraphPage.vue:270
msgid "Successfully deactivated {amount} NIM from your stake with {validator}"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:171
#: src/components/staking/StakingGraphPage.vue:177
msgid "Successfully staked {amount} NIM with {validator}"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:377
#: src/components/staking/StakingInfoPage.vue:391
msgid "Successfully unstaked {amount} NIM"
msgstr ""

Expand Down
26 changes: 13 additions & 13 deletions src/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ msgstr "Intercambios de cripto estan actualmente en mantenimiento."
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:264
#: src/components/staking/StakingInfoPage.vue:265
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2421,7 +2421,7 @@ msgid "Send, receive and hold BTC in your wallet."
msgstr "Envíe, reciba y almacene BTC en su billetera."

#: src/components/staking/StakingGraphPage.vue:139
#: src/components/staking/StakingGraphPage.vue:221
#: src/components/staking/StakingGraphPage.vue:234
msgid "Sending Staking Transaction"
msgstr ""

Expand All @@ -2431,7 +2431,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr "Enviando Transacción"

#: src/components/staking/StakingInfoPage.vue:327
#: src/components/staking/StakingInfoPage.vue:335
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2575,10 +2575,10 @@ msgstr "Omitir"
#: src/components/modals/SendModal.vue:636
#: src/components/modals/SendModal.vue:821
#: src/components/modals/StablecoinSendModal.vue:677
#: src/components/staking/StakingGraphPage.vue:275
#: src/components/staking/StakingInfoPage.vue:314
#: src/components/staking/StakingInfoPage.vue:391
#: src/components/staking/ValidatorDetailsOverlay.vue:163
#: src/components/staking/StakingGraphPage.vue:295
#: src/components/staking/StakingInfoPage.vue:322
#: src/components/staking/StakingInfoPage.vue:405
#: src/components/staking/ValidatorDetailsOverlay.vue:175
msgid "Something went wrong"
msgstr "Algo ha salido mal"

Expand Down Expand Up @@ -2650,27 +2650,27 @@ msgstr ""
msgid "Store of value, got it"
msgstr "Reserva de valor, entendido"

#: src/components/staking/StakingGraphPage.vue:208
#: src/components/staking/StakingGraphPage.vue:221
msgid "Successfully added {amount} NIM to your stake with {validator}"
msgstr ""

#: src/components/staking/ValidatorDetailsOverlay.vue:147
#: src/components/staking/ValidatorDetailsOverlay.vue:159
msgid "Successfully changed validator to {validator}"
msgstr "Cambio el validador exitosamente a {validator}"

#: src/components/staking/StakingInfoPage.vue:298
#: src/components/staking/StakingInfoPage.vue:306
msgid "Successfully deactivated {amount} NIM"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:250
#: src/components/staking/StakingGraphPage.vue:270
msgid "Successfully deactivated {amount} NIM from your stake with {validator}"
msgstr ""

#: src/components/staking/StakingGraphPage.vue:171
#: src/components/staking/StakingGraphPage.vue:177
msgid "Successfully staked {amount} NIM with {validator}"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:377
#: src/components/staking/StakingInfoPage.vue:391
msgid "Successfully unstaked {amount} NIM"
msgstr ""

Expand Down
Loading

0 comments on commit b2660d2

Please sign in to comment.