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