1
1
// Copyright 2022-2024 @paritytech/contracts-ui authors & contributors
2
2
// SPDX-License-Identifier: GPL-3.0-only
3
3
4
- import { useEffect , useState , useRef , useMemo } from 'react' ;
4
+ import { useEffect , useMemo , useRef , useState } from 'react' ;
5
5
import { ResultsOutput } from './ResultsOutput' ;
6
+ import { BN_ZERO } from 'lib/bn' ;
7
+ import {
8
+ decodeStorageDeposit ,
9
+ getGasLimit ,
10
+ getStorageDepositLimit ,
11
+ transformUserInput ,
12
+ } from 'lib/callOptions' ;
13
+ import { getDecodedOutput } from 'lib/output' ;
6
14
import {
7
15
AbiMessage ,
16
+ Balance ,
17
+ CallResult ,
8
18
ContractExecResult ,
19
+ ContractOptions ,
9
20
ContractSubmittableResult ,
10
- CallResult ,
11
21
SubmittableResult ,
12
- ContractOptions ,
13
- Balance ,
14
22
UIContract ,
15
23
} from 'types' ;
16
24
import { AccountSelect } from 'ui/components/account' ;
17
- import { Dropdown , Button , Buttons } from 'ui/components/common' ;
25
+ import { Button , Buttons , Dropdown } from 'ui/components/common' ;
18
26
import { ArgumentForm , Form , FormField , OptionsForm } from 'ui/components/form' ;
19
- import { BN_ZERO } from 'lib/bn' ;
20
27
import { useApi , useTransactions } from 'ui/contexts' ;
21
- import { useWeight , useBalance , useArgValues } from 'ui/hooks' ;
28
+ import { useArgValues , useBalance , useWeight } from 'ui/hooks' ;
29
+ import { useAccountAvailable } from 'ui/hooks/useAccountAvailable' ;
22
30
import { useStorageDepositLimit } from 'ui/hooks/useStorageDepositLimit' ;
23
31
import { createMessageOptions } from 'ui/util/dropdown' ;
24
- import {
25
- decodeStorageDeposit ,
26
- getGasLimit ,
27
- getStorageDepositLimit ,
28
- transformUserInput ,
29
- } from 'lib/callOptions' ;
30
- import { getDecodedOutput } from 'lib/output' ;
31
32
32
33
interface Props {
33
34
contract : UIContract ;
@@ -57,6 +58,7 @@ export const InteractTab = ({
57
58
const proofSize = useWeight ( outcome ?. gasRequired . proofSize . toBn ( ) ) ;
58
59
const timeoutId = useRef < NodeJS . Timeout | null > ( null ) ;
59
60
const isCustom = refTime . mode === 'custom' || proofSize . mode === 'custom' ;
61
+ const isAccountAvailable = useAccountAvailable ( accountId ) ;
60
62
61
63
useEffect ( ( ) : void => {
62
64
if ( ! accounts || accounts . length === 0 ) return ;
@@ -181,7 +183,8 @@ export const InteractTab = ({
181
183
! proofSize . isValid ||
182
184
txs [ txId ] ?. status === 'processing' ||
183
185
! ! outcome ?. result . isErr ||
184
- ! ! decodedOutput ?. isError ;
186
+ ! ! decodedOutput ?. isError ||
187
+ isAccountAvailable === false ;
185
188
186
189
const isDispatchable = message ?. isMutating || message ?. isPayable ;
187
190
@@ -193,7 +196,9 @@ export const InteractTab = ({
193
196
className = "caller mb-8"
194
197
help = "The sending account for this interaction. Any transaction fees will be deducted from this account."
195
198
id = "accountId"
199
+ isError = { isAccountAvailable === false }
196
200
label = "Caller"
201
+ message = "Selected Account is not available to sign extrinsics."
197
202
>
198
203
< AccountSelect
199
204
className = "mb-2"
0 commit comments