@thesingularitynetwork/darkswap-sdk 0.2.4 → 0.2.7-beta1

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.
@@ -2584,6 +2584,26 @@ function _getNullifierBySignature() {
2584
2584
  }));
2585
2585
  return _getNullifierBySignature.apply(this, arguments);
2586
2586
  }
2587
+ function isNoteCreated(_x19, _x20) {
2588
+ return _isNoteCreated.apply(this, arguments);
2589
+ }
2590
+ function _isNoteCreated() {
2591
+ _isNoteCreated = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(darkSwap, note) {
2592
+ var contract, isNotCreated;
2593
+ return _regenerator().w(function (_context8) {
2594
+ while (1) switch (_context8.n) {
2595
+ case 0:
2596
+ contract = getContract(darkSwap.contracts.merkleTreeOperator, darkSwap);
2597
+ _context8.n = 1;
2598
+ return contract.noteIsNotCreated(hexlify32(note));
2599
+ case 1:
2600
+ isNotCreated = _context8.v;
2601
+ return _context8.a(2, !isNotCreated);
2602
+ }
2603
+ }, _callee8);
2604
+ }));
2605
+ return _isNoteCreated.apply(this, arguments);
2606
+ }
2587
2607
 
2588
2608
  var _format$1 = "hh-sol-artifact-1";
2589
2609
  var contractName$1 = "DarkSwapAssetManager";
@@ -4208,13 +4228,19 @@ var ERC20_USDT = {
4208
4228
  ChainId[ChainId["HARDHAT_BASE"] = 31339] = "HARDHAT_BASE";
4209
4229
  ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
4210
4230
  ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
4231
+ ChainId[ChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
4211
4232
  ChainId[ChainId["HORIZEN_TESTNET"] = 845320009] = "HORIZEN_TESTNET";
4212
4233
  ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
4213
4234
  ChainId[ChainId["BASE"] = 8453] = "BASE";
4214
4235
  })(exports.ChainId || (exports.ChainId = {}));
4215
4236
 
4216
- var _legacyTokenConfig;
4237
+ var _legacyTokenConfig, _confirmationsConfig;
4217
4238
  var legacyTokenConfig = (_legacyTokenConfig = {}, _legacyTokenConfig[exports.ChainId.MAINNET] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig[exports.ChainId.HARDHAT] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig);
4239
+ var confirmationsConfig = (_confirmationsConfig = {}, _confirmationsConfig[exports.ChainId.MAINNET] = 3, _confirmationsConfig[exports.ChainId.ARBITRUM_ONE] = 3, _confirmationsConfig[exports.ChainId.BASE] = 3, _confirmationsConfig[exports.ChainId.SEPOLIA] = 3, _confirmationsConfig[exports.ChainId.HARDHAT] = 3, _confirmationsConfig);
4240
+ var DEFAULT_CONFIRMATIONS = 3;
4241
+ var getConfirmations = function getConfirmations(chainId) {
4242
+ return confirmationsConfig[chainId] || DEFAULT_CONFIRMATIONS;
4243
+ };
4218
4244
  var DEFAULT_FEE_RATIO = 300n;
4219
4245
  var GAS_LIMIT_MULTIPLIER = 120n;
4220
4246
  var GAS_LIMIT_PRECISION = 100n;
@@ -4725,8 +4751,8 @@ var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAIN
4725
4751
  darkSwapFeeAssetManager: '0x0',
4726
4752
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4727
4753
  synaraBridge: '0x0',
4728
- zkverifyRelayerUrls: [],
4729
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api'
4754
+ synaraCanonicalTokenRegistry: '0x0',
4755
+ zkverifyRelayerUrls: []
4730
4756
  }, _contractConfig[exports.ChainId.ARBITRUM_ONE] = {
4731
4757
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4732
4758
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4736,30 +4762,41 @@ var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAIN
4736
4762
  darkSwapFeeAssetManager: '0x0',
4737
4763
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4738
4764
  synaraBridge: '0x0',
4739
- zkverifyRelayerUrls: [],
4740
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
4765
+ synaraCanonicalTokenRegistry: '0x0',
4766
+ zkverifyRelayerUrls: []
4741
4767
  }, _contractConfig[exports.ChainId.BASE] = {
4742
4768
  priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
4743
4769
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4744
4770
  nativeWrapper: '0x4200000000000000000000000000000000000006',
4745
- merkleTreeOperator: '0x0',
4746
- darkSwapAssetManager: '0x0',
4747
- darkSwapFeeAssetManager: '0x0',
4771
+ merkleTreeOperator: '0x918B4F76CAE5F67A3818D8eD3d0e11D9888684E9',
4772
+ darkSwapAssetManager: '0x6fbA1F1aAb8449b7ba576E41F4617d918391b7cF',
4773
+ darkSwapFeeAssetManager: '0xfde341e63EB2f25A32D353d58C2DAd7f91c8Bd57',
4748
4774
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4749
4775
  synaraBridge: '0x0',
4750
- zkverifyRelayerUrls: [],
4751
- darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
4776
+ synaraCanonicalTokenRegistry: '0x0',
4777
+ zkverifyRelayerUrls: []
4752
4778
  }, _contractConfig[exports.ChainId.SEPOLIA] = {
4753
4779
  priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
4754
4780
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4755
4781
  nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
4756
- merkleTreeOperator: '0x0',
4757
- darkSwapAssetManager: '0x0',
4758
- darkSwapFeeAssetManager: '0x0',
4759
- synaraDarkSwapOnBridgeAssetManager: '0x0',
4760
- synaraBridge: '0x0',
4761
- zkverifyRelayerUrls: [],
4762
- darkSwapSubgraphUrl: ''
4782
+ merkleTreeOperator: '0xbeCd9FD715d131F8E897095Ef008BB4d9325B744',
4783
+ darkSwapAssetManager: '0x6E56b48361aD94Cb67EB5aA9182b2813bC76E6C0',
4784
+ darkSwapFeeAssetManager: '0x5C550CE1F4a02865F0f59d839D86807C75A6ddE0',
4785
+ synaraDarkSwapOnBridgeAssetManager: '0xEAC8292c1ef7b112Ccd5B3CB16E587E1799358db',
4786
+ synaraBridge: '0x2a9569b5df66B7E24B4FdC2B91d19E4C1C02F2D3',
4787
+ synaraCanonicalTokenRegistry: '0xD35264a934b5b7b8b3507b1d073e29EeBa4Dc754',
4788
+ zkverifyRelayerUrls: []
4789
+ }, _contractConfig[exports.ChainId.BASE_SEPOLIA] = {
4790
+ priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
4791
+ ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
4792
+ nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
4793
+ merkleTreeOperator: '0xC486e448e068A888AF09c386337E3C3C4812569b',
4794
+ darkSwapAssetManager: '0xEd349302ff6C2527be9555Fa386061652EAC712D',
4795
+ darkSwapFeeAssetManager: '0xa62C0693296f64eb9BA29ff2E41E96749c18de0F',
4796
+ synaraDarkSwapOnBridgeAssetManager: '0x0aAd845E874F0007e328862A3C455CB2D6625660',
4797
+ synaraBridge: '0xda348F7dEAeE972D8a5B4D4D182EF0273aDd3E2c',
4798
+ synaraCanonicalTokenRegistry: '0x016C6334d644E0B21aD5c6e91083Dd2f22739eB6',
4799
+ zkverifyRelayerUrls: []
4763
4800
  }, _contractConfig[exports.ChainId.HORIZEN_TESTNET] = {
4764
4801
  priceOracle: '0x54c375f28ce4B0c2B986D6256E4Bc75d242A8793',
4765
4802
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4769,8 +4806,8 @@ var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAIN
4769
4806
  darkSwapFeeAssetManager: '0x8CF86856Bd7dE95b4ba33DCae4cd5Ec02542Bf5b',
4770
4807
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4771
4808
  synaraBridge: '0x0',
4772
- zkverifyRelayerUrls: [],
4773
- darkSwapSubgraphUrl: ''
4809
+ synaraCanonicalTokenRegistry: '0x0',
4810
+ zkverifyRelayerUrls: []
4774
4811
  }, _contractConfig[exports.ChainId.HARDHAT] = {
4775
4812
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4776
4813
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4780,8 +4817,8 @@ var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAIN
4780
4817
  darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
4781
4818
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4782
4819
  synaraBridge: '0x0',
4783
- zkverifyRelayerUrls: [],
4784
- darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4820
+ synaraCanonicalTokenRegistry: '0x0',
4821
+ zkverifyRelayerUrls: []
4785
4822
  }, _contractConfig[exports.ChainId.HARDHAT_BASE] = {
4786
4823
  priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
4787
4824
  ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
@@ -4791,8 +4828,8 @@ var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAIN
4791
4828
  darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
4792
4829
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4793
4830
  synaraBridge: '0x0',
4794
- zkverifyRelayerUrls: [],
4795
- darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4831
+ synaraCanonicalTokenRegistry: '0x0',
4832
+ zkverifyRelayerUrls: []
4796
4833
  }, _contractConfig);
4797
4834
 
4798
4835
  function refineGasLimit(estimatedGas) {
@@ -5023,7 +5060,7 @@ var DepositService = /*#__PURE__*/function (_BaseContractService) {
5023
5060
  case 3:
5024
5061
  tx = _context4.v;
5025
5062
  _context4.n = 4;
5026
- return tx.wait();
5063
+ return tx.wait(getConfirmations(this._darkSwap.chainId));
5027
5064
  case 4:
5028
5065
  return _context4.a(2);
5029
5066
  }
@@ -9361,9 +9398,9 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9361
9398
  }
9362
9399
  _inheritsLoose(RetailCreateOrderService, _BaseContractService);
9363
9400
  var _proto = RetailCreateOrderService.prototype;
9364
- _proto.prepare = /*#__PURE__*/function () {
9365
- var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(address, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
9366
- var _yield$generateKeyPai, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
9401
+ _proto.rebuildContextFromSwapMessage = /*#__PURE__*/function () {
9402
+ var _rebuildContextFromSwapMessage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(swapMessage, signature) {
9403
+ var _yield$generateKeyPai, pubKey, context;
9367
9404
  return _regenerator().w(function (_context) {
9368
9405
  while (1) switch (_context.n) {
9369
9406
  case 0:
@@ -9372,12 +9409,46 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9372
9409
  case 1:
9373
9410
  _yield$generateKeyPai = _context.v;
9374
9411
  pubKey = _yield$generateKeyPai[0];
9375
- privKey = _yield$generateKeyPai[1];
9412
+ if (validateOrderNoteWithPubKey(swapMessage.orderNote, pubKey)) {
9413
+ _context.n = 2;
9414
+ break;
9415
+ }
9416
+ throw new DarkSwapError('SwapMessage does not belong to this wallet');
9417
+ case 2:
9418
+ context = new RetailCreateOrderContext(signature);
9419
+ context.orderNote = swapMessage.orderNote;
9420
+ context.swapInNote = swapMessage.inNote;
9421
+ context.feeAmount = swapMessage.feeAmount;
9422
+ context.address = swapMessage.address;
9423
+ _context.n = 3;
9424
+ return this.generateProof(context);
9425
+ case 3:
9426
+ return _context.a(2, context);
9427
+ }
9428
+ }, _callee, this);
9429
+ }));
9430
+ function rebuildContextFromSwapMessage(_x, _x2) {
9431
+ return _rebuildContextFromSwapMessage.apply(this, arguments);
9432
+ }
9433
+ return rebuildContextFromSwapMessage;
9434
+ }();
9435
+ _proto.prepare = /*#__PURE__*/function () {
9436
+ var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(address, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
9437
+ var _yield$generateKeyPai2, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
9438
+ return _regenerator().w(function (_context2) {
9439
+ while (1) switch (_context2.n) {
9440
+ case 0:
9441
+ _context2.n = 1;
9442
+ return generateKeyPair(signature);
9443
+ case 1:
9444
+ _yield$generateKeyPai2 = _context2.v;
9445
+ pubKey = _yield$generateKeyPai2[0];
9446
+ privKey = _yield$generateKeyPai2[1];
9376
9447
  _t = BigInt;
9377
- _context.n = 2;
9448
+ _context2.n = 2;
9378
9449
  return getFeeRatio(address, this._darkSwap);
9379
9450
  case 2:
9380
- _t2 = _context.v;
9451
+ _t2 = _context2.v;
9381
9452
  feeRatio = _t(_t2);
9382
9453
  orderNote = createOrderNoteExt(address, depositAsset, depositAmount, feeRatio, pubKey);
9383
9454
  feeAmount = calcFeeAmount(swapInAmount, feeRatio);
@@ -9388,36 +9459,36 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9388
9459
  context.swapInNote = swapInNote;
9389
9460
  context.feeAmount = feeAmount;
9390
9461
  context.address = address;
9391
- _context.n = 3;
9462
+ _context2.n = 3;
9392
9463
  return generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
9393
9464
  case 3:
9394
- swapMessage = _context.v;
9465
+ swapMessage = _context2.v;
9395
9466
  context.swapMessage = swapMessage;
9396
- return _context.a(2, {
9467
+ return _context2.a(2, {
9397
9468
  context: context,
9398
9469
  swapMessage: swapMessage
9399
9470
  });
9400
9471
  }
9401
- }, _callee, this);
9472
+ }, _callee2, this);
9402
9473
  }));
