mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-22 09:02:01 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f34ea286a | ||
|
|
26f39023c4 | ||
|
|
fe37c3ca43 | ||
|
|
ff4ffab670 |
Generated
+22
-23
@@ -9,8 +9,8 @@
|
||||
"version": "4.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bip32-utils": "1.0.1",
|
||||
"@psf/bitcoincash-ops": "2.0.0",
|
||||
"@psf/bitcoincashjs-lib": "4.0.2",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
@@ -286,6 +286,18 @@
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chris.troutner/bip32-utils": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@chris.troutner/bip32-utils/-/bip32-utils-1.0.5.tgz",
|
||||
"integrity": "sha512-pa9dh5VpPmfol1bdLy+FyqONmxlf/QH6Q01a57OP6C9gTVOZM1Rt0kCLXxXKC6e2AnNIrXpYN1UtlyBm+r6P0g==",
|
||||
"dependencies": {
|
||||
"keccak": "^3.0.1",
|
||||
"tape": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.15.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@dabh/diagnostics": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
|
||||
@@ -613,19 +625,6 @@
|
||||
"qs": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bip32-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "http://94.130.170.209:4873/@psf%2fbip32-utils/-/bip32-utils-1.0.1.tgz",
|
||||
"integrity": "sha512-Q4fayYLTZYDQTr/UMas1Zf+LdTBCFuJwPWFWMf36TlhlFSBB+i0cDI2fvbaqaVwUChNQ0ppFrPmypYSgtp4oow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"keccak": "^3.0.1",
|
||||
"tape": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.15.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bitcoincash-ops": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz",
|
||||
@@ -13851,6 +13850,15 @@
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"@chris.troutner/bip32-utils": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@chris.troutner/bip32-utils/-/bip32-utils-1.0.5.tgz",
|
||||
"integrity": "sha512-pa9dh5VpPmfol1bdLy+FyqONmxlf/QH6Q01a57OP6C9gTVOZM1Rt0kCLXxXKC6e2AnNIrXpYN1UtlyBm+r6P0g==",
|
||||
"requires": {
|
||||
"keccak": "^3.0.1",
|
||||
"tape": "*"
|
||||
}
|
||||
},
|
||||
"@dabh/diagnostics": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
|
||||
@@ -14108,15 +14116,6 @@
|
||||
"qs": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"@psf/bip32-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "http://94.130.170.209:4873/@psf%2fbip32-utils/-/bip32-utils-1.0.1.tgz",
|
||||
"integrity": "sha512-Q4fayYLTZYDQTr/UMas1Zf+LdTBCFuJwPWFWMf36TlhlFSBB+i0cDI2fvbaqaVwUChNQ0ppFrPmypYSgtp4oow==",
|
||||
"requires": {
|
||||
"keccak": "^3.0.1",
|
||||
"tape": "*"
|
||||
}
|
||||
},
|
||||
"@psf/bitcoincash-ops": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz",
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bip32-utils": "1.0.1",
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bitcoincash-ops": "2.0.0",
|
||||
"@psf/bitcoincashjs-lib": "4.0.2",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
const Bitcoin = require('@psf/bitcoincashjs-lib')
|
||||
const coininfo = require('@psf/coininfo')
|
||||
const bip32utils = require('@psf/bip32-utils')
|
||||
const bip32utils = require('@chris.troutner/bip32-utils')
|
||||
const bchaddrjs = require('bchaddrjs-slp')
|
||||
|
||||
class HDNode {
|
||||
@@ -34,7 +34,9 @@ class HDNode {
|
||||
*/
|
||||
fromSeed (rootSeedBuffer, network = 'mainnet') {
|
||||
let bitcoincash
|
||||
if (network === 'bitcoincash' || network === 'mainnet') { bitcoincash = coininfo.bitcoincash.main } else bitcoincash = coininfo.bitcoincash.test
|
||||
if (network === 'bitcoincash' || network === 'mainnet') {
|
||||
bitcoincash = coininfo.bitcoincash.main
|
||||
} else bitcoincash = coininfo.bitcoincash.test
|
||||
|
||||
const bitcoincashBitcoinJSLib = bitcoincash.toBitcoinJS()
|
||||
return Bitcoin.HDNode.fromSeedBuffer(
|
||||
|
||||
@@ -379,12 +379,14 @@ class Transaction {
|
||||
thisVin.tokenId = inTokenData.tokenId
|
||||
} else {
|
||||
thisVin.tokenQty = null
|
||||
thisVin.tokenQtyStr = null
|
||||
}
|
||||
} catch (err) {
|
||||
// If decodeOpReturn() throws an error, then this input is not
|
||||
// from an SLP transaction and can be ignored.
|
||||
// thisVin.tokenQty = null
|
||||
thisVin.tokenQty = null
|
||||
thisVin.tokenQtyStr = null
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,6 +351,10 @@ describe('#TransactionLib', () => {
|
||||
assert.property(result.vin[0], 'value')
|
||||
assert.property(result.vin[0], 'tokenQty')
|
||||
|
||||
// Assert that tokenIds and tokenQty are included in inputs.
|
||||
assert.property(result.vin[0], 'tokenId')
|
||||
assert.equal(result.vin[0].tokenQtyStr, '998834')
|
||||
|
||||
// Assert blockheight is added
|
||||
assert.equal(result.blockheight, 603424)
|
||||
})
|
||||
@@ -419,6 +423,12 @@ describe('#TransactionLib', () => {
|
||||
assert.equal(result.vin[0].tokenQty, 10000000)
|
||||
assert.equal(result.vin[1].tokenQty, null)
|
||||
|
||||
// Assert that tokenIds and tokenQty are included in inputs.
|
||||
assert.property(result.vin[0], 'tokenId')
|
||||
assert.equal(result.vin[0].tokenQtyStr, '10000000')
|
||||
assert.equal(result.vin[1].tokenQty, null)
|
||||
assert.equal(result.vin[1].tokenQtyStr, null)
|
||||
|
||||
// Assert blockheight is added
|
||||
assert.equal(result.blockheight, 543409)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user