@dignetwork/dig-sdk 0.0.1-alpha.19 → 0.0.1-alpha.191

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.
Files changed (91) hide show
  1. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts +10 -1
  2. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts.map +1 -1
  3. package/dist/DataIntegrityTree/DataIntegrityTree.js +77 -10
  4. package/dist/DigNetwork/ContentServer.d.ts +20 -5
  5. package/dist/DigNetwork/ContentServer.d.ts.map +1 -1
  6. package/dist/DigNetwork/ContentServer.js +224 -28
  7. package/dist/DigNetwork/DigNetwork.d.ts +15 -9
  8. package/dist/DigNetwork/DigNetwork.d.ts.map +1 -1
  9. package/dist/DigNetwork/DigNetwork.js +129 -189
  10. package/dist/DigNetwork/DigPeer.d.ts +8 -3
  11. package/dist/DigNetwork/DigPeer.d.ts.map +1 -1
  12. package/dist/DigNetwork/DigPeer.js +72 -115
  13. package/dist/DigNetwork/IncentiveServer.d.ts.map +1 -1
  14. package/dist/DigNetwork/IncentiveServer.js +6 -5
  15. package/dist/DigNetwork/PropagationServer.d.ts +89 -33
  16. package/dist/DigNetwork/PropagationServer.d.ts.map +1 -1
  17. package/dist/DigNetwork/PropagationServer.js +625 -358
  18. package/dist/blockchain/DataStore.d.ts +25 -7
  19. package/dist/blockchain/DataStore.d.ts.map +1 -1
  20. package/dist/blockchain/DataStore.js +117 -159
  21. package/dist/blockchain/DataStoreSerializer.d.ts +1 -1
  22. package/dist/blockchain/DataStoreSerializer.d.ts.map +1 -1
  23. package/dist/blockchain/FullNodePeer.d.ts +95 -10
  24. package/dist/blockchain/FullNodePeer.d.ts.map +1 -1
  25. package/dist/blockchain/FullNodePeer.js +325 -115
  26. package/dist/blockchain/ServerCoin.d.ts +13 -5
  27. package/dist/blockchain/ServerCoin.d.ts.map +1 -1
  28. package/dist/blockchain/ServerCoin.js +89 -28
  29. package/dist/blockchain/StoreMonitorRegistry.d.ts +85 -0
  30. package/dist/blockchain/StoreMonitorRegistry.d.ts.map +1 -0
  31. package/dist/blockchain/StoreMonitorRegistry.js +238 -0
  32. package/dist/blockchain/Wallet.d.ts +2 -2
  33. package/dist/blockchain/Wallet.d.ts.map +1 -1
  34. package/dist/blockchain/Wallet.js +50 -18
  35. package/dist/blockchain/coins.d.ts +1 -2
  36. package/dist/blockchain/coins.d.ts.map +1 -1
  37. package/dist/blockchain/coins.js +1 -55
  38. package/dist/blockchain/index.d.ts +1 -0
  39. package/dist/blockchain/index.d.ts.map +1 -1
  40. package/dist/blockchain/index.js +1 -0
  41. package/dist/types.d.ts +2 -0
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/utils/ContentScanner.d.ts +63 -0
  44. package/dist/utils/ContentScanner.d.ts.map +1 -0
  45. package/dist/utils/ContentScanner.js +175 -0
  46. package/dist/utils/DigCache.d.ts +38 -0
  47. package/dist/utils/DigCache.d.ts.map +1 -0
  48. package/dist/utils/DigCache.js +236 -0
  49. package/dist/utils/Environment.d.ts +21 -0
  50. package/dist/utils/Environment.d.ts.map +1 -0
  51. package/dist/utils/Environment.js +93 -0
  52. package/dist/utils/FileCache.d.ts +1 -1
  53. package/dist/utils/FileCache.d.ts.map +1 -1
  54. package/dist/utils/FileCache.js +2 -2
  55. package/dist/utils/FileTransfer.d.ts +47 -0
  56. package/dist/utils/FileTransfer.d.ts.map +1 -0
  57. package/dist/utils/FileTransfer.js +209 -0
  58. package/dist/utils/NconfManager.d.ts.map +1 -1
  59. package/dist/utils/NconfManager.js +16 -7
  60. package/dist/utils/PeerRanker.d.ts +55 -0
  61. package/dist/utils/PeerRanker.d.ts.map +1 -0
  62. package/dist/utils/PeerRanker.js +186 -0
  63. package/dist/utils/StoreArchiveManager.d.ts +45 -0
  64. package/dist/utils/StoreArchiveManager.d.ts.map +1 -0
  65. package/dist/utils/StoreArchiveManager.js +153 -0
  66. package/dist/utils/Udi.d.ts +30 -0
  67. package/dist/utils/Udi.d.ts.map +1 -0
  68. package/dist/utils/Udi.js +170 -0
  69. package/dist/utils/config.d.ts +4 -3
  70. package/dist/utils/config.d.ts.map +1 -1
  71. package/dist/utils/config.js +13 -8
  72. package/dist/utils/directoryUtils.d.ts +16 -0
  73. package/dist/utils/directoryUtils.d.ts.map +1 -1
  74. package/dist/utils/directoryUtils.js +66 -0
  75. package/dist/utils/index.d.ts +5 -1
  76. package/dist/utils/index.d.ts.map +1 -1
  77. package/dist/utils/index.js +5 -1
  78. package/dist/utils/merkle.d.ts +2 -0
  79. package/dist/utils/merkle.d.ts.map +1 -0
  80. package/dist/utils/merkle.js +28 -0
  81. package/dist/utils/network.d.ts +2 -1
  82. package/dist/utils/network.d.ts.map +1 -1
  83. package/dist/utils/network.js +40 -15
  84. package/dist/utils/promiseUtils.d.ts +27 -0
  85. package/dist/utils/promiseUtils.d.ts.map +1 -0
  86. package/dist/utils/promiseUtils.js +69 -0
  87. package/dist/utils/ssl.js +2 -2
  88. package/package.json +31 -13
  89. package/dist/utils/deltaUtils.d.ts +0 -2
  90. package/dist/utils/deltaUtils.d.ts.map +0 -1
  91. package/dist/utils/deltaUtils.js +0 -83
