@thesingularitynetwork/darkswap-sdk 0.1.16 → 0.1.17
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/index.esm.js +10 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -12
- package/dist/index.js.map +1 -1
- package/dist/types/src/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/proof/noteService.ts +7 -12
- package/src/types.ts +1 -0
- package/src/utils/swapUtils.ts +2 -0
package/dist/index.esm.js
CHANGED
|
@@ -732,21 +732,15 @@ function mimc_bn254(array) {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
let getRandomValues;
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
getRandomValues = (buf) => {
|
|
742
|
-
const randomBytes = cryptoJs.randomBytes(buf.length);
|
|
743
|
-
buf.set(randomBytes);
|
|
744
|
-
return buf;
|
|
745
|
-
};
|
|
746
|
-
}
|
|
735
|
+
getRandomValues = (buf) => {
|
|
736
|
+
const randomBytes = cryptoJs.randomBytes(buf.length);
|
|
737
|
+
buf.set(randomBytes);
|
|
738
|
+
return buf;
|
|
739
|
+
};
|
|
747
740
|
const DOMAIN_NOTE = 2n;
|
|
748
741
|
const DOMAIN_ORDER_NOTE = 3n;
|
|
749
742
|
const EMPTY_NOTE = {
|
|
743
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
750
744
|
rho: 0n,
|
|
751
745
|
note: 0n,
|
|
752
746
|
amount: 0n,
|
|
@@ -759,6 +753,7 @@ function createNote(address, asset, amount, fuzkPubKey) {
|
|
|
759
753
|
const assetMod = encodeAddress(asset);
|
|
760
754
|
const note = mimc_bn254([DOMAIN_NOTE, addressMod, assetMod, amount, footer]);
|
|
761
755
|
return {
|
|
756
|
+
address,
|
|
762
757
|
rho,
|
|
763
758
|
note,
|
|
764
759
|
asset,
|
|
@@ -806,6 +801,7 @@ function createOrderNoteExt(address, asset, amount, feeRatio, fuzkPubKey) {
|
|
|
806
801
|
footer,
|
|
807
802
|
]);
|
|
808
803
|
return {
|
|
804
|
+
address,
|
|
809
805
|
rho,
|
|
810
806
|
note: noteCommitment,
|
|
811
807
|
asset,
|
|
@@ -7423,6 +7419,7 @@ function deserializeDarkSwapMessage(serializedMessage) {
|
|
|
7423
7419
|
return {
|
|
7424
7420
|
address: message.address,
|
|
7425
7421
|
orderNote: {
|
|
7422
|
+
address: message.orderNote.address,
|
|
7426
7423
|
rho: BigInt(message.orderNote.rho),
|
|
7427
7424
|
amount: BigInt(message.orderNote.amount),
|
|
7428
7425
|
asset: message.orderNote.asset,
|
|
@@ -7431,6 +7428,7 @@ function deserializeDarkSwapMessage(serializedMessage) {
|
|
|
7431
7428
|
},
|
|
7432
7429
|
feeAmount: BigInt(message.feeAmount),
|
|
7433
7430
|
inNote: {
|
|
7431
|
+
address: message.inNote.address,
|
|
7434
7432
|
rho: BigInt(message.inNote.rho),
|
|
7435
7433
|
amount: BigInt(message.inNote.amount),
|
|
7436
7434
|
asset: message.inNote.asset,
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,21 +734,15 @@ function mimc_bn254(array) {
|
|
|
734
734
|
}
|
|
735
735
|
|
|
736
736
|
let getRandomValues;
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
getRandomValues = (buf) => {
|
|
744
|
-
const randomBytes = cryptoJs.randomBytes(buf.length);
|
|
745
|
-
buf.set(randomBytes);
|
|
746
|
-
return buf;
|
|
747
|
-
};
|
|
748
|
-
}
|
|
737
|
+
getRandomValues = (buf) => {
|
|
738
|
+
const randomBytes = cryptoJs.randomBytes(buf.length);
|
|
739
|
+
buf.set(randomBytes);
|
|
740
|
+
return buf;
|
|
741
|
+
};
|
|
749
742
|
const DOMAIN_NOTE = 2n;
|
|
750
743
|
const DOMAIN_ORDER_NOTE = 3n;
|
|
751
744
|
const EMPTY_NOTE = {
|
|
745
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
752
746
|
rho: 0n,
|
|
753
747
|
note: 0n,
|
|
754
748
|
amount: 0n,
|
|
@@ -761,6 +755,7 @@ function createNote(address, asset, amount, fuzkPubKey) {
|
|
|
761
755
|
const assetMod = encodeAddress(asset);
|
|
762
756
|
const note = mimc_bn254([DOMAIN_NOTE, addressMod, assetMod, amount, footer]);
|
|
763
757
|
return {
|
|
758
|
+
address,
|
|
764
759
|
rho,
|
|
765
760
|
note,
|
|
766
761
|
asset,
|
|
@@ -808,6 +803,7 @@ function createOrderNoteExt(address, asset, amount, feeRatio, fuzkPubKey) {
|
|
|
808
803
|
footer,
|
|
809
804
|
]);
|
|
810
805
|
return {
|
|
806
|
+
address,
|
|
811
807
|
rho,
|
|
812
808
|
note: noteCommitment,
|
|
813
809
|
asset,
|
|
@@ -7425,6 +7421,7 @@ function deserializeDarkSwapMessage(serializedMessage) {
|
|
|
7425
7421
|
return {
|
|
7426
7422
|
address: message.address,
|
|
7427
7423
|
orderNote: {
|
|
7424
|
+
address: message.orderNote.address,
|
|
7428
7425
|
rho: BigInt(message.orderNote.rho),
|
|
7429
7426
|
amount: BigInt(message.orderNote.amount),
|
|
7430
7427
|
asset: message.orderNote.asset,
|
|
@@ -7433,6 +7430,7 @@ function deserializeDarkSwapMessage(serializedMessage) {
|
|
|
7433
7430
|
},
|
|
7434
7431
|
feeAmount: BigInt(message.feeAmount),
|
|
7435
7432
|
inNote: {
|
|
7433
|
+
address: message.inNote.address,
|
|
7436
7434
|
rho: BigInt(message.inNote.rho),
|
|
7437
7435
|
amount: BigInt(message.inNote.amount),
|
|
7438
7436
|
asset: message.inNote.asset,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
package/src/proof/noteService.ts
CHANGED
|
@@ -8,24 +8,17 @@ import cryptoJs from 'crypto-js'
|
|
|
8
8
|
|
|
9
9
|
let getRandomValues: (buf: Uint8Array) => Uint8Array
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
) {
|
|
16
|
-
getRandomValues = (buf) => window.crypto.getRandomValues(buf)
|
|
17
|
-
} else {
|
|
18
|
-
getRandomValues = (buf) => {
|
|
19
|
-
const randomBytes = cryptoJs.randomBytes(buf.length)
|
|
20
|
-
buf.set(randomBytes)
|
|
21
|
-
return buf
|
|
22
|
-
}
|
|
11
|
+
getRandomValues = (buf) => {
|
|
12
|
+
const randomBytes = cryptoJs.randomBytes(buf.length)
|
|
13
|
+
buf.set(randomBytes)
|
|
14
|
+
return buf
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
export const DOMAIN_NOTE = 2n
|
|
26
18
|
export const DOMAIN_ORDER_NOTE = 3n
|
|
27
19
|
|
|
28
20
|
export const EMPTY_NOTE: DarkSwapNote = {
|
|
21
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
29
22
|
rho: 0n,
|
|
30
23
|
note: 0n,
|
|
31
24
|
amount: 0n,
|
|
@@ -45,6 +38,7 @@ export function createNote(
|
|
|
45
38
|
const assetMod = encodeAddress(asset)
|
|
46
39
|
const note = mimc_bn254([DOMAIN_NOTE, addressMod, assetMod, amount, footer])
|
|
47
40
|
return {
|
|
41
|
+
address,
|
|
48
42
|
rho,
|
|
49
43
|
note,
|
|
50
44
|
asset,
|
|
@@ -106,6 +100,7 @@ export function createOrderNoteExt(
|
|
|
106
100
|
])
|
|
107
101
|
|
|
108
102
|
return {
|
|
103
|
+
address,
|
|
109
104
|
rho,
|
|
110
105
|
note: noteCommitment,
|
|
111
106
|
asset,
|
package/src/types.ts
CHANGED
package/src/utils/swapUtils.ts
CHANGED
|
@@ -33,6 +33,7 @@ export function deserializeDarkSwapMessage(serializedMessage: string): DarkSwapM
|
|
|
33
33
|
return {
|
|
34
34
|
address: message.address,
|
|
35
35
|
orderNote: {
|
|
36
|
+
address: message.orderNote.address,
|
|
36
37
|
rho: BigInt(message.orderNote.rho),
|
|
37
38
|
amount: BigInt(message.orderNote.amount),
|
|
38
39
|
asset: message.orderNote.asset,
|
|
@@ -41,6 +42,7 @@ export function deserializeDarkSwapMessage(serializedMessage: string): DarkSwapM
|
|
|
41
42
|
},
|
|
42
43
|
feeAmount: BigInt(message.feeAmount),
|
|
43
44
|
inNote: {
|
|
45
|
+
address: message.inNote.address,
|
|
44
46
|
rho: BigInt(message.inNote.rho),
|
|
45
47
|
amount: BigInt(message.inNote.amount),
|
|
46
48
|
asset: message.inNote.asset,
|