Skip to content

Commit

Permalink
feat: add space params to strategy playground (#4941)
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e authored Dec 2, 2024
1 parent 8d71296 commit bbf46bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/helpers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface StrategyExample {
network: string;
addresses: string[];
snapshot: number;
space?: string;
}

interface StrategySchema {
Expand Down
13 changes: 11 additions & 2 deletions src/views/PlaygroundView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const scores = ref(null);
const searchInput = ref('');
const form = ref<{
params: Record<string, any>;
space: string;
network: string;
snapshot: string;
addresses: string[];
}>({
params: {},
space: '',
network: '1',
snapshot: '',
addresses: []
Expand Down Expand Up @@ -67,14 +69,15 @@ const scoresWithZeroBalanceAddresses = computed(() => {
const strategyExample = computed(() => {
if (queryParams.query) {
try {
const { params, network, snapshot, addresses } = decodeJson(
const { params, network, snapshot, addresses, space } = decodeJson(
queryParams.query
);
return {
...extendedStrategy.value?.examples?.[0],
addresses: addresses || extendedStrategy.value?.examples?.[0].addresses,
network,
snapshot,
space,
strategy: { params }
};
} catch (e) {
Expand All @@ -97,7 +100,7 @@ async function loadScores() {
params: form.value.params
};
scores.value = await getScores(
'',
form.value.space,
[strategyParams],
form.value.network,
form.value.addresses,
Expand Down Expand Up @@ -155,6 +158,7 @@ watch(
() => {
form.value.params = strategyExample.value?.strategy.params ?? defaultParams;
form.value.network = strategyExample.value?.network ?? '1';
form.value.space = strategyExample.value?.space ?? '';
form.value.addresses = strategyExample.value?.addresses ?? [];
},
{ immediate: true }
Expand Down Expand Up @@ -221,6 +225,11 @@ function handleNetworkSelect(value) {
:title="$t('snapshot')"
@update:model-value="handleURLUpdate"
/>
<BaseInput
v-model="form.space"
title="Space"
@update:model-value="handleURLUpdate"
/>
</div>
<BaseBlock
v-if="networkError"
Expand Down

0 comments on commit bbf46bd

Please sign in to comment.