1 | var bip70 = require('../main'); |
||
2 | var ProtoBuf = bip70.ProtoBuf; |
||
3 | var HttpClient = bip70.HttpClient; |
||
4 | var RequestValidator = bip70.X509.RequestValidator; |
||
5 | var TrustStore = require('../lib/x509/truststore'); |
||
6 | |||
7 | if (process.argv.length < 3) { |
||
8 | throw new Error("Expecting a url as an argument"); |
||
9 | } |
||
10 | |||
11 | var url = process.argv[2]; |
||
12 | var opts = { |
||
13 | trustStore: TrustStore |
||
14 | }; |
||
15 | var validator = new RequestValidator(opts); |
||
16 | var client = new HttpClient(validator); |
||
17 | |||
18 | client |
||
19 | .getRequest(url, validator) |
||
20 | .then(function(requestData) { |
||
21 | var paymentRequest = requestData[0]; |
||
22 | //var path = requestData[1]; |
||
23 | console.log(paymentRequest); |
||
0 ignored issues
–
show
Debugging Code
introduced
by
![]() |
|||
24 | var details = ProtoBuf.PaymentDetails.decode(paymentRequest.serializedPaymentDetails); |
||
25 | |||
26 | details.outputs.map(function(output,i) { |
||
27 | console.log(" * " + i + " [value: " + output.amount + ", script: " + output.script.toString('hex')) |
||
0 ignored issues
–
show
|
|||
28 | }); |
||
29 | |||
30 | }, function(error) { |
||
31 | console.log(error); |
||
0 ignored issues
–
show
|
|||
32 | }); |
||
33 |