Skip to content

Commit

Permalink
Update Staking UI (hacky)
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Nov 19, 2024
1 parent d6af0c6 commit 7249a02
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 145 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.hasDefaultIcon
? 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.hasDefaultIcon)
? 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.hasDefaultIcon
? 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 @@ -151,6 +151,7 @@
{{ $t('unstake everything') }}
</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 @@ -275,6 +276,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.hasDefaultIcon
? validator.value.logo
: undefined,
amount: Math.abs(stake.value.activeBalance),
});
if (!txs) {
Expand Down Expand Up @@ -355,6 +363,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.hasDefaultIcon
? 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 { config } = useConfig();
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.hasDefaultIcon
? props.validator.logo
: undefined,
fromValidatorAddress: activeValidator.value!.address,
fromValidatorImageUrl: 'logo' in activeValidator.value! && !activeValidator.value.hasDefaultIcon
? 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 @@ -956,7 +956,7 @@ msgstr "Krypto-Swaps werden derzeit gewartet."
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:259
#: src/components/staking/StakingInfoPage.vue:260
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2433,7 +2433,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 @@ -2443,7 +2443,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr "Transaktion wird versendet"

#: src/components/staking/StakingInfoPage.vue:323
#: src/components/staking/StakingInfoPage.vue:331
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2587,10 +2587,10 @@ msgstr "Überspringen"
#: src/components/modals/SendModal.vue:640
#: src/components/modals/SendModal.vue:826
#: src/components/modals/StablecoinSendModal.vue:680
#: src/components/staking/StakingGraphPage.vue:276
#: src/components/staking/StakingInfoPage.vue:310
#: src/components/staking/StakingInfoPage.vue:388
#: src/components/staking/ValidatorDetailsOverlay.vue:164
#: src/components/staking/StakingGraphPage.vue:296
#: src/components/staking/StakingInfoPage.vue:318
#: src/components/staking/StakingInfoPage.vue:402
#: src/components/staking/ValidatorDetailsOverlay.vue:176
msgid "Something went wrong"
msgstr "Etwas ging schief"

Expand Down Expand Up @@ -2667,27 +2667,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:293
#: src/components/staking/StakingInfoPage.vue:301
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:373
#: src/components/staking/StakingInfoPage.vue:387
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 @@ -881,7 +881,7 @@ msgstr ""
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:259
#: src/components/staking/StakingInfoPage.vue:260
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2226,7 +2226,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 @@ -2236,7 +2236,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:323
#: src/components/staking/StakingInfoPage.vue:331
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2379,10 +2379,10 @@ msgstr ""
#: src/components/modals/SendModal.vue:640
#: src/components/modals/SendModal.vue:826
#: src/components/modals/StablecoinSendModal.vue:680
#: src/components/staking/StakingGraphPage.vue:276
#: src/components/staking/StakingInfoPage.vue:310
#: src/components/staking/StakingInfoPage.vue:388
#: src/components/staking/ValidatorDetailsOverlay.vue:164
#: src/components/staking/StakingGraphPage.vue:296
#: src/components/staking/StakingInfoPage.vue:318
#: src/components/staking/StakingInfoPage.vue:402
#: src/components/staking/ValidatorDetailsOverlay.vue:176
msgid "Something went wrong"
msgstr ""

Expand Down Expand Up @@ -2457,27 +2457,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:293
#: src/components/staking/StakingInfoPage.vue:301
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:373
#: src/components/staking/StakingInfoPage.vue:387
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 @@ -954,7 +954,7 @@ msgstr "Intercambios de cripto estan actualmente en mantenimiento."
msgid "Deactivate validator"
msgstr ""

#: src/components/staking/StakingInfoPage.vue:259
#: src/components/staking/StakingInfoPage.vue:260
msgid "Deactivating Stake"
msgstr ""

Expand Down Expand Up @@ -2425,7 +2425,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 @@ -2435,7 +2435,7 @@ msgstr ""
msgid "Sending Transaction"
msgstr "Enviando Transacción"

#: src/components/staking/StakingInfoPage.vue:323
#: src/components/staking/StakingInfoPage.vue:331
msgid "Sending Unstaking Transaction"
msgstr ""

Expand Down Expand Up @@ -2579,10 +2579,10 @@ msgstr "Omitir"
#: src/components/modals/SendModal.vue:640
#: src/components/modals/SendModal.vue:826
#: src/components/modals/StablecoinSendModal.vue:680
#: src/components/staking/StakingGraphPage.vue:276
#: src/components/staking/StakingInfoPage.vue:310
#: src/components/staking/StakingInfoPage.vue:388
#: src/components/staking/ValidatorDetailsOverlay.vue:164
#: src/components/staking/StakingGraphPage.vue:296
#: src/components/staking/StakingInfoPage.vue:318
#: src/components/staking/StakingInfoPage.vue:402
#: src/components/staking/ValidatorDetailsOverlay.vue:176
msgid "Something went wrong"
msgstr "Algo ha salido mal"

Expand Down Expand Up @@ -2661,27 +2661,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:293
#: src/components/staking/StakingInfoPage.vue:301
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:373
#: src/components/staking/StakingInfoPage.vue:387
msgid "Successfully unstaked {amount} NIM"
msgstr ""

Expand Down
Loading

0 comments on commit 7249a02

Please sign in to comment.