@thesingularitynetwork/darkswap-sdk 0.1.27 → 0.1.28
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 +50 -49
- 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 +50 -49
- package/dist/darkswap-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/test/utils/helpers.d.ts +0 -9
|
@@ -380,6 +380,11 @@ var abi = [
|
|
|
380
380
|
],
|
|
381
381
|
name: "appendMerkleLeaf",
|
|
382
382
|
outputs: [
|
|
383
|
+
{
|
|
384
|
+
internalType: "uint256",
|
|
385
|
+
name: "",
|
|
386
|
+
type: "uint256"
|
|
387
|
+
}
|
|
383
388
|
],
|
|
384
389
|
stateMutability: "nonpayable",
|
|
385
390
|
type: "function"
|
|
@@ -403,6 +408,25 @@ var abi = [
|
|
|
403
408
|
stateMutability: "view",
|
|
404
409
|
type: "function"
|
|
405
410
|
},
|
|
411
|
+
{
|
|
412
|
+
inputs: [
|
|
413
|
+
{
|
|
414
|
+
internalType: "bytes32",
|
|
415
|
+
name: "_noteCommitment",
|
|
416
|
+
type: "bytes32"
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
name: "getCommitmentIndex",
|
|
420
|
+
outputs: [
|
|
421
|
+
{
|
|
422
|
+
internalType: "uint256",
|
|
423
|
+
name: "",
|
|
424
|
+
type: "uint256"
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
stateMutability: "view",
|
|
428
|
+
type: "function"
|
|
429
|
+
},
|
|
406
430
|
{
|
|
407
431
|
inputs: [
|
|
408
432
|
],
|
|
@@ -566,9 +590,9 @@ var abi = [
|
|
|
566
590
|
name: "noteCommitmentsCreated",
|
|
567
591
|
outputs: [
|
|
568
592
|
{
|
|
569
|
-
internalType: "
|
|
570
|
-
name: "
|
|
571
|
-
type: "
|
|
593
|
+
internalType: "uint256",
|
|
594
|
+
name: "commitmentIndex",
|
|
595
|
+
type: "uint256"
|
|
572
596
|
}
|
|
573
597
|
],
|
|
574
598
|
stateMutability: "view",
|
|
@@ -755,6 +779,11 @@ var abi = [
|
|
|
755
779
|
internalType: "bytes32",
|
|
756
780
|
name: "commitment",
|
|
757
781
|
type: "bytes32"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
internalType: "uint256",
|
|
785
|
+
name: "indexOffset",
|
|
786
|
+
type: "uint256"
|
|
758
787
|
}
|
|
759
788
|
],
|
|
760
789
|
name: "setNoteCommitmentCreated",
|
|
@@ -2386,16 +2415,16 @@ function getNoteOnChainStatus(_x, _x2, _x3) {
|
|
|
2386
2415
|
}
|
|
2387
2416
|
function _getNoteOnChainStatus() {
|
|
2388
2417
|
_getNoteOnChainStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(darkSwap, note, nullifier) {
|
|
2389
|
-
var contract,
|
|
2418
|
+
var contract, isNotCreated, isSpent, isLocked;
|
|
2390
2419
|
return _regenerator().w(function (_context) {
|
|
2391
2420
|
while (1) switch (_context.n) {
|
|
2392
2421
|
case 0:
|
|
2393
2422
|
contract = getContract(darkSwap.contracts.merkleTreeOperator, darkSwap);
|
|
2394
2423
|
_context.n = 1;
|
|
2395
|
-
return contract.
|
|
2424
|
+
return contract.noteIsNotCreated(note);
|
|
2396
2425
|
case 1:
|
|
2397
|
-
|
|
2398
|
-
if (
|
|
2426
|
+
isNotCreated = _context.v;
|
|
2427
|
+
if (!isNotCreated) {
|
|
2399
2428
|
_context.n = 2;
|
|
2400
2429
|
break;
|
|
2401
2430
|
}
|
|
@@ -4650,59 +4679,31 @@ function multiGetMerklePathAndRoot(_x3, _x4) {
|
|
|
4650
4679
|
}
|
|
4651
4680
|
function _multiGetMerklePathAndRoot() {
|
|
4652
4681
|
_multiGetMerklePathAndRoot = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(notes, darkSwap) {
|
|
4653
|
-
var contract,
|
|
4682
|
+
var contract, _yield$contract$getMu, root, paths, indexes, results, i;
|
|
4654
4683
|
return _regenerator().w(function (_context2) {
|
|
4655
4684
|
while (1) switch (_context2.n) {
|
|
4656
4685
|
case 0:
|
|
4657
4686
|
contract = getContract$1(darkSwap.contracts.merkleTreeOperator, darkSwap);
|
|
4658
|
-
results = [];
|
|
4659
4687
|
_context2.n = 1;
|
|
4660
|
-
return contract.getMultiMerklePaths(
|
|
4688
|
+
return contract.getMultiMerklePaths(notes.map(function (note) {
|
|
4689
|
+
return hexlify32(note);
|
|
4690
|
+
}));
|
|
4661
4691
|
case 1:
|
|
4662
4692
|
_yield$contract$getMu = _context2.v;
|
|
4663
4693
|
root = _yield$contract$getMu[0];
|
|
4664
4694
|
paths = _yield$contract$getMu[1];
|
|
4665
4695
|
indexes = _yield$contract$getMu[2];
|
|
4666
|
-
results
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
if (!(i < notes.length)) {
|
|
4677
|
-
_context2.n = 6;
|
|
4678
|
-
break;
|
|
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;
|
|
4696
|
+
results = [];
|
|
4697
|
+
for (i = 0; i < notes.length; i++) {
|
|
4698
|
+
results.push({
|
|
4699
|
+
noteCommitment: notes[i],
|
|
4700
|
+
path: paths[i],
|
|
4701
|
+
index: indexes[i].map(function (x) {
|
|
4702
|
+
return x ? 1 : 0;
|
|
4703
|
+
}),
|
|
4704
|
+
root: root
|
|
4705
|
+
});
|
|
4690
4706
|
}
|
|
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:
|
|
4706
4707
|
return _context2.a(2, results);
|
|
4707
4708
|
}
|
|
4708
4709
|
}, _callee2);
|