@thesingularitynetwork/darkswap-sdk 0.1.0 → 0.1.2
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/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +27 -19
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/config/chain.d.ts +9 -0
- package/dist/types/src/config/config.d.ts +4 -0
- package/dist/types/src/config/contractConfig.d.ts +12 -0
- package/dist/types/src/config/index.d.ts +3 -0
- package/dist/types/src/darkSwap.d.ts +9 -0
- package/dist/types/src/entities/error.d.ts +3 -0
- package/dist/types/src/entities/index.d.ts +3 -0
- package/dist/types/src/entities/token.d.ts +8 -0
- package/dist/types/src/entities/types.d.ts +6 -0
- package/dist/types/src/index.d.ts +7 -0
- package/dist/types/src/proof/baseProofService.d.ts +6 -0
- package/dist/types/src/proof/basic/depositProof.d.ts +13 -0
- package/dist/types/src/proof/basic/joinProof.d.ts +17 -0
- package/dist/types/src/proof/basic/tripleJoinProof.d.ts +21 -0
- package/dist/types/src/proof/basic/withdrawProof.d.ts +13 -0
- package/dist/types/src/proof/keyService.d.ts +2 -0
- package/dist/types/src/proof/noteService.d.ts +9 -0
- package/dist/types/src/proof/pro/orders/cancelOrderProof.d.ts +15 -0
- package/dist/types/src/proof/pro/orders/createOrderProof.d.ts +16 -0
- package/dist/types/src/proof/pro/orders/swapProof.d.ts +23 -0
- package/dist/types/src/proof/retail/cancelOrderProof.d.ts +11 -0
- package/dist/types/src/proof/retail/depositOrderProof.d.ts +14 -0
- package/dist/types/src/proof/retail/swapProof.d.ts +19 -0
- package/dist/types/src/services/BaseService.d.ts +19 -0
- package/dist/types/src/services/EventService.d.ts +3 -0
- package/dist/types/src/services/base/deposit.d.ts +29 -0
- package/dist/types/src/services/base/index.d.ts +4 -0
- package/dist/types/src/services/base/join.d.ts +29 -0
- package/dist/types/src/services/base/tripleJoin.d.ts +32 -0
- package/dist/types/src/services/base/withdraw.d.ts +29 -0
- package/dist/types/src/services/index.d.ts +5 -0
- package/dist/types/src/services/merkletree.d.ts +18 -0
- package/dist/types/src/services/noteService.d.ts +8 -0
- package/dist/types/src/services/pro/cancelOrder.d.ts +29 -0
- package/dist/types/src/services/pro/createOrder.d.ts +40 -0
- package/dist/types/src/services/pro/index.d.ts +1 -0
- package/dist/types/src/services/pro/proSwap.d.ts +36 -0
- package/dist/types/src/services/retail/cancelAndWithdrawOrder.d.ts +22 -0
- package/dist/types/src/services/retail/depositAndCreateOrder.d.ts +32 -0
- package/dist/types/src/services/retail/index.d.ts +2 -0
- package/dist/types/src/types.d.ts +53 -0
- package/dist/types/src/utils/constants.d.ts +2 -0
- package/dist/types/src/utils/encoders.d.ts +1 -0
- package/dist/types/src/utils/formatters.d.ts +3 -0
- package/dist/types/src/utils/mimc.d.ts +1 -0
- package/dist/types/src/utils/proofUtils.d.ts +4 -0
- package/dist/types/src/utils/util.d.ts +4 -0
- package/dist/types/test/proof/depositProof.test.d.ts +1 -0
- package/dist/types/test/proof/keyService.test.d.ts +1 -0
- package/dist/types/test/proof/retail/cancelOrderProof.test.d.ts +1 -0
- package/dist/types/test/proof/retail/createOrderProof.test.d.ts +1 -0
- package/dist/types/test/services/depositService.test.d.ts +1 -0
- package/dist/types/test/utils/helpers.d.ts +5 -0
- package/package.json +5 -5
- package/src/config/index.ts +3 -0
- package/src/index.ts +3 -0
package/dist/index.esm.js
CHANGED
|
@@ -5183,5 +5183,5 @@ class DarkSwap {
|
|
|
5183
5183
|
}
|
|
5184
5184
|
}
|
|
5185
5185
|
|
|
5186
|
-
export { DarkSwap, DarkSwapError, DepositContext, DepositService, EMPTY_PATH, JoinService, NoteOnChainStatus, ProCreateOrderService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, multiGetMerklePathAndRoot };
|
|
5186
|
+
export { ChainId, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO, FEE_RATIO_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCreateOrderService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, contractConfig, generateKeyPair, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot };
|
|
5187
5187
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.js
CHANGED
|
@@ -5183,5 +5183,5 @@ class DarkSwap {
|
|
|
5183
5183
|
}
|
|
5184
5184
|
}
|
|
5185
5185
|
|
|
5186
|
-
export { DarkSwap, DarkSwapError, DepositContext, DepositService, EMPTY_PATH, JoinService, NoteOnChainStatus, ProCreateOrderService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, multiGetMerklePathAndRoot };
|
|
5186
|
+
export { ChainId, DarkSwap, DarkSwapError, DarkSwapProofError, DepositContext, DepositService, EMPTY_FOOTER, EMPTY_NULLIFIER, EMPTY_PATH, FEE_RATIO, FEE_RATIO_PRECISION, JoinService, NoteOnChainStatus, PROOF_DOMAIN, ProCreateOrderService, RetailCancelOrderService, RetailCreateOrderService, TripleJoinService, WithdrawService, contractConfig, generateKeyPair, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, hexlify32, isAddressEquals, isHexEquals, isNativeAsset, isNoteActive, isNoteSpent, isNoteValid, legacyTokenConfig, multiGetMerklePathAndRoot };
|
|
5187
5187
|
//# sourceMappingURL=index.js.map
|
package/dist/index.umd.js
CHANGED
|
@@ -2411,7 +2411,7 @@
|
|
|
2411
2411
|
var ERC20_USDT = {
|
|
2412
2412
|
abi: abi$6};
|
|
2413
2413
|
|
|
2414
|
-
|
|
2414
|
+
exports.ChainId = void 0;
|
|
2415
2415
|
(function (ChainId) {
|
|
2416
2416
|
ChainId[ChainId["HARDHAT"] = 31337] = "HARDHAT";
|
|
2417
2417
|
ChainId[ChainId["HARDHAT_ARBITRUM"] = 31338] = "HARDHAT_ARBITRUM";
|
|
@@ -2420,11 +2420,11 @@
|
|
|
2420
2420
|
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
2421
2421
|
ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
|
|
2422
2422
|
ChainId[ChainId["BASE"] = 8453] = "BASE";
|
|
2423
|
-
})(ChainId || (ChainId = {}));
|
|
2423
|
+
})(exports.ChainId || (exports.ChainId = {}));
|
|
2424
2424
|
|
|
2425
2425
|
const legacyTokenConfig = {
|
|
2426
|
-
[ChainId.MAINNET]: ['0xdac17f958d2ee523a2206206994597c13d831ec7'],
|
|
2427
|
-
[ChainId.HARDHAT]: ['0xdac17f958d2ee523a2206206994597c13d831ec7']
|
|
2426
|
+
[exports.ChainId.MAINNET]: ['0xdac17f958d2ee523a2206206994597c13d831ec7'],
|
|
2427
|
+
[exports.ChainId.HARDHAT]: ['0xdac17f958d2ee523a2206206994597c13d831ec7']
|
|
2428
2428
|
};
|
|
2429
2429
|
const FEE_RATIO = 300n;
|
|
2430
2430
|
|
|
@@ -2633,7 +2633,7 @@
|
|
|
2633
2633
|
brillig_names: brillig_names$5
|
|
2634
2634
|
};
|
|
2635
2635
|
|
|
2636
|
-
|
|
2636
|
+
exports.PROOF_DOMAIN = void 0;
|
|
2637
2637
|
(function (PROOF_DOMAIN) {
|
|
2638
2638
|
PROOF_DOMAIN[PROOF_DOMAIN["DEPOSIT"] = 10001] = "DEPOSIT";
|
|
2639
2639
|
PROOF_DOMAIN[PROOF_DOMAIN["WITHDRAW"] = 10002] = "WITHDRAW";
|
|
@@ -2645,7 +2645,7 @@
|
|
|
2645
2645
|
PROOF_DOMAIN[PROOF_DOMAIN["JOIN"] = 10008] = "JOIN";
|
|
2646
2646
|
PROOF_DOMAIN[PROOF_DOMAIN["TRIPLE_JOIN"] = 10009] = "TRIPLE_JOIN";
|
|
2647
2647
|
PROOF_DOMAIN[PROOF_DOMAIN["RETAIL_SWAP"] = 10010] = "RETAIL_SWAP";
|
|
2648
|
-
})(PROOF_DOMAIN || (PROOF_DOMAIN = {}));
|
|
2648
|
+
})(exports.PROOF_DOMAIN || (exports.PROOF_DOMAIN = {}));
|
|
2649
2649
|
const EMPTY_NULLIFIER = 0n;
|
|
2650
2650
|
const EMPTY_FOOTER = 0n;
|
|
2651
2651
|
const FEE_RATIO_PRECISION = 1000000n;
|
|
@@ -2713,7 +2713,7 @@
|
|
|
2713
2713
|
const newBalanceFooter = getNoteFooter(param.newBalanceNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
2714
2714
|
const addressMod = encodeAddress(param.address);
|
|
2715
2715
|
const message = bn_to_hex(mimc_bn254([
|
|
2716
|
-
BigInt(PROOF_DOMAIN.DEPOSIT),
|
|
2716
|
+
BigInt(exports.PROOF_DOMAIN.DEPOSIT),
|
|
2717
2717
|
oldBalanceNullifier,
|
|
2718
2718
|
addressMod,
|
|
2719
2719
|
param.newBalanceNote.note,
|
|
@@ -3187,7 +3187,7 @@
|
|
|
3187
3187
|
const addressMod = encodeAddress(param.address);
|
|
3188
3188
|
const assetMod = encodeAddress(param.oldBalance.asset);
|
|
3189
3189
|
const message = bn_to_hex(mimc_bn254([
|
|
3190
|
-
BigInt(PROOF_DOMAIN.WITHDRAW),
|
|
3190
|
+
BigInt(exports.PROOF_DOMAIN.WITHDRAW),
|
|
3191
3191
|
addressMod,
|
|
3192
3192
|
oldBalanceNullifier,
|
|
3193
3193
|
param.newBalance.note,
|
|
@@ -3579,7 +3579,7 @@
|
|
|
3579
3579
|
const outNoteFooter = getNoteFooter(param.outNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
3580
3580
|
const addressMod = encodeAddress(param.address);
|
|
3581
3581
|
const message = bn_to_hex(mimc_bn254([
|
|
3582
|
-
BigInt(PROOF_DOMAIN.JOIN),
|
|
3582
|
+
BigInt(exports.PROOF_DOMAIN.JOIN),
|
|
3583
3583
|
inNullifier1,
|
|
3584
3584
|
inNullifier2,
|
|
3585
3585
|
param.outNote.note,
|
|
@@ -4043,7 +4043,7 @@
|
|
|
4043
4043
|
const outNoteFooter = getNoteFooter(param.outNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
4044
4044
|
const addressMod = encodeAddress(param.address);
|
|
4045
4045
|
const message = bn_to_hex(mimc_bn254([
|
|
4046
|
-
BigInt(PROOF_DOMAIN.TRIPLE_JOIN),
|
|
4046
|
+
BigInt(exports.PROOF_DOMAIN.TRIPLE_JOIN),
|
|
4047
4047
|
inNullifier1,
|
|
4048
4048
|
inNullifier2,
|
|
4049
4049
|
inNullifier3,
|
|
@@ -4245,7 +4245,7 @@
|
|
|
4245
4245
|
const orderNoteFooter = getNoteFooter(param.orderNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
4246
4246
|
const addressMod = encodeAddress(param.address);
|
|
4247
4247
|
const message = bn_to_hex(mimc_bn254([
|
|
4248
|
-
BigInt(PROOF_DOMAIN.PRO_CREATE_ORDER),
|
|
4248
|
+
BigInt(exports.PROOF_DOMAIN.PRO_CREATE_ORDER),
|
|
4249
4249
|
oldBalanceNullifier,
|
|
4250
4250
|
addressMod,
|
|
4251
4251
|
param.newBalanceNote.note,
|
|
@@ -4621,7 +4621,7 @@
|
|
|
4621
4621
|
const nullifier = calcNullifier(param.orderNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
4622
4622
|
const addressMod = encodeAddress(param.address);
|
|
4623
4623
|
const message = bn_to_hex(mimc_bn254([
|
|
4624
|
-
BigInt(PROOF_DOMAIN.RETAIL_CANCEL_ORDER),
|
|
4624
|
+
BigInt(exports.PROOF_DOMAIN.RETAIL_CANCEL_ORDER),
|
|
4625
4625
|
addressMod,
|
|
4626
4626
|
nullifier,
|
|
4627
4627
|
param.orderNote.feeRatio,
|
|
@@ -4916,7 +4916,7 @@
|
|
|
4916
4916
|
const addressMod = encodeAddress(address);
|
|
4917
4917
|
calcNullifier(orderNote.rho, pubKey);
|
|
4918
4918
|
const message = bn_to_hex(mimc_bn254([
|
|
4919
|
-
BigInt(PROOF_DOMAIN.RETAIL_CREATE_ORDER),
|
|
4919
|
+
BigInt(exports.PROOF_DOMAIN.RETAIL_CREATE_ORDER),
|
|
4920
4920
|
addressMod,
|
|
4921
4921
|
orderNote.note,
|
|
4922
4922
|
orderNote.feeRatio,
|
|
@@ -4944,7 +4944,7 @@
|
|
|
4944
4944
|
const swapInNoteFooter = getNoteFooter(param.swapInNote.rho, [fuzkPubKeyX, fuzkPubKeyY]);
|
|
4945
4945
|
const addressMod = encodeAddress(param.address);
|
|
4946
4946
|
const message = bn_to_hex(mimc_bn254([
|
|
4947
|
-
BigInt(PROOF_DOMAIN.RETAIL_CREATE_ORDER),
|
|
4947
|
+
BigInt(exports.PROOF_DOMAIN.RETAIL_CREATE_ORDER),
|
|
4948
4948
|
addressMod,
|
|
4949
4949
|
param.depositNote.note,
|
|
4950
4950
|
param.depositNote.feeRatio,
|
|
@@ -5091,7 +5091,7 @@
|
|
|
5091
5091
|
}
|
|
5092
5092
|
|
|
5093
5093
|
const contractConfig = {
|
|
5094
|
-
[ChainId.MAINNET]: {
|
|
5094
|
+
[exports.ChainId.MAINNET]: {
|
|
5095
5095
|
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
5096
5096
|
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
5097
5097
|
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
@@ -5100,7 +5100,7 @@
|
|
|
5100
5100
|
darkSwapFeeAssetManager: '0x0', //FIXME
|
|
5101
5101
|
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api',
|
|
5102
5102
|
},
|
|
5103
|
-
[ChainId.ARBITRUM_ONE]: {
|
|
5103
|
+
[exports.ChainId.ARBITRUM_ONE]: {
|
|
5104
5104
|
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
5105
5105
|
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
5106
5106
|
nativeWrapper: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
@@ -5109,7 +5109,7 @@
|
|
|
5109
5109
|
darkSwapFeeAssetManager: '0x0', //FIXME
|
|
5110
5110
|
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
|
|
5111
5111
|
},
|
|
5112
|
-
[ChainId.BASE]: {
|
|
5112
|
+
[exports.ChainId.BASE]: {
|
|
5113
5113
|
priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
|
|
5114
5114
|
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
5115
5115
|
nativeWrapper: '0x4200000000000000000000000000000000000006',
|
|
@@ -5118,7 +5118,7 @@
|
|
|
5118
5118
|
darkSwapFeeAssetManager: '0x0', //FIXME
|
|
5119
5119
|
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
|
|
5120
5120
|
},
|
|
5121
|
-
[ChainId.SEPOLIA]: {
|
|
5121
|
+
[exports.ChainId.SEPOLIA]: {
|
|
5122
5122
|
priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
|
|
5123
5123
|
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
5124
5124
|
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
@@ -5127,7 +5127,7 @@
|
|
|
5127
5127
|
darkSwapFeeAssetManager: '0x0', //FIXME
|
|
5128
5128
|
drakpoolSubgraphUrl: ''
|
|
5129
5129
|
},
|
|
5130
|
-
[ChainId.HARDHAT]: {
|
|
5130
|
+
[exports.ChainId.HARDHAT]: {
|
|
5131
5131
|
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
5132
5132
|
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
5133
5133
|
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
@@ -5185,15 +5185,22 @@
|
|
|
5185
5185
|
|
|
5186
5186
|
exports.DarkSwap = DarkSwap;
|
|
5187
5187
|
exports.DarkSwapError = DarkSwapError;
|
|
5188
|
+
exports.DarkSwapProofError = DarkSwapProofError;
|
|
5188
5189
|
exports.DepositContext = DepositContext;
|
|
5189
5190
|
exports.DepositService = DepositService;
|
|
5191
|
+
exports.EMPTY_FOOTER = EMPTY_FOOTER;
|
|
5192
|
+
exports.EMPTY_NULLIFIER = EMPTY_NULLIFIER;
|
|
5190
5193
|
exports.EMPTY_PATH = EMPTY_PATH;
|
|
5194
|
+
exports.FEE_RATIO = FEE_RATIO;
|
|
5195
|
+
exports.FEE_RATIO_PRECISION = FEE_RATIO_PRECISION;
|
|
5191
5196
|
exports.JoinService = JoinService;
|
|
5192
5197
|
exports.ProCreateOrderService = ProCreateOrderService;
|
|
5193
5198
|
exports.RetailCancelOrderService = RetailCancelOrderService;
|
|
5194
5199
|
exports.RetailCreateOrderService = RetailCreateOrderService;
|
|
5195
5200
|
exports.TripleJoinService = TripleJoinService;
|
|
5196
5201
|
exports.WithdrawService = WithdrawService;
|
|
5202
|
+
exports.contractConfig = contractConfig;
|
|
5203
|
+
exports.generateKeyPair = generateKeyPair;
|
|
5197
5204
|
exports.getMerklePathAndRoot = getMerklePathAndRoot;
|
|
5198
5205
|
exports.getNoteOnChainStatusByPublicKey = getNoteOnChainStatusByPublicKey;
|
|
5199
5206
|
exports.hexlify32 = hexlify32;
|
|
@@ -5203,6 +5210,7 @@
|
|
|
5203
5210
|
exports.isNoteActive = isNoteActive;
|
|
5204
5211
|
exports.isNoteSpent = isNoteSpent;
|
|
5205
5212
|
exports.isNoteValid = isNoteValid;
|
|
5213
|
+
exports.legacyTokenConfig = legacyTokenConfig;
|
|
5206
5214
|
exports.multiGetMerklePathAndRoot = multiGetMerklePathAndRoot;
|
|
5207
5215
|
|
|
5208
5216
|
}));
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ContractConfiguartion = {
|
|
2
|
+
priceOracle: string;
|
|
3
|
+
ethAddress: string;
|
|
4
|
+
nativeWrapper: string;
|
|
5
|
+
merkleTreeOperator: string;
|
|
6
|
+
darkSwapAssetManager: string;
|
|
7
|
+
darkSwapFeeAssetManager: string;
|
|
8
|
+
drakpoolSubgraphUrl: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const contractConfig: {
|
|
11
|
+
[chainId: number]: ContractConfiguartion;
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { ContractConfiguartion } from './config/contractConfig';
|
|
3
|
+
export declare class DarkSwap {
|
|
4
|
+
signer: ethers.Signer;
|
|
5
|
+
provider: ethers.Provider;
|
|
6
|
+
chainId: number;
|
|
7
|
+
contracts: ContractConfiguartion;
|
|
8
|
+
constructor(signer: ethers.Signer, chainId: number, contracts?: ContractConfiguartion);
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Fr } from "@aztec/foundation/fields";
|
|
2
|
+
export declare function generateProof(circuit: any, inputs: any): Promise<{
|
|
3
|
+
proof: string;
|
|
4
|
+
verifyInputs: string[];
|
|
5
|
+
}>;
|
|
6
|
+
export declare function signMessage(message: string, fuzkPriKey: Fr): Promise<Buffer<ArrayBufferLike>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote } from "../../types";
|
|
2
|
+
export type DepositProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
merkleIndex: number[];
|
|
5
|
+
merklePath: string[];
|
|
6
|
+
oldBalanceNote: DarkSwapNote;
|
|
7
|
+
newBalanceNote: DarkSwapNote;
|
|
8
|
+
};
|
|
9
|
+
export type DepositProofResult = BaseProofResult & {
|
|
10
|
+
oldBalanceNullifier: string;
|
|
11
|
+
newBalanceFooter: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function generateDepositProof(param: DepositProofParam): Promise<DepositProofResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote } from "../../types";
|
|
2
|
+
export type JoinProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
inMerkleIndex1: number[];
|
|
5
|
+
inMerkleIndex2: number[];
|
|
6
|
+
inMerklePath1: string[];
|
|
7
|
+
inMerklePath2: string[];
|
|
8
|
+
inNote1: DarkSwapNote;
|
|
9
|
+
inNote2: DarkSwapNote;
|
|
10
|
+
outNote: DarkSwapNote;
|
|
11
|
+
};
|
|
12
|
+
export type JoinProofResult = BaseProofResult & {
|
|
13
|
+
inNullifier1: string;
|
|
14
|
+
inNullifier2: string;
|
|
15
|
+
outNoteFooter: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function generateJoinProof(param: JoinProofParam): Promise<JoinProofResult>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote } from "../../types";
|
|
2
|
+
export type TripleJoinProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
inMerkleIndex1: number[];
|
|
5
|
+
inMerkleIndex2: number[];
|
|
6
|
+
inMerkleIndex3: number[];
|
|
7
|
+
inMerklePath1: string[];
|
|
8
|
+
inMerklePath2: string[];
|
|
9
|
+
inMerklePath3: string[];
|
|
10
|
+
inNote1: DarkSwapNote;
|
|
11
|
+
inNote2: DarkSwapNote;
|
|
12
|
+
inNote3: DarkSwapNote;
|
|
13
|
+
outNote: DarkSwapNote;
|
|
14
|
+
};
|
|
15
|
+
export type TripleJoinProofResult = BaseProofResult & {
|
|
16
|
+
inNullifier1: string;
|
|
17
|
+
inNullifier2: string;
|
|
18
|
+
inNullifier3: string;
|
|
19
|
+
outNoteFooter: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function generateTripleJoinProof(param: TripleJoinProofParam): Promise<TripleJoinProofResult>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote } from "../../types";
|
|
2
|
+
export type WithdrawProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
merkleIndex: number[];
|
|
5
|
+
merklePath: string[];
|
|
6
|
+
oldBalance: DarkSwapNote;
|
|
7
|
+
newBalance: DarkSwapNote;
|
|
8
|
+
};
|
|
9
|
+
export type WithdrawProofResult = BaseProofResult & {
|
|
10
|
+
oldBalanceNullifier: string;
|
|
11
|
+
newBalanceFooter: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function generateWithdrawProof(param: WithdrawProofParam): Promise<WithdrawProofResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Fr } from "@aztec/foundation/fields";
|
|
2
|
+
import { DarkSwapNote, DarkSwapNoteExt, DarkSwapOrderNote } from "../types.js";
|
|
3
|
+
export declare const DOMAIN_NOTE = 2n;
|
|
4
|
+
export declare const DOMAIN_ORDER_NOTE = 3n;
|
|
5
|
+
export declare const EMPTY_NOTE: DarkSwapNote;
|
|
6
|
+
export declare function createNote(address: string, asset: string, amount: bigint, fuzkPubKey: [Fr, Fr]): DarkSwapNoteExt;
|
|
7
|
+
export declare function getNoteFooter(rho: bigint, publicKey: [Fr, Fr]): bigint;
|
|
8
|
+
export declare function calcNullifier(rho: bigint, fuzkPubKey: [Fr, Fr]): bigint;
|
|
9
|
+
export declare function createOrderNoteExt(address: string, asset: string, amount: bigint, feeRatio: bigint, fuzkPubKey: [Fr, Fr]): DarkSwapOrderNote;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote, DarkSwapOrderNote } from "../../../types";
|
|
2
|
+
export type ProCancelOrderProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
merkleIndex: number[];
|
|
5
|
+
merklePath: string[];
|
|
6
|
+
orderNote: DarkSwapOrderNote;
|
|
7
|
+
oldBalanceNote: DarkSwapNote;
|
|
8
|
+
newBalanceNote: DarkSwapNote;
|
|
9
|
+
};
|
|
10
|
+
export type ProCancelOrderProofResult = BaseProofResult & {
|
|
11
|
+
orderNullifier: string;
|
|
12
|
+
oldBalanceNullifier: string;
|
|
13
|
+
newBalanceNoteFooter: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function generateProCancelOrderProof(param: ProCancelOrderProofParam): Promise<ProCancelOrderProofResult>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapNote, DarkSwapOrderNote } from "../../../types";
|
|
2
|
+
export type ProCreateOrderProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
merkleIndex: number[];
|
|
5
|
+
merklePath: string[];
|
|
6
|
+
oldBalanceNote: DarkSwapNote;
|
|
7
|
+
newBalanceNote: DarkSwapNote;
|
|
8
|
+
orderNote: DarkSwapOrderNote;
|
|
9
|
+
inNote: DarkSwapNote;
|
|
10
|
+
};
|
|
11
|
+
export type ProCreateOrderProofResult = BaseProofResult & {
|
|
12
|
+
oldBalanceNullifier: string;
|
|
13
|
+
newBalanceFooter: string;
|
|
14
|
+
orderNoteFooter: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function generateProCreateOrderProof(param: ProCreateOrderProofParam): Promise<ProCreateOrderProofResult>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseProofResult, DarkSwapMessage, DarkSwapNote, DarkSwapOrderNote } from "../../../types";
|
|
2
|
+
export type ProSwapProofParam = {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
aliceMerkleIndex: number[];
|
|
5
|
+
aliceMerklePath: string[];
|
|
6
|
+
aliceAddress: string;
|
|
7
|
+
aliceOrderNote: DarkSwapOrderNote;
|
|
8
|
+
aliceInNote: DarkSwapNote;
|
|
9
|
+
aliceChangeNote: DarkSwapNote;
|
|
10
|
+
aliceSignedMessage: string;
|
|
11
|
+
bobMerkleIndex: number[];
|
|
12
|
+
bobMerklePath: string[];
|
|
13
|
+
bobAddress: string;
|
|
14
|
+
bobMessage: DarkSwapMessage;
|
|
15
|
+
};
|
|
16
|
+
export type ProSwapProofResult = BaseProofResult & {
|
|
17
|
+
aliceOutNullifier: string;
|
|
18
|
+
aliceInNoteFooter: string;
|
|
19
|
+
aliceChangeNoteFooter: string;
|
|
20
|
+
bobOutNullifier: string;
|
|
21
|
+
bobInNoteFooter: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function generateProSwapProof(param: ProSwapProofParam): Promise<ProSwapProofResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapOrderNote } from "../../types";
|
|
2
|
+
export type RetailCancelOrderProofParam = BaseProofParam & {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
merkleIndex: number[];
|
|
5
|
+
merklePath: string[];
|
|
6
|
+
orderNote: DarkSwapOrderNote;
|
|
7
|
+
};
|
|
8
|
+
export type RetailCancelOrderProofResult = BaseProofResult & {
|
|
9
|
+
nullifier: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function generateRetailCancelOrderProof(param: RetailCancelOrderProofParam): Promise<RetailCancelOrderProofResult>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseProofParam, BaseProofResult, DarkSwapMessage, DarkSwapNote, DarkSwapOrderNote } from "../../types";
|
|
2
|
+
import { Fr } from "@aztec/foundation/fields";
|
|
3
|
+
export type RetailCreateOrderProofParam = BaseProofParam & {
|
|
4
|
+
depositNote: DarkSwapOrderNote;
|
|
5
|
+
swapInNote: DarkSwapNote;
|
|
6
|
+
feeAmount: bigint;
|
|
7
|
+
};
|
|
8
|
+
export type RetailCreateOrderProofResult = BaseProofResult & {
|
|
9
|
+
depositNullifier: string;
|
|
10
|
+
depositFooter: string;
|
|
11
|
+
swapInNoteFooter: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function generateRetailSwapMessage(address: string, orderNote: DarkSwapOrderNote, swapInNote: DarkSwapNote, pubKey: [Fr, Fr], privKey: Fr): Promise<DarkSwapMessage>;
|
|
14
|
+
export declare function generateRetailCreateOrderProof(param: RetailCreateOrderProofParam): Promise<RetailCreateOrderProofResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseProofResult, DarkSwapMessage } from "../../types";
|
|
2
|
+
export type RetailSwapProofParam = {
|
|
3
|
+
merkleRoot: string;
|
|
4
|
+
aliceMerkleIndex: number[];
|
|
5
|
+
aliceMerklePath: string[];
|
|
6
|
+
aliceAddress: string;
|
|
7
|
+
aliceMessage: DarkSwapMessage;
|
|
8
|
+
bobMerkleIndex: number[];
|
|
9
|
+
bobMerklePath: string[];
|
|
10
|
+
bobAddress: string;
|
|
11
|
+
bobMessage: DarkSwapMessage;
|
|
12
|
+
};
|
|
13
|
+
export type RetailSwapProofResult = BaseProofResult & {
|
|
14
|
+
aliceOrderNullifier: string;
|
|
15
|
+
aliceInNoteFooter: string;
|
|
16
|
+
bobOrderNullifier: string;
|
|
17
|
+
bobInNoteFooter: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function generateRetailSwapProof(param: RetailSwapProofParam): Promise<RetailSwapProofResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DarkSwap } from '../darkSwap';
|
|
2
|
+
export declare class BaseContext {
|
|
3
|
+
private _address?;
|
|
4
|
+
private _signature;
|
|
5
|
+
private _merkleRoot?;
|
|
6
|
+
private _tx?;
|
|
7
|
+
constructor(signature: string);
|
|
8
|
+
set address(address: string | undefined);
|
|
9
|
+
get address(): string | undefined;
|
|
10
|
+
get signature(): string;
|
|
11
|
+
set merkleRoot(merkleRoot: string | undefined);
|
|
12
|
+
get merkleRoot(): string | undefined;
|
|
13
|
+
set tx(tx: string | undefined);
|
|
14
|
+
get tx(): string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class BaseContractService {
|
|
17
|
+
protected _darkSwap: DarkSwap;
|
|
18
|
+
constructor(_darkSwap: DarkSwap);
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { DepositProofResult } from '../../proof/basic/depositProof';
|
|
3
|
+
import { DarkSwapNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
export declare class DepositContext extends BaseContext {
|
|
6
|
+
private _currentBalance?;
|
|
7
|
+
private _newBalance?;
|
|
8
|
+
private _proof?;
|
|
9
|
+
private _depositAmount?;
|
|
10
|
+
constructor(signature: string);
|
|
11
|
+
set currentBalance(currentBalance: DarkSwapNote | undefined);
|
|
12
|
+
get currentBalance(): DarkSwapNote | undefined;
|
|
13
|
+
set newBalance(newBalance: DarkSwapNote | undefined);
|
|
14
|
+
get newBalance(): DarkSwapNote | undefined;
|
|
15
|
+
set proof(proof: DepositProofResult | undefined);
|
|
16
|
+
get proof(): DepositProofResult | undefined;
|
|
17
|
+
set depositAmount(depositAmount: bigint | undefined);
|
|
18
|
+
get depositAmount(): bigint | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class DepositService extends BaseContractService {
|
|
21
|
+
constructor(_darkSwap: DarkSwap);
|
|
22
|
+
prepare(currentBalance: DarkSwapNote, depositAsset: string, depositAmount: bigint, walletAddress: string, signature: string): Promise<{
|
|
23
|
+
context: DepositContext;
|
|
24
|
+
newBalanceNote: DarkSwapNote;
|
|
25
|
+
}>;
|
|
26
|
+
private generateProof;
|
|
27
|
+
execute(context: DepositContext): Promise<string>;
|
|
28
|
+
protected allowance(context: DepositContext): Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JoinProofResult } from '../../proof/basic/joinProof';
|
|
2
|
+
import { DarkSwapNote } from '../../types';
|
|
3
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
4
|
+
import { DarkSwap } from '../../darkSwap';
|
|
5
|
+
declare class JoinContext extends BaseContext {
|
|
6
|
+
private _inNote1?;
|
|
7
|
+
private _inNote2?;
|
|
8
|
+
private _outNote?;
|
|
9
|
+
private _proof?;
|
|
10
|
+
constructor(signature: string);
|
|
11
|
+
set inNote1(note: DarkSwapNote | undefined);
|
|
12
|
+
get inNote1(): DarkSwapNote | undefined;
|
|
13
|
+
set inNote2(note: DarkSwapNote | undefined);
|
|
14
|
+
get inNote2(): DarkSwapNote | undefined;
|
|
15
|
+
set outNote(note: DarkSwapNote | undefined);
|
|
16
|
+
get outNote(): DarkSwapNote | undefined;
|
|
17
|
+
set proof(proof: JoinProofResult | undefined);
|
|
18
|
+
get proof(): JoinProofResult | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class JoinService extends BaseContractService {
|
|
21
|
+
constructor(_darkSwap: DarkSwap);
|
|
22
|
+
prepare(address: string, inNote1: DarkSwapNote, inNote2: DarkSwapNote, signature: string): Promise<{
|
|
23
|
+
context: JoinContext;
|
|
24
|
+
outNotes: DarkSwapNote[];
|
|
25
|
+
}>;
|
|
26
|
+
private generateProof;
|
|
27
|
+
execute(context: JoinContext): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { TripleJoinProofResult } from '../../proof/basic/tripleJoinProof';
|
|
3
|
+
import { DarkSwapNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class TripleJoinContext extends BaseContext {
|
|
6
|
+
private _inNote1?;
|
|
7
|
+
private _inNote2?;
|
|
8
|
+
private _inNote3?;
|
|
9
|
+
private _outNote?;
|
|
10
|
+
private _proof?;
|
|
11
|
+
constructor(signature: string);
|
|
12
|
+
set inNote1(note: DarkSwapNote | undefined);
|
|
13
|
+
get inNote1(): DarkSwapNote | undefined;
|
|
14
|
+
set inNote2(note: DarkSwapNote | undefined);
|
|
15
|
+
get inNote2(): DarkSwapNote | undefined;
|
|
16
|
+
set inNote3(note: DarkSwapNote | undefined);
|
|
17
|
+
get inNote3(): DarkSwapNote | undefined;
|
|
18
|
+
set outNote(note: DarkSwapNote | undefined);
|
|
19
|
+
get outNote(): DarkSwapNote | undefined;
|
|
20
|
+
set proof(proof: TripleJoinProofResult | undefined);
|
|
21
|
+
get proof(): TripleJoinProofResult | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare class TripleJoinService extends BaseContractService {
|
|
24
|
+
constructor(_darkSwap: DarkSwap);
|
|
25
|
+
prepare(address: string, inNote1: DarkSwapNote, inNote2: DarkSwapNote, inNote3: DarkSwapNote, signature: string): Promise<{
|
|
26
|
+
context: TripleJoinContext;
|
|
27
|
+
outNotes: DarkSwapNote[];
|
|
28
|
+
}>;
|
|
29
|
+
private generateProof;
|
|
30
|
+
execute(context: TripleJoinContext): Promise<string>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { WithdrawProofResult } from '../../proof/basic/withdrawProof';
|
|
3
|
+
import { DarkSwapNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class WithdrawContext extends BaseContext {
|
|
6
|
+
private _currentBalance?;
|
|
7
|
+
private _newBalance?;
|
|
8
|
+
private _withdrawAmount?;
|
|
9
|
+
private _proof?;
|
|
10
|
+
constructor(signature: string);
|
|
11
|
+
set currentBalance(note: DarkSwapNote | undefined);
|
|
12
|
+
get currentBalance(): DarkSwapNote | undefined;
|
|
13
|
+
set newBalance(note: DarkSwapNote | undefined);
|
|
14
|
+
get newBalance(): DarkSwapNote | undefined;
|
|
15
|
+
set withdrawAmount(amount: bigint | undefined);
|
|
16
|
+
get withdrawAmount(): bigint | undefined;
|
|
17
|
+
set proof(proof: WithdrawProofResult | undefined);
|
|
18
|
+
get proof(): WithdrawProofResult | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class WithdrawService extends BaseContractService {
|
|
21
|
+
constructor(_darkSwap: DarkSwap);
|
|
22
|
+
prepare(address: string, currentBalance: DarkSwapNote, withdrawAmount: bigint, signature: string): Promise<{
|
|
23
|
+
context: WithdrawContext;
|
|
24
|
+
outNotes: DarkSwapNote[];
|
|
25
|
+
}>;
|
|
26
|
+
private generateProof;
|
|
27
|
+
execute(context: WithdrawContext): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DarkSwap } from '../darkSwap';
|
|
2
|
+
export interface MerklePath {
|
|
3
|
+
noteCommitment: bigint;
|
|
4
|
+
path: string[];
|
|
5
|
+
index: number[];
|
|
6
|
+
root: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const EMPTY_PATH: {
|
|
9
|
+
path: any[];
|
|
10
|
+
index: any[];
|
|
11
|
+
root: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function getMerklePathAndRoot(note: bigint, darkSwap: DarkSwap): Promise<{
|
|
14
|
+
path: any;
|
|
15
|
+
index: any;
|
|
16
|
+
root: any;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function multiGetMerklePathAndRoot(notes: bigint[], darkSwap: DarkSwap): Promise<MerklePath[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NoteOnChainStatus } from '../entities';
|
|
2
|
+
import { DarkSwap } from '../darkSwap';
|
|
3
|
+
import { DarkSwapNote } from '../types';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
export declare function getNoteOnChainStatusByPublicKey(darkSwap: DarkSwap, note: DarkSwapNote, publicKey: [Fr, Fr]): Promise<NoteOnChainStatus>;
|
|
6
|
+
export declare function isNoteActive(darkSwap: DarkSwap, note: DarkSwapNote, publicKey: [Fr, Fr]): Promise<boolean>;
|
|
7
|
+
export declare function isNoteSpent(darkSwap: DarkSwap, note: DarkSwapNote, publicKey: [Fr, Fr]): Promise<boolean>;
|
|
8
|
+
export declare function isNoteValid(darkSwap: DarkSwap, note: DarkSwapNote, publicKey: [Fr, Fr]): Promise<boolean>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { ProCancelOrderProofResult } from '../../proof/pro/orders/cancelOrderProof';
|
|
3
|
+
import { DarkSwapNote, DarkSwapOrderNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class ProCancelOrderContext extends BaseContext {
|
|
6
|
+
private _orderNote?;
|
|
7
|
+
private _oldBalance?;
|
|
8
|
+
private _newBalance?;
|
|
9
|
+
private _proof?;
|
|
10
|
+
constructor(signature: string);
|
|
11
|
+
set orderNote(orderNote: DarkSwapOrderNote | undefined);
|
|
12
|
+
get orderNote(): DarkSwapOrderNote | undefined;
|
|
13
|
+
set oldBalance(oldBalance: DarkSwapNote | undefined);
|
|
14
|
+
get oldBalance(): DarkSwapNote | undefined;
|
|
15
|
+
set newBalance(newBalance: DarkSwapNote | undefined);
|
|
16
|
+
get newBalance(): DarkSwapNote | undefined;
|
|
17
|
+
set proof(proof: ProCancelOrderProofResult | undefined);
|
|
18
|
+
get proof(): ProCancelOrderProofResult | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class ProCancelOrderService extends BaseContractService {
|
|
21
|
+
constructor(_darkSwap: DarkSwap);
|
|
22
|
+
prepare(address: string, orderNote: DarkSwapOrderNote, balanceNote: DarkSwapNote, signature: string): Promise<{
|
|
23
|
+
context: ProCancelOrderContext;
|
|
24
|
+
newBalance: DarkSwapNote;
|
|
25
|
+
}>;
|
|
26
|
+
private generateProof;
|
|
27
|
+
execute(context: ProCancelOrderContext): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { ProCreateOrderProofResult } from '../../proof/pro/orders/createOrderProof';
|
|
3
|
+
import { DarkSwapMessage, DarkSwapNote, DarkSwapOrderNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class ProCreateOrderContext extends BaseContext {
|
|
6
|
+
private _orderNote?;
|
|
7
|
+
private _oldBalance?;
|
|
8
|
+
private _newBalance?;
|
|
9
|
+
private _swapInNote?;
|
|
10
|
+
private _proof?;
|
|
11
|
+
private _feeAmount?;
|
|
12
|
+
private _swapMessage?;
|
|
13
|
+
constructor(signature: string);
|
|
14
|
+
set orderNote(orderNote: DarkSwapOrderNote | undefined);
|
|
15
|
+
get orderNote(): DarkSwapOrderNote | undefined;
|
|
16
|
+
set swapInNote(swapInNote: DarkSwapNote | undefined);
|
|
17
|
+
get swapInNote(): DarkSwapNote | undefined;
|
|
18
|
+
set oldBalance(oldBalance: DarkSwapNote | undefined);
|
|
19
|
+
get oldBalance(): DarkSwapNote | undefined;
|
|
20
|
+
set newBalance(newBalance: DarkSwapNote | undefined);
|
|
21
|
+
get newBalance(): DarkSwapNote | undefined;
|
|
22
|
+
set feeAmount(feeAmount: bigint | undefined);
|
|
23
|
+
get feeAmount(): bigint | undefined;
|
|
24
|
+
set proof(proof: ProCreateOrderProofResult | undefined);
|
|
25
|
+
get proof(): ProCreateOrderProofResult | undefined;
|
|
26
|
+
set swapMessage(swapMessage: DarkSwapMessage | undefined);
|
|
27
|
+
get swapMessage(): DarkSwapMessage | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare class ProCreateOrderService extends BaseContractService {
|
|
30
|
+
constructor(_darkSwap: DarkSwap);
|
|
31
|
+
prepare(address: string, depositAsset: string, depositAmount: bigint, swapInAsset: string, swapInAmount: bigint, balanceNote: DarkSwapNote, signature: string): Promise<{
|
|
32
|
+
context: ProCreateOrderContext;
|
|
33
|
+
orderNote: DarkSwapOrderNote;
|
|
34
|
+
swapInNote: DarkSwapNote;
|
|
35
|
+
newBalance: DarkSwapNote;
|
|
36
|
+
}>;
|
|
37
|
+
private generateProof;
|
|
38
|
+
execute(context: ProCreateOrderContext): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createOrder';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { ProSwapProofResult } from '../../proof/pro/orders/swapProof';
|
|
3
|
+
import { DarkSwapMessage, DarkSwapNote, DarkSwapOrderNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class ProSwapContext extends BaseContext {
|
|
6
|
+
private _orderNote?;
|
|
7
|
+
private _changeNote?;
|
|
8
|
+
private _swapInNote?;
|
|
9
|
+
private _proof?;
|
|
10
|
+
private _bobAddress?;
|
|
11
|
+
private _bobSwapMessage?;
|
|
12
|
+
constructor(signature: string);
|
|
13
|
+
set orderNote(orderNote: DarkSwapOrderNote | undefined);
|
|
14
|
+
get orderNote(): DarkSwapOrderNote | undefined;
|
|
15
|
+
set changeNote(changeNote: DarkSwapNote | undefined);
|
|
16
|
+
get changeNote(): DarkSwapNote | undefined;
|
|
17
|
+
set swapInNote(swapInNote: DarkSwapNote | undefined);
|
|
18
|
+
get swapInNote(): DarkSwapNote | undefined;
|
|
19
|
+
set proof(proof: ProSwapProofResult | undefined);
|
|
20
|
+
get proof(): ProSwapProofResult | undefined;
|
|
21
|
+
set bobSwapMessage(bobSwapMessage: DarkSwapMessage | undefined);
|
|
22
|
+
get bobSwapMessage(): DarkSwapMessage | undefined;
|
|
23
|
+
set bobAddress(bobAddress: string | undefined);
|
|
24
|
+
get bobAddress(): string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare class ProSwapService extends BaseContractService {
|
|
27
|
+
constructor(_darkSwap: DarkSwap);
|
|
28
|
+
prepare(address: string, orderNote: DarkSwapOrderNote, swapOutAmount: bigint, swapInAmount: bigint, bobAddress: string, bobSwapMessage: DarkSwapMessage, signature: string): Promise<{
|
|
29
|
+
context: ProSwapContext;
|
|
30
|
+
swapInNote: DarkSwapNote;
|
|
31
|
+
changeNote: DarkSwapNote;
|
|
32
|
+
}>;
|
|
33
|
+
private generateProof;
|
|
34
|
+
execute(context: ProSwapContext): Promise<string>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { RetailCancelOrderProofResult } from '../../proof/retail/cancelOrderProof';
|
|
3
|
+
import { DarkSwapOrderNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class RetailCancelOrderContext extends BaseContext {
|
|
6
|
+
private _orderNote?;
|
|
7
|
+
private _proof?;
|
|
8
|
+
constructor(signature: string);
|
|
9
|
+
set orderNote(orderNote: DarkSwapOrderNote | undefined);
|
|
10
|
+
get orderNote(): DarkSwapOrderNote | undefined;
|
|
11
|
+
set proof(proof: RetailCancelOrderProofResult | undefined);
|
|
12
|
+
get proof(): RetailCancelOrderProofResult | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare class RetailCancelOrderService extends BaseContractService {
|
|
15
|
+
constructor(_darkSwap: DarkSwap);
|
|
16
|
+
prepare(address: string, orderNote: DarkSwapOrderNote, signature: string): Promise<{
|
|
17
|
+
context: RetailCancelOrderContext;
|
|
18
|
+
}>;
|
|
19
|
+
private generateProof;
|
|
20
|
+
execute(context: RetailCancelOrderContext): Promise<string>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DarkSwap } from '../../darkSwap';
|
|
2
|
+
import { RetailCreateOrderProofResult } from '../../proof/retail/depositOrderProof';
|
|
3
|
+
import { DarkSwapMessage, DarkSwapNote, DarkSwapOrderNote } from '../../types';
|
|
4
|
+
import { BaseContext, BaseContractService } from '../BaseService';
|
|
5
|
+
declare class RetailCreateOrderContext extends BaseContext {
|
|
6
|
+
private _orderNote?;
|
|
7
|
+
private _swapInNote?;
|
|
8
|
+
private _proof?;
|
|
9
|
+
private _feeAmount?;
|
|
10
|
+
private _swapMessage?;
|
|
11
|
+
constructor(signature: string);
|
|
12
|
+
set orderNote(orderNote: DarkSwapOrderNote | undefined);
|
|
13
|
+
get orderNote(): DarkSwapOrderNote | undefined;
|
|
14
|
+
set swapInNote(swapInNote: DarkSwapNote | undefined);
|
|
15
|
+
get swapInNote(): DarkSwapNote | undefined;
|
|
16
|
+
set feeAmount(feeAmount: bigint | undefined);
|
|
17
|
+
get feeAmount(): bigint | undefined;
|
|
18
|
+
set proof(proof: RetailCreateOrderProofResult | undefined);
|
|
19
|
+
get proof(): RetailCreateOrderProofResult | undefined;
|
|
20
|
+
set swapMessage(swapMessage: DarkSwapMessage | undefined);
|
|
21
|
+
get swapMessage(): DarkSwapMessage | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare class RetailCreateOrderService extends BaseContractService {
|
|
24
|
+
constructor(_darkSwap: DarkSwap);
|
|
25
|
+
prepare(address: string, depositAsset: string, depositAmount: bigint, swapInAsset: string, swapInAmount: bigint, signature: string): Promise<{
|
|
26
|
+
context: RetailCreateOrderContext;
|
|
27
|
+
swapMessage: DarkSwapMessage;
|
|
28
|
+
}>;
|
|
29
|
+
private generateProof;
|
|
30
|
+
execute(context: RetailCreateOrderContext): Promise<string>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Fr } from "@aztec/foundation/fields";
|
|
2
|
+
export type Hex = `0x${string}`;
|
|
3
|
+
export declare enum PROOF_DOMAIN {
|
|
4
|
+
DEPOSIT = 10001,
|
|
5
|
+
WITHDRAW = 10002,
|
|
6
|
+
RETAIL_CREATE_ORDER = 10003,
|
|
7
|
+
PRO_CREATE_ORDER = 10004,
|
|
8
|
+
PRO_SWAP = 10005,
|
|
9
|
+
PRO_CANCEL_ORDER = 10006,
|
|
10
|
+
RETAIL_CANCEL_ORDER = 10007,
|
|
11
|
+
JOIN = 10008,
|
|
12
|
+
TRIPLE_JOIN = 10009,
|
|
13
|
+
RETAIL_SWAP = 10010
|
|
14
|
+
}
|
|
15
|
+
export declare const EMPTY_NULLIFIER = 0n;
|
|
16
|
+
export declare const EMPTY_FOOTER = 0n;
|
|
17
|
+
export declare const FEE_RATIO_PRECISION = 1000000n;
|
|
18
|
+
export declare class DarkSwapProofError extends Error {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
export type DarkSwapNote = CreateNoteParam & {
|
|
22
|
+
note: bigint;
|
|
23
|
+
};
|
|
24
|
+
export type DarkSwapOrderNote = DarkSwapNote & {
|
|
25
|
+
feeRatio: bigint;
|
|
26
|
+
};
|
|
27
|
+
export type CreateNoteParam = {
|
|
28
|
+
rho: bigint;
|
|
29
|
+
amount: bigint;
|
|
30
|
+
asset: string;
|
|
31
|
+
};
|
|
32
|
+
export type DarkSwapNoteExt = DarkSwapNote & {
|
|
33
|
+
footer: bigint;
|
|
34
|
+
};
|
|
35
|
+
export type BaseProofParam = {
|
|
36
|
+
address: string;
|
|
37
|
+
signedMessage: string;
|
|
38
|
+
};
|
|
39
|
+
export type BaseProofResult = {
|
|
40
|
+
proof: string;
|
|
41
|
+
verifyInputs: string[];
|
|
42
|
+
};
|
|
43
|
+
export type BaseProofInput = {
|
|
44
|
+
address: string;
|
|
45
|
+
pub_key: [string, string];
|
|
46
|
+
signature: any;
|
|
47
|
+
};
|
|
48
|
+
export type DarkSwapMessage = {
|
|
49
|
+
orderNote: DarkSwapOrderNote;
|
|
50
|
+
inNote: DarkSwapNote;
|
|
51
|
+
publicKey: [Fr, Fr];
|
|
52
|
+
signature: any;
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeAddress(address: string): bigint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mimc_bn254(array: bigint[]): bigint;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function mergeUnit8Array(arr1: Uint8Array, arr2: Uint8Array): number[];
|
|
2
|
+
export declare function signatureToHexString(sig: [Uint8Array, Uint8Array]): string;
|
|
3
|
+
export declare function hexStringToSignature(hex: string): Uint8Array;
|
|
4
|
+
export declare function uint8ArrayToNumberArray(uint8Array: Uint8Array): number[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isNativeAsset(asset: string): boolean;
|
|
2
|
+
export declare function isAddressEquals(address1: string, address2: string): boolean;
|
|
3
|
+
export declare function hexlify32(value: bigint | number): string;
|
|
4
|
+
export declare function isHexEquals(hex1: string, hex2: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thesingularitynetwork/darkswap-sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"access": "public"
|
|
6
|
-
},
|
|
3
|
+
"version": "0.1.2",
|
|
7
4
|
"description": "DarkSwap SDK for browser and Node.js",
|
|
8
5
|
"type": "module",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
9
7
|
"main": "dist/index.js",
|
|
10
8
|
"files": [
|
|
11
9
|
"dist",
|
|
12
10
|
"src"
|
|
13
11
|
],
|
|
14
12
|
"scripts": {
|
|
15
|
-
"build": "
|
|
13
|
+
"build:types": "tsc -p tsconfig.json",
|
|
14
|
+
"build:js": "rollup -c",
|
|
15
|
+
"build": "yarn build:types && yarn build:js",
|
|
16
16
|
"dev": "rollup -c --bundleConfigAsCjs -w",
|
|
17
17
|
"test": "vitest",
|
|
18
18
|
"lint": "eslint src --ext .ts",
|