9403
- function prepare(_x, _x2, _x3, _x4, _x5, _x6) {
9474
+ function prepare(_x3, _x4, _x5, _x6, _x7, _x8) {
9404
9475
  return _prepare.apply(this, arguments);
9405
9476
  }
9406
9477
  return prepare;
9407
9478
  }();
9408
9479
  _proto.generateProof = /*#__PURE__*/function () {
9409
- var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context) {
9480
+ var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
9410
9481
  var proof;
9411
- return _regenerator().w(function (_context2) {
9412
- while (1) switch (_context2.n) {
9482
+ return _regenerator().w(function (_context3) {
9483
+ while (1) switch (_context3.n) {
9413
9484
  case 0:
9414
9485
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || !context.feeAmount || !context.signature)) {
9415
- _context2.n = 1;
9486
+ _context3.n = 1;
9416
9487
  break;
9417
9488
  }
9418
9489
  throw new DarkSwapError('Invalid context');
9419
9490
  case 1:
9420
- _context2.n = 2;
9491
+ _context3.n = 2;
9421
9492
  return generateRetailCreateOrderProof({
9422
9493
  depositNote: context.orderNote,
9423
9494
  swapInNote: context.swapInNote,
@@ -9426,71 +9497,77 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9426
9497
  feeAmount: context.feeAmount
9427
9498
  });
9428
9499
  case 2:
9429
- proof = _context2.v;
9500
+ proof = _context3.v;
9430
9501
  context.proof = proof;
9431
9502
  case 3:
9432
- return _context2.a(2);
9503
+ return _context3.a(2);
9433
9504
  }
9434
- }, _callee2);
9505
+ }, _callee3);
9435
9506
  }));
9436
- function generateProof(_x7) {
9507
+ function generateProof(_x9) {
9437
9508
  return _generateProof.apply(this, arguments);
9438
9509
  }
9439
9510
  return generateProof;
9440
9511
  }();
9441
9512
  _proto.allowance = /*#__PURE__*/function () {
9442
- var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
9513
+ var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
9443
9514
  var signer, asset, amount, allowanceContract, allowance, isLegacy, contract, tx;
9444
- return _regenerator().w(function (_context3) {
9445
- while (1) switch (_context3.n) {
9515
+ return _regenerator().w(function (_context4) {
9516
+ while (1) switch (_context4.n) {
9446
9517
  case 0:
9447
9518
  if (!(!context || !context.orderNote || !context.address || !context.signature || !context.proof)) {
9448
- _context3.n = 1;
9519
+ _context4.n = 1;
9449
9520
  break;
9450
9521
  }
9451
9522
  throw new DarkSwapError('Invalid context');
9452
9523
  case 1:
9524
+ if (!isNativeAsset(context.orderNote.asset)) {
9525
+ _context4.n = 2;
9526
+ break;
9527
+ }
9528
+ return _context4.a(2);
9529
+ case 2:
9453
9530
  signer = this._darkSwap.signer;
9454
9531
  asset = context.orderNote.asset;
9455
9532
  amount = context.orderNote.amount;
9456
9533
  allowanceContract = new ethers.ethers.Contract(asset, ERC20Abi.abi, this._darkSwap);
9457
- _context3.n = 2;
9534
+ _context4.n = 3;
9458
9535
  return allowanceContract.allowance(signer.getAddress(), this._darkSwap.contracts.darkSwapAssetManager);
9459
- case 2:
9460
- allowance = _context3.v;
9536
+ case 3:
9537
+ allowance = _context4.v;
9461
9538
  if (!(BigInt(allowance) < amount)) {
9462
- _context3.n = 4;
9539
+ _context4.n = 5;
9463
9540
  break;
9464
9541
  }
9465
9542
  isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwap.chainId) && legacyTokenConfig[this._darkSwap.chainId].includes(asset.toLowerCase());
9466
9543
  contract = new ethers.ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
9467
- _context3.n = 3;
9544
+ _context4.n = 4;
9468
9545
  return contract.approve(this._darkSwap.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
9469
- case 3:
9470
- tx = _context3.v;
9471
- _context3.n = 4;
9472
- return tx.wait();
9473
9546
  case 4:
9474
- return _context3.a(2);
9547
+ tx = _context4.v;
9548
+ _context4.n = 5;
9549
+ return tx.wait(getConfirmations(this._darkSwap.chainId));
9550
+ case 5:
9551
+ return _context4.a(2);
9475
9552
  }
9476
- }, _callee3, this);
9553
+ }, _callee4, this);
9477
9554
  }));
9478
- function allowance(_x8) {
9555
+ function allowance(_x0) {
9479
9556
  return _allowance.apply(this, arguments);
9480
9557
  }
9481
9558
  return allowance;
9482
9559
  }();
9483
9560
  _proto.execute = /*#__PURE__*/function () {
9484
- var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
9561
+ var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
9485
9562
  var contract, ethAmount, tx;
9486
- return _regenerator().w(function (_context4) {
9487
- while (1) switch (_context4.n) {
9563
+ return _regenerator().w(function (_context5) {
9564
+ while (1) switch (_context5.n) {
9488
9565
  case 0:
9489
- _context4.n = 1;
9566
+ _context5.n = 1;
9490
9567
  return this.generateProof(context);
9491
9568
  case 1:
9492
9569
  if (!(!context || !context.orderNote || !context.swapInNote || !context.proof)) {
9493
- _context4.n = 2;
9570
+ _context5.n = 2;
9494
9571
  break;
9495
9572
  }
9496
9573
  throw new DarkSwapError('Invalid context');
@@ -9498,30 +9575,30 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
9498
9575
  contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
9499
9576
  ethAmount = 0n;
9500
9577
  if (!isNativeAsset(context.orderNote.asset)) {
9501
- _context4.n = 3;
9578
+ _context5.n = 3;
9502
9579
  break;
9503
9580
  }
9504
9581
  ethAmount = context.orderNote.amount;
9505
- _context4.n = 4;
9582
+ _context5.n = 4;
9506
9583
  break;
9507
9584
  case 3:
9508
- _context4.n = 4;
9585
+ _context5.n = 4;
9509
9586
  return this.allowance(context);
9510
9587
  case 4:
9511
- _context4.n = 5;
9588
+ _context5.n = 5;
9512
9589
  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, {
9513
9590
  value: bn_to_0xhex(ethAmount)
9514
9591
  });
9515
9592
  case 5:
9516
- tx = _context4.v;
9517
- _context4.n = 6;
9593
+ tx = _context5.v;
9594
+ _context5.n = 6;
9518
9595
  return tx.wait();
9519
9596
  case 6:
9520
- return _context4.a(2, tx.hash);
9597
+ return _context5.a(2, tx.hash);
9521
9598
  }
9522
- }, _callee4, this);
9599
+ }, _callee5, this);
9523
9600
  }));
