Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #17

Merged
merged 49 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1f3d0b6
feat: Breakdown balance when clicking on account in account page.
eliasmpw Sep 21, 2022
2ae4cf1
fix: Display correct staked and bonded values
eliasmpw Sep 21, 2022
f753852
Stake screens developing
mihailpolev Sep 22, 2022
fca72ad
Add countdown to vested unlock
eliasmpw Sep 22, 2022
34b1cce
feat: Load accounts and balance info on send page
eliasmpw Sep 22, 2022
71c6080
fix: wip market price to display usd value
eliasmpw Sep 27, 2022
0c953ad
dev: Stake screens done
mihailpolev Sep 28, 2022
16ba1f4
Price loading on Accounts and Send pages
eliasmpw Sep 28, 2022
742ea11
Remove unused files
eliasmpw Sep 28, 2022
01b70e9
Croadloan develop
mihailpolev Sep 29, 2022
1ded399
fix: fee calculation and refactor some components and types
eliasmpw Sep 29, 2022
32393f3
Send values to verify route
eliasmpw Sep 29, 2022
9a697dd
develop: Crowdloan screens done
mihailpolev Sep 30, 2022
d3b8dab
feature: check existential deposit and display warning accordingly
eliasmpw Sep 30, 2022
ec4f46d
fix: open connect wallet dropdown from claim page
eliasmpw Oct 3, 2022
015cac9
feat: Add claim dot and ksm functionality
eliasmpw Oct 4, 2022
d8753dc
fix: name of local storage, order of value setting
eliasmpw Oct 4, 2022
5125c42
Merge remote-tracking branch 'origin/feature/send-page' into feature/…
eliasmpw Oct 4, 2022
97b3228
fix: Disable button when sending
eliasmpw Oct 5, 2022
1d2d4f9
dev: UI fixes and updates
mihailpolev Oct 10, 2022
7393753
Merge remote-tracking branch 'origin/feature/ui' into feature/staking
eliasmpw Oct 10, 2022
8b4e342
First step of staking wizard
eliasmpw Oct 11, 2022
668fd57
feat: step 2 of the staking wizard
eliasmpw Oct 12, 2022
007d75e
feat: display validator list, filters and formatting pending
eliasmpw Oct 13, 2022
4c0b787
feat: submit stake extrinsic call
eliasmpw Oct 14, 2022
b157138
fix: Small fixes on data displayed on button, and routing
eliasmpw Oct 14, 2022
a4f12a3
feat: Query stake stashes of connected accounts
eliasmpw Oct 18, 2022
309ef4f
fix: Add validator status and commission data
eliasmpw Oct 20, 2022
e57ce14
fix: List of validators not displaying correct number
eliasmpw Oct 20, 2022
1139aeb
feat: Add subsquid endpoint integration
eliasmpw Oct 21, 2022
e5f260b
feat: unbond page
eliasmpw Oct 22, 2022
ce2d881
Set mainnet values
eliasmpw Oct 24, 2022
e0da551
fix: don't show enkrypt banner when using enkrypt
brettkolodny Oct 24, 2022
c5f7bc3
Merge pull request #4 from enkryptcom/ui/hide-enkrypt-poppup
brettkolodny Oct 24, 2022
07b868d
Feature/send page (#5)
brettkolodny Oct 24, 2022
27f9bb5
Feature/claim dot (#6)
brettkolodny Oct 24, 2022
fbf52ae
feat: cleaned unbound logic
eliasmpw Oct 24, 2022
88c32b0
fix: fix endpoint
eliasmpw Oct 24, 2022
747157c
fix: lint
eliasmpw Oct 24, 2022
72c246a
Merge remote-tracking branch 'origin/develop' into feature/staking
eliasmpw Oct 24, 2022
176c165
fix: fix stuff that was broken on merge conflicts
eliasmpw Oct 24, 2022
205096a
fix: lint
eliasmpw Oct 24, 2022
d914572
Merge pull request #7 from enkryptcom/feature/staking
eliasmpw Oct 24, 2022
d94fb0b
Feature/connect last ext (#8)
brettkolodny Oct 25, 2022
992bacc
UI/hide unavailable extensions (#10)
brettkolodny Oct 25, 2022
70e16f9
Feature/recent addresses (#12)
brettkolodny Oct 25, 2022
080baa7
fix: send url query (#13)
brettkolodny Oct 26, 2022
fef707a
Feature/crowdloan (#15)
eliasmpw Nov 17, 2022
9bfa72c
fix: stake button goes to the stake screen (#16)
brettkolodny Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Feature/send page (#5)
* feat: Breakdown balance when clicking on account in account page.

* fix: Display correct staked and bonded values

* Add countdown to vested unlock

* feat: Load accounts and balance info on send page

* fix: wip market price to display usd value

* Price loading on Accounts and Send pages

* Remove unused files

* fix: fee calculation and refactor some components and types

* Send values to verify route

* feature: check existential deposit and display warning accordingly

* fix: name of local storage, order of value setting

* fix: fix mainnet endpoints

* fix: fee symbol changes on network change

* feat: account balances on send screen

* fix: dot decimals

* fix: remove balances from verify send page

* fix: send button goes to correct send account page

* fix: top send button goes to send screen

Co-authored-by: eliasmpw <eliasmpw@hotmail.com>
  • Loading branch information
brettkolodny and eliasmpw authored Oct 24, 2022
commit 07b868d77c901e304e30382d654156dae70359b3
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
"publish": "git push origin `git subtree split --prefix dist main`:gh-pages --force"
},
"dependencies": {
"@chenfengyuan/vue-countdown": "2",
"@polkadot/api": "^9.4.1",
"@substrate/connect": "^0.7.13",
"@vueuse/core": "^9.1.1",
"bignumber.js": "^9.1.0",
"localforage": "^1.10.0",
"moment": "^2.29.4",
"vue": "^3.2.37",
"vue-router": "^4.1.3",
"web3-utils": "^1.8.0"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@polkadot/api-derive": "^9.4.1",
"@polkadot/extension-inject": "^0.44.6",
"@polkadot/keyring": "^10.1.8",
"@polkadot/types": "^9.4.1",
Expand Down
65 changes: 49 additions & 16 deletions src/components/amount-input/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,31 @@
<div class="amount-input" :class="{ error: isError }">
<img :src="token.image" class="amount-input__icon" />
<base-button
:stroke="true"
class="amount-input__max"
:class="{ error: !hasEnoughBalance }"
title="Max"
:stroke="true"
:small="true"
@click="setMaxValue"
/>
<div class="amount-input__wrapper">
<input
ref="inputRef"
v-model="textValue"
type="text"
v-model="amountValue"
type="number"
class="amount-input__input"
placeholder="0 DOT"
placeholder="0"
:class="{ error: !hasEnoughBalance }"
:style="{ width: size + 'ch' }"
/>
<span v-show="props.value != '0'" @click="focus">{{ token.symbol }}</span>
</div>

<p v-if="props.value == '0'" class="amount-input__fiat">
{{ $filters.currencyFormat(0, "USD") }}
<p v-if="props.value" class="amount-input__fiat">
~{{ $filters.currencyFormat(amountInFiat, "USD") }}
</p>
<p v-else class="amount-input__fiat">
~{{ $filters.currencyFormat(3.1, "USD") }}
{{ $filters.currencyFormat(0, "USD") }}
</p>
</div>
</template>
Expand All @@ -32,36 +35,53 @@
import { PropType, computed, ref, ComponentPublicInstance } from "vue";
import { Token } from "@/types/token";
import BaseButton from "@/components/base-button/index.vue";
import { nativeToken } from "@/stores";
import BigNumber from "bignumber.js";

const inputRef = ref<ComponentPublicInstance<HTMLInputElement>>();
defineExpose({ inputRef });

const props = defineProps({
token: {
type: Object as PropType<Token>,
default: null,
default: nativeToken,
},
hasEnoughBalance: {
type: Boolean,
default: false,
},
isError: {
type: Boolean,
default: false,
},
value: {
type: String,
default: () => {
return "";
},
default: "",
},
maxValue: {
type: Object as PropType<BigNumber>,
default: new BigNumber(0),
},
});

const emit = defineEmits(["update:amount"]);

const textValue = computed({
get: () => (props.value != "0" ? props.value.replace(/[^0-9.-]+/g, "") : ""),
set: (value) => emit("update:amount", value.replace(/[^0-9.-]+/g, "")),
});
const setMaxValue = () => {
emit("update:amount", props.maxValue?.toString() || "0");
};

const amountValue = computed({
get: () => props.value,
set: (value) => {
emit("update:amount", value ? new BigNumber(value).toFixed() : "");
},
});
const size = computed(() => {
return textValue.value.length == 0 ? 70 : textValue.value.length;
return amountValue.value.length == 0 ? 70 : amountValue.value.length;
});

const amountInFiat = computed(() => {
return new BigNumber(props.value || 0).times(props.token.price);
});

const focus = () => {
Expand Down Expand Up @@ -114,6 +134,15 @@ const focus = () => {
margin-bottom: 4px;
max-width: 100%;

&[type="number"]::-webkit-outer-spin-button,
&[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
&[type="number"] {
-moz-appearance: textfield;
}

&::placeholder {
color: @tertiaryLabel;
}
Expand Down Expand Up @@ -144,5 +173,9 @@ const focus = () => {
color: @tertiaryLabel;
margin: 0;
}

.error {
color: @error !important;
}
}
</style>
26 changes: 23 additions & 3 deletions src/components/fee-info/index.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
<template>
<div class="fee-info">
<p class="fee-info__title">Network fee:</p>
<p class="fee-info__fiat">{{ $filters.currencyFormat(0.34, "USD") }}</p>
<p class="fee-info__fiat">
{{ $filters.currencyFormat(fee.fiatValue, fee.fiatSymbol) }}
</p>
<p class="fee-info__amount">
{{ $filters.cryptoCurrencyFormat(0.037) }} <span>dot</span>
{{ $filters.cryptoCurrencyFormat(fee.nativeValue) }}
<span>{{ nativeToken.symbol }}</span>
</p>
</div>
</template>

<script setup lang="ts"></script>
<script setup lang="ts">
import { GasFeeInfo } from "@/types/transaction";
import BigNumber from "bignumber.js";
import { PropType } from "vue";
import { nativeToken } from "@/stores";

defineProps({
fee: {
type: Object as PropType<GasFeeInfo>,
default: () => ({
nativeValue: new BigNumber(0),
fiatValue: new BigNumber(0),
nativeSymbol: "dot",
fiatSymbol: "USD",
}),
},
});
</script>

<style lang="less" scoped>
@import "@/assets/styles/theme.less";
Expand Down
53 changes: 44 additions & 9 deletions src/components/search-account-input/index.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<template>
<div class="search-account-input">
<div ref="container" class="search-account-input">
<div class="search-account-input__info">
<img v-if="account" :src="account.image" />
<img v-if="account?.image" :src="account.image" />
<div v-else class="search-account-input__info-icon"></div>
<div class="search-account-input__info-name">
<h5 class="search-account-input__title">To</h5>
<input
ref="inputRef"
v-model="addressValue"
type="text"
class="search-account-input__input"
:class="{ sized: size != 1 && !isFocus }"
placeholder="Search or paste Polkadot address"
:value="value"
:style="{ color: !isAddress ? 'red' : 'black' }"
:size="size"
@focus="changeFocus"
@blur="changeFocus"
Expand Down Expand Up @@ -42,9 +43,12 @@ import AccountSelect from "@/components/account-select/index.vue";
import { Account } from "@/types/account";
import { PropType, ref, computed, ComponentPublicInstance } from "vue";
import { onClickOutside } from "@vueuse/core";

import { formatAddress } from "@/utils/filters";
import createIcon from "@/libs/polkadot-identicon";
import { encodeSubstrateAddress } from "@/utils";
const isOpenDropdown = ref<boolean>(false);
const isFocus = ref<boolean>(false);
const container = ref(null);
const dropdown = ref(null);
const inputRef = ref<ComponentPublicInstance<HTMLInputElement>>();
defineExpose({ inputRef });
Expand All @@ -68,10 +72,41 @@ const props = defineProps({
},
});

const value = computed(() => {
if (props.account == null) return null;
if (isFocus.value) return props.account.address;
return props.account.name ? props.account.name : props.account.address;
const addressValue = computed({
get: () => {
try {
const auxAddress = props.account?.address || "";
if (isFocus.value && isAddress.value) {
return auxAddress;
} else if (isAddress.value) {
return props.account?.name ? props.account.name : auxAddress;
}

return auxAddress;
} catch {
return props.account?.address || "";
}
},
set: (value) => {
if (value) {
const isValidAddress = encodeSubstrateAddress(value);
const formatted = isValidAddress ? formatAddress(value) : value;
const name =
props.accounts.find((item) => item.address === formatted)?.name || "";

emit("update:select", {
id: Number.MAX_SAFE_INTEGER,
name,
address: formatted,
image: isValidAddress ? createIcon(value) : undefined,
isLedger: false,
});
}
},
});

const isAddress = computed(() => {
return !!encodeSubstrateAddress(props.account?.address);
});

const size = computed(() => {
Expand Down Expand Up @@ -101,7 +136,7 @@ const focus = () => {
if (inputRef.value) inputRef.value.focus();
};

onClickOutside(dropdown, () => {
onClickOutside(container, () => {
isFocus.value = false;
closeAccounts();
});
Expand Down
29 changes: 21 additions & 8 deletions src/components/select-account-input/index.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<template>
<div class="select-account-input">
<a ref="toggle" class="select-account-input__info" @click="toggleAccounts">
<img v-if="account.image" :src="account.image" />
<img v-if="account?.image" :src="account.image" />
<div v-else class="select-account-input__info-icon"></div>
<div class="select-account-input__info-name">
<h5 class="select-account-input__title">{{ title }}</h5>
<p>
{{ account.name }}
<p v-if="account">
{{ account?.name }}
<span>
{{ $filters.replaceWithEllipsis(account.address, 6, 6) }}
{{ $filters.replaceWithEllipsis(account?.address, 6, 6) }}
</span>
<span v-if="isAmount">
{{ $filters.cryptoCurrencyFormat(15.9) }} <span>dot</span>
<span v-if="isAmount && availableBalance">
{{ $filters.cryptoCurrencyFormat(availableBalance) }}
<span>dot</span>
</span>
</p>
<p v-else>Select an account to send from</p>
</div>
<chevron-small-down />
</a>
Expand All @@ -32,8 +34,9 @@ import ChevronSmallDown from "@/icons/common/chevron-small-down.vue";
import DropdownWrapper from "@/components/dropdown-wrapper/index.vue";
import AccountSelect from "@/components/account-select/index.vue";
import { Account } from "@/types/account";
import { PropType, ref } from "vue";
import { PropType, ref, computed } from "vue";
import { onClickOutside } from "@vueuse/core";
import { nativeBalances } from "@/stores";

const isOpenDropdown = ref<boolean>(false);
const dropdown = ref(null);
Expand All @@ -43,7 +46,7 @@ const emit = defineEmits<{
(e: "update:select", account: Account): void;
}>();

defineProps({
const props = defineProps({
account: {
type: Object as PropType<Account>,
default: null,
Expand All @@ -62,6 +65,16 @@ defineProps({
},
});

const availableBalance = computed(() => {
if (props.account) {
const balance = nativeBalances.value[props.account.address];

if (balance) return balance.available.toString();
}

return null;
});

const toggleAccounts = () => {
isOpenDropdown.value = !isOpenDropdown.value;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const connectToWallet = async (wallet: WalletItem) => {
isLedger: false,
}));

return accounts;
return accounts.value;
};
</script>

Expand Down
Loading