ImportPrivateKeyAsync() public method

public ImportPrivateKeyAsync ( global request, CallOptions options ) : AsyncUnaryCall
request global
options CallOptions
return AsyncUnaryCall
コード例 #1
0
ファイル: WalletClient.cs プロジェクト: decred/Paymetheus
        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);
        }