Skip to content

Commit

Permalink
fix freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Oct 31, 2023
1 parent c1a0563 commit 7f8a2c0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions resources/js/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class ApiService {
collectionId: freezeData.collectionId,
freezeType: freezeData.freezeType,
tokenId: freezeData.tokenId,
freezeState: freezeData.freezeState,
collectionAccount: freezeData.collectionAccount,
tokenAccount: freezeData.tokenAccount,
idempotencyKey: freezeData.idempotencyKey,
Expand Down
3 changes: 1 addition & 2 deletions resources/js/components/CollapseFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
:placeholder="placeholder"
v-model="filter"
:options="options"
>
</FormSelect>
/>
<Btn @click="addItem" class="!py-1 !px-2 !flex" primary>
<PlusIcon class="w-6 h-6 m-auto" />
</Btn>
Expand Down
16 changes: 15 additions & 1 deletion resources/js/components/slideovers/common/FreezeSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
disabled
required
/>
<FormSelect
v-model="freezeState"
label="Freeze State"
name="freezeState"
description="Freeze state to set."
:options="freezeStates"
required
/>
<TokenIdInput
v-if="freezeType === FreezeType.TOKEN"
v-model="tokenId"
Expand Down Expand Up @@ -87,7 +95,7 @@ import FormCheckbox from '~/components/FormCheckbox.vue';
import Btn from '~/components/Btn.vue';
import { ApiService } from '~/api';
import snackbar from '~/util/snackbar';
import { FreezeType, TokenIdSelectType } from '~/types/types.enums';
import { FreezeType, FreezeStateType, TokenIdSelectType } from '~/types/types.enums';
import { formatData, formatToken, snackbarErrors } from '~/util';
import TokenIdInput from '~/components/TokenIdInput.vue';
import { useAppStore } from '~/store';
Expand All @@ -97,6 +105,7 @@ import {
stringNotRequiredSchema,
stringRequiredSchema,
} from '~/util/schemas';
import FormSelect from '~/components/FormSelect.vue';
const emit = defineEmits(['close']);
Expand All @@ -121,11 +130,14 @@ const tokenId = ref({
tokenId: props.item?.tokenId ?? '',
});
const collectionAccount = ref('');
const freezeState = ref(FreezeStateType.PERMANENT);
const tokenAccount = ref('');
const idempotencyKey = ref('');
const skipValidation = ref(false);
const formRef = ref();
const freezeStates = Object.values(FreezeStateType);
const validation = yup.object({
collectionId: collectionIdRequiredSchema,
freezeType: stringRequiredSchema.oneOf(Object.values(FreezeType)),
Expand All @@ -134,6 +146,7 @@ const validation = yup.object({
then: () => stringRequiredSchema,
otherwise: () => stringNotRequiredSchema,
}),
freezeState: stringRequiredSchema.oneOf(freezeStates),
collectionAccount: stringNotRequiredSchema,
tokenAccount: stringNotRequiredSchema,
idempotencyKey: stringNotRequiredSchema,
Expand All @@ -153,6 +166,7 @@ const freeze = async () => {
freezeType: freezeType.value,
tokenId: formatToken(tokenId.value),
collectionAccount: collectionAccount.value,
freezeState: freezeState.value,
tokenAccount: tokenAccount.value,
idempotencyKey: idempotencyKey.value,
skipValidation: skipValidation.value,
Expand Down
3 changes: 2 additions & 1 deletion resources/js/graphql/mutation/Freeze.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export default `mutation Freeze($freezeType: FreezeType!, $collectionId: BigInt!, $tokenId: EncodableTokenIdInput, $collectionAccount: String, $tokenAccount: String, $idempotencyKey: String, $skipValidation: Boolean! = false) {
export default `mutation Freeze($freezeType: FreezeType!, $collectionId: BigInt!, $freezeState: FreezeStateType, $tokenId: EncodableTokenIdInput, $collectionAccount: String, $tokenAccount: String, $idempotencyKey: String, $skipValidation: Boolean! = false) {
Freeze(
freezeType: $freezeType
collectionId: $collectionId
tokenId: $tokenId
freezeState: $freezeState
collectionAccount: $collectionAccount
tokenAccount: $tokenAccount
idempotencyKey: $idempotencyKey
Expand Down
6 changes: 6 additions & 0 deletions resources/js/types/types.enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export enum TokenCapType {
INFINITE = 'INFINITE',
}

export enum FreezeStateType {
PERMANENT = 'PERMANENT',
TEMPORARY = 'TEMPORARY',
NEVER = 'NEVER',
}

export enum TokenIdSelectType {
Integer = 'integer',
StringId = 'stringId',
Expand Down

0 comments on commit 7f8a2c0

Please sign in to comment.