@thesingularitynetwork/darkswap-sdk 0.1.7 → 0.1.9

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 CHANGED
@@ -22,7 +22,7 @@ function isHexEquals(hex1, hex2) {
22
22
  return hex1.toLowerCase() === hex2.toLowerCase();
23
23
  }
24
24
 
25
- var abi$b = [
25
+ var abi$c = [
26
26
  {
27
27
  inputs: [
28
28
  {
@@ -566,7 +566,7 @@ var abi$b = [
566
566
  }
567
567
  ];
568
568
  var MerkleAbi = {
569
- abi: abi$b};
569
+ abi: abi$c};
570
570
 
571
571
  class DarkSwapError extends Error {
572
572
  constructor(message) {
@@ -811,12 +811,12 @@ async function generateKeyPair(signature) {
811
811
  return [[publicKey.x, publicKey.y], privateKey];
812
812
  }
813
813
 
814
- function getContract$1(address, darkSwap) {
814
+ function getContract$2(address, darkSwap) {
815
815
  const provider = darkSwap.provider;
816
816
  return new ethers.Contract(address, MerkleAbi.abi, provider);
817
817
  }
818
818
  async function getNoteOnChainStatus(darkSwap, note, nullifier) {
819
- const contract = getContract$1(darkSwap.contracts.merkleTreeOperator, darkSwap);
819
+ const contract = getContract$2(darkSwap.contracts.merkleTreeOperator, darkSwap);
820
820
  const isCreated = (await contract.noteCommitmentsCreated(note));
821
821
  if (!isCreated) {
822
822
  return NoteOnChainStatus.UNKNOWN;
@@ -857,8 +857,12 @@ async function isNoteValid(darkSwap, note, publicKey) {
857
857
  const onChainStatus = await getNoteOnChainStatus(darkSwap, hexlify32(note.note), hexlify32(nullifier));
858
858
  return onChainStatus === NoteOnChainStatus.ACTIVE;
859
859
  }
860
+ async function getNullifierBySignature(note, signature) {
861
+ const [publicKey] = await generateKeyPair(signature);
862
+ return hexlify32(calcNullifier(note.rho, publicKey));
863
+ }
860
864
 
861
- var abi$a = [
865
+ var abi$b = [
862
866
  {
863
867
  inputs: [
864
868
  {
@@ -2049,9 +2053,9 @@ var abi$a = [
2049
2053
  }
2050
2054
  ];
2051
2055
  var DarkSwapAssetManagerAbi = {
2052
- abi: abi$a};
2056
+ abi: abi$b};
2053
2057
 
2054
- var abi$9 = [
2058
+ var abi$a = [
2055
2059
  {
2056
2060
  anonymous: false,
2057
2061
  inputs: [
@@ -2238,9 +2242,9 @@ var abi$9 = [
2238
2242
  }
2239
2243
  ];
2240
2244
  var ERC20Abi = {
2241
- abi: abi$9};
2245
+ abi: abi$a};
2242
2246
 
2243
- var abi$8 = [
2247
+ var abi$9 = [
2244
2248
  {
2245
2249
  anonymous: false,
2246
2250
  inputs: [
@@ -2422,7 +2426,7 @@ var abi$8 = [
2422
2426
  }
2423
2427
  ];
2424
2428
  var ERC20_USDT = {
2425
- abi: abi$8};
2429
+ abi: abi$9};
2426
2430
 
2427
2431
  var ChainId;
2428
2432
  (function (ChainId) {
@@ -2439,11 +2443,11 @@ const legacyTokenConfig = {
2439
2443
  [ChainId.MAINNET]: ['0xdac17f958d2ee523a2206206994597c13d831ec7'],
2440
2444
  [ChainId.HARDHAT]: ['0xdac17f958d2ee523a2206206994597c13d831ec7']
2441
2445
  };
2442
- const FEE_RATIO = 300n;
2446
+ const DEFAULT_FEE_RATIO = 300n;
2443
2447
 
2444
2448
  var noir_version$7 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
2445
2449
  var hash$7 = "7682678699971186506";
2446
- var abi$7 = {
2450
+ var abi$8 = {
2447
2451
  parameters: [
2448
2452
  {
2449
2453
  name: "merkle_root",
@@ -2638,7 +2642,7 @@ var brillig_names$7 = [
2638
2642
  var depositCircuit = {
2639
2643
  noir_version: noir_version$7,
2640
2644
  hash: hash$7,
2641
- abi: abi$7,
2645
+ abi: abi$8,
2642
2646
  bytecode: bytecode$7,
2643
2647
  debug_symbols: debug_symbols$7,
2644
2648
  file_map: file_map$7,
@@ -2817,17 +2821,17 @@ const EMPTY_PATH = {
2817
2821
  index: Array(32).fill(0),
2818
2822
  root: '0x0000000000000000000000000000000000000000000000000000000000000000'
2819
2823
  };
2820
- function getContract(address, darkSwap) {
2824
+ function getContract$1(address, darkSwap) {
2821
2825
  const provider = darkSwap.provider;
2822
2826
  return new ethers.Contract(address, MerkleAbi.abi, provider);
2823
2827
  }
2824
2828
  async function getMerklePathAndRoot(note, darkSwap) {
2825
- const contract = getContract(darkSwap.contracts.merkleTreeOperator, darkSwap);
2829
+ const contract = getContract$1(darkSwap.contracts.merkleTreeOperator, darkSwap);
2826
2830
  const [path, index, root] = await contract.getMerklePath(hexlify32(note));
2827
2831
  return { path, index: index.map((x) => (x ? 1 : 0)), root };
2828
2832
  }
2829
2833
  async function multiGetMerklePathAndRoot(notes, darkSwap) {
2830
- const contract = getContract(darkSwap.contracts.merkleTreeOperator, darkSwap);
2834
+ const contract = getContract$1(darkSwap.contracts.merkleTreeOperator, darkSwap);
2831
2835
  const blockNumber = await darkSwap.provider.getBlockNumber();
2832
2836
  const [root, ...results] = await Promise.all([
2833
2837
  contract.getMerkleRoot({ blockTag: blockNumber }),
@@ -2948,7 +2952,6 @@ class DepositService extends BaseContractService {
2948
2952
  return tx.hash;
2949
2953
  }
2950
2954
  else {
2951
- console.log(context.merkleRoot, context.newBalance.asset, hexlify32(context.depositAmount), context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof);
2952
2955
  const tx = await contract.deposit(context.merkleRoot, context.newBalance.asset, hexlify32(context.depositAmount), context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof, { value: context.depositAmount });
2953
2956
  await tx.wait();
2954
2957
  return tx.hash;
@@ -2973,7 +2976,7 @@ class DepositService extends BaseContractService {
2973
2976
 
2974
2977
  var noir_version$6 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
2975
2978
  var hash$6 = "15365108151991054878";
2976
- var abi$6 = {
2979
+ var abi$7 = {
2977
2980
  parameters: [
2978
2981
  {
2979
2982
  name: "address",
@@ -3168,7 +3171,7 @@ var brillig_names$6 = [
3168
3171
  var withdrawCircuit = {
3169
3172
  noir_version: noir_version$6,
3170
3173
  hash: hash$6,
3171
- abi: abi$6,
3174
+ abi: abi$7,
3172
3175
  bytecode: bytecode$6,
3173
3176
  debug_symbols: debug_symbols$6,
3174
3177
  file_map: file_map$6,
@@ -3282,14 +3285,14 @@ class WithdrawService extends BaseContractService {
3282
3285
  super(_darkSwap);
3283
3286
  }
3284
3287
  async prepare(address, currentBalance, withdrawAmount, signature) {
3285
- const [pubKey, privKey] = await generateKeyPair(signature);
3288
+ const [pubKey] = await generateKeyPair(signature);
3286
3289
  const newBalanceNote = createNote(address, currentBalance.asset, currentBalance.amount - withdrawAmount, pubKey);
3287
3290
  const context = new WithdrawContext(signature);
3288
3291
  context.currentBalance = currentBalance;
3289
3292
  context.newBalance = newBalanceNote;
3290
3293
  context.withdrawAmount = withdrawAmount;
3291
3294
  context.address = address;
3292
- return { context, outNotes: [newBalanceNote] };
3295
+ return { context, newBalanceNote };
3293
3296
  }
3294
3297
  async generateProof(context) {
3295
3298
  if (!context || !context.currentBalance || !context.newBalance || !context.withdrawAmount || !context.address) {
@@ -3314,14 +3317,15 @@ class WithdrawService extends BaseContractService {
3314
3317
  throw new DarkSwapError('Invalid context');
3315
3318
  }
3316
3319
  const contract = new ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
3317
- const tx = await contract.withdraw(context.merkleRoot, context.proof.oldBalanceNullifier, context.proof.newBalanceFooter, context.withdrawAmount, context.proof.proof);
3320
+ const tx = await contract.withdraw(context.merkleRoot, context.currentBalance.asset, context.withdrawAmount, context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof);
3321
+ await tx.wait();
3318
3322
  return tx.hash;
3319
3323
  }
3320
3324
  }
3321
3325
 
3322
3326
  var noir_version$5 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
3323
3327
  var hash$5 = "17244069702039590701";
3324
- var abi$5 = {
3328
+ var abi$6 = {
3325
3329
  parameters: [
3326
3330
  {
3327
3331
  name: "merkle_root",
@@ -3561,7 +3565,7 @@ var brillig_names$5 = [
3561
3565
  var joinCircuit = {
3562
3566
  noir_version: noir_version$5,
3563
3567
  hash: hash$5,
3564
- abi: abi$5,
3568
+ abi: abi$6,
3565
3569
  bytecode: bytecode$5,
3566
3570
  debug_symbols: debug_symbols$5,
3567
3571
  file_map: file_map$5,
@@ -3730,7 +3734,7 @@ class JoinService extends BaseContractService {
3730
3734
 
3731
3735
  var noir_version$4 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
3732
3736
  var hash$4 = "7879007139962935588";
3733
- var abi$4 = {
3737
+ var abi$5 = {
3734
3738
  parameters: [
3735
3739
  {
3736
3740
  name: "merkle_root",
@@ -4022,7 +4026,7 @@ var brillig_names$4 = [
4022
4026
  var tripleJoinCircuit = {
4023
4027
  noir_version: noir_version$4,
4024
4028
  hash: hash$4,
4025
- abi: abi$4,
4029
+ abi: abi$5,
4026
4030
  bytecode: bytecode$4,
4027
4031
  debug_symbols: debug_symbols$4,
4028
4032
  file_map: file_map$4,
@@ -4398,7 +4402,8 @@ class ProCreateOrderService extends BaseContractService {
4398
4402
  }
4399
4403
  async prepare(address, orderAsset, orderAmount, swapInAsset, swapInAmount, balanceNote, signature) {
4400
4404
  const [pubKey] = await generateKeyPair(signature);
4401
- const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, FEE_RATIO, pubKey);
4405
+ const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, DEFAULT_FEE_RATIO, pubKey);
4406
+ const orderNullifier = hexlify32(calcNullifier(orderNote.rho, pubKey));
4402
4407
  const newBalance = createNote(address, orderAsset, balanceNote.amount - orderAmount, pubKey);
4403
4408
  const context = new ProCreateOrderContext(signature);
4404
4409
  context.orderNote = orderNote;
@@ -4407,7 +4412,7 @@ class ProCreateOrderService extends BaseContractService {
4407
4412
  context.oldBalance = balanceNote;
4408
4413
  context.newBalance = newBalance;
4409
4414
  context.address = address;
4410
- return { context, orderNote, newBalance };
4415
+ return { context, orderNote: { ...orderNote, nullifier: orderNullifier }, newBalance };
4411
4416
  }
4412
4417
  async generateProof(context) {
4413
4418
  if (!context
@@ -4455,7 +4460,7 @@ class ProCreateOrderService extends BaseContractService {
4455
4460
 
4456
4461
  var noir_version$3 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
4457
4462
  var hash$3 = "12482019510959241043";
4458
- var abi$3 = {
4463
+ var abi$4 = {
4459
4464
  parameters: [
4460
4465
  {
4461
4466
  name: "merkle_root",
@@ -4702,7 +4707,7 @@ var brillig_names$3 = [
4702
4707
  var proCancelOrderCircuit = {
4703
4708
  noir_version: noir_version$3,
4704
4709
  hash: hash$3,
4705
- abi: abi$3,
4710
+ abi: abi$4,
4706
4711
  bytecode: bytecode$3,
4707
4712
  debug_symbols: debug_symbols$3,
4708
4713
  file_map: file_map$3,
@@ -4874,7 +4879,7 @@ class ProCancelOrderService extends BaseContractService {
4874
4879
 
4875
4880
  var noir_version$2 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
4876
4881
  var hash$2 = "3721322605212299927";
4877
- var abi$2 = {
4882
+ var abi$3 = {
4878
4883
  parameters: [
4879
4884
  {
4880
4885
  name: "merkle_root",
@@ -5229,7 +5234,7 @@ var brillig_names$2 = [
5229
5234
  var swapCircuit = {
5230
5235
  noir_version: noir_version$2,
5231
5236
  hash: hash$2,
5232
- abi: abi$2,
5237
+ abi: abi$3,
5233
5238
  bytecode: bytecode$2,
5234
5239
  debug_symbols: debug_symbols$2,
5235
5240
  file_map: file_map$2,
@@ -5466,7 +5471,7 @@ class ProSwapService extends BaseContractService {
5466
5471
 
5467
5472
  var noir_version$1 = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
5468
5473
  var hash$1 = "4983868594874572748";
5469
- var abi$1 = {
5474
+ var abi$2 = {
5470
5475
  parameters: [
5471
5476
  {
5472
5477
  name: "merkle_root",
@@ -5639,7 +5644,7 @@ var brillig_names$1 = [
5639
5644
  var retailCancelOrderCircuit = {
5640
5645
  noir_version: noir_version$1,
5641
5646
  hash: hash$1,
5642
- abi: abi$1,
5647
+ abi: abi$2,
5643
5648
  bytecode: bytecode$1,
5644
5649
  debug_symbols: debug_symbols$1,
5645
5650
  file_map: file_map$1,
@@ -5756,7 +5761,7 @@ class RetailCancelOrderService extends BaseContractService {
5756
5761
 
5757
5762
  var noir_version = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
5758
5763
  var hash = "16217067117964406131";
5759
- var abi = {
5764
+ var abi$1 = {
5760
5765
  parameters: [
5761
5766
  {
5762
5767
  name: "address",
@@ -5941,7 +5946,7 @@ var brillig_names = [
5941
5946
  var retailCreateOrderCircuit = {
5942
5947
  noir_version: noir_version,
5943
5948
  hash: hash,
5944
- abi: abi,
5949
+ abi: abi$1,
5945
5950
  bytecode: bytecode,
5946
5951
  debug_symbols: debug_symbols,
5947
5952
  file_map: file_map,
@@ -5951,7 +5956,7 @@ var retailCreateOrderCircuit = {
5951
5956
 
5952
5957
  async function generateRetailSwapMessage(address, orderNote, swapInNote, pubKey, privKey) {
5953
5958
  const addressMod = encodeAddress(address);
5954
- calcNullifier(orderNote.rho, pubKey);
5959
+ const orderNoteNullifier = hexlify32(calcNullifier(orderNote.rho, pubKey));
5955
5960
  const message = bn_to_hex(mimc_bn254([
5956
5961
  BigInt(PROOF_DOMAIN.RETAIL_CREATE_ORDER),
5957
5962
  addressMod,
@@ -5962,6 +5967,7 @@ async function generateRetailSwapMessage(address, orderNote, swapInNote, pubKey,
5962
5967
  const signature = await signMessage(message, privKey);
5963
5968
  return {
5964
5969
  orderNote: orderNote,
5970
+ orderNullifier: orderNoteNullifier,
5965
5971
  inNote: swapInNote,
5966
5972
  publicKey: pubKey,
5967
5973
  signature: signature,
@@ -6086,8 +6092,8 @@ class RetailCreateOrderService extends BaseContractService {
6086
6092
  }
6087
6093
  async prepare(address, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
6088
6094
  const [pubKey, privKey] = await generateKeyPair(signature);
6089
- const orderNote = createOrderNoteExt(address, depositAsset, depositAmount, FEE_RATIO, pubKey);
6090
- const feeAmount = (swapInAmount * FEE_RATIO) / FEE_RATIO_PRECISION;
6095
+ const orderNote = createOrderNoteExt(address, depositAsset, depositAmount, DEFAULT_FEE_RATIO, pubKey);
6096
+ const feeAmount = (swapInAmount * DEFAULT_FEE_RATIO) / FEE_RATIO_PRECISION;
6091
6097
  const realSwapInAmount = swapInAmount - feeAmount;
6092
6098
  const swapInNote = createNote(address, swapInAsset, realSwapInAmount, pubKey);
6093
6099
  const context = new RetailCreateOrderContext(signature);
@@ -6127,6 +6133,300 @@ class RetailCreateOrderService extends BaseContractService {
6127
6133
  }
6128
6134
  }
6129
6135
 
6136
+ var abi = [
6137
+ {
6138
+ inputs: [
6139
+ {
6140
+ internalType: "address",
6141
+ name: "assetPoolERC20",
6142
+ type: "address"
6143
+ },
6144
+ {
6145
+ internalType: "address",
6146
+ name: "assetPoolETH",
6147
+ type: "address"
6148
+ },
6149
+ {
6150
+ internalType: "address",
6151
+ name: "initialOwner",
6152
+ type: "address"
6153
+ }
6154
+ ],
6155
+ stateMutability: "nonpayable",
6156
+ type: "constructor"
6157
+ },
6158
+ {
6159
+ inputs: [
6160
+ {
6161
+ internalType: "address",
6162
+ name: "owner",
6163
+ type: "address"
6164
+ }
6165
+ ],
6166
+ name: "OwnableInvalidOwner",
6167
+ type: "error"
6168
+ },
6169
+ {
6170
+ inputs: [
6171
+ {
6172
+ internalType: "address",
6173
+ name: "account",
6174
+ type: "address"
6175
+ }
6176
+ ],
6177
+ name: "OwnableUnauthorizedAccount",
6178
+ type: "error"
6179
+ },
6180
+ {
6181
+ inputs: [
6182
+ {
6183
+ internalType: "address",
6184
+ name: "token",
6185
+ type: "address"
6186
+ }
6187
+ ],
6188
+ name: "SafeERC20FailedOperation",
6189
+ type: "error"
6190
+ },
6191
+ {
6192
+ anonymous: false,
6193
+ inputs: [
6194
+ {
6195
+ indexed: true,
6196
+ internalType: "address",
6197
+ name: "previousOwner",
6198
+ type: "address"
6199
+ },
6200
+ {
6201
+ indexed: true,
6202
+ internalType: "address",
6203
+ name: "newOwner",
6204
+ type: "address"
6205
+ }
6206
+ ],
6207
+ name: "OwnershipTransferred",
6208
+ type: "event"
6209
+ },
6210
+ {
6211
+ stateMutability: "payable",
6212
+ type: "fallback"
6213
+ },
6214
+ {
6215
+ inputs: [
6216
+ {
6217
+ internalType: "address",
6218
+ name: "_wallet",
6219
+ type: "address"
6220
+ },
6221
+ {
6222
+ internalType: "uint8",
6223
+ name: "level",
6224
+ type: "uint8"
6225
+ }
6226
+ ],
6227
+ name: "addMarketMaker",
6228
+ outputs: [
6229
+ ],
6230
+ stateMutability: "nonpayable",
6231
+ type: "function"
6232
+ },
6233
+ {
6234
+ inputs: [
6235
+ {
6236
+ internalType: "address",
6237
+ name: "wallet",
6238
+ type: "address"
6239
+ },
6240
+ {
6241
+ internalType: "uint256",
6242
+ name: "amount",
6243
+ type: "uint256"
6244
+ }
6245
+ ],
6246
+ name: "calculateFee",
6247
+ outputs: [
6248
+ {
6249
+ internalType: "uint256",
6250
+ name: "",
6251
+ type: "uint256"
6252
+ },
6253
+ {
6254
+ internalType: "uint256",
6255
+ name: "",
6256
+ type: "uint256"
6257
+ }
6258
+ ],
6259
+ stateMutability: "view",
6260
+ type: "function"
6261
+ },
6262
+ {
6263
+ inputs: [
6264
+ {
6265
+ internalType: "address",
6266
+ name: "asset",
6267
+ type: "address"
6268
+ },
6269
+ {
6270
+ internalType: "uint256",
6271
+ name: "amount",
6272
+ type: "uint256"
6273
+ }
6274
+ ],
6275
+ name: "claimFee",
6276
+ outputs: [
6277
+ ],
6278
+ stateMutability: "nonpayable",
6279
+ type: "function"
6280
+ },
6281
+ {
6282
+ inputs: [
6283
+ {
6284
+ internalType: "address",
6285
+ name: "_wallet",
6286
+ type: "address"
6287
+ }
6288
+ ],
6289
+ name: "getMaketMakerRegistration",
6290
+ outputs: [
6291
+ {
6292
+ internalType: "uint8",
6293
+ name: "",
6294
+ type: "uint8"
6295
+ }
6296
+ ],
6297
+ stateMutability: "view",
6298
+ type: "function"
6299
+ },
6300
+ {
6301
+ inputs: [
6302
+ {
6303
+ internalType: "address",
6304
+ name: "wallet",
6305
+ type: "address"
6306
+ }
6307
+ ],
6308
+ name: "getServiceFeePercentage",
6309
+ outputs: [
6310
+ {
6311
+ internalType: "uint256",
6312
+ name: "",
6313
+ type: "uint256"
6314
+ }
6315
+ ],
6316
+ stateMutability: "view",
6317
+ type: "function"
6318
+ },
6319
+ {
6320
+ inputs: [
6321
+ ],
6322
+ name: "owner",
6323
+ outputs: [
6324
+ {
6325
+ internalType: "address",
6326
+ name: "",
6327
+ type: "address"
6328
+ }
6329
+ ],
6330
+ stateMutability: "view",
6331
+ type: "function"
6332
+ },
6333
+ {
6334
+ inputs: [
6335
+ {
6336
+ internalType: "address",
6337
+ name: "asset",
6338
+ type: "address"
6339
+ },
6340
+ {
6341
+ internalType: "address",
6342
+ name: "to",
6343
+ type: "address"
6344
+ },
6345
+ {
6346
+ internalType: "uint256",
6347
+ name: "amount",
6348
+ type: "uint256"
6349
+ }
6350
+ ],
6351
+ name: "releaseFee",
6352
+ outputs: [
6353
+ ],
6354
+ stateMutability: "nonpayable",
6355
+ type: "function"
6356
+ },
6357
+ {
6358
+ inputs: [
6359
+ {
6360
+ internalType: "address",
6361
+ name: "_wallet",
6362
+ type: "address"
6363
+ }
6364
+ ],
6365
+ name: "removeMarketMaker",
6366
+ outputs: [
6367
+ ],
6368
+ stateMutability: "nonpayable",
6369
+ type: "function"
6370
+ },
6371
+ {
6372
+ inputs: [
6373
+ ],
6374
+ name: "renounceOwnership",
6375
+ outputs: [
6376
+ ],
6377
+ stateMutability: "nonpayable",
6378
+ type: "function"
6379
+ },
6380
+ {
6381
+ inputs: [
6382
+ {
6383
+ internalType: "uint8",
6384
+ name: "level",
6385
+ type: "uint8"
6386
+ },
6387
+ {
6388
+ internalType: "uint256",
6389
+ name: "feePercent",
6390
+ type: "uint256"
6391
+ }
6392
+ ],
6393
+ name: "setServiceFeePercent",
6394
+ outputs: [
6395
+ ],
6396
+ stateMutability: "nonpayable",
6397
+ type: "function"
6398
+ },
6399
+ {
6400
+ inputs: [
6401
+ {
6402
+ internalType: "address",
6403
+ name: "newOwner",
6404
+ type: "address"
6405
+ }
6406
+ ],
6407
+ name: "transferOwnership",
6408
+ outputs: [
6409
+ ],
6410
+ stateMutability: "nonpayable",
6411
+ type: "function"
6412
+ },
6413
+ {
6414
+ stateMutability: "payable",
6415
+ type: "receive"
6416
+ }
6417
+ ];
6418
+ var DarkSwapFeeAssetManagerAbi = {
6419
+ abi: abi};
6420
+
6421
+ function getContract(address, darkSwap) {
6422
+ const provider = darkSwap.provider;
6423
+ return new ethers.Contract(address, DarkSwapFeeAssetManagerAbi.abi, provider);
6424
+ }
6425
+ async function getFeeRatio(wallet, darkSwap) {
6426
+ const contract = getContract(darkSwap.contracts.darkSwapFeeAssetManager, darkSwap);
6427
+ return await contract.getServiceFeePercentage(wallet);
6428
+ }
6429
+
6130
6430
  const contractConfig = {
6131
6431
  [ChainId.MAINNET]: {
6132
6432
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
@@ -6220,5 +6520,5 @@ class DarkSwap {
6220
6520
  }
6221
6521
  }
6222
6522
 
6223
- export { ChainId, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO, FEE_RATIO_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCancelOrderService, ProCreateOrderService, ProSwapService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, contractConfig, generateKeyPair, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, getNoteOnChainStatusBySignature, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot };
6523
+ export { ChainId, DEFAULT_FEE_RATIO, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCancelOrderService, ProCreateOrderService, ProSwapService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, contractConfig, generateKeyPair, getFeeRatio, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, getNoteOnChainStatusBySignature, getNullifierBySignature, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot };
6224
6524
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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