Skip to content
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
15 changes: 9 additions & 6 deletions packages/komodo_defi_sdk/example/lib/screens/asset_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ class _AssetHeaderState extends State<AssetHeader> {
_currentUser?.authOptions.derivationMethod == DerivationMethod.hdWallet;
final hasAddresses =
widget.pubkeys != null && widget.pubkeys!.keys.isNotEmpty;
final supportsSigning = widget.asset.supportsMessageSigning;

return Wrap(
alignment: WrapAlignment.spaceEvenly,
Expand Down Expand Up @@ -357,14 +358,16 @@ class _AssetHeaderState extends State<AssetHeader> {

Tooltip(
message:
!hasAddresses
? 'No addresses available to sign with'
: isHdWallet
? 'Will sign with the first address'
: 'Sign a message with this address',
supportsSigning
? !hasAddresses
? 'No addresses available to sign with'
: isHdWallet
? 'Will sign with the first address'
: 'Sign a message with this address'
: 'Message signing not supported for this asset',
Comment thread
CharlVS marked this conversation as resolved.
child: FilledButton.tonalIcon(
onPressed:
_isSigningMessage || !hasAddresses
_isSigningMessage || !hasAddresses || !supportsSigning
? null
: () => _showSignMessageDialog(context),
icon: const Icon(Icons.edit_document),
Expand Down
6 changes: 6 additions & 0 deletions packages/komodo_defi_types/lib/src/assets/asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class Asset extends Equatable {
final bool isWalletOnly;
final String? signMessagePrefix;

/// Whether this asset supports message signing.
///
/// Determined by the presence of the `sign_message_prefix` field in the
/// coin config.
bool get supportsMessageSigning => signMessagePrefix != null;

JsonMap toJson() => {
'protocol': protocol.toJson(),
'id': id.toJson(),
Expand Down
Loading