Skip to content

Commit

Permalink
Merge pull request #195 from soramitsu/adar-dev
Browse files Browse the repository at this point in the history
Adar dev
  • Loading branch information
timofeytrepalin authored Aug 22, 2023
2 parents c7b39ec + 72c0585 commit ae146cd
Show file tree
Hide file tree
Showing 39 changed files with 182 additions and 193 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adar",
"version": "1.0.5",
"version": "1.0.6",
"repository": {
"type": "git",
"url": "https://github.com/soramitsu/adar.git"
Expand All @@ -23,7 +23,7 @@
},
"dependencies": {
"@metamask/detect-provider": "^2.0.0",
"@soramitsu/soraneo-wallet-web": "1.19.1",
"@soramitsu/soraneo-wallet-web": "1.20.0",
"@walletconnect/web3-provider": "^1.8.0",
"base-64": "^1.0.0",
"core-js": "^3.26.0",
Expand Down
1 change: 1 addition & 0 deletions src/components/mixins/BridgeMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class BridgeMixin extends Mixins(mixins.LoadingMixin, WalletConne
@state.bridge.assetLockedBalance assetLockedBalance!: Nullable<CodecString>;

@getter.web3.isValidNetwork isValidNetwork!: boolean;
@getter.bridge.asset asset!: Nullable<RegisteredAccountAsset>;
@getter.bridge.sender sender!: string;
@getter.bridge.recipient recipient!: string;
@getter.bridge.soraNetworkFee soraNetworkFee!: CodecString;
Expand Down
2 changes: 1 addition & 1 deletion src/components/mixins/ExplorePageMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class ExplorePageMixin extends Mixins(

@Ref('table') readonly tableComponent!: any;
@Prop({ default: '', type: String }) readonly exploreQuery!: string;
@Prop({ default: false, type: Boolean }) readonly isAccountItems!: boolean;
@Prop({ default: false, type: Boolean }) readonly isAccountItemsOnly!: boolean;
@Watch('exploreQuery')
private resetCurrentPage(): void {
this.currentPage = 1;
Expand Down
92 changes: 13 additions & 79 deletions src/components/pages/Bridge/SelectAccount.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<template>
<dialog-base :visible.sync="visibility" :title="t('connection.selectAccount')" custom-class="account-select-dialog">
<div class="account-select">
<search-input
ref="search"
v-model="query"
:placeholder="t('addressText')"
autofocus
@clear="handleClearSearch"
class="asset-search"
/>
<address-book-input v-model="address" />

<s-button
class="s-typography-button--large account-select-button"
Expand All @@ -18,52 +11,35 @@
>
{{ t('saveText') }}
</s-button>

<connection-items v-loading="loading" :size="accountList.length" :visible="3">
<wallet-account
v-button
v-for="{ account, isConnected } in accountList"
:key="account.address"
:polkadotAccount="account"
tabindex="0"
@click.native="handleSelectAccount(account)"
>
<s-button v-if="isConnected" size="small" disabled>
{{ t('connection.wallet.connected') }}
</s-button>
</wallet-account>
</connection-items>
</div>
</dialog-base>
</template>

<script lang="ts">
import { api, mixins, components, WALLET_TYPES, WALLET_CONSTS, getWalletAccounts } from '@soramitsu/soraneo-wallet-web';
import { api, mixins, components } from '@soramitsu/soraneo-wallet-web';
import { Component, Mixins, Watch } from 'vue-property-decorator';
import SearchInputMixin from '@/components/mixins/SearchInputMixin';
import TranslationMixin from '@/components/mixins/TranslationMixin';
import { action, state, mutation, getter } from '@/store/decorators';
import { action, state, mutation } from '@/store/decorators';
@Component({
components: {
DialogBase: components.DialogBase,
SearchInput: components.SearchInput,
WalletAccount: components.WalletAccount,
ConnectionItems: components.ConnectionItems,
AddressBookInput: components.AddressBookInput,
},
})
export default class BridgeSelectAccount extends Mixins(mixins.LoadingMixin, TranslationMixin, SearchInputMixin) {
export default class BridgeSelectAccount extends Mixins(mixins.LoadingMixin, TranslationMixin) {
@state.web3.subAddress private subAddress!: string;
@state.web3.selectAccountDialogVisibility private selectAccountDialogVisibility!: boolean;
@mutation.web3.setSelectAccountDialogVisibility private setSelectAccountDialogVisibility!: (flag: boolean) => void;
@action.web3.connectSubAccount private connectSubAccount!: (address: string) => Promise<void>;
@state.wallet.account.source private source!: Nullable<WALLET_CONSTS.AppWallet>;
@getter.wallet.account.isConnectedAccount private isConnectedAccount!: (
account: WALLET_TYPES.PolkadotJsAccount
) => boolean;
address = '';
private accounts: Array<WALLET_TYPES.PolkadotJsAccount> = [];
@Watch('visibility')
private updateAddress(isVisible: boolean) {
this.address = isVisible ? this.subAddress : '';
}
get visibility(): boolean {
return this.selectAccountDialogVisibility;
Expand All @@ -73,54 +49,12 @@ export default class BridgeSelectAccount extends Mixins(mixins.LoadingMixin, Tra
this.setSelectAccountDialogVisibility(flag);
}
@Watch('visibility')
private updateAccountsSubscription(visibility: boolean): void {
if (visibility) {
this.clearAndFocusSearch();
this.getAccounts();
} else {
this.resetAccounts();
}
}
get accountList() {
return this.accounts.map((account) => ({
account,
isConnected: this.isConnectedAccount(account),
}));
}
get validAddress(): boolean {
return !!this.query && api.validateAddress(this.query);
}
private async getAccounts(): Promise<void> {
await this.withLoading(async () => {
try {
if (!this.source) return;
this.accounts = await getWalletAccounts(this.source);
} catch {
this.resetAccounts();
this.visibility = false;
}
});
}
private resetAccounts(): void {
this.accounts = [];
}
handleSelectAccount(account: WALLET_TYPES.PolkadotJsAccount): void {
const subAddress = api.formatAddress(account.address);
this.updateSubAccount(subAddress);
return !!this.address && api.validateAddress(this.address);
}
handleSelectAddress(): void {
this.updateSubAccount(this.query);
}
private updateSubAccount(address: string): void {
this.connectSubAccount(address);
this.connectSubAccount(this.address);
this.visibility = false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/ExternalLink.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<a class="external-link p4" :href="href" target="_blank" rel="nofollow noopener">
<a class="external-link" :class="defaultClass" :href="href" target="_blank" rel="nofollow noopener">
<span>{{ title }}</span>
</a>
</template>
Expand All @@ -11,6 +11,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator';
export default class ExternalLink extends Vue {
@Prop({ default: '', type: String }) title!: string;
@Prop({ default: '', type: String }) href!: string;
@Prop({ default: 'p4', type: String }) defaultClass!: string;
}
</script>

Expand Down
4 changes: 3 additions & 1 deletion src/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Most {Hashi}",
"disclaimerTitle": "Disclaimer \/ Zřeknutí se odpovědnosti",
"explore": {
"showOnlyMyPositions": "Zobrazit pouze moje pozice"
"showOnly": "Zobrazit pouze {entities}",
"myPositions": "moje pozice",
"synthetics": "syntetické tokeny"
},
"tooltips": {
"roi": "{ROI} znamená návratnost investic. Vypočítá se vydělením zisku získaného z investice náklady na tuto investici v procentuálním ekvivalentu.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} Brücke",
"disclaimerTitle": "Haftungsausschluss",
"explore": {
"showOnlyMyPositions": "Nur meine Positionen anzeigen"
"showOnly": "Nur {entities} anzeigen",
"myPositions": "Meine Positionen",
"synthetics": "Synthetische Tokens"
},
"tooltips": {
"roi": "{ROI} steht für Return on Investment. Es wird berechnet, indem der mit einer Investition erzielte Gewinn durch die Kosten dieser Investition in einem prozentualen Äquivalent dividiert wird.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,9 @@
"hashiBridgeText": "{Hashi} bridge",
"disclaimerTitle": "Disclaimer",
"explore": {
"showOnlyMyPositions": "Show only my positions"
"showOnly": "Show only {entities}",
"myPositions": "my positions",
"synthetics": "synthetic tokens"
},
"tooltips": {
"roi": "{ROI} stands for Return on Investment. It is calculated by dividing the profit earned on an investment by the cost of that investment in a percentage equivalent.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,9 @@
"hashiBridgeText": "Puente {Hashi}",
"disclaimerTitle": "Aviso legal",
"explore": {
"showOnlyMyPositions": "Mostrar solo mis posiciones"
"showOnly": "Mostrar solo {entities}",
"myPositions": "mis posiciones",
"synthetics": "tokens sintéticos"
},
"tooltips": {
"roi": "{ROI} significa Retorno de la Inversión. Se calcula dividiendo la ganancia obtenida en una inversión por el costo de esa inversión en un porcentaje equivalente.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,9 @@
"hashiBridgeText": "Pont {Hashi}",
"disclaimerTitle": "Avertissement",
"explore": {
"showOnlyMyPositions": "Afficher uniquement mes positions"
"showOnly": "Afficher uniquement {entities}",
"myPositions": "mes postes",
"synthetics": "jetons synthétiques"
},
"tooltips": {
"roi": "{ROI} signifie retour sur investissement. Il est calculé en divisant le bénéfice réalisé sur un investissement par le coût de cet investissement en pourcentage équivalent.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} most",
"disclaimerTitle": "Disclaimer:",
"explore": {
"showOnlyMyPositions": "Pokaži samo moje pozicije"
"showOnly": "Pokaži samo {entities}",
"myPositions": "moje pozicije",
"synthetics": "sintetički tokeni"
},
"tooltips": {
"roi": "{ROI} je kratica za povrat ulaganja. Izračunava se dijeljenjem dobiti ostvarene ulaganjem troškom tog ulaganja u postotnom ekvivalentu.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} híd",
"disclaimerTitle": "Jogi nyilatkozat",
"explore": {
"showOnlyMyPositions": "Csak az én pozíciómat mutasd"
"showOnly": "Csak {entities} megjelenítése",
"myPositions": "saját pozícióim",
"synthetics": "szintetikus tokenek"
},
"tooltips": {
"roi": "A {ROI} a befektetés megtérülését jelenti. Kiszámítása úgy történik, hogy a befektetésen megszerzett nyereséget elosztjuk a befektetés százalékban kifejezett költségével.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/hy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} կամուրջ",
"disclaimerTitle": "Հրաժարում պատասխանատվությունից",
"explore": {
"showOnlyMyPositions": "Ցույց տալ միայն իմ դիրքերը"
"showOnly": "Ցուցադրել միայն {entities}",
"myPositions": "իմ դիրքերը",
"synthetics": "արհեստական թոքեններ"
},
"tooltips": {
"roi": "{ROI} նշանակում է ներդրումների վերադարձ: Այն հաշվարկվում է ներդրումներից ստացված շահույթը բաժանելով այդ ներդրման արժեքին` տոկոսային համարժեքով:",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Jembatan {Hashi}",
"disclaimerTitle": "Penafian",
"explore": {
"showOnlyMyPositions": "Hanya tampilkan posisi saya"
"showOnly": "Hanya tampilkan {entities}",
"myPositions": "posisi saya",
"synthetics": "token sintetis"
},
"tooltips": {
"roi": "{ROI} adalah singkatan dari Pengembalian Investasi. Ini dihitung dengan membagi laba yang diperoleh dari investasi dengan biaya investasi itu dalam persentase yang setara.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Ponte {Hashi}",
"disclaimerTitle": "Disclaimer",
"explore": {
"showOnlyMyPositions": "Mostra solo le mie posizioni"
"showOnly": "Mostra solo {entities}",
"myPositions": "le mie posizioni",
"synthetics": "token sintetici"
},
"tooltips": {
"roi": "{ROI} sta per ritorno sull'investimento. Viene calcolato dividendo il profitto ottenuto su un investimento per il costo di tale investimento in una percentuale equivalente.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} brug",
"disclaimerTitle": "Disclaimer",
"explore": {
"showOnlyMyPositions": "Toon alleen mijn posities"
"showOnly": "Toon alleen {entities}",
"myPositions": "mijn posities",
"synthetics": "synthetische tokens"
},
"tooltips": {
"roi": "{ROI} staat voor Return on Investment. Het wordt berekend door de winst op een investering te delen door de kosten van die investering in een procentueel equivalent.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} bro",
"disclaimerTitle": "Ansvarsfraskrivelse",
"explore": {
"showOnlyMyPositions": "Vis bare mine posisjoner"
"showOnly": "Vis bare {entities}",
"myPositions": "mine posisjoner",
"synthetics": "syntetiske tokens"
},
"tooltips": {
"roi": "{ROI} står for Return on Investment. Den beregnes ved å dele fortjenesten opptjent på en investering med kostnaden for den investeringen i en prosentekvivalent.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Most {Hashi}",
"disclaimerTitle": "Zastrzeżenie",
"explore": {
"showOnlyMyPositions": "Pokaż tylko moje pozycje"
"showOnly": "Pokaż tylko {entities}",
"myPositions": "moje pozycje",
"synthetics": "tokeny syntetyczne"
},
"tooltips": {
"roi": "{ROI} oznacza zwrot z inwestycji. Oblicza się go, dzieląc zysk uzyskany z inwestycji przez koszt tej inwestycji w ekwiwalencie procentowym.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Мост {Hashi}",
"disclaimerTitle": "Отказ от ответственности",
"explore": {
"showOnlyMyPositions": "Показать только мои позиции"
"showOnly": "Показать только {entities}",
"myPositions": "мои позиции",
"synthetics": "синтетические токены"
},
"tooltips": {
"roi": "{ROI} означает рентабельность инвестиций. Она рассчитывается путем деления прибыли, полученной от инвестиции, на стоимость этой инвестиции в процентном эквиваленте.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Most {Hashi}",
"disclaimerTitle": "Vylúčenie zodpovednosti",
"explore": {
"showOnlyMyPositions": "Zobraziť iba moje pozície"
"showOnly": "Zobraziť iba {entities}",
"myPositions": "moje pozície",
"synthetics": "syntetické žetóny"
},
"tooltips": {
"roi": "{ROI} znamená návratnosť investícií. Vypočítava sa vydelením zisku získaného z investície nákladmi na túto investíciu v percentuálnom ekvivalente.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/sr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} most",
"disclaimerTitle": "Одрицање одговорности",
"explore": {
"showOnlyMyPositions": "Prikaži samo moje pozicije"
"showOnly": "Prikaži samo {entities}",
"myPositions": "moje pozicije",
"synthetics": "sintetički tokeni"
},
"tooltips": {
"roi": "{ROI} označava povraćaj investicije. Obračunava se deljenjem dobiti ostvarene na investiciji po trošku te investicije u procentualno ekvivalentnom iznosu.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} bro",
"disclaimerTitle": "Ansvarsfriskrivning",
"explore": {
"showOnlyMyPositions": "Visa bara mina positioner"
"showOnly": "Visa endast {entities}",
"myPositions": "mina positioner",
"synthetics": "syntetiska tokens"
},
"tooltips": {
"roi": "{ROI} står för Return on Investment. Den beräknas genom att dividera den vinst som tjänats in på en investering med kostnaden för den investeringen i en motsvarande procentsats.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "Cầu {Hashi}",
"disclaimerTitle": "Disclaimer",
"explore": {
"showOnlyMyPositions": "Chỉ hiển thị vị trí của tôi"
"showOnly": "Chỉ hiển thị {entities}",
"myPositions": "vị trí của tôi",
"synthetics": "token tổng hợp"
},
"tooltips": {
"roi": "{ROI} là viết tắt của Lợi tức đầu tư. Nó được tính bằng cách chia lợi nhuận kiếm được từ một khoản đầu tư cho chi phí của khoản đầu tư đó theo tỷ lệ phần trăm tương đương.",
Expand Down
4 changes: 3 additions & 1 deletion src/lang/yo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"hashiBridgeText": "{Hashi} Afara",
"disclaimerTitle": "Akiyesi",
"explore": {
"showOnlyMyPositions": "Ṣe afihan awọn ipo mi nikan"
"showOnly": "Ṣafihan {entities} nikan",
"myPositions": "awọn ipo mi",
"synthetics": "sintetiki àmi"
},
"tooltips": {
"roi": "{ROI} duro fun Pada lori Idoko-owo. O ṣe iṣiro nipasẹ pinpin èrè ti o jo'gun lori idoko-owo nipasẹ idiyele ti idoko-owo yẹn ni deede ogorun kan.",
Expand Down
Loading

0 comments on commit ae146cd

Please sign in to comment.