Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 4522581

Browse files
authored
Merge pull request #672 from kodadot/transfer
Transfer Page
2 parents 2e5b23d + f709899 commit 4522581

24 files changed

+508
-581
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"lazysizes": "^5.3.2",
4747
"markdown-it-vue": "^1.1.6",
4848
"mingo": "^4.1.2",
49-
"netlify-lambda": "^2.0.9",
5049
"register-service-worker": "^1.7.2",
5150
"setimmediate": "^1.0.5",
5251
"slugify": "^1.5.3",
@@ -76,6 +75,7 @@
7675
"@vue/cli-plugin-typescript": "^4.2.3",
7776
"@vue/cli-service": "^4.2.3",
7877
"all-contributors-cli": "^6.20.0",
78+
"netlify-lambda": "^2.0.14",
7979
"sass": "^1.35.1",
8080
"sass-loader": "^10.2",
8181
"tslint": "^6.1.0",

src-functions/getKey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ exports.handler = async (event) => {
3030
Authorization: `Bearer ${process.env.PINATA_MASTER}`
3131
},
3232
});
33-
console.log('[PINATA] Generate Key', status, data);
33+
console.log('[PINATA] Generate Key', status);
3434

3535
if (status < 400) {
3636
return {

src/components/Navbar.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
:to="{ name: 'rmrkFaq'}">
6060
{{ $t('FAQ') }}
6161
</b-navbar-item>
62+
<b-navbar-item
63+
tag="router-link"
64+
:to="{ name: 'transfer'}">
65+
{{ $t('Transfer') }}
66+
</b-navbar-item>
6267
<b-navbar-item
6368
tag="router-link"
6469
:to="{ name: 'settings'}">

src/components/rmrk/Create/CreateItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default class CreateItem extends Vue {
9292
@PropSync('description', { type: String }) vDescription!: string
9393
@PropSync('edition', { type: Number }) vEdition!: number;
9494
@PropSync('nsfw', { type: Boolean }) vNsfw!: boolean;
95-
@PropSync('price', { type: Number }) vPrice!: string | number;
95+
@PropSync('price', { type: [Number, String] }) vPrice!: string | number;
9696
@PropSync('tags', { type: Array }) vTags!: Attribute[];
9797
@PropSync('file', { type: Blob }) vFile!: Blob | null;
9898
@PropSync('secondFile', { type: Blob }) vSecondFile!: Blob | null;

src/components/rmrk/Create/CreateToken.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ type MintedCollection = {
142142
PasswordInput,
143143
Tooltip,
144144
Support,
145-
BalanceInput: () => import('@/components/shared/BalanceInput.vue'),
146145
Money: () => import('@/components/shared/format/Money.vue'),
147146
Loader: () => import('@/components/shared/Loader.vue'),
148147
ArweaveUploadSwitch: () => import('./ArweaveUploadSwitch.vue')

src/components/rmrk/Gallery/AvailableActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{ action }}
99
</b-button>
1010
</div>
11-
<component class="mb-4" v-if="showMeta" :is="showMeta" @input="updateMeta" />
11+
<component class="mb-4" v-if="showMeta" :is="showMeta" @input="updateMeta" emptyOnError />
1212
<b-button
1313
v-if="showSubmit"
1414
type="is-primary"

src/components/shared/AddressInput.vue

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
<template>
22
<div>
3-
<b-field :label="$t(label)">
4-
<b-input type="is-danger" v-model="value" @input="handleInput" :message="err"></b-input>
3+
<b-field :type="type" :message="err" :label="$t(label)">
4+
<b-input v-model="inputValue" @input="handleInput"></b-input>
55
</b-field>
66
</div>
77
</template>
88

99
<script lang="ts">
10+
import correctFormat from '@/utils/ss58Format';
1011
import { checkAddress } from '@polkadot/util-crypto';
1112
import { Debounce } from 'vue-debounce-decorator';
12-
import { Component, Emit, Prop, Vue } from 'vue-property-decorator';
13+
import { Component, Emit, Prop, Vue, VModel } from 'vue-property-decorator';
1314
1415
@Component({})
1516
export default class AddressInput extends Vue {
16-
17-
private value: string = '';
17+
@Prop(String) public value!: string;
1818
private err: string | null = '';
19-
@Prop({ default: 'insert address' }) public label!: string;
19+
@Prop({ type: String, default: 'insert address' }) public label!: string;
20+
@Prop(Boolean) public emptyOnError!: boolean;
21+
22+
get inputValue(): string {
23+
return this.value;
24+
}
25+
26+
set inputValue(value: string) {
27+
this.handleInput(value);
28+
}
29+
30+
get type() {
31+
return this.err ? 'is-danger': '';
32+
}
2033
2134
@Debounce(500)
2235
@Emit('input')
2336
protected handleInput(value: string) {
24-
const [valid, err] = checkAddress(value, process.env.VUE_APP_KEYRING === 'true' ? 0 : this.ss58Format);
25-
this.err = err;
26-
27-
if (valid) {
28-
return value
29-
}
37+
const [, err] = checkAddress(value, correctFormat(this.ss58Format));
38+
this.err = value ? err : '';
3039
31-
return ''
40+
return this.emptyOnError && this.err ? '' : value;
3241
}
3342
3443
get ss58Format(): number {
Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<div class="arguments-wrapper">
33
<b-field :label="$t(label)" class="balance">
4-
<b-input v-model="value" @input="handleInput" type="number" step="0.001" min="0"/>
4+
<b-input v-model="inputValue" @input="handleInput" type="number" step="0.001" min="0"/>
55
<p class="control balance">
6-
<b-select v-model="selectedUnit" @input="handleInput">
6+
<b-select :disabled="!calculate" v-model="selectedUnit" @input="handleInput">
77
<option v-for="u in units" v-bind:key="u.value" v-bind:value="u.value">
88
{{ u.name }}
99
</option>
@@ -14,12 +14,13 @@
1414
</template>
1515

1616
<script lang="ts" >
17-
import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator';
17+
import { Component, Prop, Vue, Watch, Emit, Mixins } from 'vue-property-decorator';
1818
import Balance from '@/params/components/Balance.vue';
1919
import { units as defaultUnits } from '@/params/constants';
2020
import { Unit } from '@/params/types';
2121
import shouldUpdate from '@/utils/shouldUpdate';
2222
import { Debounce } from 'vue-debounce-decorator';
23+
import ChainMixin from '@/utils/mixins/chainMixin';
2324
2425
const components = { Balance }
2526
@@ -28,27 +29,27 @@ type BalanceType = {
2829
}
2930
3031
@Component({ components })
31-
export default class BalanceInput extends Vue {
32-
private value: number = 0;
32+
export default class BalanceInput extends Mixins(ChainMixin) {
33+
@Prop({ type: [Number, String], default: 0 }) value!: number;
3334
protected units: Unit[] = defaultUnits;
3435
private selectedUnit: number = 1;
3536
@Prop({ default: 'balance' }) public label!: string;
37+
@Prop({ default: true }) public calculate!: boolean;
3638
37-
38-
get chainProperties() {
39-
return this.$store.getters.getChainProperties;
39+
get inputValue(): number {
40+
return this.value;
4041
}
4142
42-
get decimals(): number {
43-
return this.chainProperties.tokenDecimals
43+
set inputValue(value: number) {
44+
this.handleInput(value);
4445
}
4546
46-
get unit(): string {
47-
return this.chainProperties.tokenSymbol
47+
formatSelectedValue(value: number): number {
48+
return value * (10**this.decimals) * this.selectedUnit
4849
}
4950
5051
get calculatedBalance() {
51-
return this.value * (10**this.decimals) * this.selectedUnit
52+
return this.formatSelectedValue(this.inputValue)
5253
}
5354
5455
protected mapper(unit: Unit) {
@@ -62,23 +63,10 @@ export default class BalanceInput extends Vue {
6263
this.units = defaultUnits.map(this.mapper);
6364
}
6465
65-
// @Watch('$store.getters.getChainProperties.tokenSymbol')
66-
// protected updateUnit(val: string, oldVal: string) {
67-
// console.log('@Watch(unit)', val, oldVal)
68-
// if (shouldUpdate(val, oldVal)) {
69-
// this.units = defaultUnits.map(u => {
70-
// if (u.name === '-') {
71-
// return { ...u, name: val }
72-
// }
73-
// return u
74-
// })
75-
// }
76-
// }
77-
7866
@Debounce(200)
7967
@Emit('input')
80-
public handleInput() {
81-
return this.calculatedBalance;
68+
public handleInput(value: number) {
69+
return this.calculate ? this.formatSelectedValue(value) : value;
8270
}
8371
}
8472
</script>

0 commit comments

Comments
 (0)