@thesingularitynetwork/darkswap-sdk 0.2.4 → 0.2.6

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.
@@ -4722,6 +4722,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4722
4722
  darkSwapFeeAssetManager: '0x0',
4723
4723
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4724
4724
  synaraBridge: '0x0',
4725
+ synaraCanonicalTokenRegistry: '0x0',
4725
4726
  zkverifyRelayerUrls: [],
4726
4727
  darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api'
4727
4728
  }, _contractConfig[ChainId.ARBITRUM_ONE] = {
@@ -4733,6 +4734,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4733
4734
  darkSwapFeeAssetManager: '0x0',
4734
4735
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4735
4736
  synaraBridge: '0x0',
4737
+ synaraCanonicalTokenRegistry: '0x0',
4736
4738
  zkverifyRelayerUrls: [],
4737
4739
  darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
4738
4740
  }, _contractConfig[ChainId.BASE] = {
@@ -4744,6 +4746,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4744
4746
  darkSwapFeeAssetManager: '0x0',
4745
4747
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4746
4748
  synaraBridge: '0x0',
4749
+ synaraCanonicalTokenRegistry: '0x0',
4747
4750
  zkverifyRelayerUrls: [],
4748
4751
  darkSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
4749
4752
  }, _contractConfig[ChainId.SEPOLIA] = {
@@ -4755,6 +4758,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4755
4758
  darkSwapFeeAssetManager: '0x0',
4756
4759
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4757
4760
  synaraBridge: '0x0',
4761
+ synaraCanonicalTokenRegistry: '0x0',
4758
4762
  zkverifyRelayerUrls: [],
4759
4763
  darkSwapSubgraphUrl: ''
4760
4764
  }, _contractConfig[ChainId.HORIZEN_TESTNET] = {
@@ -4766,6 +4770,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4766
4770
  darkSwapFeeAssetManager: '0x8CF86856Bd7dE95b4ba33DCae4cd5Ec02542Bf5b',
4767
4771
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4768
4772
  synaraBridge: '0x0',
4773
+ synaraCanonicalTokenRegistry: '0x0',
4769
4774
  zkverifyRelayerUrls: [],
4770
4775
  darkSwapSubgraphUrl: ''
4771
4776
  }, _contractConfig[ChainId.HARDHAT] = {
@@ -4777,6 +4782,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4777
4782
  darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
4778
4783
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4779
4784
  synaraBridge: '0x0',
4785
+ synaraCanonicalTokenRegistry: '0x0',
4780
4786
  zkverifyRelayerUrls: [],
4781
4787
  darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4782
4788
  }, _contractConfig[ChainId.HARDHAT_BASE] = {
@@ -4788,6 +4794,7 @@ var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
4788
4794
  darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
4789
4795
  synaraDarkSwapOnBridgeAssetManager: '0x0',
4790
4796
  synaraBridge: '0x0',
4797
+ synaraCanonicalTokenRegistry: '0x0',
4791
4798
  zkverifyRelayerUrls: [],
4792
4799
  darkSwapSubgraphUrl: 'https://app.dev.portalgate.me:8080/subgraphs/name/singularity/'
4793
4800
  }, _contractConfig);
@@ -11109,6 +11116,1908 @@ var SynaraDarkSwapOnBridgeAssetManagerAbi = {
11109
11116
  deployedLinkReferences: deployedLinkReferences$5
11110
11117
  };
11111
11118
 
