Exemplo n.º 1
0
        public async Task <TupleValue <string, bool> > ImportScriptAsync(byte[] scriptBytes, bool rescan, int scanFrom,
                                                                         string passphrase, bool requireRedeemable)
        {
            if (scriptBytes == null)
            {
                throw new ArgumentNullException(nameof(scriptBytes));
            }
            if (passphrase == null)
            {
                throw new ArgumentNullException(nameof(passphrase));
            }

            var client  = new WalletService.WalletServiceClient(_channel);
            var request = new ImportScriptRequest
            {
                Script            = ByteString.CopyFrom(scriptBytes),
                Rescan            = rescan,
                Passphrase        = ByteString.CopyFromUtf8(passphrase), // Poorly named: this outputs UTF8 from a UTF16 System.String
                ScanFrom          = scanFrom,
                RequireRedeemable = requireRedeemable,
            };
            var resp = await client.ImportScriptAsync(request, cancellationToken : _tokenSource.Token);

            return(TupleValue.Create(resp.P2ShAddress, resp.Redeemable));
        }
Exemplo n.º 2
0
        public async Task ImportScriptAsync(byte[] scriptBytes, bool rescan, int scanFrom, string passphrase)
        {
            if (scriptBytes == null)
            {
                throw new ArgumentNullException(nameof(scriptBytes));
            }
            if (passphrase == null)
            {
                throw new ArgumentNullException(nameof(passphrase));
            }

            var client  = new WalletService.WalletServiceClient(_channel);
            var request = new ImportScriptRequest
            {
                Script     = ByteString.CopyFrom(scriptBytes),
                Rescan     = rescan,
                Passphrase = ByteString.CopyFromUtf8(passphrase), // Poorly named: this outputs UTF8 from a UTF16 System.String
                ScanFrom   = scanFrom,
            };
            await client.ImportScriptAsync(request, cancellationToken : _tokenSource.Token);
        }
Exemplo n.º 3
0
        public async Task ImportScriptAsync(byte[] scriptBytes, bool rescan, int scanFrom, string passphrase)
        {
            if (scriptBytes == null)
                throw new ArgumentNullException(nameof(scriptBytes));
            if (passphrase == null)
                throw new ArgumentNullException(nameof(passphrase));

            var client = new WalletService.WalletServiceClient(_channel);
            var request = new ImportScriptRequest
            {
                Script = ByteString.CopyFrom(scriptBytes),
                Rescan = rescan,
                Passphrase = ByteString.CopyFromUtf8(passphrase), // Poorly named: this outputs UTF8 from a UTF16 System.String
                ScanFrom = scanFrom,
            };
            await client.ImportScriptAsync(request, cancellationToken: _tokenSource.Token);
        }