Skip to content
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

[AMB-114] feat: add account descriptors to wallet settings #30

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/graphql/queries/__generated__/wallet.generated.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/graphql/queries/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const GetWalletDetails = gql`
type
protected_mnemonic
}
accounts {
descriptor
account_type
}
}
}
}
Expand Down
33 changes: 33 additions & 0 deletions src/views/wallet/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,39 @@ export const WalletSettings: FC<{ walletId: string }> = ({ walletId }) => {
</Section>

<WalletMnemonic walletId={walletId} />

<Section
title="Details"
description="Technical information about your wallet, helpful for advanced recovery."
>
{!data?.wallets.find_one.accounts.length ? (
<p className="text-sm text-muted-foreground">No accounts found.</p>
) : (
data.wallets.find_one.accounts.map((a, i) => {
return (
<div key={i}>
<Label htmlFor="descriptor">
<span className="capitalize">
{a.account_type.toLowerCase()}
</span>{' '}
Descriptor
</Label>
<div className="flex gap-2">
<Input id="descriptor" readOnly defaultValue={a.descriptor} />
<Button onClick={() => copy(a.descriptor)}>
{copiedText === a.descriptor ? 'Copied' : 'Copy'}
{copiedText === a.descriptor ? (
<CopyCheck className="ml-2 size-4" color="green" />
) : (
<Copy className="ml-2 size-4" />
)}
</Button>
</div>
</div>
);
})
)}
</Section>
</div>
);
};
Loading