Skip to content

Commit

Permalink
add infusion parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Sep 25, 2024
1 parent 23da658 commit 04a2918
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions resources/js/components/FormInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const props = withDefaults(
type?: string;
min?: number;
modelValue?: number | string | null;
value?: number | string | null;
disabled?: boolean;
prefix?: string;
name: string;
Expand Down Expand Up @@ -109,10 +110,10 @@ const inputChange = (e: Event) => {
const localModelValue = computed({
get() {
return props.modelValue;
return props.modelValue ?? props.value;
},
set(value) {
if (localModelValue.value !== value) {
if (value && localModelValue.value !== value) {
emit('update:modelValue', value);
}
},
Expand Down
18 changes: 13 additions & 5 deletions resources/js/components/pages/create/CreateToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@
/>
<template v-if="tokenType === 'ft'">
<FormInput
v-model="itemsInfuse"
v-model="initialSupply"
name="itemsInfuse"
label="Number of items"
type="number"
required
disabled
/>
<FormInput
v-model="totalInfuseAmount"
:value="totalInfuseAmountComputed"
name="totalInfuseAmount"
label="Total Infuse Amount"
type="number"
Expand Down Expand Up @@ -413,8 +413,6 @@ const infuseAmount = ref();
const isCurrency = ref(false);
const infuseEnj = ref(false);
const infuseAccess = ref('Only Me');
const itemsInfuse = ref();
const totalInfuseAmount = ref();
const beneficiaryAddress = ref('');
const beneficiaryPercentage = ref(0);
const listingForbidden = ref(false);
Expand All @@ -437,6 +435,10 @@ const capTypes =
const collectionIds = computed(() => appStore.collections);
const isAdvanced = computed(() => mode.value === 'advanced');
const totalInfuseAmountComputed = computed(() => {
return initialSupply.value * infuseAmount.value;
});
const validation = yup.object({
imageUrl: stringNotRequiredSchema,
name: stringRequiredSchema,
Expand Down Expand Up @@ -536,6 +538,12 @@ const createToken = async () => {
isCurrency: isCurrency.value,
},
listingForbidden: listingForbidden.value,
...(infuseEnj.value
? {
infusion: totalInfuseAmountComputed.value,
anyoneCanInfuse: infuseAccess.value === 'Everyone',
}
: {}),
attributes: [
...simpleAttributes(),
...attributes.value.filter((a) => a.key !== '' && a.value !== ''),
Expand Down

0 comments on commit 04a2918

Please sign in to comment.