I'm trying to follow this guide and implement a BIP70 payment protocol. https://bitcore.io/api/paypro
In the guide, it shows two required steps which bitcore-payment-protocol
does not provide functionality for. Those two things are:
- creating a output
details.set('outputs', outputs);
- creating a script
outputs.set('script', script.toBuffer()); // an instance of script
So naturally, I figure I need to use the bitcore-lib library to create an output and a script, to be able to implement BIP70 in Bitcore. So I require it like so:
var PaymentProtocol = require('bitcore-payment-protocol');
var BitcoreLib = require('bitcore-lib');
But that's a no-go, it just makes an error when running
$ node bitcoin.js
/Users/chrisgrimmett/scripts/loluwin/node_modules/bitcore-lib/index.js:12
throw new Error(message);
^
Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.
at Object.bitcore.versionGuard (/Users/chrisgrimmett/scripts/loluwin/node_modules/bitcore-lib/index.js:12:11)
at Object.<anonymous> (/Users/chrisgrimmett/scripts/loluwin/node_modules/bitcore-lib/index.js:15:9)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/chrisgrimmett/scripts/loluwin/bitcoin.js:2:18)
at Module._compile (module.js:460:26)
Looking around at other GitHub issues, and judging by the error message itself, the recommended fix seems to be to "check that submodules do not also include their own bitcore-lib dependency." However that doesn't seem possible in bitcore-payment-protocol
...
bitcore-payment-protocol is hard coded to require it's own instance of bitcore-lib and doesn't export a handle, so I don't think I can stop it from including it's own, and I can't "tap into" that instance to implement what I think I need.
Am I doing something wrong?