package/dist/utils/ssl.js CHANGED
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getOrCreateSSLCerts = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
- const chia_server_coin_1 = require("chia-server-coin");
29
+ const datalayer_driver_1 = require("@dignetwork/datalayer-driver");
30
30
  const config_1 = require("./config");
31
31
  const getOrCreateSSLCerts = () => {
32
32
  const sslDir = path.join(config_1.USER_DIR_PATH, "ssl");
@@ -38,7 +38,7 @@ const getOrCreateSSLCerts = () => {
38
38
  }
39
39
  // Check if the certificate and key exist, if not, generate them
40
40
  if (!fs.existsSync(certPath) || !fs.existsSync(keyPath)) {
41
- new chia_server_coin_1.Tls(certPath, keyPath);
41
+ new datalayer_driver_1.Tls(certPath, keyPath);
42
42
  console.log("Client certificate and key generated successfully.");
43
43
  }
44
44
  // Return the paths to the cert and key files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dignetwork/dig-sdk",
3
- "version": "0.0.1-alpha.19",
3
+ "version": "0.0.1-alpha.191",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -25,41 +25,59 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
+ "@dignetwork/datalayer-driver": "^0.1.29",
29
+ "@dignetwork/dig-sdk": "^0.0.1-alpha.158",
30
+ "archiver": "^7.0.1",
31
+ "async-mutex": "^0.5.0",
32
+ "axios": "^1.7.7",
28
33
  "bip39": "^3.1.0",
34
+ "bottleneck": "^2.19.5",
29
35
  "chia-bls": "^1.0.2",
30
36
  "chia-config-loader": "^1.0.1",
31
37
  "chia-root-resolver": "^1.0.0",
32
- "chia-server-coin": "^0.0.5",
33
38
  "chia-wallet": "^1.0.18",
34
39
  "cli-progress": "^3.12.0",
40
+ "colorette": "^2.0.20",
35
41
  "crypto-js": "^4.2.0",
36
- "datalayer-driver": "^0.1.21",
42
+ "figures": "^6.1.0",
37
43
  "fs-extra": "^11.2.0",
44
+ "hi-base32": "^0.5.1",
38
45
  "ignore": "^5.3.2",
39
- "inquirer": "^10.1.8",
46
+ "inquirer": "^10.2.2",
40
47
  "lodash": "^4.17.21",
41
48
  "merkletreejs": "^0.4.0",
42
49
  "nanospinner": "^1.1.0",
43
50
  "nconf": "^0.12.1",
44
- "p-limit": "^6.1.0",
45
- "superagent": "^10.0.0"
51
+ "node-cache": "^5.1.2",
52
+ "node-stun": "^0.1.2",
53
+ "progress-stream": "^2.0.0",
54
+ "proper-lockfile": "^4.1.2",
55
+ "superagent": "^10.1.0",
56
+ "redis": "^4.7.0",
57
+ "superagent": "^10.0.0",
58
+ "unzipper": "^0.12.3",
59
+ "urns": "^0.6.0"
46
60
  },
