@thesingularitynetwork/darkswap-sdk 0.2.6 → 0.2.7-beta2

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.
@@ -2579,6 +2579,26 @@ function _getNullifierBySignature() {
2579
2579
  }));
2580
2580
  return _getNullifierBySignature.apply(this, arguments);
2581
2581
  }
2582
+ function isNoteCreated(_x19, _x20) {
2583
+ return _isNoteCreated.apply(this, arguments);
2584
+ }
2585
+ function _isNoteCreated() {
2586
+ _isNoteCreated = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(darkSwap, note) {
2587
+ var contract, isNotCreated;
2588
+ return _regenerator().w(function (_context8) {
2589
+ while (1) switch (_context8.n) {
2590
+ case 0:
2591
+ contract = getContract(darkSwap.contracts.merkleTreeOperator, darkSwap);
2592
+ _context8.n = 1;
2593
+ return contract.noteIsNotCreated(hexlify32(note));
2594
+ case 1:
2595
+ isNotCreated = _context8.v;
2596
+ return _context8.a(2, !isNotCreated);
2597
+ }
2598
+ }, _callee8);
2599
+ }));
2600
+ return _isNoteCreated.apply(this, arguments);
2601
+ }
2582
2602
 
2583
2603
  var _format$1 = "hh-sol-artifact-1";
2584
2604
  var contractName$1 = "DarkSwapAssetManager";
@@ -4204,13 +4224,19 @@ var ChainId;
4204
4224
  ChainId[ChainId["HARDHAT_BASE"] = 31339] = "HARDHAT_BASE";
4205
4225
  ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
4206
4226
  ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
4227
+ ChainId[ChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
4207
4228
  ChainId[ChainId["HORIZEN_TESTNET"] = 845320009] = "HORIZEN_TESTNET";
4208
4229
  ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
4209
4230
  ChainId[ChainId["BASE"] = 8453] = "BASE";
4210
4231
  })(ChainId || (ChainId = {}));
4211
4232
 
4212
- var _legacyTokenConfig;
4233
+ var _legacyTokenConfig, _confirmationsConfig;
4213
4234
  var legacyTokenConfig = (_legacyTokenConfig = {}, _legacyTokenConfig[ChainId.MAINNET] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig[ChainId.HARDHAT] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig);
4235
+ var confirmationsConfig = (_confirmationsConfig = {}, _confirmationsConfig[ChainId.MAINNET] = 3, _confirmationsConfig[ChainId.ARBITRUM_ONE] = 3, _confirmationsConfig[ChainId.BASE] = 3, _confirmationsConfig[ChainId.SEPOLIA] = 3, _confirmationsConfig[ChainId.HARDHAT] = 3, _confirmationsConfig);
4236
+ var DEFAULT_CONFIRMATIONS = 3;
4237
+ var getConfirmations = function getConfirmations(chainId) {
4238
+ return confirmationsConfig[chainId] || DEFAULT_CONFIRMATIONS;
4239
+ };
4214
4240
  var DEFAULT_FEE_RATIO = 300n;
4215
4241
  var GAS_LIMIT_MULTIPLIER = 120n;
4216
4242
  var GAS_LIMIT_PRECISION = 100n;
@@ -4723,8 +4749,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4723
4749
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4724
4750
  synaraBridge: '0x0',
4725
4751
  synaraCanonicalTokenRegistry: '0x0',
4726
- zkverifyRelayerUrls: [],
4727
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api'
4752
+ zkverifyRelayerUrls: []
4728
4753
  }, _contractConfig[ChainId.ARBITRUM_ONE] = {
4729
4754
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4730
4755
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4735,32 +4760,40 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4735
4760
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4736
4761
  synaraBridge: '0x0',
4737
4762
  synaraCanonicalTokenRegistry: '0x0',
4738
- zkverifyRelayerUrls: [],
4739
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
4763
+ zkverifyRelayerUrls: []
4740
4764
  }, _contractConfig[ChainId.BASE] = {
4741
4765
  priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
4742
4766
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4743
4767
  nativeWrapper: '0x4200000000000000000000000000000000000006',
4744
- merkleTreeOperator: '0x0',
4745
- darkSwapAssetManager: '0x0',
4746
- darkSwapFeeAssetManager: '0x0',
4768
+ merkleTreeOperator: '0x918B4F76CAE5F67A3818D8eD3d0e11D9888684E9',
4769
+ darkSwapAssetManager: '0x6fbA1F1aAb8449b7ba576E41F4617d918391b7cF',
4770
+ darkSwapFeeAssetManager: '0xfde341e63EB2f25A32D353d58C2DAd7f91c8Bd57',
4747
4771
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4748
4772
  synaraBridge: '0x0',
4749
4773
  synaraCanonicalTokenRegistry: '0x0',
4750
- zkverifyRelayerUrls: [],
4751
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
4774
+ zkverifyRelayerUrls: []
4752
4775
  }, _contractConfig[ChainId.SEPOLIA] = {
4753
4776
  priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
4754
4777
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4755
4778
  nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
4756
- merkleTreeOperator: '0x0',
4757
- darkSwapAssetManager: '0x0',
4758
- darkSwapFeeAssetManager: '0x0',
4759
- synaraDarkSwapOnBridgeAssetManager: '0x0',
4760
- synaraBridge: '0x0',
4761
- synaraCanonicalTokenRegistry: '0x0',
4762
- zkverifyRelayerUrls: [],
4763
- darkSwapSubgraphUrl: ''
4779
+ merkleTreeOperator: '0xbeCd9FD715d131F8E897095Ef008BB4d9325B744',
4780
+ darkSwapAssetManager: '0x6E56b48361aD94Cb67EB5aA9182b2813bC76E6C0',
4781
+ darkSwapFeeAssetManager: '0x5C550CE1F4a02865F0f59d839D86807C75A6ddE0',
4782
+ synaraDarkSwapOnBridgeAssetManager: '0xEAC8292c1ef7b112Ccd5B3CB16E587E1799358db',
4783
+ synaraBridge: '0x2a9569b5df66B7E24B4FdC2B91d19E4C1C02F2D3',
4784
+ synaraCanonicalTokenRegistry: '0xD35264a934b5b7b8b3507b1d073e29EeBa4Dc754',
4785
+ zkverifyRelayerUrls: []
4786
+ }, _contractConfig[ChainId.BASE_SEPOLIA] = {
4787
+ priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
4788
+ ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4789
+ nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
4790
+ merkleTreeOperator: '0xC486e448e068A888AF09c386337E3C3C4812569b',
4791
+ darkSwapAssetManager: '0xEd349302ff6C2527be9555Fa386061652EAC712D',
4792
+ darkSwapFeeAssetManager: '0xa62C0693296f64eb9BA29ff2E41E96749c18de0F',
4793
+ synaraDarkSwapOnBridgeAssetManager: '0x0aAd845E874F0007e328862A3C455CB2D6625660',
4794
+ synaraBridge: '0xda348F7dEAeE972D8a5B4D4D182EF0273aDd3E2c',
4795
+ synaraCanonicalTokenRegistry: '0x016C6334d644E0B21aD5c6e91083Dd2f22739eB6',
4796
+ zkverifyRelayerUrls: []
4764
4797
  }, _contractConfig[ChainId.HORIZEN_TESTNET] = {
4765
4798
  priceOracle: '0x54c375f28ce4B0c2B986D6256E4Bc75d242A8793',
4766
4799
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4771,8 +4804,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4771
4804
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4772
4805
  synaraBridge: '0x0',
4773
4806
  synaraCanonicalTokenRegistry: '0x0',
4774
- zkverifyRelayerUrls: [],
4775
- darkSwapSubgraphUrl: ''
4807
+ zkverifyRelayerUrls: []
4776
4808
  }, _contractConfig[ChainId.HARDHAT] = {
4777
4809
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4778
4810
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4783,8 +4815,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4783
4815
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4784
4816
  synaraBridge: '0x0',
4785
4817
  synaraCanonicalTokenRegistry: '0x0',
4786
- zkverifyRelayerUrls: [],
4787
- darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4818
+ zkverifyRelayerUrls: []
4788
4819
  }, _contractConfig[ChainId.HARDHAT_BASE] = {
4789
4820
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4790
4821
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4795,8 +4826,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4795
4826
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4796
4827
  synaraBridge: '0x0',
4797
4828
  synaraCanonicalTokenRegistry: '0x0',
4798
- zkverifyRelayerUrls: [],
4799
- darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4829
+ zkverifyRelayerUrls: []
4800
4830
  }, _contractConfig);
