-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use new inputs in jetton management (#29)
- Loading branch information
Showing
17 changed files
with
373 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<TextInput ref="input" :optional="optional" :label="label" :placeholder="placeholder" :help-text="helpText" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Builder, Address } from 'ton-core'; | ||
import TextInput from '../Inputs/TextInput.vue'; | ||
import BaseField from './BaseField.vue'; | ||
export default { | ||
extends: BaseField, | ||
components: { | ||
TextInput | ||
}, | ||
methods: { | ||
validate(): boolean { | ||
return (this.$refs.input as typeof TextInput).validate(); | ||
}, | ||
store(builder: Builder): void { | ||
builder.storeAddress(Address.parse((this.$refs.input as typeof TextInput).value)) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<BooleanInput ref="input" :optional="optional" :label="label" :placeholder="placeholder" :help-text="helpText" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Builder } from 'ton-core'; | ||
import BaseField from './BaseField.vue'; | ||
import BooleanInput from '../Inputs/BooleanInput.vue'; | ||
export default { | ||
extends: BaseField, | ||
components: { | ||
BooleanInput | ||
}, | ||
methods: { | ||
validate(): boolean { | ||
return (this.$refs.input as typeof BooleanInput).validate(); | ||
}, | ||
store(builder: Builder): void { | ||
builder.storeBit((this.$refs.input as typeof BooleanInput).value) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<TextInput ref="input" :optional="optional" :label="label" :placeholder="placeholder" :help-text="helpText" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Cell, Builder } from 'ton-core'; | ||
import BaseField from './BaseField.vue'; | ||
import TextInput from '../Inputs/TextInput.vue'; | ||
export default { | ||
extends: BaseField, | ||
components: { | ||
TextInput | ||
}, | ||
methods: { | ||
store(builder: Builder): void { | ||
builder.storeSlice(Cell.fromBase64((this.$refs.input as typeof TextInput).value).asSlice()) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<NumberInput ref="input" :optional="optional" :label="label" :placeholder="placeholder" :help-text="helpText" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import type { Builder } from 'ton-core'; | ||
import NumberInput from '../Inputs/NumberInput.vue'; | ||
import BaseField from './BaseField.vue'; | ||
export default { | ||
extends: BaseField, | ||
props: { | ||
format: { | ||
type: Number, | ||
required: true, | ||
} | ||
}, | ||
components: { | ||
NumberInput | ||
}, | ||
methods: { | ||
validate(): boolean { | ||
return (this.$refs.input as typeof NumberInput).validate() | ||
}, | ||
store(builder: Builder): void { | ||
builder.storeUint(parseInt((this.$refs.input as typeof NumberInput).value), this.format) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<strong>{{ label }}</strong><br /> | ||
<strong>{{ expected }}</strong> field type is not implemented yet. | ||
</template> | ||
|
||
<script lang="ts"> | ||
import BaseField from './BaseField.vue'; | ||
export default { | ||
extends: BaseField, | ||
props: { | ||
expected: { | ||
type: String, | ||
} | ||
}, | ||
methods: { | ||
validate() { | ||
return false; | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template extends> | ||
<BaseLabel :optional="optional" :label="label" :placeholder="placeholder" :help-text="helpText" | ||
:error-text="errorText"> | ||
<input v-bind:class="{ 'is-danger': errorText }" @change="validate" v-model="value" class="checkbox" type="checkbox" | ||
:placeholder="placeholder"> | ||
</BaseLabel> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import BaseInput from './BaseInput.vue'; | ||
export default { | ||
extends: BaseInput, | ||
methods: { | ||
validate(): boolean { | ||
if (this.defaultValidation()) { | ||
try { | ||
parseInt(this.value); | ||
} catch { | ||
this.errorText = this.$t("Message.Common.NaN"); | ||
return false | ||
} | ||
} else { | ||
return false | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.