9524
- function execute(_x9) {
9601
+ function execute(_x1) {
9525
9602
  return _execute.apply(this, arguments);
9526
9603
  }
9527
9604
  return execute;
@@ -9871,7 +9948,7 @@ function generateRetailSwapProof(_x) {
9871
9948
  }
9872
9949
  function _generateRetailSwapProof() {
9873
9950
  _generateRetailSwapProof = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(param) {
9874
- var aliceFeeAmount, bobFeeAmount, aliceOrderNoteNullifier, aliceInNoteFooter, bobOrderNoteNullifier, bobInNoteFooter, aliceAddressMod, bobAddressMod, inputs, proof;
9951
+ var aliceOrderNoteNullifier, aliceInNoteFooter, bobOrderNoteNullifier, bobInNoteFooter, aliceAddressMod, bobAddressMod, inputs, proof;
9875
9952
  return _regenerator().w(function (_context) {
9876
9953
  while (1) switch (_context.n) {
9877
9954
  case 0:
@@ -9887,14 +9964,12 @@ function _generateRetailSwapProof() {
9887
9964
  }
9888
9965
  throw new DarkSwapProofError("Invalid note amount");
9889
9966
  case 2:
9890
- if (!(param.aliceMessage.orderNote.amount != param.bobMessage.inNote.amount || param.bobMessage.orderNote.amount != param.aliceMessage.inNote.amount)) {
9967
+ if (!(param.aliceMessage.orderNote.amount != param.bobMessage.inNote.amount + param.bobMessage.feeAmount || param.bobMessage.orderNote.amount != param.aliceMessage.inNote.amount + param.aliceMessage.feeAmount)) {
9891
9968
  _context.n = 3;
9892
9969
  break;
9893
9970
  }
9894
9971
  throw new DarkSwapProofError("Invalid order amount");
9895
9972
  case 3:
9896
- aliceFeeAmount = param.aliceMessage.inNote.amount * param.aliceMessage.orderNote.feeRatio / FEE_RATIO_PRECISION;
9897
- bobFeeAmount = param.bobMessage.inNote.amount * param.bobMessage.orderNote.feeRatio / FEE_RATIO_PRECISION;
9898
9973
  aliceOrderNoteNullifier = calcNullifier(param.aliceMessage.orderNote.rho, param.aliceMessage.publicKey);
9899
9974
  aliceInNoteFooter = getNoteFooter(param.aliceMessage.inNote.rho, param.aliceMessage.publicKey);
9900
9975
  bobOrderNoteNullifier = calcNullifier(param.bobMessage.orderNote.rho, param.bobMessage.publicKey);
@@ -9914,10 +9989,10 @@ function _generateRetailSwapProof() {
9914
9989
  alice_out_note: bn_to_0xhex(param.aliceMessage.orderNote.note),
9915
9990
  alice_out_nullifier: bn_to_0xhex(aliceOrderNoteNullifier),
9916
9991
  alice_fee_ratio: bn_to_0xhex(param.aliceMessage.orderNote.feeRatio),
9917
- alice_fee_amount: bn_to_0xhex(aliceFeeAmount),
9992
+ alice_fee_amount: bn_to_0xhex(param.aliceMessage.feeAmount),
9918
9993
  alice_in_rho: bn_to_0xhex(param.aliceMessage.inNote.rho),
9919
9994
  alice_in_asset: bn_to_0xhex(encodeAddress(param.aliceMessage.inNote.asset)),
9920
- alice_in_amount: bn_to_0xhex(param.aliceMessage.inNote.amount),
9995
+ alice_in_amount: bn_to_0xhex(param.aliceMessage.inNote.amount + param.aliceMessage.feeAmount),
9921
9996
  alice_in_note: bn_to_0xhex(param.aliceMessage.inNote.note),
9922
9997
  alice_in_note_footer: bn_to_0xhex(aliceInNoteFooter),
9923
9998
  alice_pub_key: [param.aliceMessage.publicKey[0].toString(), param.aliceMessage.publicKey[1].toString()],
@@ -9931,7 +10006,7 @@ function _generateRetailSwapProof() {
9931
10006
  bob_out_rho: bn_to_0xhex(param.bobMessage.orderNote.rho),
9932
10007
  bob_out_nullifier: bn_to_0xhex(bobOrderNoteNullifier),
9933
10008
  bob_fee_ratio: bn_to_0xhex(param.bobMessage.orderNote.feeRatio),
9934
- bob_fee_amount: bn_to_0xhex(bobFeeAmount),
10009
+ bob_fee_amount: bn_to_0xhex(param.bobMessage.feeAmount),
9935
10010
  bob_in_note: bn_to_0xhex(param.bobMessage.inNote.note),
9936
10011
  bob_in_rho: bn_to_0xhex(param.bobMessage.inNote.rho),
9937
10012
  bob_in_note_footer: bn_to_0xhex(bobInNoteFooter),
@@ -11112,144 +11187,1614 @@ var SynaraDarkSwapOnBridgeAssetManagerAbi = {
11112
11187
  deployedLinkReferences: deployedLinkReferences$5
11113
11188
  };
11114
11189
 
11115
- var _DOMAIN_PREFIX = "0x191253796e6172614272696467654465706f7369740a";
11116
- var BridgeCreateOrderContext = /*#__PURE__*/function (_BaseContext) {
11117
- function BridgeCreateOrderContext(signature) {
11118
- return _BaseContext.call(this, signature) || this;
11119
- }
11120
- _inheritsLoose(BridgeCreateOrderContext, _BaseContext);
11121
- return _createClass(BridgeCreateOrderContext, [{
11122
- key: "orderNote",
11123
- get: function get() {
11124
- return this._orderNote;
11125
- },
11126
- set: function set(orderNote) {
11127
- this._orderNote = orderNote;
11128
- }
11129
- }, {
11130
- key: "swapInNote",
11131
- get: function get() {
11132
- return this._swapInNote;
11133
- },
11134
- set: function set(swapInNote) {
11135
- this._swapInNote = swapInNote;
11136
- }
11137
- }, {
11138
- key: "feeAmount",
11139
- get: function get() {
11140
- return this._feeAmount;
11141
- },
11142
- set: function set(feeAmount) {
11143
- this._feeAmount = feeAmount;
11144
- }
11145
- }, {
11146
- key: "proof",
11147
- get: function get() {
11148
- return this._proof;
11149
- },
11150
- set: function set(proof) {
11151
- this._proof = proof;
11152
- }
11153
- }, {
11154
- key: "swapMessage",
11155
- get: function get() {
11156
- return this._swapMessage;
11157
- },
11158
- set: function set(swapMessage) {
11159
- this._swapMessage = swapMessage;
11160
- }
11161
- }, {
11162
- key: "sourceChainId",
11163
- get: function get() {
11164
- return this._sourceChainId;
11165
- },
11166
- set: function set(sourceChainId) {
11167
- this._sourceChainId = sourceChainId;
11168
- }
11169
- }, {
11170
- key: "destChainId",
11171
- get: function get() {
11172
- return this._destChainId;
11173
- },
11174
- set: function set(destChainId) {
11175
- this._destChainId = destChainId;
11176
- }
11177
- }, {
11178
- key: "sourceAsset",
11179
- get: function get() {
11180
- return this._sourceAsset;
11181
- },
11182
- set: function set(sourceAsset) {
11183
- this._sourceAsset = sourceAsset;
11184
- }
11185
- }, {
11186
- key: "sourceAmount",
11187
- get: function get() {
11188
- return this._sourceAmount;
11189
- },
11190
- set: function set(sourceAmount) {
11191
- this._sourceAmount = sourceAmount;
11192
- }
11193
- }, {
11194
- key: "bridgeFeeAmount",
11195
- get: function get() {
11196
- return this._bridgeFeeAmount;
11197
- },
11198
- set: function set(bridgeFeeAmount) {
11199
- this._bridgeFeeAmount = bridgeFeeAmount;
11200
- }
11201
- }, {
11202
- key: "depositId",
11203
- get: function get() {
11204
- return this._depositId;
11205
- },
11206
- set: function set(depositId) {
11207
- this._depositId = depositId;
11208
- }
11209
- }, {
11210
- key: "attestationDetails",
11211
- get: function get() {
11212
- return this._attestationDetails;
11213
- },
11214
- set: function set(attestationDetails) {
11215
- this._attestationDetails = attestationDetails;
11216
- }
11217
- }, {
11218
- key: "relayer",
11219
- get: function get() {
11220
- return this._relayer;
11221
- },
11222
- set: function set(relayer) {
11223
- this._relayer = relayer;
11224
- }
11225
- }, {
11226
- key: "jobId",
11227
- get: function get() {
11228
- return this._jobId;
11229
- },
11230
- set: function set(jobId) {
11231
- this._jobId = jobId;
11232
- }
11233
- }, {
11234
- key: "canonicalId",
11235
- get: function get() {
11236
- return this._canonicalId;
11237
- },
11238
- set: function set(canonicalId) {
11239
- this._canonicalId = canonicalId;
11240
- }
11241
- }, {
11242
- key: "callDataHash",
11243
- get: function get() {
11244
- return this._callDataHash;
11245
- },
11246
- set: function set(callDataHash) {
11247
- this._callDataHash = callDataHash;
11248
- }
11249
- }, {
11250
- key: "nonce",
11251
- get: function get() {
11252
- return this._nonce;
11190
+ var CanonicalTokenRegistryAbi = [
11191
+ {
11192
+ inputs: [
11193
+ ],
11194
+ stateMutability: "nonpayable",
11195
+ type: "constructor"
11196
+ },
11197
+ {
11198
+ inputs: [
11199
+ ],
11200
+ name: "AccessControlBadConfirmation",
11201
+ type: "error"
11202
+ },
11203
+ {
11204
+ inputs: [
11205
+ {
11206
+ internalType: "address",
11207
+ name: "account",
11208
+ type: "address"
11209
+ },
11210
+ {
11211
+ internalType: "bytes32",
11212
+ name: "neededRole",
11213
+ type: "bytes32"
11214
+ }
11215
+ ],
11216
+ name: "AccessControlUnauthorizedAccount",
11217
+ type: "error"
11218
+ },
11219
+ {
11220
+ inputs: [
11221
+ ],
11222
+ name: "AlreadyRegistered",
11223
+ type: "error"
11224
+ },
11225
+ {
11226
+ inputs: [
11227
+ ],
11228
+ name: "EnforcedPause",
11229
+ type: "error"
11230
+ },
11231
+ {
11232
+ inputs: [
11233
+ ],
11234
+ name: "ExpectedPause",
11235
+ type: "error"
11236
+ },
11237
+ {
11238
+ inputs: [
11239
+ ],
11240
+ name: "NotRegistered",
11241
+ type: "error"
11242
+ },
11243
+ {
11244
+ inputs: [
11245
+ ],
11246
+ name: "TokenAlreadyMapped",
11247
+ type: "error"
11248
+ },
11249
+ {
11250
+ inputs: [
11251
+ ],
11252
+ name: "ZeroAddress",
11253
+ type: "error"
11254
+ },
11255
+ {
11256
+ inputs: [
11257
+ ],
11258
+ name: "ZeroCanonicalId",
11259
+ type: "error"
11260
+ },
11261
+ {
11262
+ anonymous: false,
11263
+ inputs: [
11264
+ {
11265
+ indexed: false,
11266
+ internalType: "address",
11267
+ name: "account",
11268
+ type: "address"
11269
+ }
11270
+ ],
11271
+ name: "Paused",
11272
+ type: "event"
11273
+ },
11274
+ {
11275
+ anonymous: false,
11276
+ inputs: [
11277
+ {
11278
+ indexed: true,
11279
+ internalType: "bytes32",
11280
+ name: "role",
11281
+ type: "bytes32"
11282
+ },
11283
+ {
11284
+ indexed: true,
11285
+ internalType: "bytes32",
11286
+ name: "previousAdminRole",
11287
+ type: "bytes32"
11288
+ },
11289
+ {
11290
+ indexed: true,
11291
+ internalType: "bytes32",
11292
+ name: "newAdminRole",
11293
+ type: "bytes32"
11294
+ }
11295
+ ],
11296
+ name: "RoleAdminChanged",
11297
+ type: "event"
11298
+ },
11299
+ {
11300
+ anonymous: false,
11301
+ inputs: [
11302
+ {
11303
+ indexed: true,
11304
+ internalType: "bytes32",
11305
+ name: "role",
11306
+ type: "bytes32"
11307
+ },
11308
+ {
11309
+ indexed: true,
11310
+ internalType: "address",
11311
+ name: "account",
11312
+ type: "address"
11313
+ },
11314
+ {
11315
+ indexed: true,
11316
+ internalType: "address",
11317
+ name: "sender",
11318
+ type: "address"
11319
+ }
11320
+ ],
11321
+ name: "RoleGranted",
11322
+ type: "event"
11323
+ },
11324
+ {
11325
+ anonymous: false,
11326
+ inputs: [
11327
+ {
11328
+ indexed: true,
11329
+ internalType: "bytes32",
11330
+ name: "role",
11331
+ type: "bytes32"
11332
+ },
11333
+ {
11334
+ indexed: true,
11335
+ internalType: "address",
11336
+ name: "account",
11337
+ type: "address"
11338
+ },
11339
+ {
11340
+ indexed: true,
11341
+ internalType: "address",
11342
+ name: "sender",
11343
+ type: "address"
11344
+ }
11345
+ ],
11346
+ name: "RoleRevoked",
11347
+ type: "event"
11348
+ },
11349
+ {
11350
+ anonymous: false,
11351
+ inputs: [
11352
+ {
11353
+ indexed: true,
11354
+ internalType: "bytes32",
11355
+ name: "canonicalId",
11356
+ type: "bytes32"
11357
+ },
11358
+ {
11359
+ indexed: true,
11360
+ internalType: "address",
11361
+ name: "token",
11362
+ type: "address"
11363
+ }
11364
+ ],
11365
+ name: "TokenMappingRemoved",
11366
+ type: "event"
11367
+ },
11368
+ {
11369
+ anonymous: false,
11370
+ inputs: [
11371
+ {
11372
+ indexed: true,
11373
+ internalType: "bytes32",
11374
+ name: "canonicalId",
11375
+ type: "bytes32"
11376
+ },
11377
+ {
11378
+ indexed: true,
11379
+ internalType: "address",
11380
+ name: "token",
11381
+ type: "address"
11382
+ }
11383
+ ],
11384
+ name: "TokenMappingSet",
11385
+ type: "event"
11386
+ },
11387
+ {
11388
+ anonymous: false,
11389
+ inputs: [
11390
+ {
11391
+ indexed: false,
11392
+ internalType: "address",
11393
+ name: "account",
11394
+ type: "address"
11395
+ }
11396
+ ],
11397
+ name: "Unpaused",
11398
+ type: "event"
11399
+ },
11400
+ {
11401
+ inputs: [
11402
+ ],
11403
+ name: "DEFAULT_ADMIN_ROLE",
11404
+ outputs: [
11405
+ {
11406
+ internalType: "bytes32",
11407
+ name: "",
11408
+ type: "bytes32"
11409
+ }
11410
+ ],
11411
+ stateMutability: "view",
11412
+ type: "function"
11413
+ },
11414
+ {
11415
+ inputs: [
11416
+ ],
11417
+ name: "GUARDIAN_ROLE",
11418
+ outputs: [
11419
+ {
11420
+ internalType: "bytes32",
11421
+ name: "",
11422
+ type: "bytes32"
11423
+ }
11424
+ ],
11425
+ stateMutability: "view",
11426
+ type: "function"
11427
+ },
11428
+ {
11429
+ inputs: [
11430
+ ],
11431
+ name: "OPERATOR_ROLE",
11432
+ outputs: [
11433
+ {
11434
+ internalType: "bytes32",
11435
+ name: "",
11436
+ type: "bytes32"
11437
+ }
11438
+ ],
11439
+ stateMutability: "view",
11440
+ type: "function"
11441
+ },
11442
+ {
11443
+ inputs: [
11444
+ {
11445
+ internalType: "address",
11446
+ name: "token",
11447
+ type: "address"
11448
+ }
11449
+ ],
11450
+ name: "getCanonicalId",
11451
+ outputs: [
11452
+ {
11453
+ internalType: "bytes32",
11454
+ name: "",
11455
+ type: "bytes32"
11456
+ }
11457
+ ],
11458
+ stateMutability: "view",
11459
+ type: "function"
11460
+ },
11461
+ {
11462
+ inputs: [
11463
+ {
11464
+ internalType: "bytes32",
11465
+ name: "role",
11466
+ type: "bytes32"
11467
+ }
11468
+ ],
11469
+ name: "getRoleAdmin",
11470
+ outputs: [
11471
+ {
11472
+ internalType: "bytes32",
11473
+ name: "",
11474
+ type: "bytes32"
11475
+ }
11476
+ ],
11477
+ stateMutability: "view",
11478
+ type: "function"
11479
+ },
11480
+ {
11481
+ inputs: [
11482
+ {
11483
+ internalType: "bytes32",
11484
+ name: "canonicalId",
11485
+ type: "bytes32"
11486
+ }
11487
+ ],
11488
+ name: "getToken",
11489
+ outputs: [
11490
+ {
11491
+ internalType: "address",
11492
+ name: "",
11493
+ type: "address"
11494
+ }
11495
+ ],
11496
+ stateMutability: "view",
11497
+ type: "function"
11498
+ },
11499
+ {
11500
+ inputs: [
11501
+ {
11502
+ internalType: "bytes32",
11503
+ name: "role",
11504
+ type: "bytes32"
11505
+ },
11506
+ {
11507
+ internalType: "address",
11508
+ name: "account",
11509
+ type: "address"
11510
+ }
11511
+ ],
11512
+ name: "grantRole",
11513
+ outputs: [
11514
+ ],
11515
+ stateMutability: "nonpayable",
11516
+ type: "function"
11517
+ },
11518
+ {
11519
+ inputs: [
11520
+ {
11521
+ internalType: "bytes32",
11522
+ name: "role",
11523
+ type: "bytes32"
11524
+ },
11525
+ {
11526
+ internalType: "address",
11527
+ name: "account",
11528
+ type: "address"
11529
+ }
11530
+ ],
11531
+ name: "hasRole",
11532
+ outputs: [
11533
+ {
11534
+ internalType: "bool",
11535
+ name: "",
11536
+ type: "bool"
11537
+ }
11538
+ ],
11539
+ stateMutability: "view",
11540
+ type: "function"
11541
+ },
11542
+ {
11543
+ inputs: [
11544
+ {
11545
+ internalType: "bytes32",
11546
+ name: "canonicalId",
11547
+ type: "bytes32"
11548
+ }
11549
+ ],
11550
+ name: "isRegistered",
11551
+ outputs: [
11552
+ {
11553
+ internalType: "bool",
11554
+ name: "",
11555
+ type: "bool"
11556
+ }
11557
+ ],
11558
+ stateMutability: "view",
11559
+ type: "function"
11560
+ },
11561
+ {
11562
+ inputs: [
11563
+ ],
11564
+ name: "pause",
11565
+ outputs: [
11566
+ ],
11567
+ stateMutability: "nonpayable",
11568
+ type: "function"
11569
+ },
11570
+ {
11571
+ inputs: [
11572
+ ],
11573
+ name: "paused",
11574
+ outputs: [
11575
+ {
11576
+ internalType: "bool",
11577
+ name: "",
11578
+ type: "bool"
11579
+ }
11580
+ ],
11581
+ stateMutability: "view",
11582
+ type: "function"
11583
+ },
11584
+ {
11585
+ inputs: [
11586
+ {
11587
+ internalType: "bytes32",
11588
+ name: "canonicalId",
11589
+ type: "bytes32"
11590
+ }
11591
+ ],
11592
+ name: "removeTokenMapping",
11593
+ outputs: [
11594
+ ],
11595
+ stateMutability: "nonpayable",
11596
+ type: "function"
11597
+ },
11598
+ {
11599
+ inputs: [
11600
+ {
11601
+ internalType: "bytes32",
11602
+ name: "role",
11603
+ type: "bytes32"
11604
+ },
11605
+ {
11606
+ internalType: "address",
11607
+ name: "callerConfirmation",
11608
+ type: "address"
11609
+ }
11610
+ ],
11611
+ name: "renounceRole",
11612
+ outputs: [
11613
+ ],
11614
+ stateMutability: "nonpayable",
11615
+ type: "function"
11616
+ },
11617
+ {
11618
+ inputs: [
11619
+ {
11620
+ internalType: "bytes32",
11621
+ name: "role",
11622
+ type: "bytes32"
11623
+ },
11624
+ {
11625
+ internalType: "address",
11626
+ name: "account",
11627
+ type: "address"
11628
+ }
11629
+ ],
11630
+ name: "revokeRole",
11631
+ outputs: [
11632
+ ],
11633
+ stateMutability: "nonpayable",
11634
+ type: "function"
11635
+ },
11636
+ {
11637
+ inputs: [
11638
+ {
11639
+ internalType: "bytes32",
11640
+ name: "canonicalId",
11641
+ type: "bytes32"
11642
+ },
11643
+ {
11644
+ internalType: "address",
11645
+ name: "token",
11646
+ type: "address"
11647
+ }
11648
+ ],
11649
+ name: "setTokenMapping",
11650
+ outputs: [
11651
+ ],
11652
+ stateMutability: "nonpayable",
11653
+ type: "function"
11654
+ },
11655
+ {
11656
+ inputs: [
11657
+ {
11658
+ internalType: "bytes4",
11659
+ name: "interfaceId",
11660
+ type: "bytes4"
11661
+ }
11662
+ ],
11663
+ name: "supportsInterface",
11664
+ outputs: [
11665
+ {
11666
+ internalType: "bool",
11667
+ name: "",
11668
+ type: "bool"
11669
+ }
11670
+ ],
11671
+ stateMutability: "view",
11672
+ type: "function"
11673
+ },
11674
+ {
11675
+ inputs: [
11676
+ ],
11677
+ name: "unpause",
11678
+ outputs: [
11679
+ ],
11680
+ stateMutability: "nonpayable",
11681
+ type: "function"
11682
+ }
11683
+ ];
11684
+
11685
+ var _format$6 = "hh-sol-artifact-1";
11686
+ var contractName$6 = "Bridge";
11687
+ var sourceName$6 = "src/Bridge.sol";
11688
+ var abi$h = [
11689
+ {
11690
+ inputs: [
11691
+ {
11692
+ internalType: "address",
11693
+ name: "_erc20Pool",
11694
+ type: "address"
11695
+ },
11696
+ {
11697
+ internalType: "address",
11698
+ name: "_nativePool",
11699
+ type: "address"
11700
+ },
11701
+ {
11702
+ internalType: "address",
11703
+ name: "feeManager",
11704
+ type: "address"
11705
+ },
11706
+ {
11707
+ internalType: "address",
11708
+ name: "verifierHub",
11709
+ type: "address"
11710
+ },
11711
+ {
11712
+ internalType: "address",
11713
+ name: "initialOwner",
11714
+ type: "address"
11715
+ }
11716
+ ],
11717
+ stateMutability: "nonpayable",
11718
+ type: "constructor"
11719
+ },
11720
+ {
11721
+ inputs: [
11722
+ ],
11723
+ name: "AmountZero",
11724
+ type: "error"
11725
+ },
11726
+ {
11727
+ inputs: [
11728
+ ],
11729
+ name: "CallDataHashMismatch",
11730
+ type: "error"
11731
+ },
11732
+ {
11733
+ inputs: [
11734
+ ],
11735
+ name: "CallerNotRegistered",
11736
+ type: "error"
11737
+ },
11738
+ {
11739
+ inputs: [
11740
+ ],
11741
+ name: "DepositExists",
11742
+ type: "error"
11743
+ },
11744
+ {
11745
+ inputs: [
11746
+ ],
11747
+ name: "DepositUsed",
11748
+ type: "error"
11749
+ },
11750
+ {
11751
+ inputs: [
11752
+ ],
11753
+ name: "NonceTooLow",
11754
+ type: "error"
11755
+ },
11756
+ {
11757
+ inputs: [
11758
+ {
11759
+ internalType: "address",
11760
+ name: "owner",
11761
+ type: "address"
11762
+ }
11763
+ ],
11764
+ name: "OwnableInvalidOwner",
11765
+ type: "error"
11766
+ },
11767
+ {
11768
+ inputs: [
11769
+ {
11770
+ internalType: "address",
11771
+ name: "account",
11772
+ type: "address"
11773
+ }
11774
+ ],
11775
+ name: "OwnableUnauthorizedAccount",
11776
+ type: "error"
11777
+ },
11778
+ {
11779
+ inputs: [
11780
+ ],
11781
+ name: "ReentrancyGuardReentrantCall",
11782
+ type: "error"
11783
+ },
11784
+ {
11785
+ inputs: [
11786
+ {
11787
+ internalType: "address",
11788
+ name: "token",
11789
+ type: "address"
11790
+ }
11791
+ ],
11792
+ name: "SafeERC20FailedOperation",
11793
+ type: "error"
11794
+ },
11795
+ {
11796
+ inputs: [
11797
+ ],
11798
+ name: "ZeroAddress",
11799
+ type: "error"
11800
+ },
11801
+ {
11802
+ anonymous: false,
11803
+ inputs: [
11804
+ {
11805
+ indexed: true,
11806
+ internalType: "bytes32",
11807
+ name: "depositCommitment",
11808
+ type: "bytes32"
11809
+ },
11810
+ {
11811
+ indexed: true,
11812
+ internalType: "bytes32",
11813
+ name: "canonicalTokenId",
11814
+ type: "bytes32"
11815
+ },
11816
+ {
11817
+ indexed: true,
11818
+ internalType: "address",
11819
+ name: "from",
11820
+ type: "address"
11821
+ },
11822
+ {
11823
+ indexed: false,
11824
+ internalType: "address",
11825
+ name: "owner",
11826
+ type: "address"
11827
+ },
11828
+ {
11829
+ indexed: false,
11830
+ internalType: "uint256",
11831
+ name: "amount",
11832
+ type: "uint256"
11833
+ },
11834
+ {
11835
+ indexed: false,
11836
+ internalType: "uint256",
11837
+ name: "destinationChain",
11838
+ type: "uint256"
11839
+ },
11840
+ {
11841
+ indexed: false,
11842
+ internalType: "uint256",
11843
+ name: "nonce",
11844
+ type: "uint256"
11845
+ },
11846
+ {
11847
+ indexed: false,
11848
+ internalType: "uint256",
11849
+ name: "sourceChain",
11850
+ type: "uint256"
11851
+ },
11852
+ {
11853
+ indexed: false,
11854
+ internalType: "address",
11855
+ name: "destContract",
11856
+ type: "address"
11857
+ },
11858
+ {
11859
+ indexed: false,
11860
+ internalType: "bytes",
11861
+ name: "callData",
11862
+ type: "bytes"
11863
+ }
11864
+ ],
11865
+ name: "Deposited",
11866
+ type: "event"
11867
+ },
11868
+ {
11869
+ anonymous: false,
11870
+ inputs: [
11871
+ {
11872
+ indexed: true,
11873
+ internalType: "address",
11874
+ name: "previousOwner",
11875
+ type: "address"
11876
+ },
11877
+ {
11878
+ indexed: true,
11879
+ internalType: "address",
11880
+ name: "newOwner",
11881
+ type: "address"
11882
+ }
11883
+ ],
11884
+ name: "OwnershipTransferred",
11885
+ type: "event"
11886
+ },
11887
+ {
11888
+ anonymous: false,
11889
+ inputs: [
11890
+ {
11891
+ indexed: true,
11892
+ internalType: "bytes32",
11893
+ name: "depositCommitment",
11894
+ type: "bytes32"
11895
+ },
11896
+ {
11897
+ indexed: true,
11898
+ internalType: "bytes32",
11899
+ name: "canonicalTokenId",
11900
+ type: "bytes32"
11901
+ },
11902
+ {
11903
+ indexed: true,
11904
+ internalType: "address",
11905
+ name: "to",
11906
+ type: "address"
11907
+ },
11908
+ {
11909
+ indexed: false,
11910
+ internalType: "uint256",
11911
+ name: "amount",
11912
+ type: "uint256"
11913
+ },
11914
+ {
11915
+ indexed: false,
11916
+ internalType: "bytes",
11917
+ name: "callData",
11918
+ type: "bytes"
11919
+ }
11920
+ ],
11921
+ name: "Withdrawal",
11922
+ type: "event"
11923
+ },
11924
+ {
11925
+ inputs: [
11926
+ ],
11927
+ name: "SYNARA_BRIDGE",
11928
+ outputs: [
11929
+ {
11930
+ internalType: "uint256",
11931
+ name: "",
11932
+ type: "uint256"
11933
+ }
11934
+ ],
11935
+ stateMutability: "view",
11936
+ type: "function"
11937
+ },
11938
+ {
11939
+ inputs: [
11940
+ {
11941
+ internalType: "bytes32",
11942
+ name: "canonicalId",
11943
+ type: "bytes32"
11944
+ },
11945
+ {
11946
+ internalType: "uint256",
11947
+ name: "amount",
11948
+ type: "uint256"
11949
+ },
11950
+ {
11951
+ internalType: "uint256",
11952
+ name: "destinationChainId",
11953
+ type: "uint256"
11954
+ },
11955
+ {
11956
+ internalType: "uint256",
11957
+ name: "nonce",
11958
+ type: "uint256"
11959
+ }
11960
+ ],
11961
+ name: "depositERC20",
11962
+ outputs: [
11963
+ ],
11964
+ stateMutability: "nonpayable",
11965
+ type: "function"
11966
+ },
11967
+ {
11968
+ inputs: [
11969
+ {
11970
+ internalType: "bytes32",
11971
+ name: "canonicalId",
11972
+ type: "bytes32"
11973
+ },
11974
+ {
11975
+ internalType: "uint256",
11976
+ name: "amount",
11977
+ type: "uint256"
11978
+ },
11979
+ {
11980
+ internalType: "uint256",
11981
+ name: "destinationChainId",
11982
+ type: "uint256"
11983
+ },
11984
+ {
11985
+ internalType: "uint256",
11986
+ name: "nonce",
11987
+ type: "uint256"
11988
+ },
11989
+ {
11990
+ components: [
11991
+ {
11992
+ internalType: "address",
11993
+ name: "target",
11994
+ type: "address"
11995
+ },
11996
+ {
11997
+ internalType: "bytes",
11998
+ name: "data",
11999
+ type: "bytes"
12000
+ }
12001
+ ],
12002
+ internalType: "struct Bridge.CrossChainCall",
12003
+ name: "call",
12004
+ type: "tuple"
12005
+ }
12006
+ ],
12007
+ name: "depositERC20WithCallData",
12008
+ outputs: [
12009
+ ],
12010
+ stateMutability: "nonpayable",
12011
+ type: "function"
12012
+ },
12013
+ {
12014
+ inputs: [
12015
+ {
12016
+ internalType: "bytes32",
12017
+ name: "canonicalId",
12018
+ type: "bytes32"
12019
+ },
12020
+ {
12021
+ internalType: "uint256",
12022
+ name: "destinationChainId",
12023
+ type: "uint256"
12024
+ },
12025
+ {
12026
+ internalType: "uint256",
12027
+ name: "nonce",
12028
+ type: "uint256"
12029
+ }
12030
+ ],
12031
+ name: "depositNative",
12032
+ outputs: [
12033
+ ],
12034
+ stateMutability: "payable",
12035
+ type: "function"
12036
+ },
12037
+ {
12038
+ inputs: [
12039
+ {
12040
+ internalType: "bytes32",
12041
+ name: "canonicalId",
12042
+ type: "bytes32"
12043
+ },
12044
+ {
12045
+ internalType: "uint256",
12046
+ name: "destinationChainId",
12047
+ type: "uint256"
12048
+ },
12049
+ {
12050
+ internalType: "uint256",
12051
+ name: "nonce",
12052
+ type: "uint256"
12053
+ },
12054
+ {
12055
+ components: [
12056
+ {
12057
+ internalType: "address",
12058
+ name: "target",
12059
+ type: "address"
12060
+ },
12061
+ {
12062
+ internalType: "bytes",
12063
+ name: "data",
12064
+ type: "bytes"
12065
+ }
12066
+ ],
12067
+ internalType: "struct Bridge.CrossChainCall",
12068
+ name: "call",
12069
+ type: "tuple"
12070
+ }
12071
+ ],
12072
+ name: "depositNativeWithCallData",
12073
+ outputs: [
12074
+ ],
12075
+ stateMutability: "payable",
12076
+ type: "function"
12077
+ },
12078
+ {
12079
+ inputs: [
12080
+ ],
12081
+ name: "erc20Pool",
12082
+ outputs: [
12083
+ {
12084
+ internalType: "address",
12085
+ name: "",
12086
+ type: "address"
12087
+ }
12088
+ ],
12089
+ stateMutability: "view",
12090
+ type: "function"
12091
+ },
12092
+ {
12093
+ inputs: [
12094
+ {
12095
+ internalType: "bytes32",
12096
+ name: "canonicalId",
12097
+ type: "bytes32"
12098
+ },
12099
+ {
12100
+ internalType: "address",
12101
+ name: "wallet",
12102
+ type: "address"
12103
+ },
12104
+ {
12105
+ internalType: "uint256",
12106
+ name: "amount",
12107
+ type: "uint256"
12108
+ }
12109
+ ],
12110
+ name: "getBridgeFee",
12111
+ outputs: [
12112
+ {
12113
+ internalType: "uint256",
12114
+ name: "",
12115
+ type: "uint256"
12116
+ }
12117
+ ],
12118
+ stateMutability: "view",
12119
+ type: "function"
12120
+ },
12121
+ {
12122
+ inputs: [
12123
+ ],
12124
+ name: "nativePool",
12125
+ outputs: [
12126
+ {
12127
+ internalType: "address",
12128
+ name: "",
12129
+ type: "address"
12130
+ }
12131
+ ],
12132
+ stateMutability: "view",
12133
+ type: "function"
12134
+ },
12135
+ {
12136
+ inputs: [
12137
+ ],
12138
+ name: "owner",
12139
+ outputs: [
12140
+ {
12141
+ internalType: "address",
12142
+ name: "",
12143
+ type: "address"
12144
+ }
12145
+ ],
12146
+ stateMutability: "view",
12147
+ type: "function"
12148
+ },
12149
+ {
12150
+ inputs: [
12151
+ {
12152
+ internalType: "address",
12153
+ name: "caller",
12154
+ type: "address"
12155
+ },
12156
+ {
12157
+ internalType: "bool",
12158
+ name: "registered",
12159
+ type: "bool"
12160
+ }
12161
+ ],
12162
+ name: "registerCaller",
12163
+ outputs: [
12164
+ ],
12165
+ stateMutability: "nonpayable",
12166
+ type: "function"
12167
+ },
12168
+ {
12169
+ inputs: [
12170
+ {
12171
+ internalType: "address",
12172
+ name: "relayer",
12173
+ type: "address"
12174
+ },
12175
+ {
12176
+ internalType: "bool",
12177
+ name: "registered",
12178
+ type: "bool"
12179
+ }
12180
+ ],
12181
+ name: "registerRelayer",
12182
+ outputs: [
12183
+ ],
12184
+ stateMutability: "nonpayable",
12185
+ type: "function"
12186
+ },
12187
+ {
12188
+ inputs: [
12189
+ ],
12190
+ name: "renounceOwnership",
12191
+ outputs: [
12192
+ ],
12193
+ stateMutability: "nonpayable",
12194
+ type: "function"
12195
+ },
12196
+ {
12197
+ inputs: [
12198
+ {
12199
+ internalType: "address",
12200
+ name: "newOwner",
12201
+ type: "address"
12202
+ }
12203
+ ],
12204
+ name: "transferOwnership",
12205
+ outputs: [
12206
+ ],
12207
+ stateMutability: "nonpayable",
12208
+ type: "function"
12209
+ },
12210
+ {
12211
+ inputs: [
12212
+ {
12213
+ components: [
12214
+ {
12215
+ internalType: "bytes32",
12216
+ name: "canonicalId",
12217
+ type: "bytes32"
12218
+ },
12219
+ {
12220
+ internalType: "uint256",
12221
+ name: "amount",
12222
+ type: "uint256"
12223
+ },
12224
+ {
12225
+ internalType: "address",
12226
+ name: "to",
12227
+ type: "address"
12228
+ },
12229
+ {
12230
+ internalType: "bytes",
12231
+ name: "callData",
12232
+ type: "bytes"
12233
+ },
12234
+ {
12235
+ internalType: "bytes32",
12236
+ name: "stateRootHigh16",
12237
+ type: "bytes32"
12238
+ },
12239
+ {
12240
+ internalType: "bytes32",
12241
+ name: "stateRootLow16",
12242
+ type: "bytes32"
12243
+ },
12244
+ {
12245
+ internalType: "bytes32",
12246
+ name: "depositCommitmentHigh16",
12247
+ type: "bytes32"
12248
+ },
12249
+ {
12250
+ internalType: "bytes32",
12251
+ name: "depositCommitmentLow16",
12252
+ type: "bytes32"
12253
+ },
12254
+ {
12255
+ internalType: "address",
12256
+ name: "from",
12257
+ type: "address"
12258
+ },
12259
+ {
12260
+ internalType: "address",
12261
+ name: "owner",
12262
+ type: "address"
12263
+ },
12264
+ {
12265
+ internalType: "uint256",
12266
+ name: "destinationChainId",
12267
+ type: "uint256"
12268
+ },
12269
+ {
12270
+ internalType: "bytes32",
12271
+ name: "calldataHashHigh16",
12272
+ type: "bytes32"
12273
+ },
12274
+ {
12275
+ internalType: "bytes32",
12276
+ name: "calldataHashLow16",
12277
+ type: "bytes32"
12278
+ }
12279
+ ],
12280
+ internalType: "struct Bridge.WithdrawalArguments",
12281
+ name: "_args",
12282
+ type: "tuple"
12283
+ },
12284
+ {
12285
+ components: [
12286
+ {
12287
+ internalType: "uint256",
12288
+ name: "attestationId",
12289
+ type: "uint256"
12290
+ },
12291
+ {
12292
+ internalType: "bytes32[]",
12293
+ name: "merklePath",
12294
+ type: "bytes32[]"
12295
+ },
12296
+ {
12297
+ internalType: "uint256",
12298
+ name: "leafCount",
12299
+ type: "uint256"
12300
+ },
12301
+ {
12302
+ internalType: "uint256",
12303
+ name: "index",
12304
+ type: "uint256"
12305
+ }
12306
+ ],
12307
+ internalType: "struct IZkvHub.AttestationDetails",
12308
+ name: "_attDetails",
12309
+ type: "tuple"
12310
+ }
12311
+ ],
12312
+ name: "withdrawERC20",
12313
+ outputs: [
12314
+ ],
12315
+ stateMutability: "nonpayable",
12316
+ type: "function"
12317
+ },
12318
+ {
12319
+ inputs: [
12320
+ {
12321
+ components: [
12322
+ {
12323
+ internalType: "bytes32",
12324
+ name: "canonicalId",
12325
+ type: "bytes32"
12326
+ },
12327
+ {
12328
+ internalType: "uint256",
12329
+ name: "amount",
12330
+ type: "uint256"
12331
+ },
12332
+ {
12333
+ internalType: "address",
12334
+ name: "to",
12335
+ type: "address"
12336
+ },
12337
+ {
12338
+ internalType: "bytes",
12339
+ name: "callData",
12340
+ type: "bytes"
12341
+ },
12342
+ {
12343
+ internalType: "bytes32",
12344
+ name: "stateRootHigh16",
12345
+ type: "bytes32"
12346
+ },
12347
+ {
12348
+ internalType: "bytes32",
12349
+ name: "stateRootLow16",
12350
+ type: "bytes32"
12351
+ },
12352
+ {
12353
+ internalType: "bytes32",
12354
+ name: "depositCommitmentHigh16",
12355
+ type: "bytes32"
12356
+ },
12357
+ {
12358
+ internalType: "bytes32",
12359
+ name: "depositCommitmentLow16",
12360
+ type: "bytes32"
12361
+ },
12362
+ {
12363
+ internalType: "address",
12364
+ name: "from",
12365
+ type: "address"
12366
+ },
12367
+ {
12368
+ internalType: "address",
12369
+ name: "owner",
12370
+ type: "address"
12371
+ },
12372
+ {
12373
+ internalType: "uint256",
12374
+ name: "destinationChainId",
12375
+ type: "uint256"
12376
+ },
12377
+ {
12378
+ internalType: "bytes32",
12379
+ name: "calldataHashHigh16",
12380
+ type: "bytes32"
12381
+ },
12382
+ {
12383
+ internalType: "bytes32",
12384
+ name: "calldataHashLow16",
12385
+ type: "bytes32"
12386
+ }
12387
+ ],
12388
+ internalType: "struct Bridge.WithdrawalArguments",
12389
+ name: "_args",
12390
+ type: "tuple"
12391
+ },
12392
+ {
12393
+ components: [
12394
+ {
12395
+ internalType: "uint256",
12396
+ name: "attestationId",
12397
+ type: "uint256"
12398
+ },
12399
+ {
12400
+ internalType: "bytes32[]",
12401
+ name: "merklePath",
12402
+ type: "bytes32[]"
12403
+ },
12404
+ {
12405
+ internalType: "uint256",
12406
+ name: "leafCount",
12407
+ type: "uint256"
12408
+ },
12409
+ {
12410
+ internalType: "uint256",
12411
+ name: "index",
12412
+ type: "uint256"
12413
+ }
12414
+ ],
12415
+ internalType: "struct IZkvHub.AttestationDetails",
12416
+ name: "_attDetails",
12417
+ type: "tuple"
12418
+ }
12419
+ ],
12420
+ name: "withdrawERC20ToContract",
12421
+ outputs: [
12422
+ ],
12423
+ stateMutability: "nonpayable",
12424
+ type: "function"
12425
+ },
12426
+ {
12427
+ inputs: [
12428
+ {
12429
+ components: [
12430
+ {
12431
+ internalType: "bytes32",
12432
+ name: "canonicalId",
12433
+ type: "bytes32"
12434
+ },
12435
+ {
12436
+ internalType: "uint256",
12437
+ name: "amount",
12438
+ type: "uint256"
12439
+ },
12440
+ {
12441
+ internalType: "address",
12442
+ name: "to",
12443
+ type: "address"
12444
+ },
12445
+ {
12446
+ internalType: "bytes",
12447
+ name: "callData",
12448
+ type: "bytes"
12449
+ },
12450
+ {
12451
+ internalType: "bytes32",
12452
+ name: "stateRootHigh16",
12453
+ type: "bytes32"
12454
+ },
12455
+ {
12456
+ internalType: "bytes32",
12457
+ name: "stateRootLow16",
12458
+ type: "bytes32"
12459
+ },
12460
+ {
12461
+ internalType: "bytes32",
12462
+ name: "depositCommitmentHigh16",
12463
+ type: "bytes32"
12464
+ },
12465
+ {
12466
+ internalType: "bytes32",
12467
+ name: "depositCommitmentLow16",
12468
+ type: "bytes32"
12469
+ },
12470
+ {
12471
+ internalType: "address",
12472
+ name: "from",
12473
+ type: "address"
12474
+ },
12475
+ {
12476
+ internalType: "address",
12477
+ name: "owner",
12478
+ type: "address"
12479
+ },
12480
+ {
12481
+ internalType: "uint256",
12482
+ name: "destinationChainId",
12483
+ type: "uint256"
12484
+ },
12485
+ {
12486
+ internalType: "bytes32",
12487
+ name: "calldataHashHigh16",
12488
+ type: "bytes32"
12489
+ },
12490
+ {
12491
+ internalType: "bytes32",
12492
+ name: "calldataHashLow16",
12493
+ type: "bytes32"
12494
+ }
12495
+ ],
12496
+ internalType: "struct Bridge.WithdrawalArguments",
12497
+ name: "_args",
12498
+ type: "tuple"
12499
+ },
12500
+ {
12501
+ components: [
12502
+ {
12503
+ internalType: "uint256",
12504
+ name: "attestationId",
12505
+ type: "uint256"
12506
+ },
12507
+ {
12508
+ internalType: "bytes32[]",
12509
+ name: "merklePath",
12510
+ type: "bytes32[]"
12511
+ },
12512
+ {
12513
+ internalType: "uint256",
12514
+ name: "leafCount",
12515
+ type: "uint256"
12516
+ },
12517
+ {
12518
+ internalType: "uint256",
12519
+ name: "index",
12520
+ type: "uint256"
12521
+ }
12522
+ ],
12523
+ internalType: "struct IZkvHub.AttestationDetails",
12524
+ name: "_attDetails",
12525
+ type: "tuple"
12526
+ }
12527
+ ],
12528
+ name: "withdrawNative",
12529
+ outputs: [
12530
+ ],
12531
+ stateMutability: "nonpayable",
12532
+ type: "function"
12533
+ },
12534
+ {
12535
+ inputs: [
12536
+ {
12537
+ components: [
12538
+ {
12539
+ internalType: "bytes32",
12540
+ name: "canonicalId",
12541
+ type: "bytes32"
12542
+ },
12543
+ {
12544
+ internalType: "uint256",
12545
+ name: "amount",
12546
+ type: "uint256"
12547
+ },
12548
+ {
12549
+ internalType: "address",
12550
+ name: "to",
12551
+ type: "address"
12552
+ },
12553
+ {
12554
+ internalType: "bytes",
12555
+ name: "callData",
12556
+ type: "bytes"
12557
+ },
12558
+ {
12559
+ internalType: "bytes32",
12560
+ name: "stateRootHigh16",
12561
+ type: "bytes32"
12562
+ },
12563
+ {
12564
+ internalType: "bytes32",
12565
+ name: "stateRootLow16",
12566
+ type: "bytes32"
12567
+ },
12568
+ {
12569
+ internalType: "bytes32",
12570
+ name: "depositCommitmentHigh16",
12571
+ type: "bytes32"
12572
+ },
12573
+ {
12574
+ internalType: "bytes32",
12575
+ name: "depositCommitmentLow16",
12576
+ type: "bytes32"
12577
+ },
12578
+ {
12579
+ internalType: "address",
12580
+ name: "from",
12581
+ type: "address"
12582
+ },
12583
+ {
12584
+ internalType: "address",
12585
+ name: "owner",
12586
+ type: "address"
12587
+ },
12588
+ {
12589
+ internalType: "uint256",
12590
+ name: "destinationChainId",
12591
+ type: "uint256"
12592
+ },
12593
+ {
12594
+ internalType: "bytes32",
12595
+ name: "calldataHashHigh16",
12596
+ type: "bytes32"
12597
+ },
12598
+ {
12599
+ internalType: "bytes32",
12600
+ name: "calldataHashLow16",
12601
+ type: "bytes32"
12602
+ }
12603
+ ],
12604
+ internalType: "struct Bridge.WithdrawalArguments",
12605
+ name: "_args",
12606
+ type: "tuple"
12607
+ },
12608
+ {
12609
+ components: [
12610
+ {
12611
+ internalType: "uint256",
12612
+ name: "attestationId",
12613
+ type: "uint256"
12614
+ },
12615
+ {
12616
+ internalType: "bytes32[]",
12617
+ name: "merklePath",
12618
+ type: "bytes32[]"
12619
+ },
12620
+ {
12621
+ internalType: "uint256",
12622
+ name: "leafCount",
12623
+ type: "uint256"
12624
+ },
12625
+ {
12626
+ internalType: "uint256",
12627
+ name: "index",
12628
+ type: "uint256"
12629
+ }
12630
+ ],
12631
+ internalType: "struct IZkvHub.AttestationDetails",
12632
+ name: "_attDetails",
12633
+ type: "tuple"
12634
+ }
12635
+ ],
12636
+ name: "withdrawNativeToContract",
12637
+ outputs: [
12638
+ ],
12639
+ stateMutability: "nonpayable",
12640
+ type: "function"
12641
+ }
12642
+ ];
12643
+ var bytecode$h = "";
12644
+ var deployedBytecode$6 = "";
12645
+ var linkReferences$6 = {
12646
+ };
12647
+ var deployedLinkReferences$6 = {
12648
+ };
12649
+ var BridgeAbi = {
12650
+ _format: _format$6,
12651
+ contractName: contractName$6,
12652
+ sourceName: sourceName$6,
12653
+ abi: abi$h,
12654
+ bytecode: bytecode$h,
12655
+ deployedBytecode: deployedBytecode$6,
12656
+ linkReferences: linkReferences$6,
12657
+ deployedLinkReferences: deployedLinkReferences$6
12658
+ };
12659
+
12660
+ var _DOMAIN_PREFIX = "0x191253796e6172614272696467654465706f7369740a";
12661
+ var BridgeCreateOrderContext = /*#__PURE__*/function (_BaseContext) {
12662
+ function BridgeCreateOrderContext(signature) {
12663
+ return _BaseContext.call(this, signature) || this;
12664
+ }
12665
+ _inheritsLoose(BridgeCreateOrderContext, _BaseContext);
12666
+ return _createClass(BridgeCreateOrderContext, [{
12667
+ key: "orderNote",
12668
+ get: function get() {
12669
+ return this._orderNote;
12670
+ },
12671
+ set: function set(orderNote) {
12672
+ this._orderNote = orderNote;
12673
+ }
12674
+ }, {
12675
+ key: "swapInNote",
12676
+ get: function get() {
12677
+ return this._swapInNote;
12678
+ },
12679
+ set: function set(swapInNote) {
12680
+ this._swapInNote = swapInNote;
12681
+ }
12682
+ }, {
12683
+ key: "feeAmount",
12684
+ get: function get() {
12685
+ return this._feeAmount;
12686
+ },
12687
+ set: function set(feeAmount) {
12688
+ this._feeAmount = feeAmount;
12689
+ }
12690
+ }, {
12691
+ key: "proof",
12692
+ get: function get() {
12693
+ return this._proof;
12694
+ },
12695
+ set: function set(proof) {
12696
+ this._proof = proof;
12697
+ }
12698
+ }, {
12699
+ key: "swapMessage",
12700
+ get: function get() {
12701
+ return this._swapMessage;
12702
+ },
12703
+ set: function set(swapMessage) {
12704
+ this._swapMessage = swapMessage;
12705
+ }
12706
+ }, {
12707
+ key: "sourceChainId",
12708
+ get: function get() {
12709
+ return this._sourceChainId;
12710
+ },
12711
+ set: function set(sourceChainId) {
12712
+ this._sourceChainId = sourceChainId;
12713
+ }
12714
+ }, {
12715
+ key: "destChainId",
12716
+ get: function get() {
12717
+ return this._destChainId;
12718
+ },
12719
+ set: function set(destChainId) {
12720
+ this._destChainId = destChainId;
12721
+ }
12722
+ }, {
12723
+ key: "sourceAsset",
12724
+ get: function get() {
12725
+ return this._sourceAsset;
12726
+ },
12727
+ set: function set(sourceAsset) {
12728
+ this._sourceAsset = sourceAsset;
12729
+ }
12730
+ }, {
12731
+ key: "sourceAmount",
12732
+ get: function get() {
12733
+ return this._sourceAmount;
12734
+ },
12735
+ set: function set(sourceAmount) {
12736
+ this._sourceAmount = sourceAmount;
12737
+ }
12738
+ }, {
12739
+ key: "bridgeFeeAmount",
12740
+ get: function get() {
12741
+ return this._bridgeFeeAmount;
12742
+ },
12743
+ set: function set(bridgeFeeAmount) {
12744
+ this._bridgeFeeAmount = bridgeFeeAmount;
12745
+ }
12746
+ }, {
12747
+ key: "depositId",
12748
+ get: function get() {
12749
+ return this._depositId;
12750
+ },
12751
+ set: function set(depositId) {
12752
+ this._depositId = depositId;
12753
+ }
12754
+ }, {
12755
+ key: "attestationDetails",
12756
+ get: function get() {
12757
+ return this._attestationDetails;
12758
+ },
12759
+ set: function set(attestationDetails) {
12760
+ this._attestationDetails = attestationDetails;
12761
+ }
12762
+ }, {
12763
+ key: "relayer",
12764
+ get: function get() {
12765
+ return this._relayer;
12766
+ },
12767
+ set: function set(relayer) {
12768
+ this._relayer = relayer;
12769
+ }
12770
+ }, {
12771
+ key: "jobId",
12772
+ get: function get() {
12773
+ return this._jobId;
12774
+ },
12775
+ set: function set(jobId) {
12776
+ this._jobId = jobId;
12777
+ }
12778
+ }, {
12779
+ key: "canonicalId",
12780
+ get: function get() {
12781
+ return this._canonicalId;
12782
+ },
12783
+ set: function set(canonicalId) {
12784
+ this._canonicalId = canonicalId;
12785
+ }
12786
+ }, {
12787
+ key: "callDataHash",
12788
+ get: function get() {
12789
+ return this._callDataHash;
12790
+ },
12791
+ set: function set(callDataHash) {
12792
+ this._callDataHash = callDataHash;
12793
+ }
12794
+ }, {
12795
+ key: "nonce",
12796
+ get: function get() {
12797
+ return this._nonce;
11253
12798
  },
11254
12799
  set: function set(nonce) {
11255
12800
  this._nonce = nonce;
@@ -11270,24 +12815,82 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11270
12815
  this._darkSwapOfDestChain = _darkSwapOfDestChain;
11271
12816
  }
11272
12817
  var _proto = BridgeCreateOrderService.prototype;
11273
- _proto.prepare = /*#__PURE__*/function () {
11274
- var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(address, sourceChainId, sourceAsset, sourceAmount, canonicalId, bridgeFee, destChainId, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
11275
- var _yield$generateKeyPai, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
12818
+ _proto.getCanonicalTokenAddress = /*#__PURE__*/function () {
12819
+ var _getCanonicalTokenAddress = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sourceAsset) {
12820
+ var canonicalTokenRegistry;
11276
12821
  return _regenerator().w(function (_context) {
11277
12822
  while (1) switch (_context.n) {
11278
12823
  case 0:
12824
+ canonicalTokenRegistry = new ethers.ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraCanonicalTokenRegistry, CanonicalTokenRegistryAbi, this._darkSwapOfSourceChain.provider);
11279
12825
  _context.n = 1;
12826
+ return canonicalTokenRegistry.getCanonicalId(sourceAsset);
12827
+ case 1:
12828
+ return _context.a(2, _context.v);
12829
+ }
12830
+ }, _callee, this);
12831
+ }));
12832
+ function getCanonicalTokenAddress(_x) {
12833
+ return _getCanonicalTokenAddress.apply(this, arguments);
12834
+ }
12835
+ return getCanonicalTokenAddress;
12836
+ }();
12837
+ _proto.getBridgeFee = /*#__PURE__*/function () {
12838
+ var _getBridgeFee = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(canonicalId, wallet, amount) {
12839
+ var bridge;
12840
+ return _regenerator().w(function (_context2) {
12841
+ while (1) switch (_context2.n) {
12842
+ case 0:
12843
+ bridge = new ethers.ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraBridge, BridgeAbi.abi, this._darkSwapOfSourceChain.provider);
12844
+ _context2.n = 1;
12845
+ return bridge.getBridgeFee(canonicalId, wallet, amount);
12846
+ case 1:
12847
+ return _context2.a(2, _context2.v);
12848
+ }
12849
+ }, _callee2, this);
12850
+ }));
12851
+ function getBridgeFee(_x2, _x3, _x4) {
12852
+ return _getBridgeFee.apply(this, arguments);
12853
+ }
12854
+ return getBridgeFee;
12855
+ }();
12856
+ _proto.prepare = /*#__PURE__*/function () {
12857
+ var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address, sourceChainId, sourceAsset, sourceAmount, canonicalId, bridgeFee, destChainId, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
12858
+ var _yield$generateKeyPai, pubKey, privKey, feeRatio, canonicalIdFromContract, bridgeFeeAmountFromContract, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
12859
+ return _regenerator().w(function (_context3) {
12860
+ while (1) switch (_context3.n) {
12861
+ case 0:
12862
+ _context3.n = 1;
11280
12863
  return generateKeyPair(signature);
11281
12864
  case 1:
11282
- _yield$generateKeyPai = _context.v;
12865
+ _yield$generateKeyPai = _context3.v;
11283
12866
  pubKey = _yield$generateKeyPai[0];
11284
12867
  privKey = _yield$generateKeyPai[1];
11285
12868
  _t = BigInt;
11286
- _context.n = 2;
12869
+ _context3.n = 2;
11287
12870
  return getFeeRatio(address, this._darkSwapOfDestChain);
11288
12871
  case 2:
11289
- _t2 = _context.v;
12872
+ _t2 = _context3.v;
11290
12873
  feeRatio = _t(_t2);
12874
+ _context3.n = 3;
12875
+ return this.getCanonicalTokenAddress(sourceAsset);
12876
+ case 3:
12877
+ canonicalIdFromContract = _context3.v;
12878
+ if (!(canonicalIdFromContract !== canonicalId)) {
12879
+ _context3.n = 4;
12880
+ break;
12881
+ }
12882
+ throw new DarkSwapError('CanonicalId not match');
12883
+ case 4:
12884
+ _context3.n = 5;
12885
+ return this.getBridgeFee(canonicalId, address, sourceAmount);
12886
+ case 5:
12887
+ bridgeFeeAmountFromContract = _context3.v;
12888
+ if (!(bridgeFeeAmountFromContract !== bridgeFee)) {
12889
+ _context3.n = 6;
12890
+ break;
12891
+ }
12892
+ throw new DarkSwapError('BridgeFee not match');
12893
+ case 6:
11291
12894
  orderNote = createOrderNoteExt(address, depositAsset, depositAmount, feeRatio, pubKey);
11292
12895
  feeAmount = calcFeeAmount(swapInAmount, feeRatio);
11293
12896
  realSwapInAmount = swapInAmount - feeAmount;
@@ -11303,19 +12906,19 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11303
12906
  context.sourceAmount = sourceAmount;
11304
12907
  context.bridgeFeeAmount = bridgeFee;
11305
12908
  context.canonicalId = canonicalId;
11306
- _context.n = 3;
12909
+ _context3.n = 7;
11307
12910
  return generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
11308
- case 3:
11309
- swapMessage = _context.v;
12911
+ case 7:
12912
+ swapMessage = _context3.v;
11310
12913
  context.swapMessage = swapMessage;
11311
- return _context.a(2, {
12914
+ return _context3.a(2, {
11312
12915
  context: context,
11313
12916
  swapMessage: swapMessage
11314
12917
  });
11315
12918
  }
11316
- }, _callee, this);
12919
+ }, _callee3, this);
11317
12920
  }));
11318
- function prepare(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10) {
12921
+ function prepare(_x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13, _x14) {
11319
12922
  return _prepare.apply(this, arguments);
11320
12923
  }
11321
12924
  return prepare;
@@ -11324,123 +12927,123 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11324
12927
  return this._darkSwapOfSourceChain.contracts.zkverifyRelayerUrls[0];
11325
12928
  };
11326
12929
  _proto.submitProof = /*#__PURE__*/function () {
11327
- var _submitProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context) {
12930
+ var _submitProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
11328
12931
  var relayerRequest, response, _yield$this$pollJobSt, error, result;
11329
- return _regenerator().w(function (_context2) {
11330
- while (1) switch (_context2.n) {
12932
+ return _regenerator().w(function (_context4) {
12933
+ while (1) switch (_context4.n) {
11331
12934
  case 0:
11332
12935
  if (context) {
11333
- _context2.n = 1;
12936
+ _context4.n = 1;
11334
12937
  break;
11335
12938
  }
11336
12939
  throw new DarkSwapError('Invalid context');
11337
12940
  case 1:
11338
- _context2.n = 2;
12941
+ _context4.n = 2;
11339
12942
  return this.generateProof(context);
11340
12943
  case 2:
11341
- context.proof = _context2.v;
12944
+ context.proof = _context4.v;
11342
12945
  relayerRequest = {
11343
12946
  proof: context.proof.proof,
11344
12947
  publicSignals: context.proof.verifyInputs,
11345
12948
  vkHash: VK_HASH_CONFIG[exports.PROOF_DOMAIN.RETAIL_BRIDGE_ORDER]
11346
12949
  };
11347
12950
  context.relayer = this.pickRelayer();
11348
- _context2.n = 3;
12951
+ _context4.n = 3;
11349
12952
  return axios.post(context.relayer + '/v1/zkVerifySubmitProof', relayerRequest);
11350
12953
  case 3:
11351
- response = _context2.v;
12954
+ response = _context4.v;
11352
12955
  if (!(response.status == 200)) {
11353
- _context2.n = 4;
12956
+ _context4.n = 4;
11354
12957
  break;
11355
12958
  }
11356
12959
  context.jobId = response.data.id;
11357
- _context2.n = 6;
12960
+ _context4.n = 6;
11358
12961
  break;
11359
12962
  case 4:
11360
12963
  if (!(response.status == 400)) {
11361
- _context2.n = 5;
12964
+ _context4.n = 5;
11362
12965
  break;
11363
12966
  }
11364
12967
  throw new Error('Request error' + response.data.error);
11365
12968
  case 5:
11366
12969
  throw new Error('Relayer not asscessable');
11367
12970
  case 6:
11368
- _context2.n = 7;
12971
+ _context4.n = 7;
11369
12972
  return this.pollJobStatus(context);
11370
12973
  case 7:
11371
- _yield$this$pollJobSt = _context2.v;
12974
+ _yield$this$pollJobSt = _context4.v;
11372
12975
  error = _yield$this$pollJobSt.error;
11373
12976
  result = _yield$this$pollJobSt.result;
11374
12977
  if (!error) {
11375
- _context2.n = 8;
12978
+ _context4.n = 8;
11376
12979
  break;
11377
12980
  }
11378
12981
  throw new DarkSwapError(error);
11379
12982
  case 8:
11380
12983
  context.attestationDetails = result;
11381
12984
  case 9:
11382
- return _context2.a(2);
12985
+ return _context4.a(2);
11383
12986
  }
11384
- }, _callee2, this);
12987
+ }, _callee4, this);
11385
12988
  }));
11386
- function submitProof(_x11) {
12989
+ function submitProof(_x15) {
11387
12990
  return _submitProof.apply(this, arguments);
11388
12991
  }
11389
12992
  return submitProof;
11390
12993
  }();
11391
12994
  _proto.pollJobStatus = /*#__PURE__*/function () {
11392
- var _pollJobStatus = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
12995
+ var _pollJobStatus = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
11393
12996
  var tries, response, error, _response$data, status, failedReason, result, _t3;
11394
- return _regenerator().w(function (_context3) {
11395
- while (1) switch (_context3.n) {
12997
+ return _regenerator().w(function (_context5) {
12998
+ while (1) switch (_context5.n) {
11396
12999
  case 0:
11397
13000
  tries = 1;
11398
13001
  case 1:
11399
13002
  if (!(tries <= 100)) {
11400
- _context3.n = 10;
13003
+ _context5.n = 10;
11401
13004
  break;
11402
13005
  }
11403
13006
  if (!(tries >= 100)) {
11404
- _context3.n = 2;
13007
+ _context5.n = 2;
11405
13008
  break;
11406
13009
  }
11407
- return _context3.a(3, 10);
13010
+ return _context5.a(3, 10);
11408
13011
  case 2:
11409
- _context3.p = 2;
11410
- _context3.n = 3;
13012
+ _context5.p = 2;
13013
+ _context5.n = 3;
11411
13014
  return axios.get(context.relayer + "/v1/jobs/" + context.jobId);
11412
13015
  case 3:
11413
- response = _context3.v;
13016
+ response = _context5.v;
11414
13017
  if (!(response.status === 400)) {
11415
- _context3.n = 4;
13018
+ _context5.n = 4;
11416
13019
  break;
11417
13020
  }
11418
13021
  error = response.data.error;
11419
13022
  console.log(error);
11420
- return _context3.a(2, {
13023
+ return _context5.a(2, {
11421
13024
  error: 'Failed to submit proof to relayer:' + error,
11422
13025
  result: undefined
11423
13026
  });
11424
13027
  case 4:
11425
13028
  if (!(response.status === 200)) {
11426
- _context3.n = 6;
13029
+ _context5.n = 6;
11427
13030
  break;
11428
13031
  }
11429
13032
  _response$data = response.data, status = _response$data.status, failedReason = _response$data.failedReason, result = _response$data.result;
11430
13033
  if (!(status === 'FAILED')) {
11431
- _context3.n = 5;
13034
+ _context5.n = 5;
11432
13035
  break;
11433
13036
  }
11434
- return _context3.a(2, {
13037
+ return _context5.a(2, {
11435
13038
  error: failedReason != null ? failedReason : 'Transaction failed.',
11436
13039
  result: undefined
11437
13040
  });
11438
13041
  case 5:
11439
13042
  if (!(status === 'CONFIRMED' || status === 'MINED')) {
11440
- _context3.n = 6;
13043
+ _context5.n = 6;
11441
13044
  break;
11442
13045
  }
11443
- return _context3.a(2, {
13046
+ return _context5.a(2, {
11444
13047
  error: undefined,
11445
13048
  result: {
11446
13049
  attestationId: BigInt(result.attestationId),
@@ -11450,47 +13053,47 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11450
13053
  }
11451
13054
  });
11452
13055
  case 6:
11453
- _context3.n = 7;
13056
+ _context5.n = 7;
11454
13057
  return new Promise(function (resolve) {
11455
13058
  return setTimeout(resolve, 5000);
11456
13059
  });
11457
13060
  case 7:
11458
- _context3.n = 9;
13061
+ _context5.n = 9;
11459
13062
  break;
11460
13063
  case 8:
11461
- _context3.p = 8;
11462
- _t3 = _context3.v;
13064
+ _context5.p = 8;
13065
+ _t3 = _context5.v;
11463
13066
  console.log(_t3);
11464
13067
  case 9:
11465
13068
  tries++;
11466
- _context3.n = 1;
13069
+ _context5.n = 1;
11467
13070
  break;
11468
13071
  case 10:
11469
- return _context3.a(2, {
13072
+ return _context5.a(2, {
11470
13073
  error: 'Waited too long for getting attestation details.',
11471
13074
  result: undefined
11472
13075
  });
11473
13076
  }
11474
- }, _callee3, null, [[2, 8]]);
13077
+ }, _callee5, null, [[2, 8]]);
11475
13078
  }));
11476
- function pollJobStatus(_x12) {
13079
+ function pollJobStatus(_x16) {
11477
13080
  return _pollJobStatus.apply(this, arguments);
11478
13081
  }
11479
13082
  return pollJobStatus;
11480
13083
  }();
11481
13084
  _proto.generateProof = /*#__PURE__*/function () {
11482
- var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
13085
+ var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(context) {
11483
13086
  var proof;
11484
- return _regenerator().w(function (_context4) {
11485
- while (1) switch (_context4.n) {
13087
+ return _regenerator().w(function (_context6) {
13088
+ while (1) switch (_context6.n) {
11486
13089
  case 0:
11487
13090
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || context.feeAmount === undefined || !context.signature || !context.sourceChainId || !context.destChainId || !context.sourceAsset || !context.sourceAmount || context.bridgeFeeAmount === undefined)) {
11488
- _context4.n = 1;
13091
+ _context6.n = 1;
11489
13092
  break;
11490
13093
  }
11491
13094
  throw new DarkSwapError('Invalid context');
11492
13095
  case 1:
11493
- _context4.n = 2;
13096
+ _context6.n = 2;
11494
13097
  return generateRetailBridgeOrderProof({
11495
13098
  depositSourceAsset: context.sourceAsset,
11496
13099
  depositNote: context.orderNote,
@@ -11503,77 +13106,77 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11503
13106
  signedMessage: context.signature
11504
13107
  });
11505
13108
  case 2:
11506
- proof = _context4.v;
11507
- return _context4.a(2, proof);
13109
+ proof = _context6.v;
13110
+ return _context6.a(2, proof);
11508
13111
  }
11509
- }, _callee4);
13112
+ }, _callee6);
11510
13113
  }));
11511
- function generateProof(_x13) {
13114
+ function generateProof(_x17) {
11512
13115
  return _generateProof.apply(this, arguments);
11513
13116
  }
11514
13117
  return generateProof;
11515
13118
  }();
11516
13119
  _proto.computeDepositId = /*#__PURE__*/function () {
11517
- var _computeDepositId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
13120
+ var _computeDepositId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(context) {
11518
13121
  var callDataHash, currentNonce, packedData, depositCommitment;
11519
- return _regenerator().w(function (_context5) {
11520
- while (1) switch (_context5.n) {
13122
+ return _regenerator().w(function (_context7) {
13123
+ while (1) switch (_context7.n) {
11521
13124
  case 0:
11522
13125
  if (!(!context || !context.callData || !context.orderNote || !context.swapInNote || !context.address || context.feeAmount === undefined || !context.signature || !context.sourceChainId || !context.destChainId || !context.sourceAsset || context.bridgeFeeAmount === undefined)) {
11523
- _context5.n = 1;
13126
+ _context7.n = 1;
11524
13127
  break;
11525
13128
  }
11526
13129
  throw new DarkSwapError('Invalid context');
11527
13130
  case 1:
11528
- callDataHash = ethers.ethers.solidityPackedKeccak256(['address', 'bytes'], [this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, context.callData]);
13131
+ callDataHash = ethers.ethers.solidityPackedKeccak256(['address', 'bytes'], [this._darkSwapOfDestChain.contracts.synaraDarkSwapOnBridgeAssetManager, context.callData]);
11529
13132
  context.callDataHash = callDataHash;
11530
- _context5.n = 2;
13133
+ _context7.n = 2;
11531
13134
  return this.getCurrentNonce(context);
11532
13135
  case 2:
11533
- currentNonce = _context5.v;
13136
+ currentNonce = _context7.v;
11534
13137
  context.nonce = currentNonce;
11535
13138
  packedData = ethers.solidityPacked(["bytes", "address", "bytes32", "address", "address", "bytes32", "bytes32", "bytes32", "bytes32", "bytes32" // _computeCallDataHash(call)
11536
13139
  ], [_DOMAIN_PREFIX, this._darkSwapOfSourceChain.contracts.synaraBridge, context.canonicalId, this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, context.address, hexlify32(context.orderNote.amount), hexlify32(context.destChainId), hexlify32(context.nonce), hexlify32(context.sourceChainId), context.callDataHash]);
11537
13140
  depositCommitment = ethers.keccak256(packedData);
11538
- return _context5.a(2, depositCommitment);
13141
+ return _context7.a(2, depositCommitment);
11539
13142
  }
11540
- }, _callee5, this);
13143
+ }, _callee7, this);
11541
13144
  }));
11542
- function computeDepositId(_x14) {
13145
+ function computeDepositId(_x18) {
11543
13146
  return _computeDepositId.apply(this, arguments);
11544
13147
  }
11545
13148
  return computeDepositId;
11546
13149
  }();
11547
13150
  _proto.getCurrentNonce = /*#__PURE__*/function () {
11548
- var _getCurrentNonce = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(context) {
13151
+ var _getCurrentNonce = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(context) {
11549
13152
  var provider, contract;
11550
- return _regenerator().w(function (_context6) {
11551
- while (1) switch (_context6.n) {
13153
+ return _regenerator().w(function (_context8) {
13154
+ while (1) switch (_context8.n) {
11552
13155
  case 0:
11553
13156
  provider = this._darkSwapOfSourceChain.provider;
11554
13157
  contract = new ethers.ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, SynaraDarkSwapOnBridgeAssetManagerAbi.abi, provider);
11555
- _context6.n = 1;
13158
+ _context8.n = 1;
11556
13159
  return contract.currentNonce({
11557
13160
  from: context.address
11558
13161
  });
11559
13162
  case 1:
11560
- return _context6.a(2, _context6.v);
13163
+ return _context8.a(2, _context8.v);
11561
13164
  }
11562
- }, _callee6, this);
13165
+ }, _callee8, this);
11563
13166
  }));
11564
- function getCurrentNonce(_x15) {
13167
+ function getCurrentNonce(_x19) {
11565
13168
  return _getCurrentNonce.apply(this, arguments);
11566
13169
  }
11567
13170
  return getCurrentNonce;
11568
13171
  }();
11569
13172
  _proto.composeCallData = /*#__PURE__*/function () {
11570
- var _composeCallData = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(context) {
13173
+ var _composeCallData = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(context) {
11571
13174
  var functionSignature, args, iface, fullData;
11572
- return _regenerator().w(function (_context7) {
11573
- while (1) switch (_context7.n) {
13175
+ return _regenerator().w(function (_context9) {
13176
+ while (1) switch (_context9.n) {
11574
13177
  case 0:
11575
13178
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || !context.destChainId || !context.sourceAsset || context.bridgeFeeAmount === undefined || !context.proof || !context.attestationDetails)) {
11576
- _context7.n = 1;
13179
+ _context9.n = 1;
11577
13180
  break;
11578
13181
  }
11579
13182
  throw new DarkSwapError('Invalid context');
@@ -11586,7 +13189,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11586
13189
  depositOutNote: hexlify32(context.orderNote.note),
11587
13190
  depositOutNoteFooter: context.proof.depositFooter,
11588
13191
  outAssetSource: context.sourceAsset,
11589
- outAssetDest: context.orderNote.address,
13192
+ outAssetDest: context.orderNote.asset,
11590
13193
  outAmount: context.orderNote.amount,
11591
13194
  feeRatio: context.orderNote.feeRatio,
11592
13195
  inNote: hexlify32(context.swapInNote.note),
@@ -11595,23 +13198,23 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11595
13198
  };
11596
13199
  iface = new ethers.ethers.Interface(["function " + functionSignature]);
11597
13200
  fullData = iface.encodeFunctionData('_retailBridgeCreateOrder', [[args.destChain, args.bridgeFee, args.owner, args.depositOutNote, args.depositOutNoteFooter, args.outAssetSource, args.outAssetDest, args.outAmount, args.feeRatio, args.inNote, args.inNoteFooter, args.destContractAddress], [context.attestationDetails.attestationId, context.attestationDetails.merklePath, context.attestationDetails.leafCount, context.attestationDetails.index]]);
11598
- return _context7.a(2, fullData);
13201
+ return _context9.a(2, fullData);
11599
13202
  }
11600
- }, _callee7, this);
13203
+ }, _callee9, this);
11601
13204
  }));
11602
- function composeCallData(_x16) {
13205
+ function composeCallData(_x20) {
11603
13206
  return _composeCallData.apply(this, arguments);
11604
13207
  }
11605
13208
  return composeCallData;
11606
13209
  }();
11607
13210
  _proto.allowance = /*#__PURE__*/function () {
11608
- var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(context) {
13211
+ var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(context) {
11609
13212
  var signer, asset, amount, allowanceContract, allowance, isLegacy, contract, tx;
11610
- return _regenerator().w(function (_context8) {
11611
- while (1) switch (_context8.n) {
13213
+ return _regenerator().w(function (_context0) {
13214
+ while (1) switch (_context0.n) {
11612
13215
  case 0:
11613
13216
  if (!(!context || !context.orderNote || !context.address || !context.signature || !context.proof)) {
11614
- _context8.n = 1;
13217
+ _context0.n = 1;
11615
13218
  break;
11616
13219
  }
11617
13220
  throw new DarkSwapError('Invalid context');
@@ -11620,74 +13223,74 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11620
13223
  asset = context.orderNote.asset;
11621
13224
  amount = context.orderNote.amount;
11622
13225
  allowanceContract = new ethers.ethers.Contract(asset, ERC20Abi.abi, this._darkSwapOfSourceChain);
11623
- _context8.n = 2;
13226
+ _context0.n = 2;
11624
13227
  return allowanceContract.allowance(signer.getAddress(), this._darkSwapOfSourceChain.contracts.darkSwapAssetManager);
11625
13228
  case 2:
11626
- allowance = _context8.v;
13229
+ allowance = _context0.v;
11627
13230
  if (!(BigInt(allowance) < amount)) {
11628
- _context8.n = 4;
13231
+ _context0.n = 4;
11629
13232
  break;
11630
13233
  }
11631
13234
  isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwapOfSourceChain.chainId) && legacyTokenConfig[this._darkSwapOfSourceChain.chainId].includes(asset.toLowerCase());
11632
13235
  contract = new ethers.ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
11633
- _context8.n = 3;
13236
+ _context0.n = 3;
11634
13237
  return contract.approve(this._darkSwapOfSourceChain.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
11635
13238
  case 3:
11636
- tx = _context8.v;
11637
- _context8.n = 4;
13239
+ tx = _context0.v;
13240
+ _context0.n = 4;
11638
13241
  return tx.wait();
11639
13242
  case 4:
11640
- return _context8.a(2);
13243
+ return _context0.a(2);
11641
13244
  }
11642
- }, _callee8, this);
13245
+ }, _callee0, this);
11643
13246
  }));
11644
- function allowance(_x17) {
13247
+ function allowance(_x21) {
11645
13248
  return _allowance.apply(this, arguments);
11646
13249
  }
11647
13250
  return allowance;
11648
13251
  }();
11649
13252
  _proto.execute = /*#__PURE__*/function () {
11650
- var _execute2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(context) {
13253
+ var _execute2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(context) {
11651
13254
  var callData, txHash;
11652
- return _regenerator().w(function (_context9) {
11653
- while (1) switch (_context9.n) {
13255
+ return _regenerator().w(function (_context1) {
13256
+ while (1) switch (_context1.n) {
11654
13257
  case 0:
11655
- _context9.n = 1;
13258
+ _context1.n = 1;
11656
13259
  return this.submitProof(context);
11657
13260
  case 1:
11658
- _context9.n = 2;
13261
+ _context1.n = 2;
11659
13262
  return this.composeCallData(context);
11660
13263
  case 2:
11661
- callData = _context9.v;
13264
+ callData = _context1.v;
11662
13265
  context.callData = callData;
11663
- _context9.n = 3;
13266
+ _context1.n = 3;
11664
13267
  return this.computeDepositId(context);
11665
13268
  case 3:
11666
- context.depositId = _context9.v;
11667
- _context9.n = 4;
13269
+ context.depositId = _context1.v;
13270
+ _context1.n = 4;
11668
13271
  return this._execute(context);
11669
13272
  case 4:
11670
- txHash = _context9.v;
11671
- return _context9.a(2, {
13273
+ txHash = _context1.v;
13274
+ return _context1.a(2, {
11672
13275
  depositId: context.depositId,
11673
13276
  txHash: txHash
11674
13277
  });
11675
13278
  }
11676
- }, _callee9, this);
13279
+ }, _callee1, this);
11677
13280
  }));
11678
- function execute(_x18) {
13281
+ function execute(_x22) {
11679
13282
  return _execute2.apply(this, arguments);
11680
13283
  }
11681
13284
  return execute;
11682
13285
  }();
11683
13286
  _proto._execute = /*#__PURE__*/function () {
11684
- var _execute3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(context) {
13287
+ var _execute3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(context) {
11685
13288
  var contract, ethAmount, tx;
11686
- return _regenerator().w(function (_context0) {
11687
- while (1) switch (_context0.n) {
13289
+ return _regenerator().w(function (_context10) {
13290
+ while (1) switch (_context10.n) {
11688
13291
  case 0:
11689
13292
  if (!(!context || !context.destChainId || !context.attestationDetails || !context.orderNote || !context.swapInNote || !context.sourceAsset || !context.sourceAmount || context.bridgeFeeAmount === undefined || !context.depositId || !context.proof)) {
11690
- _context0.n = 1;
13293
+ _context10.n = 1;
11691
13294
  break;
11692
13295
  }
11693
13296
  throw new DarkSwapError('Invalid context');
@@ -11695,30 +13298,30 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11695
13298
  contract = new ethers.ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, SynaraDarkSwapOnBridgeAssetManagerAbi.abi, this._darkSwapOfSourceChain.signer);
11696
13299
  ethAmount = 0n;
11697
13300
  if (!isNativeAsset(context.sourceAsset)) {
11698
- _context0.n = 2;
13301
+ _context10.n = 2;
11699
13302
  break;
11700
13303
  }
11701
13304
  ethAmount = context.sourceAmount;
11702
- _context0.n = 3;
13305
+ _context10.n = 3;
11703
13306
  break;
11704
13307
  case 2:
11705
- _context0.n = 3;
13308
+ _context10.n = 3;
11706
13309
  return this.allowance(context);
11707
13310
  case 3:
11708
- _context0.n = 4;
11709
- return contract.retailDepositBridge(context.depositId, [hexlify32(BigInt(context.destChainId)), hexlify32(context.bridgeFeeAmount), context.address, hexlify32(context.orderNote.note), context.proof.depositFooter, context.sourceAsset, context.orderNote.address, hexlify32(context.sourceAmount), hexlify32(context.orderNote.feeRatio), hexlify32(context.swapInNote.note), context.proof.swapInNoteFooter, this._darkSwapOfDestChain.contracts.synaraDarkSwapOnBridgeAssetManager], [hexlify32(context.attestationDetails.attestationId), context.attestationDetails.merklePath, hexlify32(context.attestationDetails.leafCount), hexlify32(context.attestationDetails.index)], {
13311
+ _context10.n = 4;
13312
+ return contract.retailDepositBridge(context.depositId, [hexlify32(BigInt(context.destChainId)), hexlify32(context.bridgeFeeAmount), context.address, hexlify32(context.orderNote.note), context.proof.depositFooter, context.sourceAsset, context.orderNote.asset, hexlify32(context.sourceAmount), hexlify32(context.orderNote.feeRatio), hexlify32(context.swapInNote.note), context.proof.swapInNoteFooter, this._darkSwapOfDestChain.contracts.synaraDarkSwapOnBridgeAssetManager], [hexlify32(context.attestationDetails.attestationId), context.attestationDetails.merklePath, hexlify32(context.attestationDetails.leafCount), hexlify32(context.attestationDetails.index)], {
11710
13313
  value: bn_to_0xhex(ethAmount)
11711
13314
  });
11712
13315
  case 4:
11713
- tx = _context0.v;
11714
- _context0.n = 5;
13316
+ tx = _context10.v;
13317
+ _context10.n = 5;
11715
13318
  return tx.wait();
11716
13319
  case 5:
11717
- return _context0.a(2, tx.hash);
13320
+ return _context10.a(2, tx.hash);
11718
13321
  }
11719
- }, _callee0, this);
13322
+ }, _callee10, this);
11720
13323
  }));
11721
- function _execute(_x19) {
13324
+ function _execute(_x23) {
11722
13325
  return _execute3.apply(this, arguments);
11723
13326
  }
11724
13327
  return _execute;
@@ -11726,11 +13329,11 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11726
13329
  return BridgeCreateOrderService;
11727
13330
  }();
11728
13331
 
11729
- var DarkSwap = function DarkSwap(signer, chainId, contracts) {
13332
+ var DarkSwap = function DarkSwap(signer, chainId, provider, contracts) {
11730
13333
  // @ts-ignore
11731
13334
  this.signer = signer;
11732
13335
  // @ts-ignore
11733
- this.provider = signer.provider;
13336
+ this.provider = provider || signer.provider;
11734
13337
  this.chainId = chainId;
11735
13338
  if (contracts) {
11736
13339
  this.contracts = contracts;
@@ -11826,6 +13429,7 @@ exports.createNote = createNote;
11826
13429
  exports.createOrderNoteExt = createOrderNoteExt;
11827
13430
  exports.deserializeDarkSwapMessage = deserializeDarkSwapMessage;
11828
13431
  exports.generateKeyPair = generateKeyPair;
13432
+ exports.getConfirmations = getConfirmations;
11829
13433
  exports.getFeeRatio = getFeeRatio;
11830
13434
  exports.getMerklePathAndRoot = getMerklePathAndRoot;
11831
13435
  exports.getNoteFooter = getNoteFooter;
@@ -11837,6 +13441,7 @@ exports.isAddressEquals = isAddressEquals;
11837
13441
  exports.isHexEquals = isHexEquals;
11838
13442
  exports.isNativeAsset = isNativeAsset;
11839
13443
  exports.isNoteActive = isNoteActive;
13444
+ exports.isNoteCreated = isNoteCreated;
11840
13445
  exports.isNoteSpent = isNoteSpent;
11841
13446
  exports.isNoteValid = isNoteValid;
11842
13447
  exports.legacyTokenConfig = legacyTokenConfig;