11119
+ var _format$6 = "hh-sol-artifact-1";
11120
+ var contractName$6 = "CanonicalTokenRegistry";
11121
+ var sourceName$6 = "src/CanonicalTokenRegistry.sol";
11122
+ var abi$h = [
11123
+ {
11124
+ inputs: [
11125
+ ],
11126
+ stateMutability: "nonpayable",
11127
+ type: "constructor"
11128
+ },
11129
+ {
11130
+ inputs: [
11131
+ ],
11132
+ name: "AccessControlBadConfirmation",
11133
+ type: "error"
11134
+ },
11135
+ {
11136
+ inputs: [
11137
+ {
11138
+ internalType: "address",
11139
+ name: "account",
11140
+ type: "address"
11141
+ },
11142
+ {
11143
+ internalType: "bytes32",
11144
+ name: "neededRole",
11145
+ type: "bytes32"
11146
+ }
11147
+ ],
11148
+ name: "AccessControlUnauthorizedAccount",
11149
+ type: "error"
11150
+ },
11151
+ {
11152
+ inputs: [
11153
+ ],
11154
+ name: "AlreadyRegistered",
11155
+ type: "error"
11156
+ },
11157
+ {
11158
+ inputs: [
11159
+ ],
11160
+ name: "EnforcedPause",
11161
+ type: "error"
11162
+ },
11163
+ {
11164
+ inputs: [
11165
+ ],
11166
+ name: "ExpectedPause",
11167
+ type: "error"
11168
+ },
11169
+ {
11170
+ inputs: [
11171
+ ],
11172
+ name: "NotMapped",
11173
+ type: "error"
11174
+ },
11175
+ {
11176
+ inputs: [
11177
+ ],
11178
+ name: "NotRegistered",
11179
+ type: "error"
11180
+ },
11181
+ {
11182
+ 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
+ ],
11200
+ name: "OwnableUnauthorizedAccount",
11201
+ type: "error"
11202
+ },
11203
+ {
11204
+ inputs: [
11205
+ ],
11206
+ name: "TokenLocked",
11207
+ type: "error"
11208
+ },
11209
+ {
11210
+ inputs: [
11211
+ ],
11212
+ name: "TokenNotActive",
11213
+ type: "error"
11214
+ },
11215
+ {
11216
+ inputs: [
11217
+ ],
11218
+ name: "ZeroAddress",
11219
+ type: "error"
11220
+ },
11221
+ {
11222
+ anonymous: false,
11223
+ inputs: [
11224
+ {
11225
+ indexed: true,
11226
+ internalType: "bytes32",
11227
+ name: "canonicalId",
11228
+ type: "bytes32"
11229
+ },
11230
+ {
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"
11241
+ },
11242
+ {
11243
+ indexed: false,
11244
+ internalType: "uint8",
11245
+ name: "decimals",
11246
+ type: "uint8"
11247
+ }
11248
+ ],
11249
+ name: "CanonicalRegistered",
11250
+ type: "event"
11251
+ },
11252
+ {
11253
+ anonymous: false,
11254
+ inputs: [
11255
+ {
11256
+ indexed: true,
11257
+ internalType: "address",
11258
+ name: "previousOwner",
11259
+ type: "address"
11260
+ },
11261
+ {
11262
+ indexed: true,
11263
+ internalType: "address",
11264
+ name: "newOwner",
11265
+ type: "address"
11266
+ }
11267
+ ],
11268
+ name: "OwnershipTransferStarted",
11269
+ type: "event"
11270
+ },
11271
+ {
11272
+ anonymous: false,
11273
+ inputs: [
11274
+ {
11275
+ indexed: true,
11276
+ internalType: "address",
11277
+ name: "previousOwner",
11278
+ type: "address"
11279
+ },
11280
+ {
11281
+ indexed: true,
11282
+ internalType: "address",
11283
+ name: "newOwner",
11284
+ type: "address"
11285
+ }
11286
+ ],
11287
+ name: "OwnershipTransferred",
11288
+ type: "event"
11289
+ },
11290
+ {
11291
+ anonymous: false,
11292
+ inputs: [
11293
+ {
11294
+ indexed: false,
11295
+ internalType: "address",
11296
+ name: "account",
11297
+ type: "address"
11298
+ }
11299
+ ],
11300
+ name: "Paused",
11301
+ type: "event"
11302
+ },
11303
+ {
11304
+ anonymous: false,
11305
+ inputs: [
11306
+ {
11307
+ indexed: true,
11308
+ internalType: "bytes32",
11309
+ name: "canonicalId",
11310
+ type: "bytes32"
11311
+ },
11312
+ {
11313
+ indexed: false,
11314
+ internalType: "uint256",
11315
+ name: "chainId",
11316
+ type: "uint256"
11317
+ },
11318
+ {
11319
+ indexed: false,
11320
+ internalType: "address",
11321
+ name: "token",
11322
+ type: "address"
11323
+ }
11324
+ ],
11325
+ name: "RepresentationMapped",
11326
+ type: "event"
11327
+ },
11328
+ {
11329
+ anonymous: false,
11330
+ inputs: [
11331
+ {
11332
+ indexed: true,
11333
+ internalType: "bytes32",
11334
+ name: "canonicalId",
11335
+ type: "bytes32"
11336
+ },
11337
+ {
11338
+ indexed: false,
11339
+ internalType: "uint256",
11340
+ name: "chainId",
11341
+ type: "uint256"
11342
+ },
11343
+ {
11344
+ indexed: false,
11345
+ internalType: "address",
11346
+ name: "token",
11347
+ type: "address"
11348
+ }
11349
+ ],
11350
+ name: "RepresentationUnmapped",
11351
+ type: "event"
11352
+ },
11353
+ {
11354
+ anonymous: false,
11355
+ inputs: [
11356
+ {
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"
11373
+ }
11374
+ ],
11375
+ name: "RoleAdminChanged",
11376
+ type: "event"
11377
+ },
11378
+ {
11379
+ anonymous: false,
11380
+ inputs: [
11381
+ {
11382
+ indexed: true,
11383
+ 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: "",
11482
+ type: "bytes32"
11483
+ }
11484
+ ],
11485
+ stateMutability: "view",
11486
+ type: "function"
11487
+ },
11488
+ {
11489
+ inputs: [
11490
+ ],
11491
+ name: "GUARDIAN_ROLE",
11492
+ outputs: [
11493
+ {
11494
+ internalType: "bytes32",
11495
+ name: "",
11496
+ type: "bytes32"
11497
+ }
11498
+ ],
11499
+ stateMutability: "view",
11500
+ type: "function"
11501
+ },
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
+ {
11517
+ inputs: [
11518
+ ],
11519
+ name: "OPERATOR_ROLE",
11520
+ outputs: [
11521
+ {
11522
+ internalType: "bytes32",
11523
+ name: "",
11524
+ type: "bytes32"
11525
+ }
11526
+ ],
11527
+ stateMutability: "view",
11528
+ type: "function"
11529
+ },
11530
+ {
11531
+ 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
+ {
11662
+ internalType: "address",
11663
+ name: "token",
11664
+ type: "address"
11665
+ }
11666
+ ],
11667
+ name: "getCanonicalId",
11668
+ outputs: [
11669
+ {
11670
+ internalType: "bytes32",
11671
+ name: "",
11672
+ type: "bytes32"
11673
+ }
11674
+ ],
11675
+ stateMutability: "view",
11676
+ type: "function"
11677
+ },
11678
+ {
11679
+ inputs: [
11680
+ {
11681
+ internalType: "bytes32",
11682
+ name: "role",
11683
+ type: "bytes32"
11684
+ }
11685
+ ],
11686
+ name: "getRoleAdmin",
11687
+ outputs: [
11688
+ {
11689
+ internalType: "bytes32",
11690
+ name: "",
11691
+ type: "bytes32"
11692
+ }
11693
+ ],
11694
+ stateMutability: "view",
11695
+ type: "function"
11696
+ },
11697
+ {
11698
+ inputs: [
11699
+ {
11700
+ internalType: "bytes32",
11701
+ name: "canonicalId",
11702
+ type: "bytes32"
11703
+ }
11704
+ ],
11705
+ name: "getTokenStatus",
11706
+ outputs: [
11707
+ {
11708
+ internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11709
+ name: "",
11710
+ type: "uint8"
11711
+ }
11712
+ ],
11713
+ stateMutability: "view",
11714
+ type: "function"
11715
+ },
11716
+ {
11717
+ inputs: [
11718
+ {
11719
+ internalType: "bytes32",
11720
+ name: "role",
11721
+ type: "bytes32"
11722
+ },
11723
+ {
11724
+ internalType: "address",
11725
+ name: "account",
11726
+ type: "address"
11727
+ }
11728
+ ],
11729
+ name: "grantRole",
11730
+ outputs: [
11731
+ ],
11732
+ stateMutability: "nonpayable",
11733
+ type: "function"
11734
+ },
11735
+ {
11736
+ inputs: [
11737
+ {
11738
+ internalType: "bytes32",
11739
+ name: "role",
11740
+ type: "bytes32"
11741
+ },
11742
+ {
11743
+ internalType: "address",
11744
+ name: "account",
11745
+ type: "address"
11746
+ }
11747
+ ],
11748
+ name: "hasRole",
11749
+ outputs: [
11750
+ {
11751
+ internalType: "bool",
11752
+ name: "",
11753
+ type: "bool"
11754
+ }
11755
+ ],
11756
+ stateMutability: "view",
11757
+ type: "function"
11758
+ },
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
+ {
11779
+ inputs: [
11780
+ {
11781
+ internalType: "bytes32",
11782
+ name: "canonicalId",
11783
+ type: "bytes32"
11784
+ }
11785
+ ],
11786
+ name: "isRegistered",
11787
+ outputs: [
11788
+ {
11789
+ internalType: "bool",
11790
+ name: "",
11791
+ type: "bool"
11792
+ }
11793
+ ],
11794
+ stateMutability: "view",
11795
+ type: "function"
11796
+ },
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
+ {
11836
+ inputs: [
11837
+ ],
11838
+ name: "pause",
11839
+ outputs: [
11840
+ ],
11841
+ stateMutability: "nonpayable",
11842
+ type: "function"
11843
+ },
11844
+ {
11845
+ inputs: [
11846
+ ],
11847
+ name: "paused",
11848
+ outputs: [
11849
+ {
11850
+ internalType: "bool",
11851
+ name: "",
11852
+ type: "bool"
11853
+ }
11854
+ ],
11855
+ stateMutability: "view",
11856
+ type: "function"
11857
+ },
11858
+ {
11859
+ 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
+ {
11893
+ internalType: "bytes32",
11894
+ name: "canonicalId",
11895
+ type: "bytes32"
11896
+ }
11897
+ ],
11898
+ stateMutability: "nonpayable",
11899
+ type: "function"
11900
+ },
11901
+ {
11902
+ inputs: [
11903
+ ],
11904
+ name: "renounceOwnership",
11905
+ outputs: [
11906
+ ],
11907
+ stateMutability: "nonpayable",
11908
+ type: "function"
11909
+ },
11910
+ {
11911
+ inputs: [
11912
+ {
11913
+ internalType: "bytes32",
11914
+ name: "role",
11915
+ type: "bytes32"
11916
+ },
11917
+ {
11918
+ internalType: "address",
11919
+ name: "callerConfirmation",
11920
+ type: "address"
11921
+ }
11922
+ ],
11923
+ name: "renounceRole",
11924
+ outputs: [
11925
+ ],
11926
+ stateMutability: "nonpayable",
11927
+ type: "function"
11928
+ },
11929
+ {
11930
+ inputs: [
11931
+ {
11932
+ internalType: "bytes32",
11933
+ name: "role",
11934
+ type: "bytes32"
11935
+ },
11936
+ {
11937
+ internalType: "address",
11938
+ name: "account",
11939
+ type: "address"
11940
+ }
11941
+ ],
11942
+ name: "revokeRole",
11943
+ outputs: [
11944
+ ],
11945
+ stateMutability: "nonpayable",
11946
+ type: "function"
11947
+ },
11948
+ {
11949
+ inputs: [
11950
+ {
11951
+ internalType: "bytes32",
11952
+ name: "canonicalId",
11953
+ type: "bytes32"
11954
+ },
11955
+ {
11956
+ internalType: "enum ICanonicalTokenRegistry.TokenStatus",
11957
+ name: "status",
11958
+ type: "uint8"
11959
+ }
11960
+ ],
11961
+ name: "setTokenStatus",
11962
+ outputs: [
11963
+ ],
11964
+ stateMutability: "nonpayable",
11965
+ type: "function"
11966
+ },
11967
+ {
11968
+ inputs: [
11969
+ {
11970
+ internalType: "bytes4",
11971
+ name: "interfaceId",
11972
+ type: "bytes4"
11973
+ }
11974
+ ],
11975
+ name: "supportsInterface",
11976
+ outputs: [
11977
+ {
11978
+ internalType: "bool",
11979
+ name: "",
11980
+ type: "bool"
11981
+ }
11982
+ ],
11983
+ stateMutability: "view",
11984
+ type: "function"
11985
+ },
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
+ {
12020
+ inputs: [
12021
+ ],
12022
+ name: "unpause",
12023
+ outputs: [
12024
+ ],
12025
+ stateMutability: "nonpayable",
12026
+ type: "function"
12027
+ }
12028
+ ];
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
+
12046
+ var _format$7 = "hh-sol-artifact-1";
12047
+ var contractName$7 = "Bridge";
12048
+ var sourceName$7 = "src/Bridge.sol";
12049
+ var abi$i = [
12050
+ {
12051
+ inputs: [
12052
+ {
12053
+ internalType: "address",
12054
+ name: "_erc20Pool",
12055
+ type: "address"
12056
+ },
12057
+ {
12058
+ internalType: "address",
12059
+ name: "_nativePool",
12060
+ type: "address"
12061
+ },
12062
+ {
12063
+ internalType: "address",
12064
+ name: "feeManager",
12065
+ type: "address"
12066
+ },
12067
+ {
12068
+ internalType: "address",
12069
+ name: "verifierHub",
12070
+ type: "address"
12071
+ },
12072
+ {
12073
+ internalType: "address",
12074
+ name: "initialOwner",
12075
+ type: "address"
12076
+ }
12077
+ ],
12078
+ stateMutability: "nonpayable",
12079
+ type: "constructor"
12080
+ },
12081
+ {
12082
+ inputs: [
12083
+ ],
12084
+ name: "AmountZero",
12085
+ type: "error"
12086
+ },
12087
+ {
12088
+ inputs: [
12089
+ ],
12090
+ name: "CallDataHashMismatch",
12091
+ type: "error"
12092
+ },
12093
+ {
12094
+ inputs: [
12095
+ ],
12096
+ name: "CallerNotRegistered",
12097
+ type: "error"
12098
+ },
12099
+ {
12100
+ inputs: [
12101
+ ],
12102
+ name: "DepositExists",
12103
+ type: "error"
12104
+ },
12105
+ {
12106
+ inputs: [
12107
+ ],
12108
+ name: "DepositUsed",
12109
+ type: "error"
12110
+ },
12111
+ {
12112
+ inputs: [
12113
+ ],
12114
+ name: "NonceTooLow",
12115
+ type: "error"
12116
+ },
12117
+ {
12118
+ inputs: [
12119
+ {
12120
+ internalType: "address",
12121
+ name: "owner",
12122
+ type: "address"
12123
+ }
12124
+ ],
12125
+ name: "OwnableInvalidOwner",
12126
+ type: "error"
12127
+ },
12128
+ {
12129
+ inputs: [
12130
+ {
12131
+ internalType: "address",
12132
+ name: "account",
12133
+ type: "address"
12134
+ }
12135
+ ],
12136
+ name: "OwnableUnauthorizedAccount",
12137
+ type: "error"
12138
+ },
12139
+ {
12140
+ inputs: [
12141
+ ],
12142
+ name: "ReentrancyGuardReentrantCall",
12143
+ type: "error"
12144
+ },
12145
+ {
12146
+ inputs: [
12147
+ {
12148
+ internalType: "address",
12149
+ name: "token",
12150
+ type: "address"
12151
+ }
12152
+ ],
12153
+ name: "SafeERC20FailedOperation",
12154
+ type: "error"
12155
+ },
12156
+ {
12157
+ inputs: [
12158
+ ],
12159
+ name: "ZeroAddress",
12160
+ type: "error"
12161
+ },
12162
+ {
12163
+ anonymous: false,
12164
+ inputs: [
12165
+ {
12166
+ indexed: true,
12167
+ internalType: "bytes32",
12168
+ name: "depositCommitment",
12169
+ type: "bytes32"
12170
+ },
12171
+ {
12172
+ indexed: true,
12173
+ internalType: "bytes32",
12174
+ name: "canonicalTokenId",
12175
+ type: "bytes32"
12176
+ },
12177
+ {
12178
+ indexed: true,
12179
+ internalType: "address",
12180
+ name: "from",
12181
+ type: "address"
12182
+ },
12183
+ {
12184
+ indexed: false,
12185
+ internalType: "address",
12186
+ name: "owner",
12187
+ type: "address"
12188
+ },
12189
+ {
12190
+ indexed: false,
12191
+ internalType: "uint256",
12192
+ name: "amount",
12193
+ type: "uint256"
12194
+ },
12195
+ {
12196
+ indexed: false,
12197
+ internalType: "uint256",
12198
+ name: "destinationChain",
12199
+ type: "uint256"
12200
+ },
12201
+ {
12202
+ indexed: false,
12203
+ internalType: "uint256",
12204
+ name: "nonce",
12205
+ type: "uint256"
12206
+ },
12207
+ {
12208
+ indexed: false,
12209
+ internalType: "uint256",
12210
+ name: "sourceChain",
12211
+ type: "uint256"
12212
+ },
12213
+ {
12214
+ indexed: false,
12215
+ internalType: "address",
12216
+ name: "destContract",
12217
+ type: "address"
12218
+ },
12219
+ {
12220
+ indexed: false,
12221
+ internalType: "bytes",
12222
+ name: "callData",
12223
+ type: "bytes"
12224
+ }
12225
+ ],
12226
+ name: "Deposited",
12227
+ type: "event"
12228
+ },
12229
+ {
12230
+ anonymous: false,
12231
+ inputs: [
12232
+ {
12233
+ indexed: true,
12234
+ internalType: "address",
12235
+ name: "previousOwner",
12236
+ type: "address"
12237
+ },
12238
+ {
12239
+ indexed: true,
12240
+ internalType: "address",
12241
+ name: "newOwner",
12242
+ type: "address"
12243
+ }
12244
+ ],
12245
+ name: "OwnershipTransferred",
12246
+ type: "event"
12247
+ },
12248
+ {
12249
+ anonymous: false,
12250
+ inputs: [
12251
+ {
12252
+ indexed: true,
12253
+ internalType: "bytes32",
12254
+ name: "depositCommitment",
12255
+ type: "bytes32"
12256
+ },
12257
+ {
12258
+ indexed: true,
12259
+ internalType: "bytes32",
12260
+ name: "canonicalTokenId",
12261
+ type: "bytes32"
12262
+ },
12263
+ {
12264
+ indexed: true,
12265
+ internalType: "address",
12266
+ name: "to",
12267
+ type: "address"
12268
+ },
12269
+ {
12270
+ indexed: false,
12271
+ internalType: "uint256",
12272
+ name: "amount",
12273
+ type: "uint256"
12274
+ },
12275
+ {
12276
+ indexed: false,
12277
+ internalType: "bytes",
12278
+ name: "callData",
12279
+ type: "bytes"
12280
+ }
12281
+ ],
12282
+ name: "Withdrawal",
12283
+ type: "event"
12284
+ },
12285
+ {
12286
+ inputs: [
12287
+ ],
12288
+ name: "SYNARA_BRIDGE",
12289
+ outputs: [
12290
+ {
12291
+ internalType: "uint256",
12292
+ name: "",
12293
+ type: "uint256"
12294
+ }
12295
+ ],
12296
+ stateMutability: "view",
12297
+ type: "function"
12298
+ },
12299
+ {
12300
+ inputs: [
12301
+ {
12302
+ internalType: "bytes32",
12303
+ name: "canonicalId",
12304
+ type: "bytes32"
12305
+ },
12306
+ {
12307
+ internalType: "uint256",
12308
+ name: "amount",
12309
+ type: "uint256"
12310
+ },
12311
+ {
12312
+ internalType: "uint256",
12313
+ name: "destinationChainId",
12314
+ type: "uint256"
12315
+ },
12316
+ {
12317
+ internalType: "uint256",
12318
+ name: "nonce",
12319
+ type: "uint256"
12320
+ }
12321
+ ],
12322
+ name: "depositERC20",
12323
+ outputs: [
12324
+ ],
12325
+ stateMutability: "nonpayable",
12326
+ type: "function"
12327
+ },
12328
+ {
12329
+ inputs: [
12330
+ {
12331
+ internalType: "bytes32",
12332
+ name: "canonicalId",
12333
+ type: "bytes32"
12334
+ },
12335
+ {
12336
+ internalType: "uint256",
12337
+ name: "amount",
12338
+ type: "uint256"
12339
+ },
12340
+ {
12341
+ internalType: "uint256",
12342
+ name: "destinationChainId",
12343
+ type: "uint256"
12344
+ },
12345
+ {
12346
+ internalType: "uint256",
12347
+ name: "nonce",
12348
+ type: "uint256"
12349
+ },
12350
+ {
12351
+ components: [
12352
+ {
12353
+ internalType: "address",
12354
+ name: "target",
12355
+ type: "address"
12356
+ },
12357
+ {
12358
+ internalType: "bytes",
12359
+ name: "data",
12360
+ type: "bytes"
12361
+ }
12362
+ ],
12363
+ internalType: "struct Bridge.CrossChainCall",
12364
+ name: "call",
12365
+ type: "tuple"
12366
+ }
12367
+ ],
12368
+ name: "depositERC20WithCallData",
12369
+ outputs: [
12370
+ ],
12371
+ stateMutability: "nonpayable",
12372
+ type: "function"
12373
+ },
12374
+ {
12375
+ inputs: [
12376
+ {
12377
+ internalType: "bytes32",
12378
+ name: "canonicalId",
12379
+ type: "bytes32"
12380
+ },
12381
+ {
12382
+ internalType: "uint256",
12383
+ name: "destinationChainId",
12384
+ type: "uint256"
12385
+ },
12386
+ {
12387
+ internalType: "uint256",
12388
+ name: "nonce",
12389
+ type: "uint256"
12390
+ }
12391
+ ],
12392
+ name: "depositNative",
12393
+ outputs: [
12394
+ ],
12395
+ stateMutability: "payable",
12396
+ type: "function"
12397
+ },
12398
+ {
12399
+ inputs: [
12400
+ {
12401
+ internalType: "bytes32",
12402
+ name: "canonicalId",
12403
+ type: "bytes32"
12404
+ },
12405
+ {
12406
+ internalType: "uint256",
12407
+ name: "destinationChainId",
12408
+ type: "uint256"
12409
+ },
12410
+ {
12411
+ internalType: "uint256",
12412
+ name: "nonce",
12413
+ type: "uint256"
12414
+ },
12415
+ {
12416
+ components: [
12417
+ {
12418
+ internalType: "address",
12419
+ name: "target",
12420
+ type: "address"
12421
+ },
12422
+ {
12423
+ internalType: "bytes",
12424
+ name: "data",
12425
+ type: "bytes"
12426
+ }
12427
+ ],
12428
+ internalType: "struct Bridge.CrossChainCall",
12429
+ name: "call",
12430
+ type: "tuple"
12431
+ }
12432
+ ],
12433
+ name: "depositNativeWithCallData",
12434
+ outputs: [
12435
+ ],
12436
+ stateMutability: "payable",
12437
+ type: "function"
12438
+ },
12439
+ {
12440
+ inputs: [
12441
+ ],
12442
+ name: "erc20Pool",
12443
+ outputs: [
12444
+ {
12445
+ internalType: "address",
12446
+ name: "",
12447
+ type: "address"
12448
+ }
12449
+ ],
12450
+ stateMutability: "view",
12451
+ type: "function"
12452
+ },
12453
+ {
12454
+ inputs: [
12455
+ {
12456
+ internalType: "bytes32",
12457
+ name: "canonicalId",
12458
+ type: "bytes32"
12459
+ },
12460
+ {
12461
+ internalType: "address",
12462
+ name: "wallet",
12463
+ type: "address"
12464
+ },
12465
+ {
12466
+ internalType: "uint256",
12467
+ name: "amount",
12468
+ type: "uint256"
12469
+ }
12470
+ ],
12471
+ name: "getBridgeFee",
12472
+ outputs: [
12473
+ {
12474
+ internalType: "uint256",
12475
+ name: "",
12476
+ type: "uint256"
12477
+ }
12478
+ ],
12479
+ stateMutability: "view",
12480
+ type: "function"
12481
+ },
12482
+ {
12483
+ inputs: [
12484
+ ],
12485
+ name: "nativePool",
12486
+ outputs: [
12487
+ {
12488
+ internalType: "address",
12489
+ name: "",
12490
+ type: "address"
12491
+ }
12492
+ ],
12493
+ stateMutability: "view",
12494
+ type: "function"
12495
+ },
12496
+ {
12497
+ inputs: [
12498
+ ],
12499
+ name: "owner",
12500
+ outputs: [
12501
+ {
12502
+ internalType: "address",
12503
+ name: "",
12504
+ type: "address"
12505
+ }
12506
+ ],
12507
+ stateMutability: "view",
12508
+ type: "function"
12509
+ },
12510
+ {
12511
+ inputs: [
12512
+ {
12513
+ internalType: "address",
12514
+ name: "caller",
12515
+ type: "address"
12516
+ },
12517
+ {
12518
+ internalType: "bool",
12519
+ name: "registered",
12520
+ type: "bool"
12521
+ }
12522
+ ],
12523
+ name: "registerCaller",
12524
+ outputs: [
12525
+ ],
12526
+ stateMutability: "nonpayable",
12527
+ type: "function"
12528
+ },
12529
+ {
12530
+ inputs: [
12531
+ {
12532
+ internalType: "address",
12533
+ name: "relayer",
12534
+ type: "address"
12535
+ },
12536
+ {
12537
+ internalType: "bool",
12538
+ name: "registered",
12539
+ type: "bool"
12540
+ }
12541
+ ],
12542
+ name: "registerRelayer",
12543
+ outputs: [
12544
+ ],
12545
+ stateMutability: "nonpayable",
12546
+ type: "function"
12547
+ },
12548
+ {
12549
+ inputs: [
12550
+ ],
12551
+ name: "renounceOwnership",
12552
+ outputs: [
12553
+ ],
12554
+ stateMutability: "nonpayable",
12555
+ type: "function"
12556
+ },
12557
+ {
12558
+ inputs: [
12559
+ {
12560
+ internalType: "address",
12561
+ name: "newOwner",
12562
+ type: "address"
12563
+ }
12564
+ ],
12565
+ name: "transferOwnership",
12566
+ outputs: [
12567
+ ],
12568
+ stateMutability: "nonpayable",
12569
+ type: "function"
12570
+ },
12571
+ {
12572
+ inputs: [
12573
+ {
12574
+ components: [
12575
+ {
12576
+ internalType: "bytes32",
12577
+ name: "canonicalId",
12578
+ type: "bytes32"
12579
+ },
12580
+ {
12581
+ internalType: "uint256",
12582
+ name: "amount",
12583
+ type: "uint256"
12584
+ },
12585
+ {
12586
+ internalType: "address",
12587
+ name: "to",
12588
+ type: "address"
12589
+ },
12590
+ {
12591
+ internalType: "bytes",
12592
+ name: "callData",
12593
+ type: "bytes"
12594
+ },
12595
+ {
12596
+ internalType: "bytes32",
12597
+ name: "stateRootHigh16",
12598
+ type: "bytes32"
12599
+ },
12600
+ {
12601
+ internalType: "bytes32",
12602
+ name: "stateRootLow16",
12603
+ type: "bytes32"
12604
+ },
12605
+ {
12606
+ internalType: "bytes32",
12607
+ name: "depositCommitmentHigh16",
12608
+ type: "bytes32"
12609
+ },
12610
+ {
12611
+ internalType: "bytes32",
12612
+ name: "depositCommitmentLow16",
12613
+ type: "bytes32"
12614
+ },
12615
+ {
12616
+ internalType: "address",
12617
+ name: "from",
12618
+ type: "address"
12619
+ },
12620
+ {
12621
+ internalType: "address",
12622
+ name: "owner",
12623
+ type: "address"
12624
+ },
12625
+ {
12626
+ internalType: "uint256",
12627
+ name: "destinationChainId",
12628
+ type: "uint256"
12629
+ },
12630
+ {
12631
+ internalType: "bytes32",
12632
+ name: "calldataHashHigh16",
12633
+ type: "bytes32"
12634
+ },
12635
+ {
12636
+ internalType: "bytes32",
12637
+ name: "calldataHashLow16",
12638
+ type: "bytes32"
12639
+ }
12640
+ ],
12641
+ internalType: "struct Bridge.WithdrawalArguments",
12642
+ name: "_args",
12643
+ type: "tuple"
12644
+ },
12645
+ {
12646
+ components: [
12647
+ {
12648
+ internalType: "uint256",
12649
+ name: "attestationId",
12650
+ type: "uint256"
12651
+ },
12652
+ {
12653
+ internalType: "bytes32[]",
12654
+ name: "merklePath",
12655
+ type: "bytes32[]"
12656
+ },
12657
+ {
12658
+ internalType: "uint256",
12659
+ name: "leafCount",
12660
+ type: "uint256"
12661
+ },
12662
+ {
12663
+ internalType: "uint256",
12664
+ name: "index",
12665
+ type: "uint256"
12666
+ }
12667
+ ],
12668
+ internalType: "struct IZkvHub.AttestationDetails",
12669
+ name: "_attDetails",
12670
+ type: "tuple"
12671
+ }
12672
+ ],
12673
+ name: "withdrawERC20",
12674
+ outputs: [
12675
+ ],
12676
+ stateMutability: "nonpayable",
12677
+ type: "function"
12678
+ },
12679
+ {
12680
+ inputs: [
12681
+ {
12682
+ components: [
12683
+ {
12684
+ internalType: "bytes32",
12685
+ name: "canonicalId",
12686
+ type: "bytes32"
12687
+ },
12688
+ {
12689
+ internalType: "uint256",
12690
+ name: "amount",
12691
+ type: "uint256"
12692
+ },
12693
+ {
12694
+ internalType: "address",
12695
+ name: "to",
12696
+ type: "address"
12697
+ },
12698
+ {
12699
+ internalType: "bytes",
12700
+ name: "callData",
12701
+ type: "bytes"
12702
+ },
12703
+ {
12704
+ internalType: "bytes32",
12705
+ name: "stateRootHigh16",
12706
+ type: "bytes32"
12707
+ },
12708
+ {
12709
+ internalType: "bytes32",
12710
+ name: "stateRootLow16",
12711
+ type: "bytes32"
12712
+ },
12713
+ {
12714
+ internalType: "bytes32",
12715
+ name: "depositCommitmentHigh16",
12716
+ type: "bytes32"
12717
+ },
12718
+ {
12719
+ internalType: "bytes32",
12720
+ name: "depositCommitmentLow16",
12721
+ type: "bytes32"
12722
+ },
12723
+ {
12724
+ internalType: "address",
12725
+ name: "from",
12726
+ type: "address"
12727
+ },
12728
+ {
12729
+ internalType: "address",
12730
+ name: "owner",
12731
+ type: "address"
12732
+ },
12733
+ {
12734
+ internalType: "uint256",
12735
+ name: "destinationChainId",
12736
+ type: "uint256"
12737
+ },
12738
+ {
12739
+ internalType: "bytes32",
12740
+ name: "calldataHashHigh16",
12741
+ type: "bytes32"
12742
+ },
12743
+ {
12744
+ internalType: "bytes32",
12745
+ name: "calldataHashLow16",
12746
+ type: "bytes32"
12747
+ }
12748
+ ],
12749
+ internalType: "struct Bridge.WithdrawalArguments",
12750
+ name: "_args",
12751
+ type: "tuple"
12752
+ },
12753
+ {
12754
+ components: [
12755
+ {
12756
+ internalType: "uint256",
12757
+ name: "attestationId",
12758
+ type: "uint256"
12759
+ },
12760
+ {
12761
+ internalType: "bytes32[]",
12762
+ name: "merklePath",
12763
+ type: "bytes32[]"
12764
+ },
12765
+ {
12766
+ internalType: "uint256",
12767
+ name: "leafCount",
12768
+ type: "uint256"
12769
+ },
12770
+ {
12771
+ internalType: "uint256",
12772
+ name: "index",
12773
+ type: "uint256"
12774
+ }
12775
+ ],
12776
+ internalType: "struct IZkvHub.AttestationDetails",
12777
+ name: "_attDetails",
12778
+ type: "tuple"
12779
+ }
12780
+ ],
12781
+ name: "withdrawERC20ToContract",
12782
+ outputs: [
12783
+ ],
12784
+ stateMutability: "nonpayable",
12785
+ type: "function"
12786
+ },
12787
+ {
12788
+ inputs: [
12789
+ {
12790
+ components: [
12791
+ {
12792
+ internalType: "bytes32",
12793
+ name: "canonicalId",
12794
+ type: "bytes32"
12795
+ },
12796
+ {
12797
+ internalType: "uint256",
12798
+ name: "amount",
12799
+ type: "uint256"
12800
+ },
12801
+ {
12802
+ internalType: "address",
12803
+ name: "to",
12804
+ type: "address"
12805
+ },
12806
+ {
12807
+ internalType: "bytes",
12808
+ name: "callData",
12809
+ type: "bytes"
12810
+ },
12811
+ {
12812
+ internalType: "bytes32",
12813
+ name: "stateRootHigh16",
12814
+ type: "bytes32"
12815
+ },
12816
+ {
12817
+ internalType: "bytes32",
12818
+ name: "stateRootLow16",
12819
+ type: "bytes32"
12820
+ },
12821
+ {
12822
+ internalType: "bytes32",
12823
+ name: "depositCommitmentHigh16",
12824
+ type: "bytes32"
12825
+ },
12826
+ {
12827
+ internalType: "bytes32",
12828
+ name: "depositCommitmentLow16",
12829
+ type: "bytes32"
12830
+ },
12831
+ {
12832
+ internalType: "address",
12833
+ name: "from",
12834
+ type: "address"
12835
+ },
12836
+ {
12837
+ internalType: "address",
12838
+ name: "owner",
12839
+ type: "address"
12840
+ },
12841
+ {
12842
+ internalType: "uint256",
12843
+ name: "destinationChainId",
12844
+ type: "uint256"
12845
+ },
12846
+ {
12847
+ internalType: "bytes32",
12848
+ name: "calldataHashHigh16",
12849
+ type: "bytes32"
12850
+ },
12851
+ {
12852
+ internalType: "bytes32",
12853
+ name: "calldataHashLow16",
12854
+ type: "bytes32"
12855
+ }
12856
+ ],
12857
+ internalType: "struct Bridge.WithdrawalArguments",
12858
+ name: "_args",
12859
+ type: "tuple"
12860
+ },
12861
+ {
12862
+ components: [
12863
+ {
12864
+ internalType: "uint256",
12865
+ name: "attestationId",
12866
+ type: "uint256"
12867
+ },
12868
+ {
12869
+ internalType: "bytes32[]",
12870
+ name: "merklePath",
12871
+ type: "bytes32[]"
12872
+ },
12873
+ {
12874
+ internalType: "uint256",
12875
+ name: "leafCount",
12876
+ type: "uint256"
12877
+ },
12878
+ {
12879
+ internalType: "uint256",
12880
+ name: "index",
12881
+ type: "uint256"
12882
+ }
12883
+ ],
12884
+ internalType: "struct IZkvHub.AttestationDetails",
12885
+ name: "_attDetails",
12886
+ type: "tuple"
12887
+ }
12888
+ ],
12889
+ name: "withdrawNative",
12890
+ outputs: [
12891
+ ],
12892
+ stateMutability: "nonpayable",
12893
+ type: "function"
12894
+ },
12895
+ {
12896
+ inputs: [
12897
+ {
12898
+ components: [
12899
+ {
12900
+ internalType: "bytes32",
12901
+ name: "canonicalId",
12902
+ type: "bytes32"
12903
+ },
12904
+ {
12905
+ internalType: "uint256",
12906
+ name: "amount",
12907
+ type: "uint256"
12908
+ },
12909
+ {
12910
+ internalType: "address",
12911
+ name: "to",
12912
+ type: "address"
12913
+ },
12914
+ {
12915
+ internalType: "bytes",
12916
+ name: "callData",
12917
+ type: "bytes"
12918
+ },
12919
+ {
12920
+ internalType: "bytes32",
12921
+ name: "stateRootHigh16",
12922
+ type: "bytes32"
12923
+ },
12924
+ {
12925
+ internalType: "bytes32",
12926
+ name: "stateRootLow16",
12927
+ type: "bytes32"
12928
+ },
12929
+ {
12930
+ internalType: "bytes32",
12931
+ name: "depositCommitmentHigh16",
12932
+ type: "bytes32"
12933
+ },
12934
+ {
12935
+ internalType: "bytes32",
12936
+ name: "depositCommitmentLow16",
12937
+ type: "bytes32"
12938
+ },
12939
+ {
12940
+ internalType: "address",
12941
+ name: "from",
12942
+ type: "address"
12943
+ },
12944
+ {
12945
+ internalType: "address",
12946
+ name: "owner",
12947
+ type: "address"
12948
+ },
12949
+ {
12950
+ internalType: "uint256",
12951
+ name: "destinationChainId",
12952
+ type: "uint256"
12953
+ },
12954
+ {
12955
+ internalType: "bytes32",
12956
+ name: "calldataHashHigh16",
12957
+ type: "bytes32"
12958
+ },
12959
+ {
12960
+ internalType: "bytes32",
12961
+ name: "calldataHashLow16",
12962
+ type: "bytes32"
12963
+ }
12964
+ ],
12965
+ internalType: "struct Bridge.WithdrawalArguments",
12966
+ name: "_args",
12967
+ type: "tuple"
12968
+ },
12969
+ {
12970
+ components: [
12971
+ {
12972
+ internalType: "uint256",
12973
+ name: "attestationId",
12974
+ type: "uint256"
12975
+ },
12976
+ {
12977
+ internalType: "bytes32[]",
12978
+ name: "merklePath",
12979
+ type: "bytes32[]"
12980
+ },
12981
+ {
12982
+ internalType: "uint256",
12983
+ name: "leafCount",
12984
+ type: "uint256"
12985
+ },
12986
+ {
12987
+ internalType: "uint256",
12988
+ name: "index",
12989
+ type: "uint256"
12990
+ }
12991
+ ],
12992
+ internalType: "struct IZkvHub.AttestationDetails",
12993
+ name: "_attDetails",
12994
+ type: "tuple"
12995
+ }
12996
+ ],
12997
+ name: "withdrawNativeToContract",
12998
+ outputs: [
12999
+ ],
13000
+ stateMutability: "nonpayable",
13001
+ type: "function"
13002
+ }
13003
+ ];
13004
+ var bytecode$i = "";
13005
+ var deployedBytecode$7 = "";
13006
+ var linkReferences$7 = {
13007
+ };
13008
+ var deployedLinkReferences$7 = {
13009
+ };
13010
+ 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
13019
+ };
13020
+
11112
13021
  var _DOMAIN_PREFIX = "0x191253796e6172614272696467654465706f7369740a";
