Comments (6)
@ekkis can you expand on how the bug manifests itself in SLP-SDK? What is the problem that it causes, exactly?
from slp-sdk.
the lodash owner has agreed to apply a patch, so this should be ok. will post more when done
from slp-sdk.
after a long and painful path, I couldn't figure out how to fix that pile of doodoo so I need to revert back to you guys. here's an example of how this breaks:
const jsp = require('js-prototype-lib');
jsp.install()
const SLP = require('slp-sdk');
var slp = new SLP({restURL: 'https://rest.bitcoin.com/v2/'});
var ret = slp.Mnemonic.toSeed('').toString('hex').substr(0, 16);
console.log(ret);
if you run the above (using the latest 3.3.0 version of SLP), you'll get something like:
/Users/ekkis/dev/now/node_modules/lodash/lodash.js:17045
names.push({ 'name': methodName, 'func': lodashFunc });
^TypeError: names.push is not a function
at /Users/ekkis/dev/now/node_modules/lodash/lodash.js:17045:15
at /Users/ekkis/dev/now/node_modules/lodash/lodash.js:4911:15
at baseForOwn (/Users/ekkis/dev/now/node_modules/lodash/lodash.js:2996:24)
at runInContext (/Users/ekkis/dev/now/node_modules/lodash/lodash.js:17039:5)
at Object. (/Users/ekkis/dev/now/node_modules/lodash/lodash.js:17080:11)
at Object. (/Users/ekkis/dev/now/node_modules/lodash/lodash.js:17107:3)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
which can be solved by applying the following patch:
~/dev/now $ cat patches/lodash+4.17.11.patch
diff --git a/node_modules/lodash/lodash.js b/node_modules/lodash/lodash.js
index cb139dd..9730f52 100644
--- a/node_modules/lodash/lodash.js
+++ b/node_modules/lodash/lodash.js
@@ -17039,8 +17039,11 @@
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
- var key = (lodashFunc.name + ''),
- names = realNames[key] || (realNames[key] = []);
+ var key = (lodashFunc.name + ''), names;
+ if (realNames.hasOwnProperty(key))
+ names = realNames[key];
+ else
+ names = realNames[key] = [];
names.push({ 'name': methodName, 'func': lodashFunc });
}
please help?
from slp-sdk.
I tried recreating the bug. Thank you for the concise code example.
This is the code I tried first and everything ran perfectly:
// Used for debugging and iterrogating JS objects.
const util = require("util");
util.inspect.defaultOptions = {depth: 1};
const SLP = require('slp-sdk')
var slp = new SLP()
let val
// Creates a Buffer
val = slp.Mnemonic.toSeed('')
// Converts the Buffer to a string
val = val.toString('hex')
console.log(`val: ${util.inspect(val)}`)
// val: '4ed8d4b17698ddeaa1f1559f152f87b5d472f725ca86d341bd0276f1b61197e21dd5a391f9f5ed7340ff4d4513aab9cce44f9497a5e7ed85fd818876b6eb402e'
let ret = val.substr(0,16)
console.log(`ret: ${util.inspect(ret)}`)
// ret: '4ed8d4b17698ddea'
It was only when I added this code at the top, that the bug you're reporting manifested itself:
const jsp = require('js-prototype-lib');
jsp.install()
I checked out the npm entry for js-prototype-lib and it says right at the top:
The argument could be made that its use is unadvisable within browsers as your mileage may vary due to the instability of these implementations...
I've never used the js-prototype-lib
and I haven't heard of any reports of any other users using this library or having an issue with lodash.
The obvious solution to me, seems to be avoiding the use of this library.
from slp-sdk.
I ran npm list lodash
. Lodash is not a direct dependency of slp-sdk. It's a dependency of a dependency. There isn't anything we can do within the slp-sdk repo to fix this issue.
from slp-sdk.
I've submitted a patch to lodash that fixes this problem and it has been accepted: lodash/lodash#4290
I've also requested of the Babel team to upgrade to the fixed version of lodash: babel/babel#9966
when that team upgrades I'll need you guys to upgrade
from slp-sdk.
Related Issues (20)
- Allow multiple input addresses in mint operation HOT 2
- Use REST validateTxid method instead of LocalValidator HOT 3
- Babel broken - needs upgrade HOT 1
- Readme Link to SLP API docs is broken/404 HOT 1
- Missing type definition file in root dir
- Required properties should be checked
- Example burn-all is broken HOT 1
- Cannot read property 'concat' of undefined on sending HOT 3
- Determine if utxo is colored on client side
- Is it possible for bch to get burnt in the non slp wallet during burning of slp tokens? HOT 2
- Feature request: Improve docs navigation
- SLPDB URL should not be hard coded.
- slpjs should be configurable for other rest servers HOT 1
- create-wallet example is not working in the browser HOT 2
- Util.tokenUtxoDetails() should check all UTXOs HOT 5
- Refactor Util.isTokenUtxo()
- Websocket listen no longer works
- TokenType1.mint does not support array for fundingAddress and fundingWif HOT 1
- Error: Transaction has no inputs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slp-sdk.