Walletrpc.WalletService.WalletServiceClient.ImportPrivateKeyAsync C# (CSharp) Method

ImportPrivateKeyAsync() public method

public ImportPrivateKeyAsync ( global request, CallOptions options ) : AsyncUnaryCall
request global
options CallOptions
return AsyncUnaryCall
      public AsyncUnaryCall<global::Walletrpc.ImportPrivateKeyResponse> ImportPrivateKeyAsync(global::Walletrpc.ImportPrivateKeyRequest request, CallOptions options)
      {
        var call = CreateCall(__Method_ImportPrivateKey, options);
        return Calls.AsyncUnaryCall(call, request);
      }
      public global::Walletrpc.FundTransactionResponse FundTransaction(global::Walletrpc.FundTransactionRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))

Same methods

WalletService.WalletServiceClient::ImportPrivateKeyAsync ( global request, Metadata headers = null, DateTime deadline = null, CancellationToken cancellationToken = default(CancellationToken) ) : AsyncUnaryCall

Usage Example

Example #1
0
        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);
        }