11113
13022
  var BridgeCreateOrderContext = /*#__PURE__*/function (_BaseContext) {
11114
13023
  function BridgeCreateOrderContext(signature) {
@@ -11267,24 +13176,82 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11267
13176
  this._darkSwapOfDestChain = _darkSwapOfDestChain;
11268
13177
  }
11269
13178
  var _proto = BridgeCreateOrderService.prototype;
11270
- _proto.prepare = /*#__PURE__*/function () {
11271
- var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(address, sourceChainId, sourceAsset, sourceAmount, canonicalId, bridgeFee, destChainId, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
11272
- var _yield$generateKeyPai, pubKey, privKey, feeRatio, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
13179
+ _proto.getCanonicalTokenAddress = /*#__PURE__*/function () {
13180
+ var _getCanonicalTokenAddress = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sourceChainId, sourceAsset) {
13181
+ var canonicalTokenRegistry;
11273
13182
  return _regenerator().w(function (_context) {
11274
13183
  while (1) switch (_context.n) {
11275
13184
  case 0:
13185
+ canonicalTokenRegistry = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraCanonicalTokenRegistry, CanonicalTokenRegistryAbi.abi, this._darkSwapOfSourceChain.provider);
11276
13186
  _context.n = 1;
13187
+ return canonicalTokenRegistry.getCanonicalId(BigInt(sourceChainId), sourceAsset);
13188
+ case 1:
13189
+ return _context.a(2, _context.v);
13190
+ }
13191
+ }, _callee, this);
13192
+ }));
13193
+ function getCanonicalTokenAddress(_x, _x2) {
13194
+ return _getCanonicalTokenAddress.apply(this, arguments);
13195
+ }
13196
+ return getCanonicalTokenAddress;
13197
+ }();
13198
+ _proto.getBridgeFee = /*#__PURE__*/function () {
13199
+ var _getBridgeFee = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(canonicalId, wallet, amount) {
13200
+ var bridge;
13201
+ return _regenerator().w(function (_context2) {
13202
+ while (1) switch (_context2.n) {
13203
+ case 0:
13204
+ bridge = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraBridge, BridgeAbi.abi, this._darkSwapOfSourceChain.provider);
13205
+ _context2.n = 1;
13206
+ return bridge.getBridgeFee(canonicalId, wallet, amount);
13207
+ case 1:
13208
+ return _context2.a(2, _context2.v);
13209
+ }
13210
+ }, _callee2, this);
13211
+ }));
13212
+ function getBridgeFee(_x3, _x4, _x5) {
13213
+ return _getBridgeFee.apply(this, arguments);
13214
+ }
13215
+ return getBridgeFee;
13216
+ }();
13217
+ _proto.prepare = /*#__PURE__*/function () {
13218
+ var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address, sourceChainId, sourceAsset, sourceAmount, canonicalId, bridgeFee, destChainId, depositAsset, depositAmount, swapInAsset, swapInAmount, signature) {
13219
+ var _yield$generateKeyPai, pubKey, privKey, feeRatio, canonicalIdFromContract, bridgeFeeAmountFromContract, orderNote, feeAmount, realSwapInAmount, swapInNote, context, swapMessage, _t, _t2;
13220
+ return _regenerator().w(function (_context3) {
13221
+ while (1) switch (_context3.n) {
13222
+ case 0:
13223
+ _context3.n = 1;
11277
13224
  return generateKeyPair(signature);
11278
13225
  case 1:
11279
- _yield$generateKeyPai = _context.v;
13226
+ _yield$generateKeyPai = _context3.v;
11280
13227
  pubKey = _yield$generateKeyPai[0];
11281
13228
  privKey = _yield$generateKeyPai[1];
11282
13229
  _t = BigInt;
11283
- _context.n = 2;
13230
+ _context3.n = 2;
11284
13231
  return getFeeRatio(address, this._darkSwapOfDestChain);
11285
13232
  case 2:
11286
- _t2 = _context.v;
13233
+ _t2 = _context3.v;
11287
13234
  feeRatio = _t(_t2);
13235
+ _context3.n = 3;
13236
+ return this.getCanonicalTokenAddress(sourceChainId, sourceAsset);
13237
+ case 3:
13238
+ canonicalIdFromContract = _context3.v;
13239
+ if (!(canonicalIdFromContract !== canonicalId)) {
13240
+ _context3.n = 4;
13241
+ break;
13242
+ }
13243
+ throw new DarkSwapError('CanonicalId not match');
13244
+ case 4:
13245
+ _context3.n = 5;
13246
+ return this.getBridgeFee(canonicalId, address, sourceAmount);
13247
+ case 5:
13248
+ bridgeFeeAmountFromContract = _context3.v;
13249
+ if (!(bridgeFeeAmountFromContract !== bridgeFee)) {
13250
+ _context3.n = 6;
13251
+ break;
13252
+ }
13253
+ throw new DarkSwapError('BridgeFee not match');
13254
+ case 6:
11288
13255
  orderNote = createOrderNoteExt(address, depositAsset, depositAmount, feeRatio, pubKey);
11289
13256
  feeAmount = calcFeeAmount(swapInAmount, feeRatio);
11290
13257
  realSwapInAmount = swapInAmount - feeAmount;
@@ -11300,19 +13267,19 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11300
13267
  context.sourceAmount = sourceAmount;
11301
13268
  context.bridgeFeeAmount = bridgeFee;
11302
13269
  context.canonicalId = canonicalId;
11303
- _context.n = 3;
13270
+ _context3.n = 7;
11304
13271
  return generateRetailSwapMessage(address, orderNote, swapInNote, feeAmount, pubKey, privKey);
11305
- case 3:
11306
- swapMessage = _context.v;
13272
+ case 7:
13273
+ swapMessage = _context3.v;
11307
13274
  context.swapMessage = swapMessage;
11308
- return _context.a(2, {
13275
+ return _context3.a(2, {
11309
13276
  context: context,
11310
13277
  swapMessage: swapMessage
11311
13278
  });
11312
13279
  }
11313
- }, _callee, this);
13280
+ }, _callee3, this);
11314
13281
  }));