4801
4831
 
4802
4832
  function refineGasLimit(estimatedGas) {
@@ -5027,7 +5057,7 @@ var DepositService = /*#__PURE__*/function (_BaseContractService) {
5027
5057
  case 3:
5028
5058
  tx = _context4.v;
5029
5059
  _context4.n = 4;
5030
- return tx.wait();
5060
+ return tx.wait(getConfirmations(this._darkSwap.chainId));
5031
5061
  case 4:
5032
5062
  return _context4.a(2);
5033
5063
  }
@@ -9365,9 +9395,9 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9365
9395
  }
9366
9396
  _inheritsLoose(RetailCreateOrderService, _BaseContractService);
9367
9397
  var _proto = RetailCreateOrderService.prototype;
9368
- _proto.prepare = /*#__PURE__*/function () {
9369
- var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(address, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
9370
- var _yield$generateKeyPai, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
9398
+ _proto.rebuildContextFromSwapMessage = /*#__PURE__*/function () {
9399
+ var _rebuildContextFromSwapMessage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(swapMessage, signature) {
9400
+ var _yield$generateKeyPai, pubKey, context;
9371
9401
  return _regenerator().w(function (_context) {
9372
9402
  while (1) switch (_context.n) {
9373
9403
  case 0:
@@ -9376,12 +9406,46 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9376
9406
  case 1:
9377
9407
  _yield$generateKeyPai = _context.v;
9378
9408
  pubKey = _yield$generateKeyPai[0];
9379
- privKey = _yield$generateKeyPai[1];
9409
+ if (validateOrderNoteWithPubKey(swapMessage.orderNote, pubKey)) {
9410
+ _context.n = 2;
9411
+ break;
9412
+ }
9413
+ throw new DarkSwapError('SwapMessage does not belong to this wallet');
9414
+ case 2:
9415
+ context = new RetailCreateOrderContext(signature);
9416
+ context.orderNote = swapMessage.orderNote;
9417
+ context.swapInNote = swapMessage.inNote;
9418
+ context.feeAmount = swapMessage.feeAmount;
9419
+ context.address = swapMessage.address;
9420
+ _context.n = 3;
9421
+ return this.generateProof(context);
9422
+ case 3:
9423
+ return _context.a(2, context);
9424
+ }
9425
+ }, _callee, this);
9426
+ }));
9427
+ function rebuildContextFromSwapMessage(_x, _x2) {
9428
+ return _rebuildContextFromSwapMessage.apply(this, arguments);
9429
+ }
9430
+ return rebuildContextFromSwapMessage;
9431
+ }();
9432
+ _proto.prepare = /*#__PURE__*/function () {
9433
+ var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(address, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
9434
+ var _yield$generateKeyPai2, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
9435
+ return _regenerator().w(function (_context2) {
9436
+ while (1) switch (_context2.n) {
9437
+ case 0:
9438
+ _context2.n = 1;
9439
+ return generateKeyPair(signature);
9440
+ case 1:
9441
+ _yield$generateKeyPai2 = _context2.v;
9442
+ pubKey = _yield$generateKeyPai2[0];
9443
+ privKey = _yield$generateKeyPai2[1];
9380
9444
  _t = BigInt;
9381
- _context.n = 2;
9445
+ _context2.n = 2;
9382
9446
  return getFeeRatio(address, this._darkSwap);
9383
9447
  case 2:
9384
- _t2 = _context.v;
9448
+ _t2 = _context2.v;
9385
9449
  feeRatio = _t(_t2);
9386
9450
  orderNote = createOrderNoteExt(address, depositAsset, depositAmount, feeRatio, pubKey);
9387
9451
  feeAmount = calcFeeAmount(swapInAmount, feeRatio);
@@ -9392,36 +9456,36 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9392
9456
  context.swapInNote = swapInNote;
9393
9457
  context.feeAmount = feeAmount;
9394
9458
  context.address = address;
9395
- _context.n = 3;
9459
+ _context2.n = 3;
9396
9460
  return generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
9397
9461
  case 3:
9398
- swapMessage = _context.v;
9462
+ swapMessage = _context2.v;
9399
9463
  context.swapMessage = swapMessage;
9400
- return _context.a(2, {
9464
+ return _context2.a(2, {
9401
9465
  context: context,
9402
9466
  swapMessage: swapMessage
9403
9467
  });
9404
9468
  }
9405
- }, _callee, this);
9469
+ }, _callee2, this);
9406
9470
  }));
9407
- function prepare(_x, _x2, _x3, _x4, _x5, _x6) {
9471
+ function prepare(_x3, _x4, _x5, _x6, _x7, _x8) {
9408
9472
  return _prepare.apply(this, arguments);
9409
9473
  }
9410
9474
  return prepare;
9411
9475
  }();
9412
9476
  _proto.generateProof = /*#__PURE__*/function () {
9413
- var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context) {
9477
+ var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
9414
9478
  var proof;
9415
- return _regenerator().w(function (_context2) {
9416
- while (1) switch (_context2.n) {
9479
+ return _regenerator().w(function (_context3) {
9480
+ while (1) switch (_context3.n) {
9417
9481
  case 0:
9418
9482
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || !context.feeAmount || !context.signature)) {
9419
- _context2.n = 1;
9483
+ _context3.n = 1;
9420
9484
  break;
9421
9485
  }
9422
9486
  throw new DarkSwapError('Invalid context');
9423
9487
  case 1:
9424
- _context2.n = 2;
9488
+ _context3.n = 2;
9425
9489
  return generateRetailCreateOrderProof({
9426
9490
  depositNote: context.orderNote,
9427
9491
  swapInNote: context.swapInNote,
@@ -9430,71 +9494,77 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9430
9494
  feeAmount: context.feeAmount
9431
9495
  });
9432
9496
  case 2:
9433
- proof = _context2.v;
9497
+ proof = _context3.v;
9434
9498
  context.proof = proof;
9435
9499
  case 3:
9436
- return _context2.a(2);
9500
+ return _context3.a(2);
9437
9501
  }
9438
- }, _callee2);
9502
+ }, _callee3);
9439
9503
  }));
