cashscript 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Transaction.js +6 -5
- package/package.json +5 -4
package/dist/Transaction.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { hexToBin, binToHex, encodeTransaction, decodeTransaction, } from '@bitauth/libauth';
|
|
2
2
|
import delay from 'delay';
|
|
3
3
|
import { hash256, placeholder, scriptToBytecode, } from '@cashscript/utils';
|
|
4
|
+
import deepEqual from 'fast-deep-equal';
|
|
4
5
|
import { isSignableUtxo, } from './interfaces.js';
|
|
5
6
|
import { meep, createInputScript, getInputSize, createOpReturnOutput, getTxSizeWithoutInputs, getPreimageSize, buildError, createSighashPreimage, validateRecipient, utxoComparator, cashScriptOutputToLibauthOutput, calculateDust, getOutputSize, addressToLockScript, publicKeyToP2PKHLockingBytecode, utxoTokenComparator, } from './utils.js';
|
|
6
7
|
import SignatureTemplate from './SignatureTemplate.js';
|
|
@@ -221,9 +222,9 @@ export class Transaction {
|
|
|
221
222
|
if (nftInput.capability === 'none') {
|
|
222
223
|
for (let i = 0; i < listNftsOutputs.length; i += 1) {
|
|
223
224
|
// Deep equality check token objects
|
|
224
|
-
if (
|
|
225
|
+
if (deepEqual(listNftsOutputs[i], nftInput)) {
|
|
225
226
|
listNftsOutputs.splice(i, 1);
|
|
226
|
-
unusedNfts = unusedNfts.filter((nft) => nft
|
|
227
|
+
unusedNfts = unusedNfts.filter((nft) => !deepEqual(nft, nftInput));
|
|
227
228
|
break;
|
|
228
229
|
}
|
|
229
230
|
}
|
|
@@ -234,7 +235,7 @@ export class Transaction {
|
|
|
234
235
|
// eslint-disable-next-line max-len
|
|
235
236
|
const newListNftsOutputs = listNftsOutputs.filter((nftOutput) => nftOutput.category !== nftInput.category);
|
|
236
237
|
if (newListNftsOutputs !== listNftsOutputs) {
|
|
237
|
-
unusedNfts = unusedNfts.filter((nft) => nft
|
|
238
|
+
unusedNfts = unusedNfts.filter((nft) => !deepEqual(nft, nftInput));
|
|
238
239
|
listNftsOutputs = newListNftsOutputs;
|
|
239
240
|
}
|
|
240
241
|
}
|
|
@@ -242,7 +243,7 @@ export class Transaction {
|
|
|
242
243
|
for (let i = 0; i < listNftsOutputs.length; i += 1) {
|
|
243
244
|
if (listNftsOutputs[i].category === nftInput.category) {
|
|
244
245
|
listNftsOutputs.splice(i, 1);
|
|
245
|
-
unusedNfts = unusedNfts.filter((nft) => nft
|
|
246
|
+
unusedNfts = unusedNfts.filter((nft) => !deepEqual(nft, nftInput));
|
|
246
247
|
break;
|
|
247
248
|
}
|
|
248
249
|
}
|
|
@@ -251,7 +252,7 @@ export class Transaction {
|
|
|
251
252
|
for (const nftOutput of listNftsOutputs) {
|
|
252
253
|
const genesisUtxo = getTokenGenesisUtxo(this.inputs, nftOutput.category);
|
|
253
254
|
if (genesisUtxo) {
|
|
254
|
-
listNftsOutputs = listNftsOutputs.filter((nft) => nft
|
|
255
|
+
listNftsOutputs = listNftsOutputs.filter((nft) => !deepEqual(nft, nftOutput));
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
if (listNftsOutputs.length !== 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cashscript",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Easily write and interact with Bitcoin Cash contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -44,11 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bitauth/libauth": "^2.0.0-alpha.8",
|
|
47
|
-
"@cashscript/utils": "^0.8.
|
|
47
|
+
"@cashscript/utils": "^0.8.1",
|
|
48
48
|
"bip68": "^1.0.4",
|
|
49
49
|
"bitcoin-rpc-promise-retry": "^1.3.0",
|
|
50
50
|
"delay": "^5.0.0",
|
|
51
|
-
"electrum-cash": "^2.0.10"
|
|
51
|
+
"electrum-cash": "^2.0.10",
|
|
52
|
+
"fast-deep-equal": "^3.1.3"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@jest/globals": "^29.4.1",
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"jest": "^29.4.1",
|
|
59
60
|
"typescript": "^4.1.5"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a70a5a57a938bc81fdf4180b1451cfcc0ff0214b"
|
|
62
63
|
}
|