11315
- function prepare(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10) {
13282
+ function prepare(_x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13, _x14, _x15) {
11316
13283
  return _prepare.apply(this, arguments);
11317
13284
  }
11318
13285
  return prepare;
@@ -11321,123 +13288,123 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11321
13288
  return this._darkSwapOfSourceChain.contracts.zkverifyRelayerUrls[0];
11322
13289
  };
11323
13290
  _proto.submitProof = /*#__PURE__*/function () {
11324
- var _submitProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context) {
13291
+ var _submitProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
11325
13292
  var relayerRequest, response, _yield$this$pollJobSt, error, result;
11326
- return _regenerator().w(function (_context2) {
11327
- while (1) switch (_context2.n) {
13293
+ return _regenerator().w(function (_context4) {
13294
+ while (1) switch (_context4.n) {
11328
13295
  case 0:
11329
13296
  if (context) {
11330
- _context2.n = 1;
13297
+ _context4.n = 1;
11331
13298
  break;
11332
13299
  }
11333
13300
  throw new DarkSwapError('Invalid context');
11334
13301
  case 1:
11335
- _context2.n = 2;
13302
+ _context4.n = 2;
11336
13303
  return this.generateProof(context);
11337
13304
  case 2:
11338
- context.proof = _context2.v;
13305
+ context.proof = _context4.v;
11339
13306
  relayerRequest = {
11340
13307
  proof: context.proof.proof,
11341
13308
  publicSignals: context.proof.verifyInputs,
11342
13309
  vkHash: VK_HASH_CONFIG[PROOF_DOMAIN.RETAIL_BRIDGE_ORDER]
11343
13310
  };
11344
13311
  context.relayer = this.pickRelayer();
11345
- _context2.n = 3;
13312
+ _context4.n = 3;
11346
13313
  return axios.post(context.relayer + '/v1/zkVerifySubmitProof', relayerRequest);
11347
13314
  case 3:
11348
- response = _context2.v;
13315
+ response = _context4.v;
11349
13316
  if (!(response.status == 200)) {
11350
- _context2.n = 4;
13317
+ _context4.n = 4;
11351
13318
  break;
11352
13319
  }
11353
13320
  context.jobId = response.data.id;
11354
- _context2.n = 6;
13321
+ _context4.n = 6;
11355
13322
  break;
11356
13323
  case 4:
11357
13324
  if (!(response.status == 400)) {
11358
- _context2.n = 5;
13325
+ _context4.n = 5;
11359
13326
  break;
11360
13327
  }
11361
13328
  throw new Error('Request error' + response.data.error);
11362
13329
  case 5:
11363
13330
  throw new Error('Relayer not asscessable');
11364
13331
  case 6:
11365
- _context2.n = 7;
13332
+ _context4.n = 7;
11366
13333
  return this.pollJobStatus(context);
11367
13334
  case 7:
11368
- _yield$this$pollJobSt = _context2.v;
13335
+ _yield$this$pollJobSt = _context4.v;
11369
13336
  error = _yield$this$pollJobSt.error;
11370
13337
  result = _yield$this$pollJobSt.result;
11371
13338
  if (!error) {
11372
- _context2.n = 8;
13339
+ _context4.n = 8;
11373
13340
  break;
11374
13341
  }
11375
13342
  throw new DarkSwapError(error);
11376
13343
  case 8:
11377
13344
  context.attestationDetails = result;
11378
13345
  case 9:
11379
- return _context2.a(2);
13346
+ return _context4.a(2);
11380
13347
  }
11381
- }, _callee2, this);
13348
+ }, _callee4, this);
11382
13349
  }));