9440
- function generateProof(_x7) {
9504
+ function generateProof(_x9) {
9441
9505
  return _generateProof.apply(this, arguments);
9442
9506
  }
9443
9507
  return generateProof;
9444
9508
  }();
9445
9509
  _proto.allowance = /*#__PURE__*/function () {
9446
- var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
9510
+ var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
9447
9511
  var signer, asset, amount, allowanceContract, allowance, isLegacy, contract, tx;
9448
- return _regenerator().w(function (_context3) {
9449
- while (1) switch (_context3.n) {
9512
+ return _regenerator().w(function (_context4) {
9513
+ while (1) switch (_context4.n) {
9450
9514
  case 0:
9451
9515
  if (!(!context || !context.orderNote || !context.address || !context.signature || !context.proof)) {
9452
- _context3.n = 1;
9516
+ _context4.n = 1;
9453
9517
  break;
9454
9518
  }
9455
9519
  throw new DarkSwapError('Invalid context');
9456
9520
  case 1:
9521
+ if (!isNativeAsset(context.orderNote.asset)) {
9522
+ _context4.n = 2;
9523
+ break;
9524
+ }
9525
+ return _context4.a(2);
9526
+ case 2:
9457
9527
  signer = this._darkSwap.signer;
9458
9528
  asset = context.orderNote.asset;
9459
9529
  amount = context.orderNote.amount;
9460
9530
  allowanceContract = new ethers.Contract(asset, ERC20Abi.abi, this._darkSwap);
9461
- _context3.n = 2;
9531
+ _context4.n = 3;
9462
9532
  return allowanceContract.allowance(signer.getAddress(), this._darkSwap.contracts.darkSwapAssetManager);
9463
- case 2:
9464
- allowance = _context3.v;
9533
+ case 3:
9534
+ allowance = _context4.v;
9465
9535
  if (!(BigInt(allowance) < amount)) {
9466
- _context3.n = 4;
9536
+ _context4.n = 5;
9467
9537
  break;
9468
9538
  }
9469
9539
  isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwap.chainId) && legacyTokenConfig[this._darkSwap.chainId].includes(asset.toLowerCase());
9470
9540
  contract = new ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
9471
- _context3.n = 3;
9541
+ _context4.n = 4;
9472
9542
  return contract.approve(this._darkSwap.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
9473
- case 3:
9474
- tx = _context3.v;
9475
- _context3.n = 4;
9476
- return tx.wait();
9477
9543
  case 4:
9478
- return _context3.a(2);
9544
+ tx = _context4.v;
9545
+ _context4.n = 5;
9546
+ return tx.wait(getConfirmations(this._darkSwap.chainId));
9547
+ case 5:
9548
+ return _context4.a(2);
9479
9549
  }
9480
- }, _callee3, this);
9550
+ }, _callee4, this);
9481
9551
  }));
9482
- function allowance(_x8) {
9552
+ function allowance(_x0) {
9483
9553
  return _allowance.apply(this, arguments);
9484
9554
  }
9485
9555
  return allowance;
9486
9556
  }();
9487
9557
  _proto.execute = /*#__PURE__*/function () {
9488
- var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
9558
+ var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
9489
9559
  var contract, ethAmount, tx;
9490
- return _regenerator().w(function (_context4) {
9491
- while (1) switch (_context4.n) {
9560
+ return _regenerator().w(function (_context5) {
9561
+ while (1) switch (_context5.n) {
9492
9562
  case 0:
9493
- _context4.n = 1;
9563
+ _context5.n = 1;
9494
9564
  return this.generateProof(context);
9495
9565
  case 1:
9496
9566
  if (!(!context || !context.orderNote || !context.swapInNote || !context.proof)) {
9497
- _context4.n = 2;
9567
+ _context5.n = 2;
9498
9568
  break;
9499
9569
  }
9500
9570
  throw new DarkSwapError('Invalid context');
@@ -9502,30 +9572,30 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9502
9572
  contract = new ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
9503
9573
  ethAmount = 0n;
9504
9574
  if (!isNativeAsset(context.orderNote.asset)) {
9505
- _context4.n = 3;
9575
+ _context5.n = 3;
9506
9576
  break;
9507
9577
  }
9508
9578
  ethAmount = context.orderNote.amount;
9509
- _context4.n = 4;
9579
+ _context5.n = 4;
9510
9580
  break;
9511
9581
  case 3:
9512
- _context4.n = 4;
9582
+ _context5.n = 4;
9513
9583
  return this.allowance(context);
9514
9584
  case 4:
9515
- _context4.n = 5;
9585
+ _context5.n = 5;
9516
9586
  return contract.retailDepositCreateOrder([hexlify32(context.orderNote.note), context.proof.depositFooter, context.orderNote.asset, bn_to_0xhex(context.orderNote.amount), hexlify32(context.swapInNote.note), context.proof.swapInNoteFooter], context.proof.proof, {
9517
9587
  value: bn_to_0xhex(ethAmount)
9518
9588
  });
9519
9589
  case 5:
9520
- tx = _context4.v;
9521
- _context4.n = 6;
9590
+ tx = _context5.v;
9591
+ _context5.n = 6;
9522
9592
  return tx.wait();
9523
9593
  case 6:
9524
- return _context4.a(2, tx.hash);
9594
+ return _context5.a(2, tx.hash);
9525
9595
  }
9526
- }, _callee4, this);
9596
+ }, _callee5, this);
9527
9597
  }));
