@thesingularitynetwork/darkswap-sdk 0.1.26 → 0.1.27
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/darkswap-sdk.cjs.development.js +42 -14
- package/dist/darkswap-sdk.cjs.development.js.map +1 -1
- package/dist/darkswap-sdk.cjs.production.min.js +1 -1
- package/dist/darkswap-sdk.cjs.production.min.js.map +1 -1
- package/dist/darkswap-sdk.esm.js +42 -14
- package/dist/darkswap-sdk.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/darkswap-sdk.esm.js
CHANGED
|
@@ -4649,31 +4649,59 @@ function multiGetMerklePathAndRoot(_x3, _x4) {
|
|
|
4649
4649
|
}
|
|
4650
4650
|
function _multiGetMerklePathAndRoot() {
|
|
4651
4651
|
_multiGetMerklePathAndRoot = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(notes, darkSwap) {
|
|
4652
|
-
var contract, _yield$contract$getMu, root, paths, indexes,
|
|
4652
|
+
var contract, results, _yield$contract$getMu, root, paths, indexes, i, _yield$contract$getMu2, _root, _paths, _indexes;
|
|
4653
4653
|
return _regenerator().w(function (_context2) {
|
|
4654
4654
|
while (1) switch (_context2.n) {
|
|
4655
4655
|
case 0:
|
|
4656
4656
|
contract = getContract$1(darkSwap.contracts.merkleTreeOperator, darkSwap);
|
|
4657
|
+
results = [];
|
|
4657
4658
|
_context2.n = 1;
|
|
4658
|
-
return contract.getMultiMerklePaths(notes
|
|
4659
|
-
return hexlify32(note);
|
|
4660
|
-
}));
|
|
4659
|
+
return contract.getMultiMerklePaths([hexlify32(notes[0])]);
|
|
4661
4660
|
case 1:
|
|
4662
4661
|
_yield$contract$getMu = _context2.v;
|
|
4663
4662
|
root = _yield$contract$getMu[0];
|
|
4664
4663
|
paths = _yield$contract$getMu[1];
|
|
4665
4664
|
indexes = _yield$contract$getMu[2];
|
|
4666
|
-
results
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4665
|
+
results.push({
|
|
4666
|
+
noteCommitment: notes[0],
|
|
4667
|
+
path: paths[0],
|
|
4668
|
+
index: indexes[0].map(function (x) {
|
|
4669
|
+
return x ? 1 : 0;
|
|
4670
|
+
}),
|
|
4671
|
+
root: root
|
|
4672
|
+
});
|
|
4673
|
+
i = 1;
|
|
4674
|
+
case 2:
|
|
4675
|
+
if (!(i < notes.length)) {
|
|
4676
|
+
_context2.n = 6;
|
|
4677
|
+
break;
|
|
4676
4678
|
}
|
|
4679
|
+
_context2.n = 3;
|
|
4680
|
+
return contract.getMultiMerklePaths([hexlify32(notes[i])]);
|
|
4681
|
+
case 3:
|
|
4682
|
+
_yield$contract$getMu2 = _context2.v;
|
|
4683
|
+
_root = _yield$contract$getMu2[0];
|
|
4684
|
+
_paths = _yield$contract$getMu2[1];
|
|
4685
|
+
_indexes = _yield$contract$getMu2[2];
|
|
4686
|
+
if (!(_root != results[0].root)) {
|
|
4687
|
+
_context2.n = 4;
|
|
4688
|
+
break;
|
|
4689
|
+
}
|
|
4690
|
+
throw new DarkSwapError('Merkle root not match for multi notes, please try again');
|
|
4691
|
+
case 4:
|
|
4692
|
+
results.push({
|
|
4693
|
+
noteCommitment: notes[i],
|
|
4694
|
+
path: _paths[0],
|
|
4695
|
+
index: _indexes[0].map(function (x) {
|
|
4696
|
+
return x ? 1 : 0;
|
|
4697
|
+
}),
|
|
4698
|
+
root: _root
|
|
4699
|
+
});
|
|
4700
|
+
case 5:
|
|
4701
|
+
i++;
|
|
4702
|
+
_context2.n = 2;
|
|
4703
|
+
break;
|
|
4704
|
+
case 6:
|
|
4677
4705
|
return _context2.a(2, results);
|
|
4678
4706
|
}
|
|
4679
4707
|
}, _callee2);
|