dop-wallet-v6 1.3.1 → 1.3.31
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/.eslintrc.js +5 -0
- package/dist/services/dop/core/react-native-init.d.ts +2 -2
- package/dist/services/dop/core/react-native-init.js +36 -15
- package/dist/services/dop/core/react-native-init.js.map +1 -1
- package/dist/services/dop/crypto/react-native-crypto-provider.js +4 -2
- package/dist/services/dop/crypto/react-native-crypto-provider.js.map +1 -1
- package/dist/services/dop/wallets/balances.js +49 -2
- package/dist/services/dop/wallets/balances.js.map +1 -1
- package/dist/services/dop/wallets/wallets.js +12 -17
- package/dist/services/dop/wallets/wallets.js.map +1 -1
- package/package.json +6 -1
- package/patches/dop-engine-v3+1.4.9.patch +55 -33
- package/dist/__tests__/index.test.d.ts +0 -1
- package/dist/__tests__/index.test.js +0 -13
- package/dist/__tests__/index.test.js.map +0 -1
- package/dist/services/artifacts/__tests__/artifact-downloader.test.d.ts +0 -1
- package/dist/services/artifacts/__tests__/artifact-downloader.test.js +0 -70
- package/dist/services/artifacts/__tests__/artifact-downloader.test.js.map +0 -1
- package/dist/services/dop/__tests__/integration.test.d.ts +0 -1
- package/dist/services/dop/__tests__/integration.test.js +0 -378
- package/dist/services/dop/__tests__/integration.test.js.map +0 -1
- package/dist/services/dop/core/__tests__/engine.test.d.ts +0 -1
- package/dist/services/dop/core/__tests__/engine.test.js +0 -30
- package/dist/services/dop/core/__tests__/engine.test.js.map +0 -1
- package/dist/services/dop/core/__tests__/providers.test.d.ts +0 -1
- package/dist/services/dop/core/__tests__/providers.test.js +0 -69
- package/dist/services/dop/core/__tests__/providers.test.js.map +0 -1
- package/dist/services/dop/dop-txids/__tests__/dop-txid-sync-graph-v2.test.d.ts +0 -1
- package/dist/services/dop/dop-txids/__tests__/dop-txid-sync-graph-v2.test.js +0 -168
- package/dist/services/dop/dop-txids/__tests__/dop-txid-sync-graph-v2.test.js.map +0 -1
- package/dist/services/dop/history/__tests__/transaction-history.test.d.ts +0 -0
- package/dist/services/dop/history/__tests__/transaction-history.test.js +0 -2
- package/dist/services/dop/history/__tests__/transaction-history.test.js.map +0 -1
- package/dist/services/dop/profile/__tests__/profile-manager.test.d.ts +0 -1
- package/dist/services/dop/profile/__tests__/profile-manager.test.js +0 -170
- package/dist/services/dop/profile/__tests__/profile-manager.test.js.map +0 -1
- package/dist/services/dop/profile/__tests__/selective-transparency.test.d.ts +0 -1
- package/dist/services/dop/profile/__tests__/selective-transparency.test.js +0 -256
- package/dist/services/dop/profile/__tests__/selective-transparency.test.js.map +0 -1
- package/dist/services/dop/profile/__tests__/storage.test.d.ts +0 -1
- package/dist/services/dop/profile/__tests__/storage.test.js +0 -174
- package/dist/services/dop/profile/__tests__/storage.test.js.map +0 -1
- package/dist/services/dop/quick-sync/V2/__tests__/quick-sync-events-graph-v2.test.d.ts +0 -1
- package/dist/services/dop/quick-sync/V2/__tests__/quick-sync-events-graph-v2.test.js +0 -126
- package/dist/services/dop/quick-sync/V2/__tests__/quick-sync-events-graph-v2.test.js.map +0 -1
- package/dist/services/dop/quick-sync/V3/__tests__/quick-sync-events-graph-v3.test.d.ts +0 -1
- package/dist/services/dop/quick-sync/V3/__tests__/quick-sync-events-graph-v3.test.js +0 -63
- package/dist/services/dop/quick-sync/V3/__tests__/quick-sync-events-graph-v3.test.js.map +0 -1
- package/dist/services/dop/util/__tests__/bytes-util.test.d.ts +0 -1
- package/dist/services/dop/util/__tests__/bytes-util.test.js +0 -23
- package/dist/services/dop/util/__tests__/bytes-util.test.js.map +0 -1
- package/dist/services/dop/util/__tests__/crypto-util.test.d.ts +0 -1
- package/dist/services/dop/util/__tests__/crypto-util.test.js +0 -62
- package/dist/services/dop/util/__tests__/crypto-util.test.js.map +0 -1
- package/dist/services/dop/wallets/__tests__/balances-live.test.d.ts +0 -1
- package/dist/services/dop/wallets/__tests__/balances-live.test.js +0 -58
- package/dist/services/dop/wallets/__tests__/balances-live.test.js.map +0 -1
- package/dist/services/dop/wallets/__tests__/balances-update.test.d.ts +0 -1
- package/dist/services/dop/wallets/__tests__/balances-update.test.js +0 -90
- package/dist/services/dop/wallets/__tests__/balances-update.test.js.map +0 -1
- package/dist/services/dop/wallets/__tests__/balances.test.d.ts +0 -1
- package/dist/services/dop/wallets/__tests__/balances.test.js +0 -59
- package/dist/services/dop/wallets/__tests__/balances.test.js.map +0 -1
- package/dist/services/dop/wallets/__tests__/wallets.test.d.ts +0 -1
- package/dist/services/dop/wallets/__tests__/wallets.test.js +0 -80
- package/dist/services/dop/wallets/__tests__/wallets.test.js.map +0 -1
- package/dist/services/ethers/__tests__/ethers-util.test.d.ts +0 -1
- package/dist/services/ethers/__tests__/ethers-util.test.js +0 -19
- package/dist/services/ethers/__tests__/ethers-util.test.js.map +0 -1
- package/dist/services/transactions/__tests__/json/formatted-relay-adapt-error-logs.json +0 -216
- package/dist/services/transactions/__tests__/proof-cache.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/proof-cache.test.js +0 -128
- package/dist/services/transactions/__tests__/proof-cache.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-cross-contract-calls.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-cross-contract-calls.test.js +0 -385
- package/dist/services/transactions/__tests__/tx-cross-contract-calls.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-decrypt.test.d.ts +0 -0
- package/dist/services/transactions/__tests__/tx-decrypt.test.js +0 -2
- package/dist/services/transactions/__tests__/tx-decrypt.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-encrypt-base-token.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-encrypt-base-token.test.js +0 -101
- package/dist/services/transactions/__tests__/tx-encrypt-base-token.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-encrypt.test.d.ts +0 -0
- package/dist/services/transactions/__tests__/tx-encrypt.test.js +0 -2
- package/dist/services/transactions/__tests__/tx-encrypt.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-gas-details.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-gas-details.test.js +0 -112
- package/dist/services/transactions/__tests__/tx-gas-details.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-notes.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-notes.test.js +0 -193
- package/dist/services/transactions/__tests__/tx-notes.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-proof-transfer-with-data.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-proof-transfer-with-data.test.js +0 -50
- package/dist/services/transactions/__tests__/tx-proof-transfer-with-data.test.js.map +0 -1
- package/dist/services/transactions/__tests__/tx-transfer.test.d.ts +0 -1
- package/dist/services/transactions/__tests__/tx-transfer.test.js +0 -280
- package/dist/services/transactions/__tests__/tx-transfer.test.js.map +0 -1
- package/dist/tests/balances.test.d.ts +0 -1
- package/dist/tests/balances.test.js +0 -419
- package/dist/tests/balances.test.js.map +0 -1
- package/dist/tests/helper.test.d.ts +0 -3
- package/dist/tests/helper.test.js +0 -16
- package/dist/tests/helper.test.js.map +0 -1
- package/dist/tests/mocks.test.d.ts +0 -50
- package/dist/tests/mocks.test.js +0 -202
- package/dist/tests/mocks.test.js.map +0 -1
- package/dist/tests/poi/test-wallet-poi-requester.test.d.ts +0 -10
- package/dist/tests/poi/test-wallet-poi-requester.test.js +0 -15
- package/dist/tests/poi/test-wallet-poi-requester.test.js.map +0 -1
- package/dist/tests/setup.test.d.ts +0 -9
- package/dist/tests/setup.test.js +0 -110
- package/dist/tests/setup.test.js.map +0 -1
- package/dist/tests/stubs/engine-stubs.test.d.ts +0 -7
- package/dist/tests/stubs/engine-stubs.test.js +0 -75
- package/dist/tests/stubs/engine-stubs.test.js.map +0 -1
- package/dist/utils/__tests__/blocked-address.test.d.ts +0 -1
- package/dist/utils/__tests__/blocked-address.test.js +0 -23
- package/dist/utils/__tests__/blocked-address.test.js.map +0 -1
- package/dist/utils/__tests__/logger.test.d.ts +0 -1
- package/dist/utils/__tests__/logger.test.js +0 -28
- package/dist/utils/__tests__/logger.test.js.map +0 -1
- package/dist/utils/__tests__/utils.test.d.ts +0 -1
- package/dist/utils/__tests__/utils.test.js +0 -21
- package/dist/utils/__tests__/utils.test.js.map +0 -1
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const dop_sharedmodels_v3_1 = require("dop-sharedmodels-v3");
|
|
7
|
-
const chai_1 = __importDefault(require("chai"));
|
|
8
|
-
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
9
|
-
const dop_txid_sync_graph_v2_1 = require("../dop-txid-sync-graph-v2");
|
|
10
|
-
chai_1.default.use(chai_as_promised_1.default);
|
|
11
|
-
const { expect } = chai_1.default;
|
|
12
|
-
describe('dop-txid-sync-graph', () => {
|
|
13
|
-
it('Should pull dop txs subsquid query - Ethereum', async () => {
|
|
14
|
-
const dopTxs = await (0, dop_txid_sync_graph_v2_1.quickSyncDopTransactionsV2)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Ethereum].chain, undefined);
|
|
15
|
-
expect(dopTxs).to.be.an('array');
|
|
16
|
-
expect(dopTxs.length).to.equal(5000);
|
|
17
|
-
expect(dopTxs[0].commitments).to.deep.equal([
|
|
18
|
-
'0x1afd01a29faf22dcc5678694092a08d38de99fc97d07b9281fa66f956ce43579',
|
|
19
|
-
'0x2ffc716d8ae767995961bbde4a208dbae438783065bbd200f51a8d4e97cc2289',
|
|
20
|
-
'0x078f9824c86b2488714eb76dc15199c3fa21903517d5f3e19ab2035d264400b6',
|
|
21
|
-
]);
|
|
22
|
-
expect(dopTxs[0].nullifiers).to.deep.equal([
|
|
23
|
-
'0x1e52cee52f67c37a468458671cddde6b56390dcbdc4cf3b770badc0e78d66401',
|
|
24
|
-
'0x0ac9f5ab5bcb5a115a3efdd0475f6c22dc6a6841caf35a52ecf86a802bfce8ee',
|
|
25
|
-
]);
|
|
26
|
-
expect(dopTxs[0].graphID).to.equal('0x0000000000000000000000000000000000000000000000000000000000e1285000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000000');
|
|
27
|
-
expect(dopTxs[0].boundParamsHash).to.equal('0x2c72a0bcce4f1169dd988204775483938ded5f5899cec84829b1cc667a683784');
|
|
28
|
-
expect(dopTxs[0].txid).to.equal('f07a9a458f57f1cc9cc2e5a627c3ef611a18b77e10c2bfc133fceca7743f8d0c');
|
|
29
|
-
expect(dopTxs[0].utxoTreeIn).to.equal(0);
|
|
30
|
-
expect(dopTxs[0].utxoTreeOut).to.equal(0);
|
|
31
|
-
expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(2);
|
|
32
|
-
expect(dopTxs[0].decrypt).to.equal(undefined);
|
|
33
|
-
expect(dopTxs[0].blockNumber).to.equal(14755920);
|
|
34
|
-
expect(dopTxs[0].verificationHash).to.equal('0x099cd3ebcadaf6ff470d16bc0186fb5f26cd4103e9970effc9b6679478e11c72');
|
|
35
|
-
}).timeout(20000);
|
|
36
|
-
it('Should pull decrypt dop txids - Ethereum', async () => {
|
|
37
|
-
const decryptDopTxids = await (0, dop_txid_sync_graph_v2_1.getDopTxidsForDecrypts)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Ethereum].chain, '0x0b3b7179df1377c0a13058508e7dff2dbe8f73c39d68f569bc90b1c8b277082e');
|
|
38
|
-
expect(decryptDopTxids).to.deep.equal([
|
|
39
|
-
'065bcb1a9d4cfa110f05b480f79f27fe2ad672868d3d1bdec05df2ddaec8333d',
|
|
40
|
-
]);
|
|
41
|
-
}).timeout(20000);
|
|
42
|
-
it('Should pull dop txs subsquid query - Polygon', async () => {
|
|
43
|
-
const dopTxs = await (0, dop_txid_sync_graph_v2_1.quickSyncDopTransactionsV2)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Polygon].chain, undefined);
|
|
44
|
-
expect(dopTxs).to.be.an('array');
|
|
45
|
-
expect(dopTxs.length).to.equal(5000);
|
|
46
|
-
expect(dopTxs[0].commitments).to.deep.equal([
|
|
47
|
-
'0x06c764e6221b61792530c5d6d33710b9cd4c4d4f734265a4e9070cf081436079',
|
|
48
|
-
'0x140459c3519d73d56d292fd6d51292980f640623f008a4df063d387a819a7451',
|
|
49
|
-
'0x23303173569d99ffd5799f526bd53cb81073e2d6e9ff8f4b07bed8d948722673',
|
|
50
|
-
]);
|
|
51
|
-
expect(dopTxs[0].nullifiers).to.deep.equal([
|
|
52
|
-
'0x1e52cee52f67c37a468458671cddde6b56390dcbdc4cf3b770badc0e78d66401',
|
|
53
|
-
]);
|
|
54
|
-
expect(dopTxs[0].graphID).to.equal('0x0000000000000000000000000000000000000000000000000000000001ae397e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000');
|
|
55
|
-
expect(dopTxs[0].boundParamsHash).to.equal('0x251fcceba8b19129e88aff1e5214ad6f2a807e4a095075e55873aa59416111a2');
|
|
56
|
-
expect(dopTxs[0].txid).to.equal('65df130da6a571fbcceb8538400f37bcaa4fe508caec7ab05f3b438f303bfe31');
|
|
57
|
-
expect(dopTxs[0].utxoTreeIn).to.equal(0);
|
|
58
|
-
expect(dopTxs[0].utxoTreeOut).to.equal(0);
|
|
59
|
-
expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(2);
|
|
60
|
-
expect(dopTxs[0].decrypt).to.equal(undefined);
|
|
61
|
-
expect(dopTxs[0].blockNumber).to.equal(28195198);
|
|
62
|
-
expect(dopTxs[0].verificationHash).to.equal('0x099cd3ebcadaf6ff470d16bc0186fb5f26cd4103e9970effc9b6679478e11c72');
|
|
63
|
-
}).timeout(20000);
|
|
64
|
-
it('Should pull decrypt dop txids - Polygon', async () => {
|
|
65
|
-
const decryptDopTxids = await (0, dop_txid_sync_graph_v2_1.getDopTxidsForDecrypts)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Polygon].chain, '0x7310a30b3a0dcec299917d5cd7ef2feab8c0507c41ec17649f38a21b4093dc32');
|
|
66
|
-
expect(decryptDopTxids).to.deep.equal([
|
|
67
|
-
'113827d5fea4ebacffc3ab7289e6185d328c51c5f59ecbcd874d8f73e5638e27',
|
|
68
|
-
]);
|
|
69
|
-
}).timeout(20000);
|
|
70
|
-
it('Should pull dop txs subsquid query - Arbitrum', async () => {
|
|
71
|
-
const dopTxs = await (0, dop_txid_sync_graph_v2_1.quickSyncDopTransactionsV2)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Arbitrum].chain, undefined);
|
|
72
|
-
expect(dopTxs).to.be.an('array');
|
|
73
|
-
expect(dopTxs.length).to.equal(5000);
|
|
74
|
-
expect(dopTxs[0].commitments).to.deep.equal([
|
|
75
|
-
'0x0bb9f2d13f87b8ba19b7f5bb7750148faeb0fed4a97bc6c3e63d7fe2a7b6d63e',
|
|
76
|
-
'0x217fb14374fcc4eca2d92c204bad0b2b36f6787e3268ae4740c992c632f7691c',
|
|
77
|
-
]);
|
|
78
|
-
expect(dopTxs[0].nullifiers).to.deep.equal([
|
|
79
|
-
'0x25234f8100ee0b86e2f331f255d982ba60d05710ceae8f226f6254addd362b1f',
|
|
80
|
-
]);
|
|
81
|
-
expect(dopTxs[0].graphID).to.equal('0x00000000000000000000000000000000000000000000000000000000039dd19000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000');
|
|
82
|
-
expect(dopTxs[0].boundParamsHash).to.equal('0x2bb2954938dfcfdcc47253fd59d2225fc98feab293eb1bc80eff5d9d79de05a2');
|
|
83
|
-
expect(dopTxs[0].txid).to.equal('cb4293e3a81241ef8b6c48285e4860222d9c147da8583aa1d53a7117f230c368');
|
|
84
|
-
expect(dopTxs[0].utxoTreeIn).to.equal(0);
|
|
85
|
-
expect(dopTxs[0].utxoTreeOut).to.equal(0);
|
|
86
|
-
expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(1);
|
|
87
|
-
expect(dopTxs[0].decrypt).to.deep.equal({
|
|
88
|
-
tokenData: {
|
|
89
|
-
tokenType: 0,
|
|
90
|
-
tokenAddress: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
91
|
-
tokenSubID: '0x00',
|
|
92
|
-
},
|
|
93
|
-
toAddress: '0x5ad95c537b002770a39dea342c4bb2b68b1497aa',
|
|
94
|
-
value: '1000000000000000',
|
|
95
|
-
});
|
|
96
|
-
expect(dopTxs[0].blockNumber).to.equal(60674448);
|
|
97
|
-
expect(dopTxs[0].verificationHash).to.equal('0x4f7406636df927247b46552673d024567d99fd60e5fb50159ba47a170580308a');
|
|
98
|
-
}).timeout(20000);
|
|
99
|
-
it('Should pull decrypt dop txids - Arbitrum', async () => {
|
|
100
|
-
const decryptDopTxids = await (0, dop_txid_sync_graph_v2_1.getDopTxidsForDecrypts)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.Arbitrum].chain, '0xcb4293e3a81241ef8b6c48285e4860222d9c147da8583aa1d53a7117f230c368');
|
|
101
|
-
expect(decryptDopTxids).to.deep.equal([
|
|
102
|
-
'1bef936762f21323e57539cdf4b87251279b34880881ae003219058dacc258a7',
|
|
103
|
-
]);
|
|
104
|
-
}).timeout(20000);
|
|
105
|
-
it('Should pull dop txs subsquid query - BNBChain', async () => {
|
|
106
|
-
const dopTxs = await (0, dop_txid_sync_graph_v2_1.quickSyncDopTransactionsV2)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.BNBChain].chain, undefined);
|
|
107
|
-
expect(dopTxs).to.be.an('array');
|
|
108
|
-
expect(dopTxs.length).to.equal(5000);
|
|
109
|
-
expect(dopTxs[0].commitments).to.deep.equal([
|
|
110
|
-
'0x2f1f83e339c05d14f102088c0c3f2b8f8addbd8497a88ef49a1e9c942bbb0f87',
|
|
111
|
-
'0x275c216c06fd5e68bb65f46f85e93afb563f9bad08b2eaf222a38ce6d848c004',
|
|
112
|
-
]);
|
|
113
|
-
expect(dopTxs[0].nullifiers).to.deep.equal([
|
|
114
|
-
'0x1866ea0094491975f18fa92ba6fac7c2f562bbc49e975866643108dd15f0a6b2',
|
|
115
|
-
]);
|
|
116
|
-
expect(dopTxs[0].graphID).to.equal('0x00000000000000000000000000000000000000000000000000000000010f2d7b000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000000');
|
|
117
|
-
expect(dopTxs[0].boundParamsHash).to.equal('0x0d0cc0770e4915c2b841f394834c0e3b2d5807642c23a9578a1bbc80f8b47f6a');
|
|
118
|
-
expect(dopTxs[0].txid).to.equal('4388f3727fe7f9cfd0d57807f7a2a126fbb7e56a25a17e3e99102931ea2e4b33');
|
|
119
|
-
expect(dopTxs[0].utxoTreeIn).to.equal(0);
|
|
120
|
-
expect(dopTxs[0].utxoTreeOut).to.equal(0);
|
|
121
|
-
expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(4);
|
|
122
|
-
expect(dopTxs[0].decrypt).to.equal(undefined);
|
|
123
|
-
expect(dopTxs[0].blockNumber).to.equal(17771899);
|
|
124
|
-
expect(dopTxs[0].verificationHash).to.equal('0x5052ad94d14b1f0a16fa8ca6680f9736a357cc73798695d3e1247ca95483415c');
|
|
125
|
-
}).timeout(20000);
|
|
126
|
-
it('Should pull decrypt dop txids - BNBChain', async () => {
|
|
127
|
-
const decryptDopTxids = await (0, dop_txid_sync_graph_v2_1.getDopTxidsForDecrypts)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.BNBChain].chain, '0xcef99c75d555b81625e5e96304716b04bd6900d99b664fda7d5a89265dca3c38');
|
|
128
|
-
expect(decryptDopTxids).to.deep.equal([
|
|
129
|
-
'27fe3f9eef756cba48cf2850935c20dc7faf36911fe2cc43b69b4650912e09e0',
|
|
130
|
-
]);
|
|
131
|
-
}).timeout(20000);
|
|
132
|
-
it('Should pull dop txs subsquid query - Sepolia', async () => {
|
|
133
|
-
const dopTxs = await (0, dop_txid_sync_graph_v2_1.quickSyncDopTransactionsV2)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.EthereumSepolia].chain, undefined);
|
|
134
|
-
expect(dopTxs).to.be.an('array');
|
|
135
|
-
expect(dopTxs.length).to.be.greaterThanOrEqual(10);
|
|
136
|
-
expect(dopTxs[0].commitments).to.deep.equal([
|
|
137
|
-
'0x213b8672321b8b6d4165528e3146b1c25da4656fd93db74efa3258416e20b5d9',
|
|
138
|
-
'0x14b55264849684c1d549c44b469e1047d67f06bfdb6aa22f1d14e1c545d749a5',
|
|
139
|
-
]);
|
|
140
|
-
expect(dopTxs[0].nullifiers).to.deep.equal([
|
|
141
|
-
'0x25234f8100ee0b86e2f331f255d982ba60d05710ceae8f226f6254addd362b1f',
|
|
142
|
-
]);
|
|
143
|
-
expect(dopTxs[0].graphID).to.equal('0x00000000000000000000000000000000000000000000000000000000005b001e000000000000000000000000000000000000000000000000000000000000003b0000000000000000000000000000000000000000000000000000000000000000');
|
|
144
|
-
expect(dopTxs[0].boundParamsHash).to.equal('0x1a2fec90b4354f18153226a457bc24fe480fa816f2cf8ae13419be7938f80b51');
|
|
145
|
-
expect(dopTxs[0].txid).to.equal('e629e8f89ab98fee9dadacb9323746e4c150dee57917218509e94d9e35cc1db0');
|
|
146
|
-
expect(dopTxs[0].utxoTreeIn).to.equal(0);
|
|
147
|
-
expect(dopTxs[0].utxoTreeOut).to.equal(0);
|
|
148
|
-
expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(1);
|
|
149
|
-
expect(dopTxs[0].decrypt).to.deep.equal({
|
|
150
|
-
tokenData: {
|
|
151
|
-
tokenType: 0,
|
|
152
|
-
tokenAddress: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
153
|
-
tokenSubID: '0x00',
|
|
154
|
-
},
|
|
155
|
-
toAddress: '0x7e3d929ebd5bdc84d02bd3205c777578f33a214d',
|
|
156
|
-
value: '10025062656641604',
|
|
157
|
-
});
|
|
158
|
-
expect(dopTxs[0].blockNumber).to.equal(5963806);
|
|
159
|
-
expect(dopTxs[0].verificationHash).to.equal('0x4f7406636df927247b46552673d024567d99fd60e5fb50159ba47a170580308a');
|
|
160
|
-
}).timeout(20000);
|
|
161
|
-
it('Should pull decrypt dop txids - Sepolia', async () => {
|
|
162
|
-
const decryptDopTxids = await (0, dop_txid_sync_graph_v2_1.getDopTxidsForDecrypts)(dop_sharedmodels_v3_1.NETWORK_CONFIG[dop_sharedmodels_v3_1.NetworkName.EthereumSepolia].chain, '0xe629e8f89ab98fee9dadacb9323746e4c150dee57917218509e94d9e35cc1db0');
|
|
163
|
-
expect(decryptDopTxids).to.deep.equal([
|
|
164
|
-
'1acb0bd1981ecdf3652d3580b72bcb97cbfe635abf66e339d8e6d8577184f65e',
|
|
165
|
-
]);
|
|
166
|
-
}).timeout(20000);
|
|
167
|
-
});
|
|
168
|
-
//# sourceMappingURL=dop-txid-sync-graph-v2.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dop-txid-sync-graph-v2.test.js","sourceRoot":"","sources":["../../../../../src/services/dop/dop-txids/__tests__/dop-txid-sync-graph-v2.test.ts"],"names":[],"mappings":";;;;;AACA,6DAAkE;AAClE,gDAAwB;AACxB,wEAA8C;AAC9C,sEAGmC;AAEnC,cAAI,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACzB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAI,CAAC;AAExB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,MAAM,GACV,MAAM,IAAA,mDAA0B,EAC9B,oCA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AAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CACzC,oEAAoE,CACrE,CAAC;IACJ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAM,CAAC,CAAC;IAEnB,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,MAAM,eAAe,GAAa,MAAM,IAAA,+CAAsB,EAC5D,oCAAc,CAAC,iCAAW,CAAC,eAAe,CAAC,CAAC,KAAK,EACjD,oEAAoE,CACrE,CAAC;QAEF,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACpC,kEAAkE;SACnE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC","sourcesContent":["import { DopTransactionV2 } from 'dop-engine-v3';\nimport { NetworkName, NETWORK_CONFIG } from 'dop-sharedmodels-v3';\nimport chai from 'chai';\nimport chaiAsPromised from 'chai-as-promised';\nimport {\n getDopTxidsForDecrypts,\n quickSyncDopTransactionsV2,\n} from '../dop-txid-sync-graph-v2';\n\nchai.use(chaiAsPromised);\nconst { expect } = chai;\n\ndescribe('dop-txid-sync-graph', () => {\n it('Should pull dop txs subsquid query - Ethereum', async () => {\n const dopTxs: DopTransactionV2[] =\n await quickSyncDopTransactionsV2(\n NETWORK_CONFIG[NetworkName.Ethereum].chain,\n undefined,\n );\n\n expect(dopTxs).to.be.an('array');\n expect(dopTxs.length).to.equal(5000);\n\n expect(dopTxs[0].commitments).to.deep.equal([\n '0x1afd01a29faf22dcc5678694092a08d38de99fc97d07b9281fa66f956ce43579',\n '0x2ffc716d8ae767995961bbde4a208dbae438783065bbd200f51a8d4e97cc2289',\n '0x078f9824c86b2488714eb76dc15199c3fa21903517d5f3e19ab2035d264400b6',\n ]);\n expect(dopTxs[0].nullifiers).to.deep.equal([\n '0x1e52cee52f67c37a468458671cddde6b56390dcbdc4cf3b770badc0e78d66401',\n '0x0ac9f5ab5bcb5a115a3efdd0475f6c22dc6a6841caf35a52ecf86a802bfce8ee',\n ]);\n expect(dopTxs[0].graphID).to.equal(\n '0x0000000000000000000000000000000000000000000000000000000000e1285000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000000',\n );\n expect(dopTxs[0].boundParamsHash).to.equal(\n '0x2c72a0bcce4f1169dd988204775483938ded5f5899cec84829b1cc667a683784',\n );\n expect(dopTxs[0].txid).to.equal(\n 'f07a9a458f57f1cc9cc2e5a627c3ef611a18b77e10c2bfc133fceca7743f8d0c',\n );\n expect(dopTxs[0].utxoTreeIn).to.equal(0);\n expect(dopTxs[0].utxoTreeOut).to.equal(0);\n expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(2);\n expect(dopTxs[0].decrypt).to.equal(undefined);\n expect(dopTxs[0].blockNumber).to.equal(14755920);\n expect(dopTxs[0].verificationHash).to.equal(\n '0x099cd3ebcadaf6ff470d16bc0186fb5f26cd4103e9970effc9b6679478e11c72',\n );\n }).timeout(20_000);\n\n it('Should pull decrypt dop txids - Ethereum', async () => {\n const decryptDopTxids: string[] = await getDopTxidsForDecrypts(\n NETWORK_CONFIG[NetworkName.Ethereum].chain,\n '0x0b3b7179df1377c0a13058508e7dff2dbe8f73c39d68f569bc90b1c8b277082e',\n );\n\n expect(decryptDopTxids).to.deep.equal([\n '065bcb1a9d4cfa110f05b480f79f27fe2ad672868d3d1bdec05df2ddaec8333d',\n ]);\n }).timeout(20000);\n\n it('Should pull dop txs subsquid query - Polygon', async () => {\n const dopTxs: DopTransactionV2[] =\n await quickSyncDopTransactionsV2(\n NETWORK_CONFIG[NetworkName.Polygon].chain,\n undefined,\n );\n\n expect(dopTxs).to.be.an('array');\n expect(dopTxs.length).to.equal(5000);\n\n expect(dopTxs[0].commitments).to.deep.equal([\n '0x06c764e6221b61792530c5d6d33710b9cd4c4d4f734265a4e9070cf081436079',\n '0x140459c3519d73d56d292fd6d51292980f640623f008a4df063d387a819a7451',\n '0x23303173569d99ffd5799f526bd53cb81073e2d6e9ff8f4b07bed8d948722673',\n ]);\n expect(dopTxs[0].nullifiers).to.deep.equal([\n '0x1e52cee52f67c37a468458671cddde6b56390dcbdc4cf3b770badc0e78d66401',\n ]);\n expect(dopTxs[0].graphID).to.equal(\n '0x0000000000000000000000000000000000000000000000000000000001ae397e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000',\n );\n expect(dopTxs[0].boundParamsHash).to.equal(\n '0x251fcceba8b19129e88aff1e5214ad6f2a807e4a095075e55873aa59416111a2',\n );\n expect(dopTxs[0].txid).to.equal(\n '65df130da6a571fbcceb8538400f37bcaa4fe508caec7ab05f3b438f303bfe31',\n );\n expect(dopTxs[0].utxoTreeIn).to.equal(0);\n expect(dopTxs[0].utxoTreeOut).to.equal(0);\n expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(2);\n expect(dopTxs[0].decrypt).to.equal(undefined);\n expect(dopTxs[0].blockNumber).to.equal(28195198);\n expect(dopTxs[0].verificationHash).to.equal(\n '0x099cd3ebcadaf6ff470d16bc0186fb5f26cd4103e9970effc9b6679478e11c72',\n );\n }).timeout(20_000);\n\n it('Should pull decrypt dop txids - Polygon', async () => {\n const decryptDopTxids: string[] = await getDopTxidsForDecrypts(\n NETWORK_CONFIG[NetworkName.Polygon].chain,\n '0x7310a30b3a0dcec299917d5cd7ef2feab8c0507c41ec17649f38a21b4093dc32',\n );\n\n expect(decryptDopTxids).to.deep.equal([\n '113827d5fea4ebacffc3ab7289e6185d328c51c5f59ecbcd874d8f73e5638e27',\n ]);\n }).timeout(20000);\n\n it('Should pull dop txs subsquid query - Arbitrum', async () => {\n const dopTxs: DopTransactionV2[] =\n await quickSyncDopTransactionsV2(\n NETWORK_CONFIG[NetworkName.Arbitrum].chain,\n undefined,\n );\n\n expect(dopTxs).to.be.an('array');\n expect(dopTxs.length).to.equal(5000);\n\n expect(dopTxs[0].commitments).to.deep.equal([\n '0x0bb9f2d13f87b8ba19b7f5bb7750148faeb0fed4a97bc6c3e63d7fe2a7b6d63e',\n '0x217fb14374fcc4eca2d92c204bad0b2b36f6787e3268ae4740c992c632f7691c',\n ]);\n expect(dopTxs[0].nullifiers).to.deep.equal([\n '0x25234f8100ee0b86e2f331f255d982ba60d05710ceae8f226f6254addd362b1f',\n ]);\n expect(dopTxs[0].graphID).to.equal(\n '0x00000000000000000000000000000000000000000000000000000000039dd19000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000',\n );\n expect(dopTxs[0].boundParamsHash).to.equal(\n '0x2bb2954938dfcfdcc47253fd59d2225fc98feab293eb1bc80eff5d9d79de05a2',\n );\n expect(dopTxs[0].txid).to.equal(\n 'cb4293e3a81241ef8b6c48285e4860222d9c147da8583aa1d53a7117f230c368',\n );\n expect(dopTxs[0].utxoTreeIn).to.equal(0);\n expect(dopTxs[0].utxoTreeOut).to.equal(0);\n expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(1);\n expect(dopTxs[0].decrypt).to.deep.equal({\n tokenData: {\n tokenType: 0,\n tokenAddress: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',\n tokenSubID: '0x00',\n },\n toAddress: '0x5ad95c537b002770a39dea342c4bb2b68b1497aa',\n value: '1000000000000000',\n });\n expect(dopTxs[0].blockNumber).to.equal(60674448);\n expect(dopTxs[0].verificationHash).to.equal(\n '0x4f7406636df927247b46552673d024567d99fd60e5fb50159ba47a170580308a',\n );\n }).timeout(20_000);\n\n it('Should pull decrypt dop txids - Arbitrum', async () => {\n const decryptDopTxids: string[] = await getDopTxidsForDecrypts(\n NETWORK_CONFIG[NetworkName.Arbitrum].chain,\n '0xcb4293e3a81241ef8b6c48285e4860222d9c147da8583aa1d53a7117f230c368',\n );\n\n expect(decryptDopTxids).to.deep.equal([\n '1bef936762f21323e57539cdf4b87251279b34880881ae003219058dacc258a7',\n ]);\n }).timeout(20000);\n\n it('Should pull dop txs subsquid query - BNBChain', async () => {\n const dopTxs: DopTransactionV2[] =\n await quickSyncDopTransactionsV2(\n NETWORK_CONFIG[NetworkName.BNBChain].chain,\n undefined,\n );\n\n expect(dopTxs).to.be.an('array');\n expect(dopTxs.length).to.equal(5000);\n\n expect(dopTxs[0].commitments).to.deep.equal([\n '0x2f1f83e339c05d14f102088c0c3f2b8f8addbd8497a88ef49a1e9c942bbb0f87',\n '0x275c216c06fd5e68bb65f46f85e93afb563f9bad08b2eaf222a38ce6d848c004',\n ]);\n expect(dopTxs[0].nullifiers).to.deep.equal([\n '0x1866ea0094491975f18fa92ba6fac7c2f562bbc49e975866643108dd15f0a6b2',\n ]);\n expect(dopTxs[0].graphID).to.equal(\n '0x00000000000000000000000000000000000000000000000000000000010f2d7b000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000000',\n );\n expect(dopTxs[0].boundParamsHash).to.equal(\n '0x0d0cc0770e4915c2b841f394834c0e3b2d5807642c23a9578a1bbc80f8b47f6a',\n );\n expect(dopTxs[0].txid).to.equal(\n '4388f3727fe7f9cfd0d57807f7a2a126fbb7e56a25a17e3e99102931ea2e4b33',\n );\n expect(dopTxs[0].utxoTreeIn).to.equal(0);\n expect(dopTxs[0].utxoTreeOut).to.equal(0);\n expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(4);\n expect(dopTxs[0].decrypt).to.equal(undefined);\n expect(dopTxs[0].blockNumber).to.equal(17771899);\n expect(dopTxs[0].verificationHash).to.equal(\n '0x5052ad94d14b1f0a16fa8ca6680f9736a357cc73798695d3e1247ca95483415c',\n );\n }).timeout(20_000);\n\n it('Should pull decrypt dop txids - BNBChain', async () => {\n const decryptDopTxids: string[] = await getDopTxidsForDecrypts(\n NETWORK_CONFIG[NetworkName.BNBChain].chain,\n '0xcef99c75d555b81625e5e96304716b04bd6900d99b664fda7d5a89265dca3c38',\n );\n\n expect(decryptDopTxids).to.deep.equal([\n '27fe3f9eef756cba48cf2850935c20dc7faf36911fe2cc43b69b4650912e09e0',\n ]);\n }).timeout(20000);\n\n it('Should pull dop txs subsquid query - Sepolia', async () => {\n const dopTxs: DopTransactionV2[] =\n await quickSyncDopTransactionsV2(\n NETWORK_CONFIG[NetworkName.EthereumSepolia].chain,\n undefined,\n );\n\n expect(dopTxs).to.be.an('array');\n expect(dopTxs.length).to.be.greaterThanOrEqual(10);\n\n expect(dopTxs[0].commitments).to.deep.equal([\n '0x213b8672321b8b6d4165528e3146b1c25da4656fd93db74efa3258416e20b5d9',\n '0x14b55264849684c1d549c44b469e1047d67f06bfdb6aa22f1d14e1c545d749a5',\n ]);\n expect(dopTxs[0].nullifiers).to.deep.equal([\n '0x25234f8100ee0b86e2f331f255d982ba60d05710ceae8f226f6254addd362b1f',\n ]);\n expect(dopTxs[0].graphID).to.equal(\n '0x00000000000000000000000000000000000000000000000000000000005b001e000000000000000000000000000000000000000000000000000000000000003b0000000000000000000000000000000000000000000000000000000000000000',\n );\n expect(dopTxs[0].boundParamsHash).to.equal(\n '0x1a2fec90b4354f18153226a457bc24fe480fa816f2cf8ae13419be7938f80b51',\n );\n expect(dopTxs[0].txid).to.equal(\n 'e629e8f89ab98fee9dadacb9323746e4c150dee57917218509e94d9e35cc1db0',\n );\n expect(dopTxs[0].utxoTreeIn).to.equal(0);\n expect(dopTxs[0].utxoTreeOut).to.equal(0);\n expect(dopTxs[0].utxoBatchStartPositionOut).to.equal(1);\n expect(dopTxs[0].decrypt).to.deep.equal({\n tokenData: {\n tokenType: 0,\n tokenAddress: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',\n tokenSubID: '0x00',\n },\n toAddress: '0x7e3d929ebd5bdc84d02bd3205c777578f33a214d',\n value: '10025062656641604',\n });\n expect(dopTxs[0].blockNumber).to.equal(5963806);\n expect(dopTxs[0].verificationHash).to.equal(\n '0x4f7406636df927247b46552673d024567d99fd60e5fb50159ba47a170580308a',\n );\n }).timeout(20_000);\n\n it('Should pull decrypt dop txids - Sepolia', async () => {\n const decryptDopTxids: string[] = await getDopTxidsForDecrypts(\n NETWORK_CONFIG[NetworkName.EthereumSepolia].chain,\n '0xe629e8f89ab98fee9dadacb9323746e4c150dee57917218509e94d9e35cc1db0',\n );\n\n expect(decryptDopTxids).to.deep.equal([\n '1acb0bd1981ecdf3652d3580b72bcb97cbfe635abf66e339d8e6d8577184f65e',\n ]);\n }).timeout(20000);\n});\n"]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-history.test.js","sourceRoot":"","sources":["../../../../../src/services/dop/history/__tests__/transaction-history.test.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const chai_1 = __importDefault(require("chai"));
|
|
7
|
-
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
8
|
-
const leveldown_1 = __importDefault(require("leveldown"));
|
|
9
|
-
const profile_manager_1 = require("../profile-manager");
|
|
10
|
-
const storage_1 = require("../storage");
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
|
-
chai_1.default.use(chai_as_promised_1.default);
|
|
13
|
-
const { expect } = chai_1.default;
|
|
14
|
-
describe('ProfileManager', () => {
|
|
15
|
-
let profileManager;
|
|
16
|
-
let testStorage;
|
|
17
|
-
let db;
|
|
18
|
-
const testDbPath = 'test-profile-manager-db';
|
|
19
|
-
const mockWalletId = 'test-wallet-id';
|
|
20
|
-
const mockProfileData = {
|
|
21
|
-
username: 'testuser',
|
|
22
|
-
bio: 'Test bio',
|
|
23
|
-
profilePicture: 'https://example.com/avatar.jpg',
|
|
24
|
-
socialLinks: {
|
|
25
|
-
twitter: 'https://twitter.com/testuser',
|
|
26
|
-
github: 'https://github.com/testuser',
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
beforeEach(async () => {
|
|
30
|
-
db = new leveldown_1.default(testDbPath);
|
|
31
|
-
await new Promise((resolve, reject) => {
|
|
32
|
-
db.open((err) => {
|
|
33
|
-
if (err)
|
|
34
|
-
reject(err);
|
|
35
|
-
else
|
|
36
|
-
resolve();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
testStorage = new storage_1.ProfileStorage(db);
|
|
40
|
-
profileManager = new profile_manager_1.ProfileManager();
|
|
41
|
-
profileManager.setStorage(testStorage);
|
|
42
|
-
});
|
|
43
|
-
afterEach(async () => {
|
|
44
|
-
await new Promise((resolve, reject) => {
|
|
45
|
-
db.close((err) => {
|
|
46
|
-
if (err)
|
|
47
|
-
reject(err);
|
|
48
|
-
else
|
|
49
|
-
resolve();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
try {
|
|
53
|
-
(0, fs_1.rmSync)(testDbPath, { recursive: true });
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
// Ignore cleanup errors
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
describe('profile management', () => {
|
|
60
|
-
it('should create a new profile', async () => {
|
|
61
|
-
const result = await profileManager.createProfile(mockWalletId, mockProfileData);
|
|
62
|
-
expect(result.id).to.equal(mockWalletId);
|
|
63
|
-
expect(result.username).to.equal(mockProfileData.username);
|
|
64
|
-
expect(result.bio).to.equal(mockProfileData.bio);
|
|
65
|
-
});
|
|
66
|
-
it('should get profile by wallet ID', async () => {
|
|
67
|
-
await profileManager.createProfile(mockWalletId, mockProfileData);
|
|
68
|
-
const result = await profileManager.getProfile(mockWalletId);
|
|
69
|
-
expect(result).to.not.be.undefined;
|
|
70
|
-
if (result) {
|
|
71
|
-
expect(result.id).to.equal(mockWalletId);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
it('should return undefined for non-existent profile', async () => {
|
|
75
|
-
const result = await profileManager.getProfile('non-existent-id');
|
|
76
|
-
expect(result).to.be.undefined;
|
|
77
|
-
});
|
|
78
|
-
it('should update profile', async () => {
|
|
79
|
-
await profileManager.createProfile(mockWalletId, mockProfileData);
|
|
80
|
-
const updates = {
|
|
81
|
-
bio: 'Updated bio',
|
|
82
|
-
};
|
|
83
|
-
const result = await profileManager.updateProfile(mockWalletId, updates);
|
|
84
|
-
expect(result.bio).to.equal(updates.bio);
|
|
85
|
-
expect(result.username).to.equal(mockProfileData.username); // unchanged
|
|
86
|
-
});
|
|
87
|
-
it('should delete profile', async () => {
|
|
88
|
-
await profileManager.createProfile(mockWalletId, mockProfileData);
|
|
89
|
-
await profileManager.deleteProfile(mockWalletId);
|
|
90
|
-
const deletedProfile = await profileManager.getProfile(mockWalletId);
|
|
91
|
-
expect(deletedProfile).to.be.undefined;
|
|
92
|
-
});
|
|
93
|
-
it('should throw error when deleting non-existent profile', async () => {
|
|
94
|
-
await expect(profileManager.deleteProfile('non-existent-id'))
|
|
95
|
-
.to.be.rejectedWith('Profile not found');
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe('profile customization', () => {
|
|
99
|
-
it('should set profile customization', async () => {
|
|
100
|
-
// Create a profile first
|
|
101
|
-
await profileManager.createProfile(mockWalletId, mockProfileData);
|
|
102
|
-
const customization = {
|
|
103
|
-
theme: 'dark',
|
|
104
|
-
displayPreferences: {
|
|
105
|
-
currencyFormat: 'USD',
|
|
106
|
-
numberFormat: 'full',
|
|
107
|
-
dateFormat: 'MM/DD/YYYY',
|
|
108
|
-
timeFormat: '12h',
|
|
109
|
-
},
|
|
110
|
-
privacyAlerts: {
|
|
111
|
-
newViewingRequest: true,
|
|
112
|
-
profileUpdate: false,
|
|
113
|
-
assetVisibilityChange: true,
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
await profileManager.setCustomization(mockWalletId, customization);
|
|
117
|
-
const result = await profileManager.getCustomization(mockWalletId);
|
|
118
|
-
expect(result).to.deep.equal(customization);
|
|
119
|
-
});
|
|
120
|
-
it('should return undefined for non-existent customization', async () => {
|
|
121
|
-
const result = await profileManager.getCustomization('non-existent-id');
|
|
122
|
-
expect(result).to.be.undefined;
|
|
123
|
-
});
|
|
124
|
-
it('should throw error when setting customization for non-existent profile', async () => {
|
|
125
|
-
const customization = {
|
|
126
|
-
theme: 'dark',
|
|
127
|
-
displayPreferences: {
|
|
128
|
-
currencyFormat: 'USD',
|
|
129
|
-
numberFormat: 'full',
|
|
130
|
-
dateFormat: 'MM/DD/YYYY',
|
|
131
|
-
timeFormat: '12h',
|
|
132
|
-
},
|
|
133
|
-
privacyAlerts: {
|
|
134
|
-
newViewingRequest: true,
|
|
135
|
-
profileUpdate: false,
|
|
136
|
-
assetVisibilityChange: true,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
await expect(profileManager.setCustomization('non-existent-id', customization))
|
|
140
|
-
.to.be.rejectedWith('Profile not found');
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
describe('validation', () => {
|
|
144
|
-
it('should throw error for invalid username', async () => {
|
|
145
|
-
const invalidProfile = {
|
|
146
|
-
...mockProfileData,
|
|
147
|
-
username: '', // empty username
|
|
148
|
-
};
|
|
149
|
-
await expect(profileManager.createProfile(mockWalletId, invalidProfile))
|
|
150
|
-
.to.be.rejectedWith('Invalid username');
|
|
151
|
-
});
|
|
152
|
-
it('should throw error for invalid bio', async () => {
|
|
153
|
-
const invalidProfile = {
|
|
154
|
-
...mockProfileData,
|
|
155
|
-
bio: 'a'.repeat(501), // too long
|
|
156
|
-
};
|
|
157
|
-
await expect(profileManager.createProfile(mockWalletId, invalidProfile))
|
|
158
|
-
.to.be.rejectedWith('Bio too long');
|
|
159
|
-
});
|
|
160
|
-
it('should throw error for invalid profile picture URL', async () => {
|
|
161
|
-
const invalidProfile = {
|
|
162
|
-
...mockProfileData,
|
|
163
|
-
profilePicture: 'not-a-url',
|
|
164
|
-
};
|
|
165
|
-
await expect(profileManager.createProfile(mockWalletId, invalidProfile))
|
|
166
|
-
.to.be.rejectedWith('Invalid profile picture URL');
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
//# sourceMappingURL=profile-manager.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-manager.test.js","sourceRoot":"","sources":["../../../../../src/services/dop/profile/__tests__/profile-manager.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,wEAA8C;AAC9C,0DAAkC;AAClC,wDAAoD;AAEpD,wCAA4C;AAC5C,2BAA4B;AAG5B,cAAI,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACzB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAI,CAAC;AAExB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,cAA8B,CAAC;IACnC,IAAI,WAA2B,CAAC;IAChC,IAAI,EAAqB,CAAC;IAC1B,MAAM,UAAU,GAAG,yBAAyB,CAAC;IAC7C,MAAM,YAAY,GAAG,gBAAgB,CAAC;IACtC,MAAM,eAAe,GAAyB;QAC5C,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,UAAU;QACf,cAAc,EAAE,gCAAgC;QAChD,WAAW,EAAE;YACX,OAAO,EAAE,8BAA8B;YACvC,MAAM,EAAE,6BAA6B;SACtC;KACF,CAAC;IAEF,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,EAAE,GAAG,IAAI,mBAAS,CAAC,UAAU,CAAC,CAAC;QAC/B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACd,IAAI,GAAG;oBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;oBAChB,OAAO,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QAC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C,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;iBACrE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;YAClE,MAAM,cAAc,GAAG;gBACrB,GAAG,eAAe;gBAClB,cAAc,EAAE,WAAW;aAC5B,CAAC;YAEF,MAAM,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;iBACrE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import chai from 'chai';\nimport chaiAsPromised from 'chai-as-promised';\nimport LevelDOWN from 'leveldown';\nimport { ProfileManager } from '../profile-manager';\nimport { UserProfile, ProfileCustomization } from '../types';\nimport { ProfileStorage } from '../storage';\nimport { rmSync } from 'fs';\nimport type { AbstractLevelDOWN } from 'abstract-leveldown';\n\nchai.use(chaiAsPromised);\nconst { expect } = chai;\n\ndescribe('ProfileManager', () => {\n let profileManager: ProfileManager;\n let testStorage: ProfileStorage;\n let db: AbstractLevelDOWN;\n const testDbPath = 'test-profile-manager-db';\n const mockWalletId = 'test-wallet-id';\n const mockProfileData: Partial<UserProfile> = {\n username: 'testuser',\n bio: 'Test bio',\n profilePicture: 'https://example.com/avatar.jpg',\n socialLinks: {\n twitter: 'https://twitter.com/testuser',\n github: 'https://github.com/testuser',\n },\n };\n\n beforeEach(async () => {\n db = new LevelDOWN(testDbPath);\n await new Promise<void>((resolve, reject) => {\n db.open((err) => {\n if (err) reject(err);\n else resolve();\n });\n });\n \n testStorage = new ProfileStorage(db);\n profileManager = new ProfileManager();\n profileManager.setStorage(testStorage);\n });\n\n afterEach(async () => {\n await new Promise<void>((resolve, reject) => {\n db.close((err) => {\n if (err) reject(err);\n else resolve();\n });\n });\n \n try {\n rmSync(testDbPath, { recursive: true });\n } catch (error) {\n // Ignore cleanup errors\n }\n });\n\n describe('profile management', () => {\n it('should create a new profile', async () => {\n const result = await profileManager.createProfile(mockWalletId, mockProfileData);\n expect(result.id).to.equal(mockWalletId);\n expect(result.username).to.equal(mockProfileData.username);\n expect(result.bio).to.equal(mockProfileData.bio);\n });\n\n it('should get profile by wallet ID', async () => {\n await profileManager.createProfile(mockWalletId, mockProfileData);\n const result = await profileManager.getProfile(mockWalletId);\n expect(result).to.not.be.undefined;\n if (result) {\n expect(result.id).to.equal(mockWalletId);\n }\n });\n\n it('should return undefined for non-existent profile', async () => {\n const result = await profileManager.getProfile('non-existent-id');\n expect(result).to.be.undefined;\n });\n\n it('should update profile', async () => {\n await profileManager.createProfile(mockWalletId, mockProfileData);\n const updates = {\n bio: 'Updated bio',\n };\n \n const result = await profileManager.updateProfile(mockWalletId, updates);\n expect(result.bio).to.equal(updates.bio);\n expect(result.username).to.equal(mockProfileData.username); // unchanged\n });\n\n it('should delete profile', async () => {\n await profileManager.createProfile(mockWalletId, mockProfileData);\n await profileManager.deleteProfile(mockWalletId);\n \n const deletedProfile = await profileManager.getProfile(mockWalletId);\n expect(deletedProfile).to.be.undefined;\n });\n\n it('should throw error when deleting non-existent profile', async () => {\n await expect(profileManager.deleteProfile('non-existent-id'))\n .to.be.rejectedWith('Profile not found');\n });\n });\n\n describe('profile customization', () => {\n it('should set profile customization', async () => {\n // Create a profile first\n await profileManager.createProfile(mockWalletId, mockProfileData);\n\n const customization: ProfileCustomization = {\n theme: 'dark',\n displayPreferences: {\n currencyFormat: 'USD',\n numberFormat: 'full',\n dateFormat: 'MM/DD/YYYY',\n timeFormat: '12h',\n },\n privacyAlerts: {\n newViewingRequest: true,\n profileUpdate: false,\n assetVisibilityChange: true,\n },\n };\n\n await profileManager.setCustomization(mockWalletId, customization);\n const result = await profileManager.getCustomization(mockWalletId);\n expect(result).to.deep.equal(customization);\n });\n\n it('should return undefined for non-existent customization', async () => {\n const result = await profileManager.getCustomization('non-existent-id');\n expect(result).to.be.undefined;\n });\n\n it('should throw error when setting customization for non-existent profile', async () => {\n const customization: ProfileCustomization = {\n theme: 'dark',\n displayPreferences: {\n currencyFormat: 'USD',\n numberFormat: 'full',\n dateFormat: 'MM/DD/YYYY',\n timeFormat: '12h',\n },\n privacyAlerts: {\n newViewingRequest: true,\n profileUpdate: false,\n assetVisibilityChange: true,\n },\n };\n\n await expect(profileManager.setCustomization('non-existent-id', customization))\n .to.be.rejectedWith('Profile not found');\n });\n });\n\n describe('validation', () => {\n it('should throw error for invalid username', async () => {\n const invalidProfile = {\n ...mockProfileData,\n username: '', // empty username\n };\n\n await expect(profileManager.createProfile(mockWalletId, invalidProfile))\n .to.be.rejectedWith('Invalid username');\n });\n\n it('should throw error for invalid bio', async () => {\n const invalidProfile = {\n ...mockProfileData,\n bio: 'a'.repeat(501), // too long\n };\n\n await expect(profileManager.createProfile(mockWalletId, invalidProfile))\n .to.be.rejectedWith('Bio too long');\n });\n\n it('should throw error for invalid profile picture URL', async () => {\n const invalidProfile = {\n ...mockProfileData,\n profilePicture: 'not-a-url',\n };\n\n await expect(profileManager.createProfile(mockWalletId, invalidProfile))\n .to.be.rejectedWith('Invalid profile picture URL');\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|