@thesingularitynetwork/singularity-sdk-lite 0.0.0-stage → 0.2.0
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/README.md +12 -2
- package/dist/config/contractConfig.d.ts +36 -0
- package/dist/config/stakingConfig.d.ts +8 -0
- package/dist/darkpool.d.ts +16 -0
- package/dist/entities/error.d.ts +3 -0
- package/dist/entities/index.d.ts +6 -0
- package/dist/entities/otcswap.d.ts +31 -0
- package/dist/entities/relayer.d.ts +5 -0
- package/dist/entities/relayerRequestTypes.d.ts +229 -0
- package/dist/entities/token.d.ts +8 -0
- package/dist/entities/types.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/lite.d.ts +11 -0
- package/dist/services/BaseService.d.ts +64 -0
- package/dist/services/base/deposit.d.ts +32 -0
- package/dist/services/base/withdraw.d.ts +38 -0
- package/dist/services/merkletree.d.ts +13 -0
- package/dist/services/noteService.d.ts +10 -0
- package/dist/singularity-sdk-lite.cjs.development.js +3869 -0
- package/dist/singularity-sdk-lite.cjs.development.js.map +1 -0
- package/dist/singularity-sdk-lite.cjs.production.min.js +2 -0
- package/dist/singularity-sdk-lite.cjs.production.min.js.map +1 -0
- package/dist/singularity-sdk-lite.esm.js +3836 -0
- package/dist/singularity-sdk-lite.esm.js.map +1 -0
- package/dist/utils/util.d.ts +9 -0
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# singularity-sdk-lite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deposit and withdraw only. Same code as
|
|
4
|
+
[`@thesingularitynetwork/singularity-sdk`](https://www.npmjs.com/package/@thesingularitynetwork/singularity-sdk)
|
|
5
|
+
of the same version, built on
|
|
6
|
+
[`@thesingularitynetwork/darkpool-v1-proof-lite`](https://www.npmjs.com/package/@thesingularitynetwork/darkpool-v1-proof-lite)
|
|
7
|
+
instead of the full proof package.
|
|
8
|
+
|
|
9
|
+
Exports: `DarkPool`, `DepositService`, `DepositContext`, `WithdrawService`, the base service classes,
|
|
10
|
+
`getMerklePathAndRoot`, the note status functions (`isNoteSpent`, `isNoteValid`, ...), `DarkpoolError`, `Relayer`,
|
|
11
|
+
`NoteOnChainStatus`, `WithdrawRelayerRequest` and the hex helpers (`hexlify32`, ...).
|
|
12
|
+
|
|
13
|
+
Built from the singularity-sdk repository with `yarn build:lite` (output in `lite/`).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type ContractConfiguartion = {
|
|
2
|
+
priceOracle: string;
|
|
3
|
+
ethAddress: string;
|
|
4
|
+
nativeWrapper: string;
|
|
5
|
+
complianceManager: string;
|
|
6
|
+
merkleTreeOperator: string;
|
|
7
|
+
darkpoolAssetManager: string;
|
|
8
|
+
transferAssetManager: string;
|
|
9
|
+
otcSwapAssetManager: string;
|
|
10
|
+
stakingOperator: string;
|
|
11
|
+
stakingAssetManager: string;
|
|
12
|
+
drakpoolSubgraphUrl: string;
|
|
13
|
+
batchJoinSplitAssetManager: string;
|
|
14
|
+
darkpoolSwapAssetManager: string;
|
|
15
|
+
nftAssetManager: string;
|
|
16
|
+
theDeepAssetManager?: string;
|
|
17
|
+
uniswapConfig?: {
|
|
18
|
+
swapRouterAddress: string;
|
|
19
|
+
quoterContractAddress: string;
|
|
20
|
+
wrappedNativeTokenAddress: string;
|
|
21
|
+
v3PosNftAddress: string;
|
|
22
|
+
factoryAddress: string;
|
|
23
|
+
subgraphUrl: string;
|
|
24
|
+
};
|
|
25
|
+
sablierConfig?: {
|
|
26
|
+
aliasPrefixLinear: string;
|
|
27
|
+
aliasPrefixDynamic: string;
|
|
28
|
+
lockupLinear: string;
|
|
29
|
+
lockupDynamic: string;
|
|
30
|
+
sablierDynamicAssetManager: string;
|
|
31
|
+
sablierLinearAssetManager: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const contractConfig: {
|
|
35
|
+
[chainId: number]: ContractConfiguartion;
|
|
36
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { ContractConfiguartion } from './config/contractConfig';
|
|
3
|
+
import { StakingConfig } from './config/stakingConfig';
|
|
4
|
+
import { Relayer } from './entities/relayer';
|
|
5
|
+
import { ProofOptions } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
6
|
+
export declare class DarkPool {
|
|
7
|
+
signer: ethers.Signer;
|
|
8
|
+
provider: ethers.Provider;
|
|
9
|
+
chainId: number;
|
|
10
|
+
relayers: Relayer[];
|
|
11
|
+
contracts: ContractConfiguartion;
|
|
12
|
+
stakingConfigs: StakingConfig[];
|
|
13
|
+
proofOptions?: ProofOptions;
|
|
14
|
+
constructor(signer: ethers.Signer, chainId: number, relayers: Relayer[], contracts?: ContractConfiguartion, stakingConfigs?: StakingConfig[], proofOptions?: ProofOptions);
|
|
15
|
+
getRelayer(): Relayer;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Note, SchnorrSignature } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
export declare type Order = {
|
|
3
|
+
orderId: string;
|
|
4
|
+
makerAsset: string;
|
|
5
|
+
makerAmount: bigint;
|
|
6
|
+
takerAsset: string;
|
|
7
|
+
takerAmount: bigint;
|
|
8
|
+
};
|
|
9
|
+
export declare type OTCSwapMakerMessage = {
|
|
10
|
+
chainId: number;
|
|
11
|
+
orderId: string;
|
|
12
|
+
makerNote: Note;
|
|
13
|
+
makerNoteNullifier: bigint;
|
|
14
|
+
makerNewFooter: bigint;
|
|
15
|
+
makerNewRho: bigint;
|
|
16
|
+
makerPubKey: {
|
|
17
|
+
x: bigint;
|
|
18
|
+
y: bigint;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type OTCSwapFullMessage = OTCSwapMakerMessage & {
|
|
22
|
+
takerNote: Note;
|
|
23
|
+
takerNoteNullifier: bigint;
|
|
24
|
+
takerNewFooter: bigint;
|
|
25
|
+
takerNewRho: bigint;
|
|
26
|
+
takerPubKey: {
|
|
27
|
+
x: bigint;
|
|
28
|
+
y: bigint;
|
|
29
|
+
};
|
|
30
|
+
takerSignature: SchnorrSignature;
|
|
31
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
declare type BaseRelayerRequest = {
|
|
2
|
+
proof: string;
|
|
3
|
+
relayer: string;
|
|
4
|
+
merkleRoot: string;
|
|
5
|
+
verifierArgs: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare type WithdrawRelayerRequest = BaseRelayerRequest & {
|
|
8
|
+
asset: string;
|
|
9
|
+
nullifier: string;
|
|
10
|
+
recipient: string;
|
|
11
|
+
amount: string;
|
|
12
|
+
refund: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type CurveAddLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
15
|
+
nullifiers: string[];
|
|
16
|
+
assets: string[];
|
|
17
|
+
amounts: string[];
|
|
18
|
+
pool: string;
|
|
19
|
+
poolType: string;
|
|
20
|
+
basePoolType: number;
|
|
21
|
+
lpToken: string;
|
|
22
|
+
poolFlag: string;
|
|
23
|
+
booleanFlag: boolean;
|
|
24
|
+
minMintAmount: string;
|
|
25
|
+
noteFooter: string;
|
|
26
|
+
gasRefund: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare type CurveRemoveLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
29
|
+
nullifier: string;
|
|
30
|
+
asset: string;
|
|
31
|
+
amount: string;
|
|
32
|
+
amountBurn: string;
|
|
33
|
+
pool: string;
|
|
34
|
+
poolType: string;
|
|
35
|
+
basePoolType: number;
|
|
36
|
+
assetsOut: string[];
|
|
37
|
+
minExpectedAmountsOut: string[];
|
|
38
|
+
poolFlag: string;
|
|
39
|
+
booleanFlag: boolean;
|
|
40
|
+
noteFooters: string[];
|
|
41
|
+
gasRefund: string[];
|
|
42
|
+
};
|
|
43
|
+
export declare type CurveMultiExchangeRelayerRequest = BaseRelayerRequest & {
|
|
44
|
+
nullifier: string;
|
|
45
|
+
assetIn: string;
|
|
46
|
+
amountIn: string;
|
|
47
|
+
routes: string[];
|
|
48
|
+
swapParams: number[][];
|
|
49
|
+
pools: string[];
|
|
50
|
+
routeHash: string;
|
|
51
|
+
assetOut: string;
|
|
52
|
+
minExpectedAmountOut: string;
|
|
53
|
+
noteFooterOut: string;
|
|
54
|
+
gasRefund: string;
|
|
55
|
+
};
|
|
56
|
+
export declare type UniswapCollectFeesRelayerRequest = BaseRelayerRequest & {
|
|
57
|
+
tokenId: string;
|
|
58
|
+
feeNoteFooter1: string;
|
|
59
|
+
feeNoteFooter2: string;
|
|
60
|
+
relayerGasFeeFromToken1: string;
|
|
61
|
+
relayerGasFeeFromToken2: string;
|
|
62
|
+
};
|
|
63
|
+
export declare type UniswapAddLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
64
|
+
asset1: string;
|
|
65
|
+
amount1: string;
|
|
66
|
+
nullifier1: string;
|
|
67
|
+
asset2: string;
|
|
68
|
+
amount2: string;
|
|
69
|
+
nullifier2: string;
|
|
70
|
+
refundToken1: string;
|
|
71
|
+
refundToken2: string;
|
|
72
|
+
changeNoteFooter1: string;
|
|
73
|
+
changeNoteFooter2: string;
|
|
74
|
+
tickMin: number;
|
|
75
|
+
tickMax: number;
|
|
76
|
+
deadline: string;
|
|
77
|
+
outNoteFooter: string;
|
|
78
|
+
feeTier: string;
|
|
79
|
+
amountMin1: string;
|
|
80
|
+
amountMin2: string;
|
|
81
|
+
};
|
|
82
|
+
export declare type UniswapRemoveLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
83
|
+
nftAddress: string;
|
|
84
|
+
tokenId: string;
|
|
85
|
+
nullifier: string;
|
|
86
|
+
outNoteFooter1: string;
|
|
87
|
+
outNoteFooter2: string;
|
|
88
|
+
relayerGasFeeFromToken1: string;
|
|
89
|
+
relayerGasFeeFromToken2: string;
|
|
90
|
+
deadline: string;
|
|
91
|
+
amount1Min: string;
|
|
92
|
+
amount2Min: string;
|
|
93
|
+
};
|
|
94
|
+
export declare type UniswapSwapRelayerRequest = BaseRelayerRequest & {
|
|
95
|
+
asset: string;
|
|
96
|
+
amount: string;
|
|
97
|
+
nullifier: string;
|
|
98
|
+
assetOut: string;
|
|
99
|
+
amountOutMin: string;
|
|
100
|
+
noteFooterOut: string;
|
|
101
|
+
refund: string;
|
|
102
|
+
poolFee: string;
|
|
103
|
+
};
|
|
104
|
+
export declare type DefiInfraRelayerRequest = BaseRelayerRequest & {
|
|
105
|
+
inNoteType: number;
|
|
106
|
+
inNullifiers: string[];
|
|
107
|
+
inAssets: string[];
|
|
108
|
+
inAmountsOrNftIds: string[];
|
|
109
|
+
contractAddress: string;
|
|
110
|
+
defiParameters: string;
|
|
111
|
+
defiParameterHash: string;
|
|
112
|
+
outNoteType: number;
|
|
113
|
+
outAssets: string[];
|
|
114
|
+
outNoteFooters: string[];
|
|
115
|
+
relayer: string;
|
|
116
|
+
gasRefund: string[];
|
|
117
|
+
};
|
|
118
|
+
export declare type StakeNoteRelayerRequest = BaseRelayerRequest & {
|
|
119
|
+
inAsset: string;
|
|
120
|
+
inNullifier: string;
|
|
121
|
+
outNoteFooter: string;
|
|
122
|
+
inAmount: string;
|
|
123
|
+
refund: string;
|
|
124
|
+
};
|
|
125
|
+
export declare type RedeemRelayerRequest = BaseRelayerRequest & {
|
|
126
|
+
inNullifier: string;
|
|
127
|
+
inAsset: string;
|
|
128
|
+
inAmount: string;
|
|
129
|
+
outNoteFooter: string;
|
|
130
|
+
refund: string;
|
|
131
|
+
};
|
|
132
|
+
export declare type AerodromeSwapSwapCommandDataForRelayer = {
|
|
133
|
+
amountIn: string;
|
|
134
|
+
amountOutMin: string;
|
|
135
|
+
hops: string;
|
|
136
|
+
isUni: boolean;
|
|
137
|
+
};
|
|
138
|
+
export declare type AerodromeSwapRelayerRequest = BaseRelayerRequest & {
|
|
139
|
+
inNullifier: string;
|
|
140
|
+
inAsset: string;
|
|
141
|
+
inAmount: string;
|
|
142
|
+
outAsset: string;
|
|
143
|
+
command: string;
|
|
144
|
+
routes: AerodromeSwapSwapCommandDataForRelayer[];
|
|
145
|
+
routeHash: string;
|
|
146
|
+
minExpectedAmountOut: string;
|
|
147
|
+
deadline: string;
|
|
148
|
+
outNoteFooter: string;
|
|
149
|
+
gasRefund: string;
|
|
150
|
+
};
|
|
151
|
+
export declare type AerodromeAddLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
152
|
+
inNullifier1: string;
|
|
153
|
+
inNullifier2: string;
|
|
154
|
+
inAsset1: string;
|
|
155
|
+
inAsset2: string;
|
|
156
|
+
inAmount1: string;
|
|
157
|
+
inAmount2: string;
|
|
158
|
+
pool: string;
|
|
159
|
+
stable: boolean;
|
|
160
|
+
amount1Min: string;
|
|
161
|
+
amount2Min: string;
|
|
162
|
+
deadline: string;
|
|
163
|
+
outNoteFooter: string;
|
|
164
|
+
outChangeFooter1: string;
|
|
165
|
+
outChangeFooter2: string;
|
|
166
|
+
refundToken1: string;
|
|
167
|
+
refundToken2: string;
|
|
168
|
+
};
|
|
169
|
+
export declare type AerodromeRemoveLiquidityRelayerRequest = BaseRelayerRequest & {
|
|
170
|
+
nullifier: string;
|
|
171
|
+
pool: string;
|
|
172
|
+
amount: string;
|
|
173
|
+
amountBurn: string;
|
|
174
|
+
stable: boolean;
|
|
175
|
+
outAsset1: string;
|
|
176
|
+
outAsset2: string;
|
|
177
|
+
outAmount1Min: string;
|
|
178
|
+
outAmount2Min: string;
|
|
179
|
+
deadline: string;
|
|
180
|
+
outNoteFooter1: string;
|
|
181
|
+
outNoteFooter2: string;
|
|
182
|
+
outChangeNoteFooter: string;
|
|
183
|
+
refundToken1: string;
|
|
184
|
+
refundToken2: string;
|
|
185
|
+
};
|
|
186
|
+
export declare type StakeRocketPoolRelayerRequest = BaseRelayerRequest & {
|
|
187
|
+
nullifier: string;
|
|
188
|
+
amount: string;
|
|
189
|
+
noteFooterOut: string;
|
|
190
|
+
refund: string;
|
|
191
|
+
};
|
|
192
|
+
export declare type UnstakeRocketPoolRelayerRequest = BaseRelayerRequest & {
|
|
193
|
+
nullifier: string;
|
|
194
|
+
amount: string;
|
|
195
|
+
noteFooterOut: string;
|
|
196
|
+
refund: string;
|
|
197
|
+
};
|
|
198
|
+
export declare type ClaimStreamSablierRelayerRequest = BaseRelayerRequest & {
|
|
199
|
+
nullifier: string;
|
|
200
|
+
stream: string;
|
|
201
|
+
streamId: string;
|
|
202
|
+
assetOut: string;
|
|
203
|
+
amountOut: string;
|
|
204
|
+
noteFooterOut: string;
|
|
205
|
+
refund: string;
|
|
206
|
+
};
|
|
207
|
+
export declare type TheDeepNoteDepositRelayerRequest = BaseRelayerRequest & {
|
|
208
|
+
vaultType: string;
|
|
209
|
+
asset1: string;
|
|
210
|
+
amount1: string;
|
|
211
|
+
asset2: string;
|
|
212
|
+
amount2: string;
|
|
213
|
+
inNullifier1: string;
|
|
214
|
+
inNullifier2: string;
|
|
215
|
+
noteFooter: string;
|
|
216
|
+
vaultAddress: string;
|
|
217
|
+
volatility: string;
|
|
218
|
+
refund1: string;
|
|
219
|
+
refund2: string;
|
|
220
|
+
};
|
|
221
|
+
export declare type TheDeepWithdrawRelayerRequest = BaseRelayerRequest & {
|
|
222
|
+
nullifier: string;
|
|
223
|
+
vaultAddress: string;
|
|
224
|
+
amount: string;
|
|
225
|
+
receipt: string;
|
|
226
|
+
refund1: string;
|
|
227
|
+
refund2: string;
|
|
228
|
+
};
|
|
229
|
+
export {};
|
package/dist/index.js
ADDED
package/dist/lite.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './services/base/deposit';
|
|
2
|
+
export * from './services/base/withdraw';
|
|
3
|
+
export * from './services/BaseService';
|
|
4
|
+
export * from './services/merkletree';
|
|
5
|
+
export * from './services/noteService';
|
|
6
|
+
export * from './entities/error';
|
|
7
|
+
export * from './entities/relayer';
|
|
8
|
+
export * from './entities/types';
|
|
9
|
+
export type { WithdrawRelayerRequest } from './entities/relayerRequestTypes';
|
|
10
|
+
export * from './darkpool';
|
|
11
|
+
export * from './utils/util';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Note, PartialNote } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
import { Relayer } from '../entities/relayer';
|
|
3
|
+
import { DarkPool } from '../darkpool';
|
|
4
|
+
export declare class BaseContext {
|
|
5
|
+
private _signature;
|
|
6
|
+
private _merkleRoot?;
|
|
7
|
+
private _tx?;
|
|
8
|
+
constructor(signature: string);
|
|
9
|
+
get signature(): string;
|
|
10
|
+
set merkleRoot(merkleRoot: string | undefined);
|
|
11
|
+
get merkleRoot(): string | undefined;
|
|
12
|
+
set tx(tx: string | undefined);
|
|
13
|
+
get tx(): string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare class BaseRelayerContext extends BaseContext {
|
|
16
|
+
private _relayer;
|
|
17
|
+
private _jobId?;
|
|
18
|
+
constructor(relayer: Relayer, signature: string);
|
|
19
|
+
get relayer(): Relayer;
|
|
20
|
+
set jobId(jobId: string | undefined);
|
|
21
|
+
get jobId(): string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface BaseRelayerResult {
|
|
24
|
+
txHash: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MultiWithdrawResult extends BaseRelayerResult {
|
|
27
|
+
outAmounts: bigint[];
|
|
28
|
+
}
|
|
29
|
+
export interface SingleNoteResult extends BaseRelayerResult {
|
|
30
|
+
note: Note;
|
|
31
|
+
}
|
|
32
|
+
export interface MultiNotesResult extends BaseRelayerResult {
|
|
33
|
+
notes: Note[];
|
|
34
|
+
}
|
|
35
|
+
export declare abstract class BaseContractService<T> {
|
|
36
|
+
protected _darkPool: DarkPool;
|
|
37
|
+
constructor(_darkPool: DarkPool);
|
|
38
|
+
abstract prepare(...args: any[]): Promise<{
|
|
39
|
+
context: T;
|
|
40
|
+
outNotes: Note[];
|
|
41
|
+
}>;
|
|
42
|
+
abstract generateProof(context: T): Promise<void>;
|
|
43
|
+
abstract execute(context: T): Promise<string>;
|
|
44
|
+
}
|
|
45
|
+
export declare abstract class BaseRelayerService<T extends BaseRelayerContext, R, S extends BaseRelayerResult> {
|
|
46
|
+
protected _darkPool: DarkPool;
|
|
47
|
+
constructor(_darkPool: DarkPool);
|
|
48
|
+
abstract prepare(...args: any[]): Promise<{
|
|
49
|
+
context: T;
|
|
50
|
+
outPartialNotes: PartialNote[];
|
|
51
|
+
}>;
|
|
52
|
+
abstract generateProof(context: T): Promise<void>;
|
|
53
|
+
protected abstract getRelayerRequest(context: T): Promise<R>;
|
|
54
|
+
protected abstract getRelayerPath(): string;
|
|
55
|
+
protected abstract postExecute(context: T): Promise<S>;
|
|
56
|
+
execute(context: T): Promise<string>;
|
|
57
|
+
executeAndWaitForResult(context: T): Promise<S>;
|
|
58
|
+
pollJobStatus(context: T): Promise<{
|
|
59
|
+
error: string | undefined;
|
|
60
|
+
txHash: string | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export declare function transferCodeToNoteFooter(transferCode: string, chainId: number): bigint;
|
|
64
|
+
export declare function validateRecipientCode(code: string): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DepositProofResult, Note } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
import { DarkPool } from '../../darkpool';
|
|
3
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
4
|
+
export declare class DepositContext extends BaseContext {
|
|
5
|
+
private _note?;
|
|
6
|
+
private _address?;
|
|
7
|
+
private _proof?;
|
|
8
|
+
constructor(signature: string);
|
|
9
|
+
set note(note: Note | undefined);
|
|
10
|
+
get note(): Note | undefined;
|
|
11
|
+
set address(address: string | undefined);
|
|
12
|
+
get address(): string | undefined;
|
|
13
|
+
set proof(proof: DepositProofResult | undefined);
|
|
14
|
+
get proof(): DepositProofResult | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare class DepositService extends BaseContractService<DepositContext> {
|
|
17
|
+
constructor(_darkPool: DarkPool);
|
|
18
|
+
prepare(asset: string, amount: bigint, walletAddress: string, signature: string): Promise<{
|
|
19
|
+
context: DepositContext;
|
|
20
|
+
outNotes: Note[];
|
|
21
|
+
}>;
|
|
22
|
+
generateProof(context: DepositContext): Promise<void>;
|
|
23
|
+
execute(context: DepositContext): Promise<string>;
|
|
24
|
+
protected allowance(context: DepositContext): Promise<void>;
|
|
25
|
+
getContractCallParameters(context: DepositContext): {
|
|
26
|
+
proof: string;
|
|
27
|
+
asset: string;
|
|
28
|
+
amount: string;
|
|
29
|
+
note: string;
|
|
30
|
+
noteFooter: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Note, PartialNote, WithdrawProofResult } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
import { WithdrawRelayerRequest } from '../../entities/relayerRequestTypes';
|
|
3
|
+
import { BaseRelayerContext, BaseRelayerResult, BaseRelayerService } from '../BaseService';
|
|
4
|
+
import { Relayer } from '../../entities/relayer';
|
|
5
|
+
import { DarkPool } from '../../darkpool';
|
|
6
|
+
declare class WithdrawContext extends BaseRelayerContext {
|
|
7
|
+
private _note?;
|
|
8
|
+
private _recipient?;
|
|
9
|
+
private _proof?;
|
|
10
|
+
constructor(relayer: Relayer, signature: string);
|
|
11
|
+
set note(note: Note | undefined);
|
|
12
|
+
get note(): Note | undefined;
|
|
13
|
+
set recipient(recipient: string | undefined);
|
|
14
|
+
get recipient(): string | undefined;
|
|
15
|
+
set proof(proof: WithdrawProofResult | undefined);
|
|
16
|
+
get proof(): WithdrawProofResult | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class WithdrawService extends BaseRelayerService<WithdrawContext, WithdrawRelayerRequest, BaseRelayerResult> {
|
|
19
|
+
constructor(_darkPool: DarkPool);
|
|
20
|
+
prepare(note: Note, recipient: string, signature: string): Promise<{
|
|
21
|
+
context: WithdrawContext;
|
|
22
|
+
outPartialNotes: PartialNote[];
|
|
23
|
+
}>;
|
|
24
|
+
generateProof(context: WithdrawContext): Promise<void>;
|
|
25
|
+
getRelayerRequest(context: WithdrawContext): Promise<WithdrawRelayerRequest>;
|
|
26
|
+
getRelayerPath(): string;
|
|
27
|
+
postExecute(context: WithdrawContext): Promise<BaseRelayerResult>;
|
|
28
|
+
getRelayerContractCallParameters(context: WithdrawContext): {
|
|
29
|
+
proof: string;
|
|
30
|
+
asset: string;
|
|
31
|
+
merkleRoot: string | undefined;
|
|
32
|
+
nullifier: string;
|
|
33
|
+
recipient: string;
|
|
34
|
+
relayer: string;
|
|
35
|
+
amount: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DarkPool } from '../darkpool';
|
|
2
|
+
export interface MerklePath {
|
|
3
|
+
noteCommitment: bigint;
|
|
4
|
+
path: string[];
|
|
5
|
+
index: number[];
|
|
6
|
+
root: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getMerklePathAndRoot(note: bigint, darkPool: DarkPool): Promise<{
|
|
9
|
+
path: any;
|
|
10
|
+
index: any;
|
|
11
|
+
root: any;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function multiGetMerklePathAndRoot(notes: bigint[], darkPool: DarkPool): Promise<MerklePath[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Note } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
import { DarkPool } from '../darkpool';
|
|
3
|
+
import { NoteOnChainStatus } from '../entities';
|
|
4
|
+
export declare function getNoteOnChainStatusByPublicKey(darkPool: DarkPool, note: Note, publicKey: any): Promise<NoteOnChainStatus>;
|
|
5
|
+
export declare function getNoteOnChainStatusBySignature(darkPool: DarkPool, note: Note, signature: string): Promise<NoteOnChainStatus>;
|
|
6
|
+
export declare function isNoteActive(darkPool: DarkPool, note: Note, signature: string): Promise<boolean>;
|
|
7
|
+
export declare function isNoteSpent(darkPool: DarkPool, note: Note, signature: string): Promise<boolean>;
|
|
8
|
+
export declare function isNoteLocked(darkPool: DarkPool, note: Note, signature: string): Promise<boolean>;
|
|
9
|
+
export declare function isNoteValid(note: Note, signature: string): Promise<boolean>;
|
|
10
|
+
export declare function isNftNoteValid(note: Note, signature: string): Promise<boolean>;
|