9528
- function execute(_x9) {
9598
+ function execute(_x1) {
9529
9599
  return _execute.apply(this, arguments);
9530
9600
  }
9531
9601
  return execute;
@@ -9875,7 +9945,7 @@ function generateRetailSwapProof(_x) {
9875
9945
  }
9876
9946
  function _generateRetailSwapProof() {
9877
9947
  _generateRetailSwapProof = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(param) {
9878
- var aliceFeeAmount, bobFeeAmount, aliceOrderNoteNullifier, aliceInNoteFooter, bobOrderNoteNullifier, bobInNoteFooter, aliceAddressMod, bobAddressMod, inputs, proof;
9948
+ var aliceOrderNoteNullifier, aliceInNoteFooter, bobOrderNoteNullifier, bobInNoteFooter, aliceAddressMod, bobAddressMod, inputs, proof;
9879
9949
  return _regenerator().w(function (_context) {
9880
9950
  while (1) switch (_context.n) {
9881
9951
  case 0:
@@ -9891,14 +9961,12 @@ function _generateRetailSwapProof() {
9891
9961
  }
9892
9962
  throw new DarkSwapProofError("Invalid note amount");
9893
9963
  case 2:
9894
- if (!(param.aliceMessage.orderNote.amount != param.bobMessage.inNote.amount || param.bobMessage.orderNote.amount != param.aliceMessage.inNote.amount)) {
9964
+ if (!(param.aliceMessage.orderNote.amount != param.bobMessage.inNote.amount + param.bobMessage.feeAmount || param.bobMessage.orderNote.amount != param.aliceMessage.inNote.amount + param.aliceMessage.feeAmount)) {
9895
9965
  _context.n = 3;
9896
9966
  break;
9897
9967
  }
9898
9968
  throw new DarkSwapProofError("Invalid order amount");
9899
9969
  case 3:
9900
- aliceFeeAmount = param.aliceMessage.inNote.amount * param.aliceMessage.orderNote.feeRatio / FEE_RATIO_PRECISION;
9901
- bobFeeAmount = param.bobMessage.inNote.amount * param.bobMessage.orderNote.feeRatio / FEE_RATIO_PRECISION;
9902
9970
  aliceOrderNoteNullifier = calcNullifier(param.aliceMessage.orderNote.rho, param.aliceMessage.publicKey);
9903
9971
  aliceInNoteFooter = getNoteFooter(param.aliceMessage.inNote.rho, param.aliceMessage.publicKey);
9904
9972
  bobOrderNoteNullifier = calcNullifier(param.bobMessage.orderNote.rho, param.bobMessage.publicKey);
@@ -9918,10 +9986,10 @@ function _generateRetailSwapProof() {
9918
9986
  alice_out_note: bn_to_0xhex(param.aliceMessage.orderNote.note),
9919
9987
  alice_out_nullifier: bn_to_0xhex(aliceOrderNoteNullifier),
9920
9988
  alice_fee_ratio: bn_to_0xhex(param.aliceMessage.orderNote.feeRatio),
9921
- alice_fee_amount: bn_to_0xhex(aliceFeeAmount),
9989
+ alice_fee_amount: bn_to_0xhex(param.aliceMessage.feeAmount),
9922
9990
  alice_in_rho: bn_to_0xhex(param.aliceMessage.inNote.rho),
9923
9991
  alice_in_asset: bn_to_0xhex(encodeAddress(param.aliceMessage.inNote.asset)),
9924
- alice_in_amount: bn_to_0xhex(param.aliceMessage.inNote.amount),
9992
+ alice_in_amount: bn_to_0xhex(param.aliceMessage.inNote.amount + param.aliceMessage.feeAmount),
9925
9993
  alice_in_note: bn_to_0xhex(param.aliceMessage.inNote.note),
9926
9994
  alice_in_note_footer: bn_to_0xhex(aliceInNoteFooter),
9927
9995
  alice_pub_key: [param.aliceMessage.publicKey[0].toString(), param.aliceMessage.publicKey[1].toString()],
@@ -9935,7 +10003,7 @@ function _generateRetailSwapProof() {
9935
10003
  bob_out_rho: bn_to_0xhex(param.bobMessage.orderNote.rho),
9936
10004
  bob_out_nullifier: bn_to_0xhex(bobOrderNoteNullifier),
9937
10005
  bob_fee_ratio: bn_to_0xhex(param.bobMessage.orderNote.feeRatio),
9938
- bob_fee_amount: bn_to_0xhex(bobFeeAmount),
10006
+ bob_fee_amount: bn_to_0xhex(param.bobMessage.feeAmount),
9939
10007
  bob_in_note: bn_to_0xhex(param.bobMessage.inNote.note),
9940
10008
  bob_in_rho: bn_to_0xhex(param.bobMessage.inNote.rho),
9941
10009
  bob_in_note_footer: bn_to_0xhex(bobInNoteFooter),
@@ -11116,10 +11184,7 @@ var SynaraDarkSwapOnBridgeAssetManagerAbi = {
11116
11184
  deployedLinkReferences: deployedLinkReferences$5
11117
11185
  };
11118
11186
 
11119
- var _format$6 = "hh-sol-artifact-1";
11120
- var contractName$6 = "CanonicalTokenRegistry";
11121
- var sourceName$6 = "src/CanonicalTokenRegistry.sol";
11122
- var abi$h = [
11187
+ var CanonicalTokenRegistryAbi = [
11123
11188
  {
11124
11189
  inputs: [
11125
11190
  ],
@@ -11166,12 +11231,6 @@ var abi$h = [
11166
11231
  name: "ExpectedPause",
11167
11232
  type: "error"
11168
11233
  },
11169
- {
11170
- inputs: [
11171
- ],
11172
- name: "NotMapped",
11173
- type: "error"
11174
- },
11175
11234
  {
11176
11235
  inputs: [
11177
11236
  ],
@@ -11180,43 +11239,34 @@ var abi$h = [
11180
11239
  },
11181
11240
  {
11182
11241
  inputs: [
11183
- {
11184
- internalType: "address",
11185
- name: "owner",
11186
- type: "address"
11187
- }
11188
- ],
11189
- name: "OwnableInvalidOwner",
11190
- type: "error"
11191
- },
11192
- {
11193
- inputs: [
11194
- {
11195
- internalType: "address",
11196
- name: "account",
11197
- type: "address"
11198
- }
11199
11242
  ],
11200
- name: "OwnableUnauthorizedAccount",
11243
+ name: "TokenAlreadyMapped",
11201
11244
  type: "error"
11202
11245
  },
11203
11246
  {
11204
11247
  inputs: [
11205
11248
  ],
11206
- name: "TokenLocked",
11249
+ name: "ZeroAddress",
11207
11250
  type: "error"
11208
11251
  },
11209
11252
  {
11210
11253
  inputs: [
11211
11254
  ],
11212
- name: "TokenNotActive",
11255
+ name: "ZeroCanonicalId",
11213
11256
  type: "error"
11214
11257
  },
11215
11258
  {
11259
+ anonymous: false,
11216
11260
  inputs: [
11261
+ {
11262
+ indexed: false,
11263
+ internalType: "address",
11264
+ name: "account",
11265
+ type: "address"
11266
+ }
11217
11267
  ],
11218
- name: "ZeroAddress",
11219
- type: "error"
11268
+ name: "Paused",
11269
+ type: "event"
11220
11270
  },
11221
11271
  {
11222
11272
  anonymous: false,
@@ -11224,48 +11274,48 @@ var abi$h = [
11224
11274
  {
11225
11275
  indexed: true,
11226
11276
  internalType: "bytes32",
11227
- name: "canonicalId",
11277
+ name: "role",
11228
11278
  type: "bytes32"
11229
11279
  },
11230
11280
  {
11231
- indexed: false,
11232
- internalType: "uint256",
11233
- name: "originChainId",
11234
- type: "uint256"
11235
- },
11236
- {
11237
- indexed: false,
11238
- internalType: "address",
11239
- name: "originToken",
11240
- type: "address"
11281
+ indexed: true,
11282
+ internalType: "bytes32",
11283
+ name: "previousAdminRole",
11284
+ type: "bytes32"
11241
11285
  },
11242
11286
  {
11243
- indexed: false,
11244
- internalType: "uint8",
11245
- name: "decimals",
11246
- type: "uint8"
11287
+ indexed: true,
11288
+ internalType: "bytes32",
11289
+ name: "newAdminRole",
11290
+ type: "bytes32"
11247
11291
  }
11248
11292
  ],
11249
- name: "CanonicalRegistered",
11293
+ name: "RoleAdminChanged",
11250
11294
  type: "event"
11251
11295
  },
11252
11296
  {
11253
11297
  anonymous: false,
11254
11298
  inputs: [
11299
+ {
11300
+ indexed: true,
11301
+ internalType: "bytes32",
11302
+ name: "role",
11303
+ type: "bytes32"
11304
+ },
11255
11305
  {
11256
11306
  indexed: true,
11257
11307
  internalType: "address",
11258
- name: "previousOwner",
11308
+ name: "account",
11259
11309
  type: "address"
11260
11310
  },
11261
11311
  {
11262
11312
  indexed: true,
11263
11313
  internalType: "address",
11264
- name: "newOwner",
11314
+ name: "sender",
11265
11315
  type: "address"
11266
11316
  }
11267
11317
  ],
11268
- name: "OwnershipTransferStarted",
11318
+ name: "RoleGranted",
11269
11319
  type: "event"
11270
11320
  },
11271
11321
  {
@@ -11273,31 +11323,24 @@ var abi$h = [
11273
11323
  inputs: [
11274
11324
  {
11275
11325
  indexed: true,
11276
- internalType: "address",
11277
- name: "previousOwner",
11278
- type: "address"
11326
+ internalType: "bytes32",
11327
+ name: "role",
11328
+ type: "bytes32"
11279
11329
  },
11280
11330
  {
11281
11331
  indexed: true,
11282
11332
  internalType: "address",
11283
- name: "newOwner",
11333
+ name: "account",
11284
11334
  type: "address"
11285
- }
11286
- ],
11287
- name: "OwnershipTransferred",
11288
- type: "event"
11289
- },
11290
- {
11291
- anonymous: false,
11292
- inputs: [
11335
+ },
11293
11336
  {
11294
- indexed: false,
11337
+ indexed: true,
11295
11338
  internalType: "address",
11296
- name: "account",
11339
+ name: "sender",
11297
11340
  type: "address"
11298
11341
  }
11299
11342
  ],
11300
- name: "Paused",
11343
+ name: "RoleRevoked",
11301
11344
  type: "event"
11302
11345
  },
11303
11346
  {
@@ -11310,19 +11353,13 @@ var abi$h = [
11310
11353
  type: "bytes32"
11311
11354
  },
11312
11355
  {
11313
- indexed: false,
11314
- internalType: "uint256",
11315
- name: "chainId",
11316
- type: "uint256"
11317
- },
11318
- {
11319
- indexed: false,
11356
+ indexed: true,
11320
11357
  internalType: "address",
11321
11358
  name: "token",
11322
11359
  type: "address"
11323
11360
  }
11324
11361
  ],
11325
- name: "RepresentationMapped",
11362
+ name: "TokenMappingRemoved",
11326
11363
  type: "event"
11327
11364
  },
11328
11365
  {
@@ -11335,150 +11372,36 @@ var abi$h = [
11335
11372
  type: "bytes32"
11336
11373
  },
11337
11374
  {
11338
- indexed: false,
11339
- internalType: "uint256",
11340
- name: "chainId",
11341
- type: "uint256"
11342
- },
11343
- {
11344
- indexed: false,
11375
+ indexed: true,
11345
11376
  internalType: "address",
11346
11377
  name: "token",
11347
11378
  type: "address"
11348
11379
  }
11349
11380
  ],
11350
- name: "RepresentationUnmapped",
11381
+ name: "TokenMappingSet",
11351
11382
  type: "event"
11352
11383
  },
11353
11384
  {
11354
11385
  anonymous: false,
11355
11386
  inputs: [
11356
11387
  {
11357
- indexed: true,
11358
- internalType: "bytes32",
11359
- name: "role",
11360
- type: "bytes32"
11361
- },
11362
- {
11363
- indexed: true,
11364
- internalType: "bytes32",
11365
- name: "previousAdminRole",
11366
- type: "bytes32"
11367
- },
11368
- {
11369
- indexed: true,
11370
- internalType: "bytes32",
11371
- name: "newAdminRole",
11372
- type: "bytes32"
11388
+ indexed: false,
11389
+ internalType: "address",
11390
+ name: "account",
11391
+ type: "address"
11373
11392
  }
11374
11393
  ],
11375
- name: "RoleAdminChanged",
11394
+ name: "Unpaused",
11376
11395
  type: "event"
11377
11396
  },
11378
11397
  {
11379
- anonymous: false,
11380
11398
  inputs: [
11399
+ ],
11400
+ name: "DEFAULT_ADMIN_ROLE",
11401
+ outputs: [
11381
11402
  {
11382
- indexed: true,
11383
11403
  internalType: "bytes32",
11384
- name: "role",
11385
- type: "bytes32"
11386
- },
11387
- {
11388
- indexed: true,
11389
- internalType: "address",
11390
- name: "account",
11391
- type: "address"
11392
- },
11393
- {
11394
- indexed: true,
11395
- internalType: "address",
11396
- name: "sender",
11397
- type: "address"
11398
- }
11399
- ],
11400
- name: "RoleGranted",
11401
- type: "event"
11402
- },
11403
- {
11404
- anonymous: false,
11405
- inputs: [
11406
- {
11407
- indexed: true,
11408
- internalType: "bytes32",
11409
- name: "role",
11410
- type: "bytes32"
11411
- },
11412
- {
11413
- indexed: true,
11414
- internalType: "address",
11415
- name: "account",
11416
- type: "address"
11417
- },
11418
- {
11419
- indexed: true,
11420
- internalType: "address",
11421
- name: "sender",
11422
- type: "address"
11423
- }
11424
- ],
11425
- name: "RoleRevoked",
11426
- type: "event"
11427
- },
11428
- {
11429
- anonymous: false,
11430
- inputs: [
11431
- {
11432
- indexed: true,
11433
- internalType: "bytes32",
11434
- name: "canonicalId",
11435
- type: "bytes32"
11436
- },
11437
- {
11438
- indexed: false,
11439
- internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11440
- name: "status",
11441
- type: "uint8"
11442
- }
11443
- ],
11444
- name: "TokenStatusChanged",
11445
- type: "event"
11446
- },
11447
- {
11448
- anonymous: false,
11449
- inputs: [
11450
- {
11451
- indexed: false,
11452
- internalType: "address",
11453
- name: "account",
11454
- type: "address"
11455
- }
11456
- ],
11457
- name: "Unpaused",
11458
- type: "event"
11459
- },
11460
- {
11461
- inputs: [
11462
- ],
11463
- name: "CANONICAL_SALT",
11464
- outputs: [
11465
- {
11466
- internalType: "bytes32",
11467
- name: "",
11468
- type: "bytes32"
11469
- }
11470
- ],
11471
- stateMutability: "view",
11472
- type: "function"
11473
- },
11474
- {
11475
- inputs: [
11476
- ],
11477
- name: "DEFAULT_ADMIN_ROLE",
11478
- outputs: [
11479
- {
11480
- internalType: "bytes32",
11481
- name: "",
11404
+ name: "",
11482
11405
  type: "bytes32"
11483
11406
  }
11484
11407
  ],
@@ -11499,20 +11422,6 @@ var abi$h = [
11499
11422
  stateMutability: "view",
11500
11423
  type: "function"
11501
11424
  },
11502
- {
11503
- inputs: [
11504
- ],
11505
- name: "NATIVE_TOKEN",
11506
- outputs: [
11507
- {
11508
- internalType: "address",
11509
- name: "",
11510
- type: "address"
11511
- }
11512
- ],
11513
- stateMutability: "view",
11514
- type: "function"
11515
- },
11516
11425
  {
11517
11426
  inputs: [
11518
11427
  ],
@@ -11529,135 +11438,6 @@ var abi$h = [
11529
11438
  },
11530
11439
  {
11531
11440
  inputs: [
11532
- ],
11533
- name: "acceptOwnership",
11534
- outputs: [
11535
- ],
11536
- stateMutability: "nonpayable",
11537
- type: "function"
11538
- },
11539
- {
11540
- inputs: [
11541
- {
11542
- internalType: "bytes32",
11543
- name: "canonicalId",
11544
- type: "bytes32"
11545
- }
11546
- ],
11547
- name: "canDeposit",
11548
- outputs: [
11549
- {
11550
- internalType: "bool",
11551
- name: "",
11552
- type: "bool"
11553
- }
11554
- ],
11555
- stateMutability: "view",
11556
- type: "function"
11557
- },
11558
- {
11559
- inputs: [
11560
- {
11561
- internalType: "bytes32",
11562
- name: "canonicalId",
11563
- type: "bytes32"
11564
- }
11565
- ],
11566
- name: "canWithdraw",
11567
- outputs: [
11568
- {
11569
- internalType: "bool",
11570
- name: "",
11571
- type: "bool"
11572
- }
11573
- ],
11574
- stateMutability: "view",
11575
- type: "function"
11576
- },
11577
- {
11578
- inputs: [
11579
- {
11580
- internalType: "bytes32",
11581
- name: "canonicalId",
11582
- type: "bytes32"
11583
- }
11584
- ],
11585
- name: "canonicalDecimals",
11586
- outputs: [
11587
- {
11588
- internalType: "uint8",
11589
- name: "",
11590
- type: "uint8"
11591
- }
11592
- ],
11593
- stateMutability: "view",
11594
- type: "function"
11595
- },
11596
- {
11597
- inputs: [
11598
- {
11599
- internalType: "uint256",
11600
- name: "originChainId",
11601
- type: "uint256"
11602
- },
11603
- {
11604
- internalType: "address",
11605
- name: "originToken",
11606
- type: "address"
11607
- }
11608
- ],
11609
- name: "computeCanonicalId",
11610
- outputs: [
11611
- {
11612
- internalType: "bytes32",
11613
- name: "",
11614
- type: "bytes32"
11615
- }
11616
- ],
11617
- stateMutability: "pure",
11618
- type: "function"
11619
- },
11620
- {
11621
- inputs: [
11622
- {
11623
- internalType: "bytes32",
11624
- name: "canonicalId",
11625
- type: "bytes32"
11626
- }
11627
- ],
11628
- name: "getCanonical",
11629
- outputs: [
11630
- {
11631
- internalType: "uint256",
11632
- name: "originChainId",
11633
- type: "uint256"
11634
- },
11635
- {
11636
- internalType: "address",
11637
- name: "originToken",
11638
- type: "address"
11639
- },
11640
- {
11641
- internalType: "uint8",
11642
- name: "decimals",
11643
- type: "uint8"
11644
- },
11645
- {
11646
- internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11647
- name: "status",
11648
- type: "uint8"
11649
- }
11650
- ],
11651
- stateMutability: "view",
11652
- type: "function"
11653
- },
11654
- {
11655
- inputs: [
11656
- {
11657
- internalType: "uint256",
11658
- name: "chainId",
11659
- type: "uint256"
11660
- },
11661
11441
  {
11662
11442
  internalType: "address",
11663
11443
  name: "token",
@@ -11702,12 +11482,12 @@ var abi$h = [
11702
11482
  type: "bytes32"
11703
11483
  }
11704
11484
  ],
11705
- name: "getTokenStatus",
11485
+ name: "getToken",
11706
11486
  outputs: [
11707
11487
  {
11708
- internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11488
+ internalType: "address",
11709
11489
  name: "",
11710
- type: "uint8"
11490
+ type: "address"
11711
11491
  }
11712
11492
  ],
11713
11493
  stateMutability: "view",
@@ -11756,25 +11536,6 @@ var abi$h = [
11756
11536
  stateMutability: "view",
11757
11537
  type: "function"
11758
11538
  },
11759
- {
11760
- inputs: [
11761
- {
11762
- internalType: "bytes32",
11763
- name: "canonicalId",
11764
- type: "bytes32"
11765
- }
11766
- ],
11767
- name: "isActive",
11768
- outputs: [
11769
- {
11770
- internalType: "bool",
11771
- name: "",
11772
- type: "bool"
11773
- }
11774
- ],
11775
- stateMutability: "view",
11776
- type: "function"
11777
- },
11778
11539
  {
11779
11540
  inputs: [
11780
11541
  {
@@ -11794,44 +11555,6 @@ var abi$h = [
11794
11555
  stateMutability: "view",
11795
11556
  type: "function"
11796
11557
  },
11797
- {
11798
- inputs: [
11799
- {
11800
- internalType: "uint256",
11801
- name: "chainId",
11802
- type: "uint256"
11803
- },
11804
- {
11805
- internalType: "address",
11806
- name: "token",
11807
- type: "address"
11808
- },
11809
- {
11810
- internalType: "bytes32",
11811
- name: "canonicalId",
11812
- type: "bytes32"
11813
- }
11814
- ],
11815
- name: "mapRepresentation",
11816
- outputs: [
11817
- ],
11818
- stateMutability: "nonpayable",
11819
- type: "function"
11820
- },
11821
- {
11822
- inputs: [
11823
- ],
11824
- name: "owner",
11825
- outputs: [
11826
- {
11827
- internalType: "address",
11828
- name: "",
11829
- type: "address"
11830
- }
11831
- ],
11832
- stateMutability: "view",
11833
- type: "function"
11834
- },
11835
11558
  {
11836
11559
  inputs: [
11837
11560
  ],
@@ -11857,51 +11580,13 @@ var abi$h = [
11857
11580
  },
11858
11581
  {
11859
11582
  inputs: [
11860
- ],
11861
- name: "pendingOwner",
11862
- outputs: [
11863
- {
11864
- internalType: "address",
11865
- name: "",
11866
- type: "address"
11867
- }
11868
- ],
11869
- stateMutability: "view",
11870
- type: "function"
11871
- },
11872
- {
11873
- inputs: [
11874
- {
11875
- internalType: "uint256",
11876
- name: "originChainId",
11877
- type: "uint256"
11878
- },
11879
- {
11880
- internalType: "address",
11881
- name: "originToken",
11882
- type: "address"
11883
- },
11884
- {
11885
- internalType: "uint8",
11886
- name: "decimals",
11887
- type: "uint8"
11888
- }
11889
- ],
11890
- name: "registerCanonical",
11891
- outputs: [
11892
11583
  {
11893
11584
  internalType: "bytes32",
11894
11585
  name: "canonicalId",
11895
11586
  type: "bytes32"
11896
11587
  }
11897
11588
  ],
11898
- stateMutability: "nonpayable",
11899
- type: "function"
11900
- },
11901
- {
11902
- inputs: [
11903
- ],
11904
- name: "renounceOwnership",
11589
+ name: "removeTokenMapping",
11905
11590
  outputs: [
11906
11591
  ],
11907
11592
  stateMutability: "nonpayable",
@@ -11953,12 +11638,12 @@ var abi$h = [
11953
11638
  type: "bytes32"
11954
11639
  },
11955
11640
  {
11956
- internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11957
- name: "status",
11958
- type: "uint8"
11641
+ internalType: "address",
11642
+ name: "token",
11643
+ type: "address"
11959
11644
  }
11960
11645
  ],
11961
- name: "setTokenStatus",
11646
+ name: "setTokenMapping",
11962
11647
  outputs: [
11963
11648
  ],
11964
11649
  stateMutability: "nonpayable",
@@ -11983,39 +11668,6 @@ var abi$h = [
11983
11668
  stateMutability: "view",
11984
11669
  type: "function"
11985
11670
  },
11986
- {
11987
- inputs: [
11988
- {
11989
- internalType: "address",
11990
- name: "newOwner",
11991
- type: "address"
11992
- }
11993
- ],
11994
- name: "transferOwnership",
11995
- outputs: [
11996
- ],
11997
- stateMutability: "nonpayable",
11998
- type: "function"
11999
- },
12000
- {
12001
- inputs: [
12002
- {
12003
- internalType: "uint256",
12004
- name: "chainId",
12005
- type: "uint256"
12006
- },
12007
- {
12008
- internalType: "address",
12009
- name: "token",
12010
- type: "address"
12011
- }
12012
- ],
12013
- name: "unmapRepresentation",
12014
- outputs: [
12015
- ],
12016
- stateMutability: "nonpayable",
12017
- type: "function"
12018
- },
12019
11671
  {
12020
11672
  inputs: [
12021
11673
  ],
@@ -12026,27 +11678,11 @@ var abi$h = [
12026
11678
  type: "function"
12027
11679
  }
12028
11680
  ];
12029
- var bytecode$h = "";
12030
- var deployedBytecode$6 = "";
12031
- var linkReferences$6 = {
12032
- };
12033
- var deployedLinkReferences$6 = {
12034
- };
12035
- var CanonicalTokenRegistryAbi = {
12036
- _format: _format$6,
12037
- contractName: contractName$6,
12038
- sourceName: sourceName$6,
12039
- abi: abi$h,
12040
- bytecode: bytecode$h,
12041
- deployedBytecode: deployedBytecode$6,
12042
- linkReferences: linkReferences$6,
12043
- deployedLinkReferences: deployedLinkReferences$6
12044
- };
12045
11681
 
12046
- var _format$7 = "hh-sol-artifact-1";
12047
- var contractName$7 = "Bridge";
12048
- var sourceName$7 = "src/Bridge.sol";
12049
- var abi$i = [
11682
+ var _format$6 = "hh-sol-artifact-1";
11683
+ var contractName$6 = "Bridge";
11684
+ var sourceName$6 = "src/Bridge.sol";
11685
+ var abi$h = [
12050
11686
  {
12051
11687
  inputs: [
12052
11688
  {
@@ -13001,21 +12637,21 @@ var abi$i = [
13001
12637
  type: "function"
13002
12638
  }
13003
12639
  ];
13004
- var bytecode$i = "";
13005
- var deployedBytecode$7 = "";
13006
- var linkReferences$7 = {
12640
+ var bytecode$h = "";
12641
+ var deployedBytecode$6 = "";
12642
+ var linkReferences$6 = {
13007
12643
  };
13008
- var deployedLinkReferences$7 = {
12644
+ var deployedLinkReferences$6 = {
13009
12645
  };
13010
12646
  var BridgeAbi = {
13011
- _format: _format$7,
13012
- contractName: contractName$7,
13013
- sourceName: sourceName$7,
13014
- abi: abi$i,
13015
- bytecode: bytecode$i,
13016
- deployedBytecode: deployedBytecode$7,
13017
- linkReferences: linkReferences$7,
13018
- deployedLinkReferences: deployedLinkReferences$7
12647
+ _format: _format$6,
12648
+ contractName: contractName$6,
12649
+ sourceName: sourceName$6,
12650
+ abi: abi$h,
12651
+ bytecode: bytecode$h,
12652
+ deployedBytecode: deployedBytecode$6,
12653
+ linkReferences: linkReferences$6,
12654
+ deployedLinkReferences: deployedLinkReferences$6
13019
12655
  };
13020
12656
 
13021
12657
  var _DOMAIN_PREFIX = "0x191253796e6172614272696467654465706f7369740a";
@@ -13177,20 +12813,20 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13177
12813
  }
13178
12814
  var _proto = BridgeCreateOrderService.prototype;
13179
12815
  _proto.getCanonicalTokenAddress = /*#__PURE__*/function () {
13180
- var _getCanonicalTokenAddress = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sourceChainId, sourceAsset) {
12816
+ var _getCanonicalTokenAddress = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sourceAsset) {
13181
12817
  var canonicalTokenRegistry;
13182
12818
  return _regenerator().w(function (_context) {
13183
12819
  while (1) switch (_context.n) {
13184
12820
  case 0:
13185
- canonicalTokenRegistry = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraCanonicalTokenRegistry, CanonicalTokenRegistryAbi.abi, this._darkSwapOfSourceChain.provider);
12821
+ canonicalTokenRegistry = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraCanonicalTokenRegistry, CanonicalTokenRegistryAbi, this._darkSwapOfSourceChain.provider);
13186
12822
  _context.n = 1;
13187
- return canonicalTokenRegistry.getCanonicalId(BigInt(sourceChainId), sourceAsset);
12823
+ return canonicalTokenRegistry.getCanonicalId(sourceAsset);
13188
12824
  case 1:
13189
12825
  return _context.a(2, _context.v);
13190
12826
  }
13191
12827
  }, _callee, this);
13192
12828
  }));
13193
- function getCanonicalTokenAddress(_x, _x2) {
12829
+ function getCanonicalTokenAddress(_x) {
13194
12830
  return _getCanonicalTokenAddress.apply(this, arguments);
13195
12831
  }
13196
12832
  return getCanonicalTokenAddress;
@@ -13209,7 +12845,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13209
12845
  }
13210
12846
  }, _callee2, this);
13211
12847
  }));
13212
- function getBridgeFee(_x3, _x4, _x5) {
12848
+ function getBridgeFee(_x2, _x3, _x4) {
13213
12849
  return _getBridgeFee.apply(this, arguments);
13214
12850
  }
13215
12851
  return getBridgeFee;
@@ -13233,7 +12869,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13233
12869
  _t2 = _context3.v;
13234
12870
  feeRatio = _t(_t2);
13235
12871
  _context3.n = 3;
13236
- return this.getCanonicalTokenAddress(sourceChainId, sourceAsset);
12872
+ return this.getCanonicalTokenAddress(sourceAsset);
13237
12873
  case 3:
13238
12874
  canonicalIdFromContract = _context3.v;
13239
12875
  if (!(canonicalIdFromContract !== canonicalId)) {
@@ -13279,7 +12915,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13279
12915
  }
13280
12916
  }, _callee3, this);
13281
12917
  }));
13282
- function prepare(_x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13, _x14, _x15) {
12918
+ function prepare(_x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13, _x14) {
13283
12919
  return _prepare.apply(this, arguments);
13284
12920
  }
13285
12921
  return prepare;
@@ -13347,7 +12983,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13347
12983
  }
13348
12984
  }, _callee4, this);
13349
12985
  }));
13350
- function submitProof(_x16) {
12986
+ function submitProof(_x15) {
13351
12987
  return _submitProof.apply(this, arguments);
13352
12988
  }
13353
12989
  return submitProof;
@@ -13437,7 +13073,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13437
13073
  }
13438
13074
  }, _callee5, null, [[2, 8]]);
13439
13075
  }));
13440
- function pollJobStatus(_x17) {
13076
+ function pollJobStatus(_x16) {
13441
13077
  return _pollJobStatus.apply(this, arguments);
13442
13078
  }
13443
13079
  return pollJobStatus;
@@ -13472,7 +13108,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13472
13108
  }
13473
13109
  }, _callee6);