11383
- function submitProof(_x11) {
13350
+ function submitProof(_x16) {
11384
13351
  return _submitProof.apply(this, arguments);
11385
13352
  }
11386
13353
  return submitProof;
11387
13354
  }();
11388
13355
  _proto.pollJobStatus = /*#__PURE__*/function () {
11389
- var _pollJobStatus = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
13356
+ var _pollJobStatus = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
11390
13357
  var tries, response, error, _response$data, status, failedReason, result, _t3;
11391
- return _regenerator().w(function (_context3) {
11392
- while (1) switch (_context3.n) {
13358
+ return _regenerator().w(function (_context5) {
13359
+ while (1) switch (_context5.n) {
11393
13360
  case 0:
11394
13361
  tries = 1;
11395
13362
  case 1:
11396
13363
  if (!(tries <= 100)) {
11397
- _context3.n = 10;
13364
+ _context5.n = 10;
11398
13365
  break;
11399
13366
  }
11400
13367
  if (!(tries >= 100)) {
11401
- _context3.n = 2;
13368
+ _context5.n = 2;
11402
13369
  break;
11403
13370
  }
11404
- return _context3.a(3, 10);
13371
+ return _context5.a(3, 10);
11405
13372
  case 2:
11406
- _context3.p = 2;
11407
- _context3.n = 3;
13373
+ _context5.p = 2;
13374
+ _context5.n = 3;
11408
13375
  return axios.get(context.relayer + "/v1/jobs/" + context.jobId);
11409
13376
  case 3:
11410
- response = _context3.v;
13377
+ response = _context5.v;
11411
13378
  if (!(response.status === 400)) {
11412
- _context3.n = 4;
13379
+ _context5.n = 4;
11413
13380
  break;
11414
13381
  }
11415
13382
  error = response.data.error;
11416
13383
  console.log(error);
11417
- return _context3.a(2, {
13384
+ return _context5.a(2, {
11418
13385
  error: 'Failed to submit proof to relayer:' + error,
11419
13386
  result: undefined
11420
13387
  });
11421
13388
  case 4:
11422
13389
  if (!(response.status === 200)) {
11423
- _context3.n = 6;
13390
+ _context5.n = 6;
11424
13391
  break;
11425
13392
  }
11426
13393
  _response$data = response.data, status = _response$data.status, failedReason = _response$data.failedReason, result = _response$data.result;
11427
13394
  if (!(status === 'FAILED')) {
11428
- _context3.n = 5;
13395
+ _context5.n = 5;
11429
13396
  break;
11430
13397
  }
11431
- return _context3.a(2, {
13398
+ return _context5.a(2, {
11432
13399
  error: failedReason != null ? failedReason : 'Transaction failed.',
11433
13400
  result: undefined
11434
13401
  });
11435
13402
  case 5:
11436
13403
  if (!(status === 'CONFIRMED' || status === 'MINED')) {
11437
- _context3.n = 6;
13404
+ _context5.n = 6;
11438
13405
  break;
11439
13406
  }
11440
- return _context3.a(2, {
13407
+ return _context5.a(2, {
11441
13408
  error: undefined,
11442
13409
  result: {
11443
13410
  attestationId: BigInt(result.attestationId),
@@ -11447,47 +13414,47 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11447
13414
  }
11448
13415
  });
11449
13416
  case 6:
11450
- _context3.n = 7;
13417
+ _context5.n = 7;
11451
13418
  return new Promise(function (resolve) {
11452
13419
  return setTimeout(resolve, 5000);
11453
13420
  });
11454
13421
  case 7:
11455
- _context3.n = 9;
13422
+ _context5.n = 9;
11456
13423
  break;
11457
13424
  case 8:
11458
- _context3.p = 8;
11459
- _t3 = _context3.v;
13425
+ _context5.p = 8;
13426
+ _t3 = _context5.v;
11460
13427
  console.log(_t3);
11461
13428
  case 9:
11462
13429
  tries++;
11463
- _context3.n = 1;
13430
+ _context5.n = 1;
11464
13431
  break;
11465
13432
  case 10:
11466
- return _context3.a(2, {
13433
+ return _context5.a(2, {
11467
13434
  error: 'Waited too long for getting attestation details.',
11468
13435
  result: undefined
11469
13436
  });
11470
13437
  }
11471
- }, _callee3, null, [[2, 8]]);
13438
+ }, _callee5, null, [[2, 8]]);
11472
13439
  }));
11473
- function pollJobStatus(_x12) {
13440
+ function pollJobStatus(_x17) {
11474
13441
  return _pollJobStatus.apply(this, arguments);
11475
13442
  }
11476
13443
  return pollJobStatus;
11477
13444
  }();
11478
13445
  _proto.generateProof = /*#__PURE__*/function () {
11479
- var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
13446
+ var _generateProof = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(context) {
11480
13447
  var proof;
11481
- return _regenerator().w(function (_context4) {
11482
- while (1) switch (_context4.n) {
13448
+ return _regenerator().w(function (_context6) {
13449
+ while (1) switch (_context6.n) {
11483
13450
  case 0:
11484
13451
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || context.feeAmount === undefined || !context.signature || !context.sourceChainId || !context.destChainId || !context.sourceAsset || !context.sourceAmount || context.bridgeFeeAmount === undefined)) {
11485
- _context4.n = 1;
13452
+ _context6.n = 1;
11486
13453
  break;
11487
13454
  }
11488
13455
  throw new DarkSwapError('Invalid context');
11489
13456
  case 1:
11490
- _context4.n = 2;
13457
+ _context6.n = 2;
11491
13458
  return generateRetailBridgeOrderProof({
11492
13459
  depositSourceAsset: context.sourceAsset,
11493
13460
  depositNote: context.orderNote,
@@ -11500,77 +13467,77 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11500
13467
  signedMessage: context.signature
11501
13468
  });
11502
13469
  case 2:
11503
- proof = _context4.v;
11504
- return _context4.a(2, proof);
13470
+ proof = _context6.v;
13471
+ return _context6.a(2, proof);
11505
13472
  }
11506
- }, _callee4);
13473
+ }, _callee6);
11507
13474
  }));
11508
- function generateProof(_x13) {
13475
+ function generateProof(_x18) {
11509
13476
  return _generateProof.apply(this, arguments);
11510
13477
  }
11511
13478
  return generateProof;
11512
13479
  }();
11513
13480
  _proto.computeDepositId = /*#__PURE__*/function () {
11514
- var _computeDepositId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(context) {
13481
+ var _computeDepositId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(context) {
11515
13482
  var callDataHash, currentNonce, packedData, depositCommitment;
11516
- return _regenerator().w(function (_context5) {
11517
- while (1) switch (_context5.n) {
13483
+ return _regenerator().w(function (_context7) {
13484
+ while (1) switch (_context7.n) {
11518
13485
  case 0:
11519
13486
  if (!(!context || !context.callData || !context.orderNote || !context.swapInNote || !context.address || context.feeAmount === undefined || !context.signature || !context.sourceChainId || !context.destChainId || !context.sourceAsset || context.bridgeFeeAmount === undefined)) {
11520
- _context5.n = 1;
13487
+ _context7.n = 1;
11521
13488
  break;
11522
13489
  }
11523
13490
  throw new DarkSwapError('Invalid context');
11524
13491
  case 1:
11525
- callDataHash = ethers.solidityPackedKeccak256(['address', 'bytes'], [this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, context.callData]);
13492
+ callDataHash = ethers.solidityPackedKeccak256(['address', 'bytes'], [this._darkSwapOfDestChain.contracts.synaraDarkSwapOnBridgeAssetManager, context.callData]);
11526
13493
  context.callDataHash = callDataHash;
11527
- _context5.n = 2;
13494
+ _context7.n = 2;
11528
13495
  return this.getCurrentNonce(context);
11529
13496
  case 2:
11530
- currentNonce = _context5.v;
13497
+ currentNonce = _context7.v;
11531
13498
  context.nonce = currentNonce;
11532
13499
  packedData = solidityPacked(["bytes", "address", "bytes32", "address", "address", "bytes32", "bytes32", "bytes32", "bytes32", "bytes32" // _computeCallDataHash(call)
11533
13500
  ], [_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]);
11534
13501
  depositCommitment = keccak256(packedData);
11535
- return _context5.a(2, depositCommitment);
13502
+ return _context7.a(2, depositCommitment);
11536
13503
  }
11537
- }, _callee5, this);
13504
+ }, _callee7, this);
11538
13505
  }));
11539
- function computeDepositId(_x14) {
13506
+ function computeDepositId(_x19) {
11540
13507
  return _computeDepositId.apply(this, arguments);
11541
13508
  }
11542
13509
  return computeDepositId;
11543
13510
  }();
11544
13511
  _proto.getCurrentNonce = /*#__PURE__*/function () {
11545
- var _getCurrentNonce = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(context) {
13512
+ var _getCurrentNonce = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(context) {
11546
13513
  var provider, contract;
11547
- return _regenerator().w(function (_context6) {
11548
- while (1) switch (_context6.n) {
13514
+ return _regenerator().w(function (_context8) {
13515
+ while (1) switch (_context8.n) {
11549
13516
  case 0:
11550
13517
  provider = this._darkSwapOfSourceChain.provider;
11551
13518
  contract = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, SynaraDarkSwapOnBridgeAssetManagerAbi.abi, provider);
11552
- _context6.n = 1;
13519
+ _context8.n = 1;
11553
13520
  return contract.currentNonce({
11554
13521
  from: context.address
11555
13522
  });
11556
13523
  case 1:
11557
- return _context6.a(2, _context6.v);
13524
+ return _context8.a(2, _context8.v);
11558
13525
  }
11559
- }, _callee6, this);
13526
+ }, _callee8, this);
11560
13527
  }));
11561
- function getCurrentNonce(_x15) {
13528
+ function getCurrentNonce(_x20) {
11562
13529
  return _getCurrentNonce.apply(this, arguments);
11563
13530
  }
11564
13531
  return getCurrentNonce;
11565
13532
  }();
11566
13533
  _proto.composeCallData = /*#__PURE__*/function () {
11567
- var _composeCallData = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(context) {
13534
+ var _composeCallData = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(context) {
11568
13535
  var functionSignature, args, iface, fullData;
11569
- return _regenerator().w(function (_context7) {
11570
- while (1) switch (_context7.n) {
13536
+ return _regenerator().w(function (_context9) {
13537
+ while (1) switch (_context9.n) {
11571
13538
  case 0:
11572
13539
  if (!(!context || !context.orderNote || !context.swapInNote || !context.address || !context.destChainId || !context.sourceAsset || context.bridgeFeeAmount === undefined || !context.proof || !context.attestationDetails)) {
11573
- _context7.n = 1;
13540
+ _context9.n = 1;
11574
13541
  break;
11575
13542
  }
11576
13543
  throw new DarkSwapError('Invalid context');
@@ -11583,7 +13550,7 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11583
13550
  depositOutNote: hexlify32(context.orderNote.note),
11584
13551
  depositOutNoteFooter: context.proof.depositFooter,
11585
13552
  outAssetSource: context.sourceAsset,
11586
- outAssetDest: context.orderNote.address,
13553
+ outAssetDest: context.orderNote.asset,
11587
13554
  outAmount: context.orderNote.amount,
11588
13555
  feeRatio: context.orderNote.feeRatio,
11589
13556
  inNote: hexlify32(context.swapInNote.note),
@@ -11592,23 +13559,23 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11592
13559
  };
11593
13560
  iface = new ethers.Interface(["function " + functionSignature]);
11594
13561
  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]]);
11595
- return _context7.a(2, fullData);
13562
+ return _context9.a(2, fullData);
11596
13563
  }
11597
- }, _callee7, this);
13564
+ }, _callee9, this);
11598
13565
  }));
11599
- function composeCallData(_x16) {
13566
+ function composeCallData(_x21) {
11600
13567
  return _composeCallData.apply(this, arguments);
11601
13568
  }
11602
13569
  return composeCallData;
11603
13570
  }();
11604
13571
  _proto.allowance = /*#__PURE__*/function () {
11605
- var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(context) {
13572
+ var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(context) {
11606
13573
  var signer, asset, amount, allowanceContract, allowance, isLegacy, contract, tx;
11607
- return _regenerator().w(function (_context8) {
11608
- while (1) switch (_context8.n) {
13574
+ return _regenerator().w(function (_context0) {
13575
+ while (1) switch (_context0.n) {
11609
13576
  case 0:
11610
13577
  if (!(!context || !context.orderNote || !context.address || !context.signature || !context.proof)) {
11611
- _context8.n = 1;
13578
+ _context0.n = 1;
11612
13579
  break;
11613
13580
  }
11614
13581
  throw new DarkSwapError('Invalid context');
@@ -11617,74 +13584,74 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11617
13584
  asset = context.orderNote.asset;
11618
13585
  amount = context.orderNote.amount;
11619
13586
  allowanceContract = new ethers.Contract(asset, ERC20Abi.abi, this._darkSwapOfSourceChain);
11620
- _context8.n = 2;
13587
+ _context0.n = 2;
11621
13588
  return allowanceContract.allowance(signer.getAddress(), this._darkSwapOfSourceChain.contracts.darkSwapAssetManager);
11622
13589
  case 2:
11623
- allowance = _context8.v;
13590
+ allowance = _context0.v;
11624
13591
  if (!(BigInt(allowance) < amount)) {
11625
- _context8.n = 4;
13592
+ _context0.n = 4;
11626
13593
  break;
11627
13594
  }
11628
13595
  isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwapOfSourceChain.chainId) && legacyTokenConfig[this._darkSwapOfSourceChain.chainId].includes(asset.toLowerCase());
11629
13596
  contract = new ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
11630
- _context8.n = 3;
13597
+ _context0.n = 3;
11631
13598
  return contract.approve(this._darkSwapOfSourceChain.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
11632
13599
  case 3:
11633
- tx = _context8.v;
11634
- _context8.n = 4;
13600
+ tx = _context0.v;
13601
+ _context0.n = 4;
11635
13602
  return tx.wait();
11636
13603
  case 4:
11637
- return _context8.a(2);
13604
+ return _context0.a(2);
11638
13605
  }
11639
- }, _callee8, this);
13606
+ }, _callee0, this);
11640
13607
  }));
11641
- function allowance(_x17) {
13608
+ function allowance(_x22) {
11642
13609
  return _allowance.apply(this, arguments);
11643
13610
  }
11644
13611
  return allowance;
11645
13612
  }();
11646
13613
  _proto.execute = /*#__PURE__*/function () {
11647
- var _execute2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(context) {
13614
+ var _execute2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(context) {
11648
13615
  var callData, txHash;
11649
- return _regenerator().w(function (_context9) {
11650
- while (1) switch (_context9.n) {
13616
+ return _regenerator().w(function (_context1) {
13617
+ while (1) switch (_context1.n) {
11651
13618
  case 0:
11652
- _context9.n = 1;
13619
+ _context1.n = 1;
11653
13620
  return this.submitProof(context);
11654
13621
  case 1:
11655
- _context9.n = 2;
13622
+ _context1.n = 2;
11656
13623
  return this.composeCallData(context);
11657
13624
  case 2:
11658
- callData = _context9.v;
13625
+ callData = _context1.v;
11659
13626
  context.callData = callData;
11660
- _context9.n = 3;
13627
+ _context1.n = 3;
11661
13628
  return this.computeDepositId(context);
11662
13629
  case 3:
11663
- context.depositId = _context9.v;
11664
- _context9.n = 4;
13630
+ context.depositId = _context1.v;
13631
+ _context1.n = 4;
11665
13632
  return this._execute(context);
11666
13633
  case 4:
11667
- txHash = _context9.v;
11668
- return _context9.a(2, {
13634
+ txHash = _context1.v;
13635
+ return _context1.a(2, {
11669
13636
  depositId: context.depositId,
11670
13637
  txHash: txHash
11671
13638
  });
11672
13639
  }
11673
- }, _callee9, this);
13640
+ }, _callee1, this);
11674
13641
  }));
11675
- function execute(_x18) {
13642
+ function execute(_x23) {
11676
13643
  return _execute2.apply(this, arguments);
11677
13644
  }
11678
13645
  return execute;
11679
13646
  }();
11680
13647
  _proto._execute = /*#__PURE__*/function () {
11681
- var _execute3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(context) {
13648
+ var _execute3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(context) {
11682
13649
  var contract, ethAmount, tx;
11683
- return _regenerator().w(function (_context0) {
11684
- while (1) switch (_context0.n) {
13650
+ return _regenerator().w(function (_context10) {
13651
+ while (1) switch (_context10.n) {
11685
13652
  case 0:
11686
13653
  if (!(!context || !context.destChainId || !context.attestationDetails || !context.orderNote || !context.swapInNote || !context.sourceAsset || !context.sourceAmount || context.bridgeFeeAmount === undefined || !context.depositId || !context.proof)) {
11687
- _context0.n = 1;
13654
+ _context10.n = 1;
11688
13655
  break;
11689
13656
  }
11690
13657
  throw new DarkSwapError('Invalid context');
@@ -11692,30 +13659,30 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11692
13659
  contract = new ethers.Contract(this._darkSwapOfSourceChain.contracts.synaraDarkSwapOnBridgeAssetManager, SynaraDarkSwapOnBridgeAssetManagerAbi.abi, this._darkSwapOfSourceChain.signer);
11693
13660
  ethAmount = 0n;
11694
13661
  if (!isNativeAsset(context.sourceAsset)) {
11695
- _context0.n = 2;
13662
+ _context10.n = 2;
11696
13663
  break;
11697
13664
  }
11698
13665
  ethAmount = context.sourceAmount;
11699
- _context0.n = 3;
13666
+ _context10.n = 3;
11700
13667
  break;
11701
13668
  case 2:
11702
- _context0.n = 3;
13669
+ _context10.n = 3;
11703
13670
  return this.allowance(context);
11704
13671
  case 3:
11705
- _context0.n = 4;
11706
- 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)], {
13672
+ _context10.n = 4;
13673
+ 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)], {
11707
13674
  value: bn_to_0xhex(ethAmount)
11708
13675
  });
11709
13676
  case 4:
11710
- tx = _context0.v;
11711
- _context0.n = 5;
13677
+ tx = _context10.v;
13678
+ _context10.n = 5;
11712
13679
  return tx.wait();
11713
13680
  case 5:
11714
- return _context0.a(2, tx.hash);
13681
+ return _context10.a(2, tx.hash);
11715
13682
  }
11716
- }, _callee0, this);
13683
+ }, _callee10, this);
11717
13684
  }));
11718
- function _execute(_x19) {
13685
+ function _execute(_x24) {
11719
13686
  return _execute3.apply(this, arguments);
11720
13687
  }
11721
13688
  return _execute;
@@ -11723,11 +13690,11 @@ var BridgeCreateOrderService = /*#__PURE__*/function () {
11723
13690
  return BridgeCreateOrderService;
11724
13691
  }();
11725
13692
 
11726
- var DarkSwap = function DarkSwap(signer, chainId, contracts) {
13693
+ var DarkSwap = function DarkSwap(signer, chainId, provider, contracts) {
11727
13694
  // @ts-ignore
11728
13695
  this.signer = signer;
11729
13696
  // @ts-ignore
11730
- this.provider = signer.provider;
13697
+ this.provider = provider || signer.provider;
11731
13698
  this.chainId = chainId;
11732
13699
  if (contracts) {
11733
13700
  this.contracts = contracts;