47
61
  "devDependencies": {
48
- "@types/chai": "^4.3.17",
62
+ "@types/archiver": "^6.0.2",
63
+ "@types/chai": "^4.3.20",
49
64
  "@types/cli-progress": "^3.11.6",
50
65
  "@types/crypto-js": "^4.2.2",
51
66
  "@types/fs-extra": "^11.0.4",
52
67
  "@types/inquirer": "^9.0.7",
53
- "@types/lodash": "^4.17.7",
54
- "@types/mocha": "^10.0.7",
68
+ "@types/lodash": "^4.17.10",
69
+ "@types/mocha": "^10.0.9",
55
70
  "@types/nconf": "^0.10.7",
56
- "@types/node": "^22.1.0",
57
- "@types/superagent": "^8.1.8",
71
+ "@types/node": "^22.7.5",
72
+ "@types/progress-stream": "^2.0.5",
73
+ "@types/proper-lockfile": "^4.1.4",
74
+ "@types/superagent": "^8.1.9",
75
+ "@types/unzipper": "^0.10.10",
58
76
  "chai": "^5.1.1",
59
77
  "copyfiles": "^2.4.1",
60
- "mocha": "^10.7.0",
78
+ "mocha": "^10.7.3",
61
79
  "standard-version": "^9.5.0",
62
80
  "ts-node": "^10.9.2",
63
- "typescript": "^5.5.4"
81
+ "typescript": "^5.6.3"
64
82
  }
65
83
  }
@@ -1,2 +0,0 @@
1
- export declare const getDeltaFiles: (storeId: string, generationIndex: number | undefined, directoryPath: string) => Promise<string[]>;
2
- //# sourceMappingURL=deltaUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deltaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deltaUtils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,YACf,MAAM,mBACE,MAAM,6BACR,MAAM,KACpB,OAAO,CAAC,MAAM,EAAE,CAwElB,CAAC"}
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getDeltaFiles = void 0;
27
- const fs = __importStar(require("fs"));
28
- const path = __importStar(require("path"));
29
- const hashUtils_1 = require("./hashUtils");
30
- const getDeltaFiles = async (storeId, generationIndex = 0, directoryPath) => {
31
- if (isNaN(generationIndex)) {
32
- generationIndex = 0;
33
- }
34
- // Load manifest file
35
- const manifestFilePath = path.join(directoryPath, storeId, "manifest.dat");
36
- if (!fs.existsSync(manifestFilePath)) {
37
- console.error("Manifest file not found", manifestFilePath);
38
- return [];
39
- }
40
- const manifestHashes = fs
41
- .readFileSync(manifestFilePath, "utf-8")
42
- .split("\n")
43
- .filter(Boolean);
44
- console.log("");
45
- console.log(`Uploading delta from generation ${generationIndex}`);
46
- const filesInvolved = [];
47
- // Include the height.dat file at the top of the directory
48
- const heightDatFilePath = path.join(directoryPath, storeId, "height.json");
49
- if (fs.existsSync(heightDatFilePath)) {
50
- filesInvolved.push(heightDatFilePath);
51
- }
52
- // Collect files starting from generationIndex + 1
53
- for (let i = generationIndex; i < manifestHashes.length; i++) {
54
- const rootHash = manifestHashes[i];
55
- const datFilePath = path.join(directoryPath, storeId, `${rootHash}.dat`);
56
- if (!fs.existsSync(datFilePath)) {
57
- console.error(`Data file for root hash ${rootHash} not found`);
58
- return [];
59
- }
60
- const datFileContent = JSON.parse(fs.readFileSync(datFilePath, "utf-8"));
61
- if (datFileContent.root !== rootHash) {
62
- console.error(`Root hash in data file does not match: ${datFileContent.root} !== ${rootHash}`);
63
- return [];
64
- }
65
- // Add the .dat file itself to the list of files involved
66
- filesInvolved.push(datFilePath);
67
- // Collect all files involved, ensuring correct paths
68
- for (const file of Object.keys(datFileContent.files)) {
69
- const filePath = (0, hashUtils_1.getFilePathFromSha256)(datFileContent.files[file].sha256, path.join(directoryPath, storeId, "data"));
70
- filesInvolved.push(filePath);
71
- }
72
- }
73
- if (process.env.DIG_DEBUG === "1") {
74
- console.log("Files involved in the delta:");
75
- console.table(filesInvolved);
76
- }
77
- // list the manifest file last, this actually
78
- // helps with upload because by overriding the manifest file last,
79
- // the store can still be considered valid even when the upload is interrupted
80
- filesInvolved.push(manifestFilePath);
81
- return filesInvolved;
82
- };
83
- exports.getDeltaFiles = getDeltaFiles;