13474
13110
  }));
13475
- function generateProof(_x18) {
13111
+ function generateProof(_x17) {
13476
13112
  return _generateProof.apply(this, arguments);
13477
13113
  }
13478
13114
  return generateProof;
@@ -13503,7 +13139,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13503
13139
  }
13504
13140
  }, _callee7, this);
13505
13141
  }));
13506
- function computeDepositId(_x19) {
13142
+ function computeDepositId(_x18) {
13507
13143
  return _computeDepositId.apply(this, arguments);
13508
13144
  }
13509
13145
  return computeDepositId;
@@ -13525,7 +13161,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13525
13161
  }
13526
13162
  }, _callee8, this);
13527
13163
  }));
13528
- function getCurrentNonce(_x20) {
13164
+ function getCurrentNonce(_x19) {
13529
13165
  return _getCurrentNonce.apply(this, arguments);
13530
13166
  }
13531
13167
  return getCurrentNonce;
@@ -13563,7 +13199,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13563
13199
  }
13564
13200
  }, _callee9, this);
13565
13201
  }));
13566
- function composeCallData(_x21) {
13202
+ function composeCallData(_x20) {
13567
13203
  return _composeCallData.apply(this, arguments);
13568
13204
  }
13569
13205
  return composeCallData;
@@ -13585,7 +13221,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13585
13221
  amount = context.orderNote.amount;
13586
13222
  allowanceContract = new ethers.Contract(asset, ERC20Abi.abi, this._darkSwapOfSourceChain);
13587
13223
  _context0.n = 2;
13588
- return allowanceContract.allowance(signer.getAddress(), this._darkSwapOfSourceChain.contracts.darkSwapAssetManager);
13224
+ return allowanceContract.allowance(signer.getAddress(), this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager);
13589
13225
  case 2:
13590
13226
  allowance = _context0.v;
13591
13227
  if (!(BigInt(allowance) < amount)) {
@@ -13595,7 +13231,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13595
13231
  isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwapOfSourceChain.chainId) && legacyTokenConfig[this._darkSwapOfSourceChain.chainId].includes(asset.toLowerCase());
13596
13232
  contract = new ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
13597
13233
  _context0.n = 3;
13598
- return contract.approve(this._darkSwapOfSourceChain.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
13234
+ return contract.approve(this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, hexlify32(MAX_ALLOWANCE));
13599
13235
  case 3:
13600
13236
  tx = _context0.v;
13601
13237
  _context0.n = 4;
@@ -13605,7 +13241,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13605
13241
  }
13606
13242
  }, _callee0, this);
