@thesingularitynetwork/darkswap-sdk 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config.d.ts +2 -0
- package/dist/darkswap-sdk.cjs.development.js +190 -89
- package/dist/darkswap-sdk.cjs.development.js.map +1 -1
- package/dist/darkswap-sdk.cjs.production.min.js +1 -1
- package/dist/darkswap-sdk.cjs.production.min.js.map +1 -1
- package/dist/darkswap-sdk.esm.js +189 -90
- package/dist/darkswap-sdk.esm.js.map +1 -1
- package/dist/services/retail/depositAndCreateOrder.d.ts +1 -0
- package/dist/utils/gasUtil.d.ts +1 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -4184,6 +4184,8 @@ var ERC20_USDT = {
|
|
|
4184
4184
|
var _legacyTokenConfig;
|
|
4185
4185
|
var legacyTokenConfig = (_legacyTokenConfig = {}, _legacyTokenConfig[exports.ChainId.MAINNET] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig[exports.ChainId.HARDHAT] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig);
|
|
4186
4186
|
var DEFAULT_FEE_RATIO = 300n;
|
|
4187
|
+
var GAS_LIMIT_MULTIPLIER = 120n;
|
|
4188
|
+
var GAS_LIMIT_PRECISION = 100n;
|
|
4187
4189
|
|
|
4188
4190
|
var noir_version = "1.0.0-beta.6+e796dfd67726cbc28eb9991782533b211025928d";
|
|
4189
4191
|
var hash = "7682678699971186506";
|
|
@@ -4680,6 +4682,61 @@ function _multiGetMerklePathAndRoot() {
|
|
|
4680
4682
|
return _multiGetMerklePathAndRoot.apply(this, arguments);
|
|
4681
4683
|
}
|
|
4682
4684
|
|
|
4685
|
+
var _contractConfig;
|
|
4686
|
+
var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAINNET] = {
|
|
4687
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
4688
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4689
|
+
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
4690
|
+
merkleTreeOperator: '0x0',
|
|
4691
|
+
darkSwapAssetManager: '0x0',
|
|
4692
|
+
darkSwapFeeAssetManager: '0x0',
|
|
4693
|
+
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api'
|
|
4694
|
+
}, _contractConfig[exports.ChainId.ARBITRUM_ONE] = {
|
|
4695
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
4696
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4697
|
+
nativeWrapper: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
4698
|
+
merkleTreeOperator: '0x0',
|
|
4699
|
+
darkSwapAssetManager: '0x0',
|
|
4700
|
+
darkSwapFeeAssetManager: '0x0',
|
|
4701
|
+
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
|
|
4702
|
+
}, _contractConfig[exports.ChainId.BASE] = {
|
|
4703
|
+
priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
|
|
4704
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4705
|
+
nativeWrapper: '0x4200000000000000000000000000000000000006',
|
|
4706
|
+
merkleTreeOperator: '0x0',
|
|
4707
|
+
darkSwapAssetManager: '0x0',
|
|
4708
|
+
darkSwapFeeAssetManager: '0x0',
|
|
4709
|
+
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
|
|
4710
|
+
}, _contractConfig[exports.ChainId.SEPOLIA] = {
|
|
4711
|
+
priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
|
|
4712
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4713
|
+
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
4714
|
+
merkleTreeOperator: '0x0',
|
|
4715
|
+
darkSwapAssetManager: '0x0',
|
|
4716
|
+
darkSwapFeeAssetManager: '0x0',
|
|
4717
|
+
drakSwapSubgraphUrl: ''
|
|
4718
|
+
}, _contractConfig[exports.ChainId.HORIZEN_TESTNET] = {
|
|
4719
|
+
priceOracle: '0x54c375f28ce4B0c2B986D6256E4Bc75d242A8793',
|
|
4720
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4721
|
+
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
4722
|
+
merkleTreeOperator: '0x8Cd4061C8b3743810B811E1F4A0B597D79225f4E',
|
|
4723
|
+
darkSwapAssetManager: '0xEBeD6c7C2189bf8ad6687D3A4cf4b83fB4D1a3D2',
|
|
4724
|
+
darkSwapFeeAssetManager: '0x8CF86856Bd7dE95b4ba33DCae4cd5Ec02542Bf5b',
|
|
4725
|
+
drakSwapSubgraphUrl: ''
|
|
4726
|
+
}, _contractConfig[exports.ChainId.HARDHAT] = {
|
|
4727
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
4728
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
4729
|
+
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
4730
|
+
merkleTreeOperator: '0xEd8D7d3A98CB4ea6C91a80dcd2220719c264531f',
|
|
4731
|
+
darkSwapAssetManager: '0x6D39d71fF4ab56a4873febd34e1a3BDefc01b41e',
|
|
4732
|
+
darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
|
|
4733
|
+
drakSwapSubgraphUrl: 'https://34.142.142.240:8080/subgraphs/name/singularity/'
|
|
4734
|
+
}, _contractConfig);
|
|
4735
|
+
|
|
4736
|
+
function refineGasLimit(estimatedGas) {
|
|
4737
|
+
return estimatedGas * GAS_LIMIT_MULTIPLIER / GAS_LIMIT_PRECISION;
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4683
4740
|
var DepositContext = /*#__PURE__*/function (_BaseContext) {
|
|
4684
4741
|
function DepositContext(signature) {
|
|
4685
4742
|
return _BaseContext.call(this, signature) || this;
|
|
@@ -4807,7 +4864,7 @@ var DepositService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
4807
4864
|
}();
|
|
4808
4865
|
_proto.execute = /*#__PURE__*/function () {
|
|
4809
4866
|
var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
|
|
4810
|
-
var signer, contract, tx, _tx;
|
|
4867
|
+
var signer, contract, _contract$deposit, depositArgs, estimatedGas, gasLimit, tx, _contract$deposit2, _depositArgs, _estimatedGas, _tx;
|
|
4811
4868
|
return _regenerator().w(function (_context3) {
|
|
4812
4869
|
while (1) switch (_context3.n) {
|
|
4813
4870
|
case 0:
|
|
@@ -4823,32 +4880,49 @@ var DepositService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
4823
4880
|
signer = this._darkSwap.signer;
|
|
4824
4881
|
contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, signer);
|
|
4825
4882
|
if (isNativeAsset(context.newBalance.asset)) {
|
|
4826
|
-
_context3.n =
|
|
4883
|
+
_context3.n = 7;
|
|
4827
4884
|
break;
|
|
4828
4885
|
}
|
|
4829
4886
|
_context3.n = 3;
|
|
4830
4887
|
return this.allowance(context);
|
|
4831
4888
|
case 3:
|
|
4889
|
+
depositArgs = [context.merkleRoot, context.newBalance.asset, hexlify32(context.depositAmount), context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof];
|
|
4832
4890
|
_context3.n = 4;
|
|
4833
|
-
return
|
|
4891
|
+
return (_contract$deposit = contract.deposit).estimateGas.apply(_contract$deposit, depositArgs.concat([{
|
|
4834
4892
|
value: 0n
|
|
4835
|
-
});
|
|
4893
|
+
}]));
|
|
4836
4894
|
case 4:
|
|
4837
|
-
|
|
4895
|
+
estimatedGas = _context3.v;
|
|
4896
|
+
gasLimit = refineGasLimit(estimatedGas);
|
|
4838
4897
|
_context3.n = 5;
|
|
4839
|
-
return
|
|
4898
|
+
return contract.deposit.apply(contract, depositArgs.concat([{
|
|
4899
|
+
value: 0n,
|
|
4900
|
+
gasLimit: gasLimit
|
|
4901
|
+
}]));
|
|
4840
4902
|
case 5:
|
|
4841
|
-
|
|
4903
|
+
tx = _context3.v;
|
|
4904
|
+
_context3.n = 6;
|
|
4905
|
+
return tx.wait();
|
|
4842
4906
|
case 6:
|
|
4843
|
-
_context3.
|
|
4844
|
-
return contract.deposit(context.merkleRoot, context.newBalance.asset, hexlify32(context.depositAmount), context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof, {
|
|
4845
|
-
value: context.depositAmount
|
|
4846
|
-
});
|
|
4907
|
+
return _context3.a(2, tx.hash);
|
|
4847
4908
|
case 7:
|
|
4848
|
-
|
|
4909
|
+
_depositArgs = [context.merkleRoot, context.newBalance.asset, hexlify32(context.depositAmount), context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, context.proof.proof];
|
|
4849
4910
|
_context3.n = 8;
|
|
4850
|
-
return
|
|
4911
|
+
return (_contract$deposit2 = contract.deposit).estimateGas.apply(_contract$deposit2, _depositArgs.concat([{
|
|
4912
|
+
value: context.depositAmount
|
|
4913
|
+
}]));
|
|
4851
4914
|
case 8:
|
|
4915
|
+
_estimatedGas = _context3.v;
|
|
4916
|
+
_context3.n = 9;
|
|
4917
|
+
return contract.deposit.apply(contract, _depositArgs.concat([{
|
|
4918
|
+
value: context.depositAmount,
|
|
4919
|
+
gasLimit: refineGasLimit(_estimatedGas)
|
|
4920
|
+
}]));
|
|
4921
|
+
case 9:
|
|
4922
|
+
_tx = _context3.v;
|
|
4923
|
+
_context3.n = 10;
|
|
4924
|
+
return _tx.wait();
|
|
4925
|
+
case 10:
|
|
4852
4926
|
return _context3.a(2, _tx.hash);
|
|
4853
4927
|
}
|
|
4854
4928
|
}, _callee3, this);
|
|
@@ -5786,7 +5860,8 @@ var JoinService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
5786
5860
|
}();
|
|
5787
5861
|
_proto.execute = /*#__PURE__*/function () {
|
|
5788
5862
|
var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
|
|
5789
|
-
var
|
|
5863
|
+
var _contract$join;
|
|
5864
|
+
var contract, joinArgs, estimatedGas, gasLimit, tx;
|
|
5790
5865
|
return _regenerator().w(function (_context3) {
|
|
5791
5866
|
while (1) switch (_context3.n) {
|
|
5792
5867
|
case 0:
|
|
@@ -5800,13 +5875,21 @@ var JoinService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
5800
5875
|
throw new DarkSwapError('Invalid context');
|
|
5801
5876
|
case 2:
|
|
5802
5877
|
contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
|
|
5878
|
+
joinArgs = [context.merkleRoot, [context.proof.inNullifier1, context.proof.inNullifier2, hexlify32(EMPTY_NULLIFIER)], hexlify32(context.outNote.note), context.proof.outNoteFooter, context.proof.proof];
|
|
5803
5879
|
_context3.n = 3;
|
|
5804
|
-
return
|
|
5880
|
+
return (_contract$join = contract.join).estimateGas.apply(_contract$join, joinArgs);
|
|
5805
5881
|
case 3:
|
|
5806
|
-
|
|
5882
|
+
estimatedGas = _context3.v;
|
|
5883
|
+
gasLimit = refineGasLimit(estimatedGas);
|
|
5807
5884
|
_context3.n = 4;
|
|
5808
|
-
return
|
|
5885
|
+
return contract.join.apply(contract, joinArgs.concat([{
|
|
5886
|
+
gasLimit: gasLimit
|
|
5887
|
+
}]));
|
|
5809
5888
|
case 4:
|
|
5889
|
+
tx = _context3.v;
|
|
5890
|
+
_context3.n = 5;
|
|
5891
|
+
return tx.wait();
|
|
5892
|
+
case 5:
|
|
5810
5893
|
return _context3.a(2, tx.hash);
|
|
5811
5894
|
}
|
|
5812
5895
|
}, _callee3, this);
|
|
@@ -6356,7 +6439,8 @@ var TripleJoinService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
6356
6439
|
}();
|
|
6357
6440
|
_proto.execute = /*#__PURE__*/function () {
|
|
6358
6441
|
var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
|
|
6359
|
-
var
|
|
6442
|
+
var _contract$join;
|
|
6443
|
+
var contract, joinArgs, estimatedGas, gasLimit, tx;
|
|
6360
6444
|
return _regenerator().w(function (_context3) {
|
|
6361
6445
|
while (1) switch (_context3.n) {
|
|
6362
6446
|
case 0:
|
|
@@ -6370,9 +6454,17 @@ var TripleJoinService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
6370
6454
|
throw new DarkSwapError('Invalid context');
|
|
6371
6455
|
case 2:
|
|
6372
6456
|
contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
|
|
6457
|
+
joinArgs = [context.merkleRoot, [context.proof.inNullifier1, context.proof.inNullifier2, context.proof.inNullifier3], hexlify32(context.outNote.note), context.proof.outNoteFooter, context.proof.proof];
|
|
6373
6458
|
_context3.n = 3;
|
|
6374
|
-
return
|
|
6459
|
+
return (_contract$join = contract.join).estimateGas.apply(_contract$join, joinArgs);
|
|
6375
6460
|
case 3:
|
|
6461
|
+
estimatedGas = _context3.v;
|
|
6462
|
+
gasLimit = refineGasLimit(estimatedGas);
|
|
6463
|
+
_context3.n = 4;
|
|
6464
|
+
return contract.join.apply(contract, joinArgs.concat([{
|
|
6465
|
+
gasLimit: gasLimit
|
|
6466
|
+
}]));
|
|
6467
|
+
case 4:
|
|
6376
6468
|
tx = _context3.v;
|
|
6377
6469
|
return _context3.a(2, tx.hash);
|
|
6378
6470
|
}
|
|
@@ -7231,7 +7323,7 @@ var ProCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
7231
7323
|
}();
|
|
7232
7324
|
_proto.execute = /*#__PURE__*/function () {
|
|
7233
7325
|
var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
|
|
7234
|
-
var contract, tx;
|
|
7326
|
+
var contract, txData, estimatedGas, gasLimit, tx;
|
|
7235
7327
|
return _regenerator().w(function (_context3) {
|
|
7236
7328
|
while (1) switch (_context3.n) {
|
|
7237
7329
|
case 0:
|
|
@@ -7245,13 +7337,21 @@ var ProCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
7245
7337
|
throw new DarkSwapError('Invalid context');
|
|
7246
7338
|
case 2:
|
|
7247
7339
|
contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
|
|
7340
|
+
txData = [context.merkleRoot, context.proof.oldBalanceNullifier, hexlify32(context.newBalance.note), context.proof.newBalanceFooter, hexlify32(context.orderNote.note), context.proof.orderNoteFooter];
|
|
7248
7341
|
_context3.n = 3;
|
|
7249
|
-
return contract.proCreateOrder
|
|
7342
|
+
return contract.proCreateOrder.estimateGas(txData, context.proof.proof);
|
|
7250
7343
|
case 3:
|
|
7251
|
-
|
|
7344
|
+
estimatedGas = _context3.v;
|
|
7345
|
+
gasLimit = refineGasLimit(estimatedGas);
|
|
7252
7346
|
_context3.n = 4;
|
|
7253
|
-
return
|
|
7347
|
+
return contract.proCreateOrder(txData, context.proof.proof, {
|
|
7348
|
+
gasLimit: gasLimit
|
|
7349
|
+
});
|
|
7254
7350
|
case 4:
|
|
7351
|
+
tx = _context3.v;
|
|
7352
|
+
_context3.n = 5;
|
|
7353
|
+
return tx.wait();
|
|
7354
|
+
case 5:
|
|
7255
7355
|
return _context3.a(2, tx.hash);
|
|
7256
7356
|
}
|
|
7257
7357
|
}, _callee3, this);
|
|
@@ -9269,40 +9369,90 @@ var RetailCreateOrderService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
9269
9369
|
}
|
|
9270
9370
|
return generateProof;
|
|
9271
9371
|
}();
|
|
9272
|
-
_proto.
|
|
9273
|
-
var
|
|
9274
|
-
var
|
|
9372
|
+
_proto.allowance = /*#__PURE__*/function () {
|
|
9373
|
+
var _allowance = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(context) {
|
|
9374
|
+
var signer, asset, amount, allowanceContract, allowance, isLegacy, contract, tx;
|
|
9275
9375
|
return _regenerator().w(function (_context3) {
|
|
9276
9376
|
while (1) switch (_context3.n) {
|
|
9277
9377
|
case 0:
|
|
9278
|
-
|
|
9378
|
+
if (!(!context || !context.orderNote || !context.address || !context.signature || !context.proof)) {
|
|
9379
|
+
_context3.n = 1;
|
|
9380
|
+
break;
|
|
9381
|
+
}
|
|
9382
|
+
throw new DarkSwapError('Invalid context');
|
|
9383
|
+
case 1:
|
|
9384
|
+
signer = this._darkSwap.signer;
|
|
9385
|
+
asset = context.orderNote.asset;
|
|
9386
|
+
amount = context.orderNote.amount;
|
|
9387
|
+
allowanceContract = new ethers.ethers.Contract(asset, ERC20Abi.abi, this._darkSwap);
|
|
9388
|
+
_context3.n = 2;
|
|
9389
|
+
return allowanceContract.allowance(signer.getAddress(), this._darkSwap.contracts.darkSwapAssetManager);
|
|
9390
|
+
case 2:
|
|
9391
|
+
allowance = _context3.v;
|
|
9392
|
+
if (!(BigInt(allowance) < amount)) {
|
|
9393
|
+
_context3.n = 4;
|
|
9394
|
+
break;
|
|
9395
|
+
}
|
|
9396
|
+
isLegacy = legacyTokenConfig.hasOwnProperty(this._darkSwap.chainId) && legacyTokenConfig[this._darkSwap.chainId].includes(asset.toLowerCase());
|
|
9397
|
+
contract = new ethers.ethers.Contract(asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
|
|
9398
|
+
_context3.n = 3;
|
|
9399
|
+
return contract.approve(this._darkSwap.contracts.darkSwapAssetManager, hexlify32(MAX_ALLOWANCE));
|
|
9400
|
+
case 3:
|
|
9401
|
+
tx = _context3.v;
|
|
9402
|
+
_context3.n = 4;
|
|
9403
|
+
return tx.wait();
|
|
9404
|
+
case 4:
|
|
9405
|
+
return _context3.a(2);
|
|
9406
|
+
}
|
|
9407
|
+
}, _callee3, this);
|
|
9408
|
+
}));
|
|
9409
|
+
function allowance(_x8) {
|
|
9410
|
+
return _allowance.apply(this, arguments);
|
|
9411
|
+
}
|
|
9412
|
+
return allowance;
|
|
9413
|
+
}();
|
|
9414
|
+
_proto.execute = /*#__PURE__*/function () {
|
|
9415
|
+
var _execute = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(context) {
|
|
9416
|
+
var contract, ethAmount, tx;
|
|
9417
|
+
return _regenerator().w(function (_context4) {
|
|
9418
|
+
while (1) switch (_context4.n) {
|
|
9419
|
+
case 0:
|
|
9420
|
+
_context4.n = 1;
|
|
9279
9421
|
return this.generateProof(context);
|
|
9280
9422
|
case 1:
|
|
9281
9423
|
if (!(!context || !context.orderNote || !context.swapInNote || !context.proof)) {
|
|
9282
|
-
|
|
9424
|
+
_context4.n = 2;
|
|
9283
9425
|
break;
|
|
9284
9426
|
}
|
|
9285
9427
|
throw new DarkSwapError('Invalid context');
|
|
9286
9428
|
case 2:
|
|
9287
9429
|
contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
|
|
9288
9430
|
ethAmount = 0n;
|
|
9289
|
-
if (isNativeAsset(context.orderNote.asset)) {
|
|
9290
|
-
|
|
9431
|
+
if (!isNativeAsset(context.orderNote.asset)) {
|
|
9432
|
+
_context4.n = 3;
|
|
9433
|
+
break;
|
|
9291
9434
|
}
|
|
9292
|
-
|
|
9435
|
+
ethAmount = context.orderNote.amount;
|
|
9436
|
+
_context4.n = 4;
|
|
9437
|
+
break;
|
|
9438
|
+
case 3:
|
|
9439
|
+
_context4.n = 4;
|
|
9440
|
+
return this.allowance(context);
|
|
9441
|
+
case 4:
|
|
9442
|
+
_context4.n = 5;
|
|
9293
9443
|
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, {
|
|
9294
9444
|
value: bn_to_0xhex(ethAmount)
|
|
9295
9445
|
});
|
|
9296
|
-
case
|
|
9297
|
-
tx =
|
|
9298
|
-
|
|
9446
|
+
case 5:
|
|
9447
|
+
tx = _context4.v;
|
|
9448
|
+
_context4.n = 6;
|
|
9299
9449
|
return tx.wait();
|
|
9300
|
-
case
|
|
9301
|
-
return
|
|
9450
|
+
case 6:
|
|
9451
|
+
return _context4.a(2, tx.hash);
|
|
9302
9452
|
}
|
|
9303
|
-
},
|
|
9453
|
+
}, _callee4, this);
|
|
9304
9454
|
}));
|
|
9305
|
-
function execute(
|
|
9455
|
+
function execute(_x9) {
|
|
9306
9456
|
return _execute.apply(this, arguments);
|
|
9307
9457
|
}
|
|
9308
9458
|
return execute;
|
|
@@ -9869,57 +10019,6 @@ var RetailSwapService = /*#__PURE__*/function (_BaseContractService) {
|
|
|
9869
10019
|
return RetailSwapService;
|
|
9870
10020
|
}(BaseContractService);
|
|
9871
10021
|
|
|
9872
|
-
var _contractConfig;
|
|
9873
|
-
var contractConfig = (_contractConfig = {}, _contractConfig[exports.ChainId.MAINNET] = {
|
|
9874
|
-
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
9875
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9876
|
-
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
9877
|
-
merkleTreeOperator: '0x0',
|
|
9878
|
-
darkSwapAssetManager: '0x0',
|
|
9879
|
-
darkSwapFeeAssetManager: '0x0',
|
|
9880
|
-
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api'
|
|
9881
|
-
}, _contractConfig[exports.ChainId.ARBITRUM_ONE] = {
|
|
9882
|
-
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
9883
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9884
|
-
nativeWrapper: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
9885
|
-
merkleTreeOperator: '0x0',
|
|
9886
|
-
darkSwapAssetManager: '0x0',
|
|
9887
|
-
darkSwapFeeAssetManager: '0x0',
|
|
9888
|
-
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
|
|
9889
|
-
}, _contractConfig[exports.ChainId.BASE] = {
|
|
9890
|
-
priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
|
|
9891
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9892
|
-
nativeWrapper: '0x4200000000000000000000000000000000000006',
|
|
9893
|
-
merkleTreeOperator: '0x0',
|
|
9894
|
-
darkSwapAssetManager: '0x0',
|
|
9895
|
-
darkSwapFeeAssetManager: '0x0',
|
|
9896
|
-
drakSwapSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
|
|
9897
|
-
}, _contractConfig[exports.ChainId.SEPOLIA] = {
|
|
9898
|
-
priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
|
|
9899
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9900
|
-
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
9901
|
-
merkleTreeOperator: '0x0',
|
|
9902
|
-
darkSwapAssetManager: '0x0',
|
|
9903
|
-
darkSwapFeeAssetManager: '0x0',
|
|
9904
|
-
drakSwapSubgraphUrl: ''
|
|
9905
|
-
}, _contractConfig[exports.ChainId.HORIZEN_TESTNET] = {
|
|
9906
|
-
priceOracle: '0x54c375f28ce4B0c2B986D6256E4Bc75d242A8793',
|
|
9907
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9908
|
-
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
9909
|
-
merkleTreeOperator: '0x8Cd4061C8b3743810B811E1F4A0B597D79225f4E',
|
|
9910
|
-
darkSwapAssetManager: '0xEBeD6c7C2189bf8ad6687D3A4cf4b83fB4D1a3D2',
|
|
9911
|
-
darkSwapFeeAssetManager: '0x8CF86856Bd7dE95b4ba33DCae4cd5Ec02542Bf5b',
|
|
9912
|
-
drakSwapSubgraphUrl: ''
|
|
9913
|
-
}, _contractConfig[exports.ChainId.HARDHAT] = {
|
|
9914
|
-
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
9915
|
-
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
9916
|
-
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
9917
|
-
merkleTreeOperator: '0xEd8D7d3A98CB4ea6C91a80dcd2220719c264531f',
|
|
9918
|
-
darkSwapAssetManager: '0x6D39d71fF4ab56a4873febd34e1a3BDefc01b41e',
|
|
9919
|
-
darkSwapFeeAssetManager: '0xb9b0c96e4E7181926D2A7ed331C9C346dfa59b4D',
|
|
9920
|
-
drakSwapSubgraphUrl: 'https://34.142.142.240:8080/subgraphs/name/singularity/'
|
|
9921
|
-
}, _contractConfig);
|
|
9922
|
-
|
|
9923
10022
|
var DarkSwap = function DarkSwap(signer, chainId, contracts) {
|
|
9924
10023
|
// @ts-ignore
|
|
9925
10024
|
this.signer = signer;
|
|
@@ -10001,6 +10100,8 @@ exports.EMPTY_NOTE = EMPTY_NOTE;
|
|
|
10001
10100
|
exports.EMPTY_NULLIFIER = EMPTY_NULLIFIER;
|
|
10002
10101
|
exports.EMPTY_PATH = EMPTY_PATH;
|
|
10003
10102
|
exports.FEE_RATIO_PRECISION = FEE_RATIO_PRECISION;
|
|
10103
|
+
exports.GAS_LIMIT_MULTIPLIER = GAS_LIMIT_MULTIPLIER;
|
|
10104
|
+
exports.GAS_LIMIT_PRECISION = GAS_LIMIT_PRECISION;
|
|
10004
10105
|
exports.JoinService = JoinService;
|
|
10005
10106
|
exports.ProCancelOrderService = ProCancelOrderService;
|
|
10006
10107
|
exports.ProCreateOrderService = ProCreateOrderService;
|