diff --git a/apps/ui/src/components/Modal/Delegate.vue b/apps/ui/src/components/Modal/Delegate.vue index 4ceab72bc..994713a89 100644 --- a/apps/ui/src/components/Modal/Delegate.vue +++ b/apps/ui/src/components/Modal/Delegate.vue @@ -47,7 +47,11 @@ const sending = ref(false); const formErrors = ref({} as Record); async function handleSubmit() { - if (!props.delegation.apiType || !props.delegation.contractAddress) { + if ( + !props.delegation.apiType || + !props.delegation.contractAddress || + !props.delegation.chainId + ) { return; } @@ -56,11 +60,10 @@ async function handleSubmit() { try { await delegate( props.space, - props.delegation.contractNetwork, props.delegation.apiType, form.delegatee, - `${props.delegation.contractNetwork}:${props.delegation.contractAddress}`, - props.delegation.chainId ?? undefined + props.delegation.contractAddress, + props.delegation.chainId ); emit('close'); } catch (e) { diff --git a/apps/ui/src/components/Modal/DelegationConfig.vue b/apps/ui/src/components/Modal/DelegationConfig.vue index def7ece27..734562826 100644 --- a/apps/ui/src/components/Modal/DelegationConfig.vue +++ b/apps/ui/src/components/Modal/DelegationConfig.vue @@ -8,7 +8,6 @@ const DEFAULT_FORM_STATE = { name: '', apiType: null, apiUrl: null, - contractNetwork: null, contractAddress: null, chainId: null }; @@ -27,10 +26,6 @@ const showPicker = ref(false); const searchValue = ref(''); const form: Ref = ref(clone(DEFAULT_FORM_STATE)); -const networkField = computed(() => - offchainNetworks.includes(props.networkId) ? 'chainId' : 'contractNetwork' -); - const definition = computed(() => { return { type: 'object', @@ -69,14 +64,15 @@ const definition = computed(() => { 'https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2' ] }, - [networkField.value]: { + chainId: { type: ['string', 'number', 'null'], format: 'network', networkId: props.networkId, + networksListKind: 'full', title: 'Delegation contract network', nullable: true }, - ...(form.value[networkField.value] !== null + ...(form.value.chainId !== null ? { contractAddress: { type: 'string', diff --git a/apps/ui/src/components/Modal/TreasuryConfig.vue b/apps/ui/src/components/Modal/TreasuryConfig.vue index 52372cbd9..cdc171563 100644 --- a/apps/ui/src/components/Modal/TreasuryConfig.vue +++ b/apps/ui/src/components/Modal/TreasuryConfig.vue @@ -47,6 +47,9 @@ const definition = computed(() => { type: ['string', 'number', 'null'], format: 'network', networkId: props.networkId, + networksListKind: offchainNetworks.includes(props.networkId) + ? 'full' + : 'builtin', title: 'Treasury network', nullable: true }, diff --git a/apps/ui/src/components/SpaceDelegates.vue b/apps/ui/src/components/SpaceDelegates.vue index 6449a7693..b5c5f199e 100644 --- a/apps/ui/src/components/SpaceDelegates.vue +++ b/apps/ui/src/components/SpaceDelegates.vue @@ -3,7 +3,6 @@ import { sanitizeUrl } from '@braintree/sanitize-url'; import removeMarkdown from 'remove-markdown'; import { getGenericExplorerUrl } from '@/helpers/explorer'; import { _n, _p, _vp, shorten } from '@/helpers/utils'; -import { getNetwork } from '@/networks'; import { DelegationType, Space, SpaceMetadataDelegation } from '@/types'; const props = defineProps<{ @@ -40,23 +39,11 @@ const { ); const { web3 } = useWeb3(); -const currentNetwork = computed(() => { - if (!props.delegation.contractNetwork) return null; - - try { - return getNetwork(props.delegation.contractNetwork); - } catch (e) { - return null; - } -}); - const spaceKey = computed(() => `${props.space.network}:${props.space.id}`); function getExplorerUrl(address: string, type: 'address' | 'token') { let url: string | null = null; - if (currentNetwork.value) { - url = currentNetwork.value.helpers.getExplorerUrl(address, type); - } else if (props.delegation.chainId) { + if (props.delegation.chainId) { url = getGenericExplorerUrl(props.delegation.chainId, address, type); } else { return null; diff --git a/apps/ui/src/components/Ui/SelectorNetwork.vue b/apps/ui/src/components/Ui/SelectorNetwork.vue index 71bb5a7b1..b11fec7fd 100644 --- a/apps/ui/src/components/Ui/SelectorNetwork.vue +++ b/apps/ui/src/components/Ui/SelectorNetwork.vue @@ -1,7 +1,7 @@