13607
13243
  }));
13608
- function allowance(_x22) {
13244
+ function allowance(_x21) {
13609
13245
  return _allowance.apply(this, arguments);
13610
13246
  }
13611
13247
  return allowance;
@@ -13639,7 +13275,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13639
13275
  }
13640
13276
  }, _callee1, this);
13641
13277
  }));
13642
- function execute(_x23) {
13278
+ function execute(_x22) {
13643
13279
  return _execute2.apply(this, arguments);
13644
13280
  }
13645
13281
  return execute;
@@ -13682,7 +13318,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
13682
13318
  }
13683
13319
  }, _callee10, this);
13684
13320
  }));
13685
- function _execute(_x24) {
13321
+ function _execute(_x23) {
13686
13322
  return _execute3.apply(this, arguments);
13687
13323
  }
13688
13324
  return _execute;
@@ -13758,5 +13394,5 @@ function deserializeDarkSwapMessage(serializedMessage) {
13758
13394
  };
13759
13395
  }
13760
13396
 
13761
- export { BridgeCreateOrderService, ChainId, DEFAULT_FEE_RATIO, DOMAIN_NOTE, DOMAIN_ORDER_NOTE, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NOTE, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO_PRECISION, GAS_LIMIT_MULTIPLIER, GAS_LIMIT_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCancelOrderService, ProCreateOrderService, ProSwapService, RetailCancelOrderService, RetailCreateOrderService, RetailSwapService, TripleJoinService, WithdrawService, calcFeeAmount, calcNullifier, contractConfig, createNote, createOrderNoteExt, deserializeDarkSwapMessage, generateKeyPair, getFeeRatio, getMerklePathAndRoot, getNoteFooter, getNoteOnChainStatusByPublicKey, getNoteOnChainStatusBySignature, getNullifierBySignature, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot, serializeDarkSwapMessage, validateNoteWithPubKey, validateOrderNoteWithPubKey };
13397
+ export { BridgeCreateOrderService, ChainId, DEFAULT_FEE_RATIO, DOMAIN_NOTE, DOMAIN_ORDER_NOTE, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NOTE, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO_PRECISION, GAS_LIMIT_MULTIPLIER, GAS_LIMIT_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCancelOrderService, ProCreateOrderService, ProSwapService, RetailCancelOrderService, RetailCreateOrderService, RetailSwapService, TripleJoinService, WithdrawService, calcFeeAmount, calcNullifier, contractConfig, createNote, createOrderNoteExt, deserializeDarkSwapMessage, generateKeyPair, getConfirmations, getFeeRatio, getMerklePathAndRoot, getNoteFooter, getNoteOnChainStatusByPublicKey, getNoteOnChainStatusBySignature, getNullifierBySignature, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteCreated, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot, serializeDarkSwapMessage, validateNoteWithPubKey, validateOrderNoteWithPubKey };
13762
13398
  //# sourceMappingURL=darkswap-sdk.esm.js.map