diff --git a/frontend/src/components/Simulator/ContractParams.vue b/frontend/src/components/Simulator/ContractParams.vue
index ee37771b2..a4c122235 100644
--- a/frontend/src/components/Simulator/ContractParams.vue
+++ b/frontend/src/components/Simulator/ContractParams.vue
@@ -105,6 +105,7 @@ onMounted(() => {
:name="paramName"
:placeholder="`${paramType}`"
:label="paramName"
+ :unionTypes="inputMap.getUnionTypes(paramType)"
/>
{
:name="paramName"
:placeholder="`${paramType}`"
:label="paramName"
+ :unionTypes="inputMap.getUnionTypes(paramType)"
/>
diff --git a/frontend/src/components/global/fields/UnionField.vue b/frontend/src/components/global/fields/UnionField.vue
new file mode 100644
index 000000000..6aa907a15
--- /dev/null
+++ b/frontend/src/components/global/fields/UnionField.vue
@@ -0,0 +1,256 @@
+
+
+
+
+
diff --git a/frontend/src/hooks/useInputMap.ts b/frontend/src/hooks/useInputMap.ts
index 8e1b6928c..5c7a88237 100644
--- a/frontend/src/hooks/useInputMap.ts
+++ b/frontend/src/hooks/useInputMap.ts
@@ -2,6 +2,7 @@ import AnyField from '@/components/global/fields/AnyField.vue';
import StringField from '@/components/global/fields/StringField.vue';
import IntegerField from '@/components/global/fields/IntegerField.vue';
import BooleanField from '@/components/global/fields/BooleanField.vue';
+import UnionField from '@/components/global/fields/UnionField.vue';
import type { ContractParamsSchema } from 'genlayer-js/types';
export const InputTypesMap: { [k: string]: any } = {
@@ -13,9 +14,14 @@ export const InputTypesMap: { [k: string]: any } = {
export const useInputMap = () => {
const getComponent = (type: ContractParamsSchema) => {
+ if (typeof type === 'object' && type !== null && '$or' in type) {
+ return UnionField;
+ }
+
if (typeof type !== 'string') {
type = 'any';
}
+
const component = InputTypesMap[type];
if (!component) {
@@ -28,5 +34,13 @@ export const useInputMap = () => {
return component;
};
- return { getComponent };
+ const getUnionTypes = (type: ContractParamsSchema): string[] => {
+ if (typeof type === 'object' && type !== null && '$or' in type) {
+ return (type as any).$or || [];
+ }
+
+ return [];
+ };
+
+ return { getComponent, getUnionTypes };
};