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
walletId
uintThe wallet_id to wrap
walletProxy
WalletProxyWallet 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
coinName
stringThe coin name
pubkey
stringThe public key
puzHash
stringThe puzzlehash
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetPubKey(CancellationToken)
Get the wallet pubkey
public Task<string> GetPubKey(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
puzzleAnnouncements
IEnumerable<string>coinAnnouncements
IEnumerable<string>cancellationToken
CancellationTokenA 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
attestData
IEnumerable<string>List of attest messages. Must be >= num_of_backup_ids_needed
pubkey
stringThe public key
puzzlehash
stringThe puzzlehash of the spend
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
SetName(string, CancellationToken)
Sets the name
public Task SetName(string name, CancellationToken cancellationToken = default)
Parameters
name
stringThe name
cancellationToken
CancellationTokenA 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
puzzlehash
stringThe puzzle-hash to spend
cancellationToken
CancellationTokenA 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
innerAddress
stringthe address
withRecoveryInfo
boolIndicator whether to include recovery info
reusePuzhash
bool?fee
ulongFee (in units of mojos)
cancellationToken
CancellationTokenA 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
metadata
stringThe name
reusePuzhash
bool?fee
ulongFee (in units of mojos)
cancellationToken
CancellationTokenA 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
newList
IEnumerable<string>The new ids
numVerificationsRequired
ulong?The number of verifications required
reusePuzhash
bool?cancellationToken
CancellationTokenA 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
newList
IEnumerable<string>The new ids
numVerificationsRequired
ulongThe number of verifications required
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationToken- Wraps a Distributed Identity Wallet
Returns
- Task
True if the wallet is a DID wallet