Class DIDWallet
Wraps a Distributed Identity Wallet
public sealed class DIDWallet : Wallet
- Inheritance
-
DIDWallet
- Inherited Members
- Extension Methods
Remarks
ctor
Constructors
DIDWallet(uint, WalletProxy)
Wraps a Distributed Identity Wallet
public DIDWallet(uint walletId, WalletProxy walletProxy)
Parameters
walletIduintThe wallet_id to wrap
walletProxyWalletProxyWallet RPC proxy to use for communication
Remarks
ctor
Methods
CreateAttest(string, string, string, CancellationToken)
Create an attest file
public Task<(string MessageSpendBundle, (string Parent, string InnerPuzzleHash, ulong Amount) Info, string AttestData, IEnumerable<TransactionRecord> Transactions)> CreateAttest(string coinName, string pubkey, string puzHash, CancellationToken cancellationToken = default)
Parameters
coinNamestringThe coin name
pubkeystringThe public key
puzHashstringThe puzzlehash
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<(string MessageSpendBundle, (string Parent, string InnerPuzzleHash, ulong Amount) Info, string AttestData, IEnumerable<TransactionRecord> Transactions)>
A spendbundle and information about the attest
CreateBackupFile(CancellationToken)
Create a backup of the wallet
public Task<string> CreateBackupFile(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetCurrentCoinInfo(CancellationToken)
Gets information about the DID wallets current coin
public Task<(string MyDid, string Parent, string InnerPuzzle, ulong Amount)> GetCurrentCoinInfo(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetDid(CancellationToken)
Get the distributed identity and coin if present
public Task<(string MyDid, string? CoinID)> GetDid(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetInformationNeededForRecovery(CancellationToken)
Create an attestment
public Task<(string MyDID, string CoinName, string NewPuzzleHash, string PublicKey, IEnumerable<byte> BackUpIds)> GetInformationNeededForRecovery(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<(string MyDID, string CoinName, string NewPuzzleHash, string PublicKey, IEnumerable<byte> BackUpIds)>
A spendbundle and information about the attest
GetMetadata(CancellationToken)
Updates the metadata
public Task<IDictionary<string, string>> GetMetadata(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<IDictionary<string, string>>
The metadata
GetName(CancellationToken)
Get the wallet name
public Task<string> GetName(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetPubKey(CancellationToken)
Get the wallet pubkey
public Task<string> GetPubKey(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetRecoveryList(CancellationToken)
Get the recover list
public Task<(IEnumerable<string> RecoverList, int NumRequired)> GetRecoveryList(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
MessageSpend(IEnumerable<string>, IEnumerable<string>, CancellationToken)
Spends a DID message.
public Task<SpendBundle> MessageSpend(IEnumerable<string> puzzleAnnouncements, IEnumerable<string> coinAnnouncements, CancellationToken cancellationToken = default)
Parameters
puzzleAnnouncementsIEnumerable<string>coinAnnouncementsIEnumerable<string>cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
RecoverySpend(IEnumerable<string>, string?, string?, CancellationToken)
Recovery spend
public Task<(SpendBundle SpendBundle, IEnumerable<TransactionRecord> Transactions)> RecoverySpend(IEnumerable<string> attestData, string? pubkey, string? puzzlehash, CancellationToken cancellationToken = default)
Parameters
attestDataIEnumerable<string>List of attest messages. Must be >= num_of_backup_ids_needed
pubkeystringThe public key
puzzlehashstringThe puzzlehash of the spend
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
SetName(string, CancellationToken)
Sets the name
public Task SetName(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
Spend(string, CancellationToken)
Spend from the DID wallet
public Task Spend(string puzzlehash, CancellationToken cancellationToken = default)
Parameters
puzzlehashstringThe puzzle-hash to spend
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
Transfer(string, bool, bool?, ulong, CancellationToken)
Transfer the DID wallet to another owner
public Task<(TransactionRecord Transaction, IEnumerable<TransactionRecord> Transactions)> Transfer(string innerAddress, bool withRecoveryInfo = true, bool? reusePuzhash = null, ulong fee = 0, CancellationToken cancellationToken = default)
Parameters
innerAddressstringthe address
withRecoveryInfoboolIndicator whether to include recovery info
reusePuzhashbool?feeulongFee (in units of mojos)
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<(TransactionRecord txRecord, IEnumerable<TransactionRecord> transactions)>
The backup data
UpdateMetadata(string, bool?, ulong, CancellationToken)
Updates the metadata
public Task<(SpendBundle SpendBundle, IEnumerable<TransactionRecord> Transactions)> UpdateMetadata(string metadata, bool? reusePuzhash = null, ulong fee = 0, CancellationToken cancellationToken = default)
Parameters
metadatastringThe name
reusePuzhashbool?feeulongFee (in units of mojos)
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
UpdateRecoveryIds(IEnumerable<string>, ulong?, bool?, CancellationToken)
Updates recovery ID's
public Task<IEnumerable<TransactionRecord>> UpdateRecoveryIds(IEnumerable<string> newList, ulong? numVerificationsRequired = null, bool? reusePuzhash = null, CancellationToken cancellationToken = default)
Parameters
newListIEnumerable<string>The new ids
numVerificationsRequiredulong?The number of verifications required
reusePuzhashbool?cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<TransactionRecord>>
A ist of TransactionRecords
UpdateRecoveryIds(IEnumerable<string>, ulong, CancellationToken)
Updates recovery ID's
public Task<IEnumerable<TransactionRecord>> UpdateRecoveryIds(IEnumerable<string> newList, ulong numVerificationsRequired, CancellationToken cancellationToken = default)
Parameters
newListIEnumerable<string>The new ids
numVerificationsRequiredulongThe number of verifications required
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<TransactionRecord>>
A ist of TransactionRecords
Validate(CancellationToken)
Validates that WalletId is a DISTRIBUTED_ID
public override Task Validate(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Wraps a Distributed Identity Wallet
Returns
- Task
True if the wallet is a DID wallet