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