-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Import Multisig] Added import multisig data logic #35
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
}, | ||
})); | ||
export const StyledStack = styled(Stack, { | ||
shouldForwardProp: (prop) => isPropValid(prop) && prop !== "logoSize", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is definitely the way to go, however when there are several properties it becomes very tedious. But for one or 2 properties let's go this way and lastly try with ownerState
or lowercase 😅
@@ -26,11 +33,15 @@ function WalletImportStep({ | |||
handleThreshold: (threshold: number) => void; | |||
handleAddress: (address: string, step: number, field?: number) => void; | |||
errors: Array<ValidationError[]>; | |||
setErrors: React.Dispatch<React.SetStateAction<ValidationError[][]>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SetState
for better readability
|
||
export function useFetchSignersAccount({ address, walletName }: Props) { | ||
const { loading, error, data } = useQuery<MyQueryResponse>(FETCH_MULTISIG, { | ||
variables: { address }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would to keep the third parties logic on a repository pattern like the others cases (Index DB, LocalStorage).
Something like that:
class XsignerOwnersRepository implements IXsignerOwnersRepository {
constructor(private client: ApolloClient<MyQueryResponse, MyQueryVariables>) {}
async getMultisigByAddress(address: string): Promise<MultisigData | null> {
const { data } = await this.client.query<MyQueryResponse, MyQueryVariables>({
query: FETCH_MULTISIG,
variables: { address },
});
return data?.multisigs[0] || null;
}
}
And then use it in this hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this logic focuses on getting the owners given an xsignerAccount, a name like useFindXsignerOwners
is better.
And in case you imagine it will have more than one hook, its own xsignerOwners
folder.
Closed in favor of #36 |
This PR has the following changes:
useFetchSignersAccount
hook to query graphql multisigs data.handleOwners
method to check for duplicated addresses.