-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from WalletConnect/feat/wallet-example
Feat/wallet example
- Loading branch information
Showing
19 changed files
with
931 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class AccountDetails { | ||
final String address; | ||
final String chain; | ||
|
||
const AccountDetails({ | ||
required this.address, | ||
required this.chain, | ||
}); | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other is AccountDetails && | ||
other.address == address && | ||
other.chain == chain; | ||
} | ||
|
||
@override | ||
int get hashCode => address.hashCode ^ chain.hashCode; | ||
} | ||
|
||
class Account { | ||
final int id; | ||
final String name; | ||
final String mnemonic; | ||
final String privateKey; | ||
final List<AccountDetails> details; | ||
|
||
const Account({ | ||
required this.id, | ||
required this.name, | ||
required this.mnemonic, | ||
required this.privateKey, | ||
required this.details, | ||
}); | ||
|
||
Account copyWith({ | ||
int? id, | ||
String? name, | ||
String? mnemonic, | ||
String? privateKey, | ||
List<AccountDetails>? details, | ||
}) { | ||
return Account( | ||
id: id ?? this.id, | ||
name: name ?? this.name, | ||
mnemonic: mnemonic ?? this.mnemonic, | ||
privateKey: privateKey ?? this.privateKey, | ||
details: details ?? this.details, | ||
); | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other is Account && | ||
other.id == id && | ||
other.name == name && | ||
other.mnemonic == mnemonic && | ||
other.privateKey == privateKey && | ||
listEquals(other.details, details); | ||
} | ||
|
||
@override | ||
int get hashCode { | ||
return id.hashCode ^ | ||
name.hashCode ^ | ||
mnemonic.hashCode ^ | ||
privateKey.hashCode ^ | ||
details.hashCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
enum ChainType { | ||
eip155, | ||
solana, | ||
kadena, | ||
} | ||
|
||
class ChainMetadata { | ||
final String chainId; | ||
final String name; | ||
final String logo; | ||
final bool isTestnet; | ||
final Color color; | ||
final ChainType type; | ||
final List<String> rpc; | ||
|
||
const ChainMetadata({ | ||
required this.chainId, | ||
required this.name, | ||
required this.logo, | ||
this.isTestnet = false, | ||
required this.color, | ||
required this.type, | ||
required this.rpc, | ||
}); | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other is ChainMetadata && | ||
other.chainId == chainId && | ||
other.name == name && | ||
other.logo == logo && | ||
other.isTestnet == isTestnet && | ||
listEquals(other.rpc, rpc); | ||
} | ||
|
||
@override | ||
int get hashCode { | ||
return chainId.hashCode ^ | ||
name.hashCode ^ | ||
logo.hashCode ^ | ||
rpc.hashCode ^ | ||
isTestnet.hashCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
enum WCSignType { | ||
message, | ||
personalMessage, | ||
typedMessageV2, | ||
typedMessageV3, | ||
typedMessageV4, | ||
} | ||
|
||
class EthereumSignMessage { | ||
final String data; | ||
final String address; | ||
final WCSignType type; | ||
|
||
const EthereumSignMessage({ | ||
required this.data, | ||
required this.address, | ||
required this.type, | ||
}); | ||
} |
Oops, something went wrong.