@thesingularitynetwork/darkswap-sdk 0.1.12 → 0.1.13
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 +2 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/proof/retail/swapProof.d.ts +0 -2
- package/dist/types/src/services/agent/index.d.ts +1 -0
- package/dist/types/src/services/agent/retailSwap.d.ts +25 -0
- package/package.json +1 -1
- package/src/proof/retail/swapProof.ts +5 -10
- package/src/services/agent/index.ts +1 -0
- package/src/services/agent/retailSwap.ts +116 -0
- package/src/services/pro/proSwap.ts +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -6293,7 +6293,8 @@ class ProSwapService extends BaseContractService {
|
|
|
6293
6293
|
const [pubKey, privKey] = await generateKeyPair(signature);
|
|
6294
6294
|
const feeAmount = swapInAmount * orderNote.feeRatio / FEE_RATIO_PRECISION;
|
|
6295
6295
|
const swapInNote = createNote(address, swapInAsset, swapInAmount - feeAmount, pubKey);
|
|
6296
|
-
|
|
6296
|
+
const darkSwapMessage = await generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
|
|
6297
|
+
return darkSwapMessage;
|
|
6297
6298
|
}
|
|
6298
6299
|
async prepare(address, orderNote, bobAddress, bobSwapMessage, signature) {
|
|
6299
6300
|
const [pubKey] = await generateKeyPair(signature);
|
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -6293,7 +6293,8 @@ class ProSwapService extends BaseContractService {
|
|
|
6293
6293
|
const [pubKey, privKey] = await generateKeyPair(signature);
|
|
6294
6294
|
const feeAmount = swapInAmount * orderNote.feeRatio / FEE_RATIO_PRECISION;
|
|
6295
6295
|
const swapInNote = createNote(address, swapInAsset, swapInAmount - feeAmount, pubKey);
|
|
6296
|
-
|
|
6296
|
+
const darkSwapMessage = await generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
|
|
6297
|
+
return darkSwapMessage;
|
|
6297
6298
|
}
|
|
6298
6299
|
async prepare(address, orderNote, bobAddress, bobSwapMessage, signature) {
|
|
6299
6300
|
const [pubKey] = await generateKeyPair(signature);
|
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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@ -6293,7 +6293,8 @@
|
|
|
6293
6293
|
const [pubKey, privKey] = await generateKeyPair(signature);
|
|
6294
6294
|
const feeAmount = swapInAmount * orderNote.feeRatio / FEE_RATIO_PRECISION;
|
|
6295
6295
|
const swapInNote = createNote(address, swapInAsset, swapInAmount - feeAmount, pubKey);
|
|
6296
|
-
|
|
6296
|
+
const darkSwapMessage = await generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
|
|
6297
|
+
return darkSwapMessage;
|
|
6297
6298
|
}
|
|
6298
6299
|
async prepare(address, orderNote, bobAddress, bobSwapMessage, signature) {
|
|
6299
6300
|
const [pubKey] = await generateKeyPair(signature);
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,11 +3,9 @@ export type RetailSwapProofParam = {
|
|
|
3
3
|
merkleRoot: string;
|
|
4
4
|
aliceMerkleIndex: number[];
|
|
5
5
|
aliceMerklePath: string[];
|
|
6
|
-
aliceAddress: string;
|
|
7
6
|
aliceMessage: DarkSwapMessage;
|
|
8
7
|
bobMerkleIndex: number[];
|
|
9
8
|
bobMerklePath: string[];
|
|
10
|
-
bobAddress: string;
|
|
11
9
|
bobMessage: DarkSwapMessage;
|
|
12
10
|
};
|
|
13
11
|
export type RetailSwapProofResult = BaseProofResult & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './retailSwap';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { RetailSwapProofResult } from '../../proof/retail/swapProof';
|
|
3
|
+
import { DarkSwapMessage } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class RetailSwapContext extends BaseContext {
|
|
6
|
+
private _aliceSwapMessage?;
|
|
7
|
+
private _bobSwapMessage?;
|
|
8
|
+
private _proof?;
|
|
9
|
+
constructor(signature: string);
|
|
10
|
+
set aliceSwapMessage(aliceSwapMessage: DarkSwapMessage | undefined);
|
|
11
|
+
get aliceSwapMessage(): DarkSwapMessage | undefined;
|
|
12
|
+
set bobSwapMessage(bobSwapMessage: DarkSwapMessage | undefined);
|
|
13
|
+
get bobSwapMessage(): DarkSwapMessage | undefined;
|
|
14
|
+
set proof(proof: RetailSwapProofResult | undefined);
|
|
15
|
+
get proof(): RetailSwapProofResult | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare class RetailSwapService extends BaseContractService {
|
|
18
|
+
constructor(_darkSwap: DarkSwap);
|
|
19
|
+
prepare(aliceSwapMessage: DarkSwapMessage, bobSwapMessage: DarkSwapMessage): Promise<{
|
|
20
|
+
context: RetailSwapContext;
|
|
21
|
+
}>;
|
|
22
|
+
private generateProof;
|
|
23
|
+
execute(context: RetailSwapContext): Promise<string>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Field } from "@noir-lang/types";
|
|
2
1
|
import retailSwapCircuit from "../../circuits/retail/dark_swap_retail_swap_compiled_circuit.json";
|
|
3
|
-
import { BaseProofResult, DarkSwapMessage,
|
|
2
|
+
import { BaseProofResult, DarkSwapMessage, DarkSwapProofError, FEE_RATIO_PRECISION } from "../../types";
|
|
4
3
|
import { encodeAddress } from "../../utils/encoders";
|
|
5
|
-
import { bn_to_0xhex
|
|
6
|
-
import { mimc_bn254 } from "../../utils/mimc";
|
|
4
|
+
import { bn_to_0xhex } from "../../utils/formatters";
|
|
7
5
|
import { hexStringToSignature, uint8ArrayToNumberArray } from "../../utils/proofUtils";
|
|
8
|
-
import { generateProof
|
|
9
|
-
import { generateKeyPair } from "../keyService";
|
|
6
|
+
import { generateProof } from "../baseProofService";
|
|
10
7
|
import { calcNullifier, getNoteFooter } from "../noteService";
|
|
11
8
|
|
|
12
9
|
type RetailSwapProofInput = {
|
|
@@ -65,12 +62,10 @@ export type RetailSwapProofParam = {
|
|
|
65
62
|
merkleRoot: string,
|
|
66
63
|
aliceMerkleIndex: number[],
|
|
67
64
|
aliceMerklePath: string[],
|
|
68
|
-
aliceAddress: string,
|
|
69
65
|
aliceMessage: DarkSwapMessage,
|
|
70
66
|
|
|
71
67
|
bobMerkleIndex: number[],
|
|
72
68
|
bobMerklePath: string[],
|
|
73
|
-
bobAddress: string,
|
|
74
69
|
bobMessage: DarkSwapMessage,
|
|
75
70
|
}
|
|
76
71
|
|
|
@@ -108,8 +103,8 @@ export async function generateRetailSwapProof(param: RetailSwapProofParam): Prom
|
|
|
108
103
|
const bobOrderNoteNullifier = calcNullifier(param.bobMessage.orderNote.rho, param.bobMessage.publicKey);
|
|
109
104
|
const bobInNoteFooter = getNoteFooter(param.bobMessage.inNote.rho, param.bobMessage.publicKey);
|
|
110
105
|
|
|
111
|
-
const aliceAddressMod = encodeAddress(param.
|
|
112
|
-
const bobAddressMod = encodeAddress(param.
|
|
106
|
+
const aliceAddressMod = encodeAddress(param.aliceMessage.address);
|
|
107
|
+
const bobAddressMod = encodeAddress(param.bobMessage.address);
|
|
113
108
|
|
|
114
109
|
const inputs: RetailSwapProofInput = {
|
|
115
110
|
merkle_root: param.merkleRoot,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './retailSwap';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import DarkSwapAssetManagerAbi from '../../abis/DarkSwapAssetManager.json';
|
|
3
|
+
import { DarkSwap } from '../../darkSwap';
|
|
4
|
+
import { DarkSwapError } from '../../entities';
|
|
5
|
+
import { generateRetailSwapProof, RetailSwapProofResult } from '../../proof/retail/swapProof';
|
|
6
|
+
import { DarkSwapMessage } from '../../types';
|
|
7
|
+
import { hexlify32 } from '../../utils/util';
|
|
8
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
9
|
+
import { multiGetMerklePathAndRoot } from '../merkletree';
|
|
10
|
+
|
|
11
|
+
class RetailSwapContext extends BaseContext {
|
|
12
|
+
private _aliceSwapMessage?: DarkSwapMessage;
|
|
13
|
+
private _bobSwapMessage?: DarkSwapMessage;
|
|
14
|
+
private _proof?: RetailSwapProofResult;
|
|
15
|
+
|
|
16
|
+
constructor(signature: string) {
|
|
17
|
+
super(signature);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set aliceSwapMessage(aliceSwapMessage: DarkSwapMessage | undefined) {
|
|
21
|
+
this._aliceSwapMessage = aliceSwapMessage;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get aliceSwapMessage(): DarkSwapMessage | undefined {
|
|
25
|
+
return this._aliceSwapMessage;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set bobSwapMessage(bobSwapMessage: DarkSwapMessage | undefined) {
|
|
29
|
+
this._bobSwapMessage = bobSwapMessage;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get bobSwapMessage(): DarkSwapMessage | undefined {
|
|
33
|
+
return this._bobSwapMessage;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set proof(proof: RetailSwapProofResult | undefined) {
|
|
37
|
+
this._proof = proof;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get proof(): RetailSwapProofResult | undefined {
|
|
41
|
+
return this._proof;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class RetailSwapService extends BaseContractService {
|
|
46
|
+
constructor(_darkSwap: DarkSwap) {
|
|
47
|
+
super(_darkSwap);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async prepare(
|
|
51
|
+
aliceSwapMessage: DarkSwapMessage,
|
|
52
|
+
bobSwapMessage: DarkSwapMessage
|
|
53
|
+
): Promise<{ context: RetailSwapContext }> {
|
|
54
|
+
const context = new RetailSwapContext(aliceSwapMessage.signature);
|
|
55
|
+
context.aliceSwapMessage = aliceSwapMessage;
|
|
56
|
+
context.bobSwapMessage = bobSwapMessage;
|
|
57
|
+
return { context };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private async generateProof(context: RetailSwapContext): Promise<void> {
|
|
61
|
+
if (!context
|
|
62
|
+
|| !context.aliceSwapMessage
|
|
63
|
+
|| !context.bobSwapMessage) {
|
|
64
|
+
throw new DarkSwapError('Invalid context');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const merklePathes = await multiGetMerklePathAndRoot([context.aliceSwapMessage.orderNote.note, context.bobSwapMessage.orderNote.note], this._darkSwap);
|
|
68
|
+
const aliceOrderNotePath = merklePathes[0];
|
|
69
|
+
const bobOrderNotePath = merklePathes[1];
|
|
70
|
+
|
|
71
|
+
const proof = await generateRetailSwapProof({
|
|
72
|
+
merkleRoot: aliceOrderNotePath.root,
|
|
73
|
+
aliceMerkleIndex: aliceOrderNotePath.index,
|
|
74
|
+
aliceMerklePath: aliceOrderNotePath.path,
|
|
75
|
+
aliceMessage: context.aliceSwapMessage,
|
|
76
|
+
bobMerkleIndex: bobOrderNotePath.index,
|
|
77
|
+
bobMerklePath: bobOrderNotePath.path,
|
|
78
|
+
bobMessage: context.bobSwapMessage,
|
|
79
|
+
});
|
|
80
|
+
context.merkleRoot = aliceOrderNotePath.root;
|
|
81
|
+
context.proof = proof;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public async execute(context: RetailSwapContext): Promise<string> {
|
|
85
|
+
await this.generateProof(context);
|
|
86
|
+
if (!context
|
|
87
|
+
|| !context.merkleRoot
|
|
88
|
+
|| !context.aliceSwapMessage
|
|
89
|
+
|| !context.bobSwapMessage
|
|
90
|
+
|| !context.proof) {
|
|
91
|
+
throw new DarkSwapError('Invalid context');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const contract = new ethers.Contract(
|
|
95
|
+
this._darkSwap.contracts.darkSwapAssetManager,
|
|
96
|
+
DarkSwapAssetManagerAbi.abi,
|
|
97
|
+
this._darkSwap.signer
|
|
98
|
+
);
|
|
99
|
+
const tx = await contract.retailSwap(
|
|
100
|
+
[
|
|
101
|
+
context.merkleRoot,
|
|
102
|
+
hexlify32(context.aliceSwapMessage.orderNote.feeRatio),
|
|
103
|
+
context.proof.aliceOrderNullifier,
|
|
104
|
+
hexlify32(context.aliceSwapMessage.inNote.note),
|
|
105
|
+
context.proof.aliceInNoteFooter,
|
|
106
|
+
hexlify32(context.bobSwapMessage.orderNote.feeRatio),
|
|
107
|
+
context.proof.bobOrderNullifier,
|
|
108
|
+
hexlify32(context.bobSwapMessage.inNote.note),
|
|
109
|
+
context.proof.bobInNoteFooter
|
|
110
|
+
],
|
|
111
|
+
context.proof.proof
|
|
112
|
+
);
|
|
113
|
+
await tx.wait();
|
|
114
|
+
return tx.hash;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -96,7 +96,8 @@ export class ProSwapService extends BaseContractService {
|
|
|
96
96
|
const [pubKey, privKey] = await generateKeyPair(signature);
|
|
97
97
|
const feeAmount = swapInAmount * orderNote.feeRatio / FEE_RATIO_PRECISION;
|
|
98
98
|
const swapInNote = createNote(address, swapInAsset, swapInAmount - feeAmount, pubKey);
|
|
99
|
-
|
|
99
|
+
const darkSwapMessage = await generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
|
|
100
|
+
return darkSwapMessage;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
public async prepare(
|