public async Task ImportPrivateKeyAsync(Account account, string privateKeyWif, bool rescan, string passphrase) { if (privateKeyWif == null) { throw new ArgumentNullException(nameof(privateKeyWif)); } if (passphrase == null) { throw new ArgumentNullException(nameof(passphrase)); } var client = WalletService.NewClient(_channel); var request = new ImportPrivateKeyRequest { Account = account.AccountNumber, PrivateKeyWif = privateKeyWif, Rescan = rescan, Passphrase = ByteString.CopyFromUtf8(passphrase), // Poorly named: this outputs UTF8 from a UTF16 System.String }; await client.ImportPrivateKeyAsync(request, cancellationToken : _tokenSource.Token); }
public async Task ImportPrivateKeyAsync(Account account, string privateKeyWif, bool rescan, string passphrase) { if (privateKeyWif == null) throw new ArgumentNullException(nameof(privateKeyWif)); if (passphrase == null) throw new ArgumentNullException(nameof(passphrase)); var client = new WalletService.WalletServiceClient(_channel); var request = new ImportPrivateKeyRequest { Account = account.AccountNumber, PrivateKeyWif = privateKeyWif, Rescan = rescan, Passphrase = ByteString.CopyFromUtf8(passphrase), // Poorly named: this outputs UTF8 from a UTF16 System.String }; await client.ImportPrivateKeyAsync(request, cancellationToken: _tokenSource.Token); }