diff --git a/README.md b/README.md index f3a6fec..c1fab77 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Options: --local cache locally to a JSON file instead of to Arweave (default: false) --localFile [file path] if caching data locally, specify the file path (default: "solarweave.cache.json") --console do not output log data to console (default: false) + --debug show more verbose debug logs in the console (default: false) --uncompressed store blocks in an uncompressed format (default: false) --parallelize [blocks] the amount of blocks to process at a time, 1 processes 1 block at a time, 8, 8 blocks at a time (default: "1") --batch [number] the number of requests to batch per Arweave transaction (default: "1") @@ -72,6 +73,7 @@ Commands: index index an existing database with their Account Keys and Signatures version Get the current version of Solarweave help [command] display help for command + ``` #### Setting credentials @@ -172,6 +174,15 @@ You can turn off console out put by passing the `console` flag. $ solarweave --console ``` +#### Debug output + +You can debug Solana RPC request and responses and Arweave requests and response with the `debug` flag. + +```bash +$ solarweave --debug +``` + + #### Compression This command does not impact local files. However, when storing blocks in Arweave. If you wanted to store a raw JSON string instead of a serialized binary `flatbuffer`. You can pass the `uncompressed` flag. diff --git a/dist/src/Config.d.ts b/dist/src/Config.d.ts index 17a286a..2a5b793 100644 --- a/dist/src/Config.d.ts +++ b/dist/src/Config.d.ts @@ -27,4 +27,4 @@ export declare const ArData: { unbundleData(txData: any): Promise; }; export declare const SolarweaveConfig: SolarweaveInterface; -export declare function UpdateConfig(rpc_version: string, database: string, arweaveGraphQL: string, url: string, credentials: string, local: boolean, localFile: string, console: boolean, compressed: boolean, parallelize: number, batch: number, benchmark: boolean, verify: boolean, index: boolean, start?: number, end?: number): void; +export declare function UpdateConfig(rpc_version: string, database: string, arweaveGraphQL: string, url: string, credentials: string, local: boolean, localFile: string, console: boolean, debug: boolean, compressed: boolean, parallelize: number, batch: number, benchmark: boolean, verify: boolean, index: boolean, start?: number, end?: number): void; diff --git a/dist/src/Config.js b/dist/src/Config.js index aea2cbf..5ad547f 100644 --- a/dist/src/Config.js +++ b/dist/src/Config.js @@ -28,6 +28,7 @@ exports.SolarweaveConfig = { local: false, localFile: "solarweave.cache.json", console: true, + debug: false, compressed: true, parallelize: 1, batch: 1, @@ -37,7 +38,7 @@ exports.SolarweaveConfig = { start: null, end: null, }; -function UpdateConfig(rpc_version, database, arweaveGraphQL, url, credentials, local, localFile, console, compressed, parallelize, batch, benchmark, verify, index, start, end) { +function UpdateConfig(rpc_version, database, arweaveGraphQL, url, credentials, local, localFile, console, debug, compressed, parallelize, batch, benchmark, verify, index, start, end) { exports.SolarweaveConfig.rpc_version = rpc_version; exports.SolarweaveConfig.database = database; exports.SolarweaveConfig.arweaveGraphQL = arweaveGraphQL; @@ -46,6 +47,7 @@ function UpdateConfig(rpc_version, database, arweaveGraphQL, url, credentials, l exports.SolarweaveConfig.local = local; exports.SolarweaveConfig.localFile = localFile; exports.SolarweaveConfig.console = console; + exports.SolarweaveConfig.debug = debug; exports.SolarweaveConfig.compressed = compressed; exports.SolarweaveConfig.parallelize = parallelize; exports.SolarweaveConfig.batch = batch; diff --git a/dist/src/Config.js.map b/dist/src/Config.js.map index 6498a7e..9bbb987 100644 --- a/dist/src/Config.js.map +++ b/dist/src/Config.js.map @@ -1 +1 @@ -{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAmC;AACnC,uEAAiD;AACjD,oEAA0C;AAK7B,QAAA,OAAO,GAAG,cAAO,CAAC,IAAI,CAAC;IAChC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;CACjB,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,yBAAW,CAAC;IAC9B,KAAK,EAAE,cAAO,CAAC,KAAK;IACpB,MAAM,EAAE,cAAO,CAAC,MAAM;IACtB,QAAQ,oBAAA;CACX,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAAwB;IACjD,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,mBAAmB;IAC7B,cAAc,EAAE,6BAA6B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BAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;AAC/B,CAAC;AAlCD,oCAkCC"} \ No newline at end of file +{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAmC;AACnC,uEAAiD;AACjD,oEAA0C;AAK7B,QAAA,OAAO,GAAG,cAAO,CAAC,IAAI,CAAC;IAChC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;CACjB,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,yBAAW,CAAC;IAC9B,KAAK,EAAE,cAAO,CAAC,KAAK;IACpB,MAAM,EAAE,cAAO,CAAC,MAAM;IACtB,QAAQ,oBAAA;CACX,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAAwB;IACjD,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,mBAAmB;IAC7B,cAAc,EAAE,6BAA6B;IAC7C,GAAG,EAAE,2BAA2B;IAChC,WAAW,EAAE,qBAAqB;IAClC,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,uBAAuB;IAClC,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;CACZ,CAAA;AAED,SAAgB,YAAY,CACxB,WAAmB,EACnB,QAAgB,EAChB,cAAsB,EACtB,GAAW,EACX,WAAmB,EACnB,KAAc,EACd,SAAiB,EACjB,OAAgB,EAChB,KAAc,EACd,UAAmB,EACnB,WAAmB,EACnB,KAAa,EACb,SAAkB,EAClB,MAAe,EACf,KAAc,EACd,KAAc,EACd,GAAY;IAEZ,wBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;IAC3C,wBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACrC,wBAAgB,CAAC,cAAc,GAAG,cAAc,CAAC;IACjD,wBAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;IAC3B,wBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;IAC3C,wBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,wBAAgB,CAAC,SAAS,GAAG,SAAS,CAAC;IACvC,wBAAgB,CAAC,OAAO,GAAG,OAAO,CAAC;IACnC,wBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,wBAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;IACzC,wBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;IAC3C,wBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,wBAAgB,CAAC,SAAS,GAAG,SAAS,CAAC;IACvC,wBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;IACjC,wBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,wBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;IAC/B,wBAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;AAC/B,CAAC;AApCD,oCAoCC"} \ No newline at end of file diff --git a/dist/src/Solarweave.js b/dist/src/Solarweave.js index 6cae9d8..d3a99eb 100644 --- a/dist/src/Solarweave.js +++ b/dist/src/Solarweave.js @@ -59,6 +59,7 @@ exports.Solarweave .option('--local', 'cache locally to a JSON file instead of to Arweave', false) .option('--localFile [file path]', 'if caching data locally, specify the file path', 'solarweave.cache.json') .option('--console', 'do not output log data to console', false) + .option('--debug', 'show more verbose debug logs in the console', false) .option('--uncompressed', 'store blocks in an uncompressed format', false) .option('--parallelize [blocks]', 'the amount of blocks to process at a time, 1 processes 1 block at a time, 8, 8 blocks at a time', '1') .option('--batch [number]', 'the number of requests to batch per Arweave transaction', '1') @@ -109,7 +110,7 @@ exports.Solarweave .command('version') .description('Get the current version of Solarweave') .action(function () { - console.log("Solarweave v2.1.2".green.bold); + console.log("Solarweave v2.2.0".green.bold); }); exports.Solarweave.parse(process.argv); //# sourceMappingURL=Solarweave.js.map \ No newline at end of file diff --git a/dist/src/Solarweave.js.map b/dist/src/Solarweave.js.map index a88093d..4d6d02f 100644 --- a/dist/src/Solarweave.js.map +++ b/dist/src/Solarweave.js.map @@ -1 +1 @@ -{"version":3,"file":"Solarweave.js","sourceRoot":"","sources":["../../src/Solarweave.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAgB;AAChB,uCAAoC;AACpC,oDAAqD;AAErD,6DAAoD;AACpD,2DAAuD;AACvD,mEAA0D;AAC1D,yDAAgD;AAChD,yDAAgD;AAEnC,QAAA,SAAS,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACzB,OAAO,EAAE,EAAE;CACd,CAAC;AAEW,QAAA,UAAU,GAAG,IAAI,mBAAO,CAAC,mBAAmB,CAAC,CAAC;AAE3D,kBAAU;KACL,MAAM,CAAC,mBAAmB,EAAE,kDAAkD,EAAE,mBAAmB,CAAC;KACpG,MAAM,CAAC,aAAa,EAAE,yCAAyC,EAAE,6BAA6B,CAAC;KAC/F,MAAM,CAAC,iBAAiB,EAAE,yCAAyC,EAAE,2BAA2B,CAAC;KACjG,MAAM,CAAC,2BAA2B,EAAE,uEAAuE,EAAE,qBAAqB,CAAC;KACnI,MAAM,CAAC,SAAS,EAAE,oDAAoD,EAAE,KAAK,CAAC;KAC9E,MAAM,CAAC,yBAAyB,EAAE,gDAAgD,EAAE,uBAAuB,CAAC;KAC5G,MAAM,CAAC,WAAW,EAAE,mCAAmC,EAAE,KAAK,CAAC;KAC/D,MAAM,CAAC,gBAAgB,EAAE,wCAAwC,EAAE,KAAK,CAAC;KACzE,MAAM,CAAC,wBAAwB,EAAE,iGAAiG,EAAE,GAAG,CAAC;KACxI,MAAM,CAAC,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C;IAC3B,qBAAK,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC;AAEP,kBAAU;KACL,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAEP,kBAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/src/interface/Solarweave.interface.d.ts b/dist/src/interface/Solarweave.interface.d.ts index a305f02..223b833 100644 --- a/dist/src/interface/Solarweave.interface.d.ts +++ b/dist/src/interface/Solarweave.interface.d.ts @@ -7,6 +7,7 @@ export interface SolarweaveInterface { local: boolean; localFile: string; console: boolean; + debug: boolean; compressed: boolean; parallelize: number; batch: number; diff --git a/dist/src/interface/Solarweave.interface.js.map b/dist/src/interface/Solarweave.interface.js.map index 0284847..99e1c6f 100644 --- a/dist/src/interface/Solarweave.interface.js.map +++ b/dist/src/interface/Solarweave.interface.js.map @@ -1 +1 @@ -{"version":3,"file":"Solarweave.interface.js","sourceRoot":"","sources":["../../../src/interface/Solarweave.interface.ts"],"names":[],"mappings":";;AAiBC,CAAC"} \ No newline at end of file +{"version":3,"file":"Solarweave.interface.js","sourceRoot":"","sources":["../../../src/interface/Solarweave.interface.ts"],"names":[],"mappings":";;AAkBC,CAAC"} \ No newline at end of file diff --git a/dist/src/service/Arweave.service.js b/dist/src/service/Arweave.service.js index 25a52e8..6439be7 100644 --- a/dist/src/service/Arweave.service.js +++ b/dist/src/service/Arweave.service.js @@ -75,30 +75,30 @@ exports.GetBalance = GetBalance; function SubmitBlocksToArweave(transactions, type) { if (type === void 0) { type = 'standard'; } return __awaiter(this, void 0, void 0, function () { - var key, bundles, i, transaction, bundledItem, bundledIndices, _a, bundledIndices, data, tx; - return __generator(this, function (_b) { - switch (_b.label) { + var key, bundles, i, transaction, bundledItem, bundledIndices, _a, bundledIndices, data, tx, _b, status, statusText; + return __generator(this, function (_c) { + switch (_c.label) { case 0: return [4 /*yield*/, LoadWallet()]; case 1: - key = _b.sent(); + key = _c.sent(); bundles = []; i = 0; - _b.label = 2; + _c.label = 2; case 2: if (!(i < transactions.length)) return [3 /*break*/, 10]; transaction = transactions[i]; if (!(type === 'standard')) return [3 /*break*/, 7]; return [4 /*yield*/, BundleItem(transaction, key)]; case 3: - bundledItem = _b.sent(); + bundledItem = _c.sent(); if (!Config_1.SolarweaveConfig.index) return [3 /*break*/, 5]; return [4 /*yield*/, BundleIndices(transaction, key)]; case 4: - _a = _b.sent(); + _a = _c.sent(); return [3 /*break*/, 6]; case 5: _a = []; - _b.label = 6; + _c.label = 6; case 6: bundledIndices = _a; bundles = bundles.concat(bundledItem, bundledIndices); @@ -107,28 +107,29 @@ function SubmitBlocksToArweave(transactions, type) { if (!(type === 'index')) return [3 /*break*/, 9]; return [4 /*yield*/, BundleIndices(transaction, key)]; case 8: - bundledIndices = _b.sent(); + bundledIndices = _c.sent(); bundles = bundles.concat(bundledIndices); - _b.label = 9; + _c.label = 9; case 9: i++; return [3 /*break*/, 2]; case 10: return [4 /*yield*/, Config_1.ArData.bundleData(bundles)]; case 11: - data = _b.sent(); + data = _c.sent(); return [4 /*yield*/, Config_1.arweave.createTransaction({ data: JSON.stringify(data) }, key)]; case 12: - tx = _b.sent(); + tx = _c.sent(); tx.addTag('Bundle-Type', 'ANS-102'); tx.addTag('Bundle-Format', 'json'); tx.addTag('Bundle-Version', '1.0.0'); tx.addTag('Content-Type', 'application/json'); return [4 /*yield*/, Config_1.arweave.transactions.sign(tx, key)]; case 13: - _b.sent(); + _c.sent(); return [4 /*yield*/, Config_1.arweave.transactions.post(tx)]; case 14: - _b.sent(); + _b = _c.sent(), status = _b.status, statusText = _b.statusText; + Log_util_1.LogArweave(status, statusText); Log_util_1.Log(("Transmitted Solana " + (type === 'index' ? 'Indexed Blocks' : 'Blocks') + " with the Slots " + transactions.map(function (t) { return t.tags.slot; }) + " to Arweave\n").green); return [2 /*return*/, true]; } diff --git a/dist/src/service/Arweave.service.js.map b/dist/src/service/Arweave.service.js.map index 322160b..6db947f 100644 --- a/dist/src/service/Arweave.service.js.map +++ b/dist/src/service/Arweave.service.js.map @@ -1 +1 @@ -{"version":3,"file":"Arweave.service.js","sourceRoot":"","sources":["../../../src/service/Arweave.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAkC;AAElC,oCAA8D;AAC9D,6CAAuC;AAEvC,sEAA+D;AAElD,QAAA,KAAK,GAAG,kEAAkE,CAAC;AAExF,SAAsB,UAAU;;;;YACtB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAI,CAAC,yBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;YAC3D,sBAAO,GAAG,EAAC;;;CACd;AAHD,gCAGC;AAED,SAAsB,UAAU;;;;;wBAChB,qBAAM,UAAU,EAAE,EAAA;;oBAAxB,GAAG,GAAG,SAAkB;oBAEd,qBAAM,gBAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAA;;oBAAjD,OAAO,GAAG,SAAuC;oBACvC,qBAAM,gBAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAA;;oBAAnD,OAAO,GAAG,SAAyC;oBAEzD,sBAAO,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,EAAC;;;;CAC/B;AAPD,gCAOC;AAED,SAAsB,qBAAqB,CAAC,YAAkC,EAAE,IAAyB;IAAzB,qBAAA,EAAA,iBAAyB;;;;;wBACzF,qBAAM,UAAU,EAAE,EAAA;;oBAAxB,GAAG,GAAG,SAAkB;oBAE1B,OAAO,GAAG,EAAE,CAAC;oBAER,CAAC,GAAG,CAAC;;;yBAAE,CAAA,CAAC,GAAG,YAAY,CAAC,MAAM,CAAA;oBAC7B,WAAW,GAAG,YAAY,CAAC,CAAC,CA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AAW,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;oBAE3G,KAAS,MAAI,CAAC,EAAE,GAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,GAAC,EAAE,EAAE;wBAC1D,QAAM,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,GAAC,CAAC,CAAC;wBAClD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAc,GAAC,MAAG,EAAE,KAAK,EAAE,KAAG,EAAE,CAAC,CAAC;qBACzD;oBAED,KAAS,MAAI,CAAC,EAAE,GAAC,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAC,EAAE,EAAE;wBACjD,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,GAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAa,GAAC,MAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;qBACxD;oBAEc,qBAAM,eAAM,CAAC,UAAU,CAAC;4BACnC,IAAI,MAAA;4BACJ,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,aAAK;4BACZ,MAAM,EAAE,OAAO;yBAClB,EAAE,GAAG,CAAC,EAAA;;oBALD,MAAM,GAAG,SAKR;oBAEc,qBAAM,eAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAA;;oBAA7C,YAAY,GAAG,SAA8B;oBAEnD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;;;oBAjCgC,CAAC,EAAE,CAAA;;wBAoChE,sBAAO,KAAK,EAAC;;;;CAChB;AAnDD,sCAmDC"} \ No newline at end of file +{"version":3,"file":"Arweave.service.js","sourceRoot":"","sources":["../../../src/service/Arweave.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,OAAO,CAAC,WAAW,CAAC,GAAC,CAAC,CAAC;wBAClD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAc,GAAC,MAAG,EAAE,KAAK,EAAE,KAAG,EAAE,CAAC,CAAC;qBACzD;oBAED,KAAS,MAAI,CAAC,EAAE,GAAC,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAC,EAAE,EAAE;wBACjD,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,GAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAa,GAAC,MAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;qBACxD;oBAEc,qBAAM,eAAM,CAAC,UAAU,CAAC;4BACnC,IAAI,MAAA;4BACJ,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,aAAK;4BACZ,MAAM,EAAE,OAAO;yBAClB,EAAE,GAAG,CAAC,EAAA;;oBALD,MAAM,GAAG,SAKR;oBAEc,qBAAM,eAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAA;;oBAA7C,YAAY,GAAG,SAA8B;oBAEnD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;;;oBAjCgC,CAAC,EAAE,CAAA;;wBAoChE,sBAAO,KAAK,EAAC;;;;CAChB;AAnDD,sCAmDC"} \ No newline at end of file diff --git a/dist/src/service/Solana.rpc.service.d.ts b/dist/src/service/Solana.rpc.service.d.ts index 5839001..4efd42e 100644 --- a/dist/src/service/Solana.rpc.service.d.ts +++ b/dist/src/service/Solana.rpc.service.d.ts @@ -1,7 +1,7 @@ -import * as superagent from 'superagent'; -export declare function GenesisHash(id?: number): Promise; -export declare function GetFirstSlot(id?: number): Promise; -export declare function GetSlot(id?: number): Promise; -export declare function GetBlock(index: number, id?: number): Promise; -export declare function GetBlocks(Slots: Array): Promise; -export declare function GetConfirmedBlocks(start: number, end: number, id?: number): Promise; +/// +export declare function GenesisHash(id?: number): Promise; +export declare function GetFirstSlot(id?: number): Promise; +export declare function GetSlot(id?: number): Promise; +export declare function GetBlock(index: number, id?: number): Promise; +export declare function GetBlocks(Slots: Array): Promise; +export declare function GetConfirmedBlocks(start: number, end: number, id?: number): Promise; diff --git a/dist/src/service/Solana.rpc.service.js b/dist/src/service/Solana.rpc.service.js index 9b1faf3..996fd00 100644 --- a/dist/src/service/Solana.rpc.service.js +++ b/dist/src/service/Solana.rpc.service.js @@ -1,23 +1,4 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -56,23 +37,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetConfirmedBlocks = exports.GetBlocks = exports.GetBlock = exports.GetSlot = exports.GetFirstSlot = exports.GenesisHash = void 0; -var superagent = __importStar(require("superagent")); +var superagent_1 = require("superagent"); var Config_1 = require("../Config"); +var Log_util_1 = require("../util/Log.util"); function GenesisHash(id) { if (id === void 0) { id = 1; } return __awaiter(this, void 0, void 0, function () { - var payload; + var request, payload; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send({ + case 0: + request = { jsonrpc: Config_1.SolarweaveConfig.rpc_version, id: id, method: "getGenesisHash", - })]; + }; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(request)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getGenesisHash', request, payload); return [2 /*return*/, payload]; } }); @@ -82,18 +65,19 @@ exports.GenesisHash = GenesisHash; function GetFirstSlot(id) { if (id === void 0) { id = 1; } return __awaiter(this, void 0, void 0, function () { - var payload; + var request, payload; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send({ + case 0: + request = { jsonrpc: Config_1.SolarweaveConfig.rpc_version, id: id, method: "getFirstAvailableBlock", - })]; + }; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(request)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getFirstAvailableBlock', request, payload); return [2 /*return*/, payload]; } }); @@ -103,18 +87,19 @@ exports.GetFirstSlot = GetFirstSlot; function GetSlot(id) { if (id === void 0) { id = 1; } return __awaiter(this, void 0, void 0, function () { - var payload; + var request, payload; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send({ + case 0: + request = { jsonrpc: Config_1.SolarweaveConfig.rpc_version, id: id, method: "getSlot", - })]; + }; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(request)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getSlot', request, payload); return [2 /*return*/, payload]; } }); @@ -123,19 +108,20 @@ function GetSlot(id) { exports.GetSlot = GetSlot; function GetBlock(index, id) { return __awaiter(this, void 0, void 0, function () { - var payload; + var request, payload; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send({ + case 0: + request = { jsonrpc: Config_1.SolarweaveConfig.rpc_version, id: (id ? id : index), method: "getConfirmedBlock", params: [index], - })]; + }; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(request)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getConfirmedBlock', request, payload); return [2 /*return*/, payload]; } }); @@ -157,11 +143,10 @@ function GetBlocks(Slots) { params: [Slots[i]], }); } - return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send(object)]; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(object)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getConfirmedBlock', object, payload); return [2 /*return*/, payload]; } }); @@ -170,19 +155,20 @@ function GetBlocks(Slots) { exports.GetBlocks = GetBlocks; function GetConfirmedBlocks(start, end, id) { return __awaiter(this, void 0, void 0, function () { - var payload; + var request, payload; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, superagent - .post(Config_1.SolarweaveConfig.url) - .send({ + case 0: + request = { jsonrpc: Config_1.SolarweaveConfig.rpc_version, id: (id ? id : start), method: "getConfirmedBlocks", params: [start, end], - })]; + }; + return [4 /*yield*/, superagent_1.post(Config_1.SolarweaveConfig.url).send(request)]; case 1: payload = _a.sent(); + Log_util_1.LogRequest('getConfirmedBlocks', request, payload); return [2 /*return*/, payload]; } }); diff --git a/dist/src/service/Solana.rpc.service.js.map b/dist/src/service/Solana.rpc.service.js.map index 7e5c3b7..5bfaadd 100644 --- a/dist/src/service/Solana.rpc.service.js.map +++ b/dist/src/service/Solana.rpc.service.js.map @@ -1 +1 @@ -{"version":3,"file":"Solana.rpc.service.js","sourceRoot":"","sources":["../../../src/service/Solana.rpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAyC;AACzC,oCAA6C;AAE7C,SAAsB,WAAW,CAAC,EAAc;IAAd,mBAAA,EAAA,MAAc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,CAAC,KAAK,CAAC;qBAClB,CAAC,EAAA;;oBAPA,OAAO,GAAG,SAOV;oBAEN,sBAAO,OAAO,EAAC;;;;CAClB;AAXD,4BAWC;AAED,SAAsB,SAAS,CAAC,KAAoB;;;;;;oBAC1C,MAAM,GAAG,EAAE,CAAC;oBAElB,KAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACnC,MAAM,CAAC,IAAI,CAAC;4BACR,OAAO,EAAE,yBAAgB,CAAC,WAAW;4BACrC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;4BACZ,MAAM,EAAE,mBAAmB;4BAC3B,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;yBACrB,CAAC,CAAC;qBACN;oBAEe,qBAAM,UAAU;6BAC3B,IAAI,CAAC,yBAAgB,CAAC,GAAG,CAAC;6BAC1B,IAAI,CAAC,MAAM,CAAC,EAAA;;oBAFX,OAAO,GAAG,SAEC;oBAEjB,sBAAO,OAAO,EAAC;;;;CAClB;AAjBD,8BAiBC;AAED,SAAsB,kBAAkB,CAAC,KAAa,EAAE,GAAW,EAAE,EAAW;;;;;wBAC5D,qBAAM,UAAU;yBAC3B,IAAI,CAAC,yBAAgB,CAAC,GAAG,CAAC;yBAC1B,IAAI,CAAC;wBACF,OAAO,EAAE,yBAAgB,CAAC,WAAW;wBACrC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;wBACrB,MAAM,EAAE,oBAAoB;wBAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;qBACvB,CAAC,EAAA;;oBAPA,OAAO,GAAG,SAOV;oBAEN,sBAAO,OAAO,EAAC;;;;CAClB;AAXD,gDAWC"} \ No newline at end of file +{"version":3,"file":"Solana.rpc.service.js","sourceRoot":"","sources":["../../../src/service/Solana.rpc.service.ts"],"names":[],"mappings":";;;;;;;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AsB,kBAAkB,CAAC,KAAa,EAAE,GAAW,EAAE,EAAW;;;;;;oBACtE,OAAO,GAAG;wBACZ,OAAO,EAAE,yBAAgB,CAAC,WAAW;wBACrC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;wBACrB,MAAM,EAAE,oBAAoB;wBAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;qBACvB,CAAC;oBAEc,qBAAM,iBAAI,CAAC,yBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;oBAAxD,OAAO,GAAG,SAA8C;oBAE9D,qBAAU,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;oBAEnD,sBAAO,OAAO,EAAC;;;;CAClB;AAbD,gDAaC"} \ No newline at end of file diff --git a/dist/src/util/Command.util.js b/dist/src/util/Command.util.js index 11b1760..68e0533 100644 --- a/dist/src/util/Command.util.js +++ b/dist/src/util/Command.util.js @@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ProcessCommand = void 0; var Config_1 = require("../Config"); function ProcessCommand(Solarweave) { - var database = Solarweave.database, gql = Solarweave.gql, url = Solarweave.url, credentials = Solarweave.credentials, local = Solarweave.local, localFile = Solarweave.localFile, console = Solarweave.console, uncompressed = Solarweave.uncompressed, parallelize = Solarweave.parallelize, batch = Solarweave.batch, benchmark = Solarweave.benchmark, noverify = Solarweave.noverify, index = Solarweave.index, start = Solarweave.start, end = Solarweave.end; - Config_1.UpdateConfig("2.0", database, gql, url, credentials, local, localFile, console ? false : true, uncompressed ? false : true, Number(parallelize), Number(batch), benchmark, noverify ? false : true, index, Number(start), Number(end)); + var database = Solarweave.database, gql = Solarweave.gql, url = Solarweave.url, credentials = Solarweave.credentials, local = Solarweave.local, localFile = Solarweave.localFile, console = Solarweave.console, debug = Solarweave.debug, uncompressed = Solarweave.uncompressed, parallelize = Solarweave.parallelize, batch = Solarweave.batch, benchmark = Solarweave.benchmark, noverify = Solarweave.noverify, index = Solarweave.index, start = Solarweave.start, end = Solarweave.end; + Config_1.UpdateConfig("2.0", database, gql, url, credentials, local, localFile, console ? false : true, debug, uncompressed ? false : true, Number(parallelize), Number(batch), benchmark, noverify ? false : true, index, Number(start), Number(end)); } exports.ProcessCommand = ProcessCommand; //# sourceMappingURL=Command.util.js.map \ No newline at end of file diff --git a/dist/src/util/Command.util.js.map b/dist/src/util/Command.util.js.map index 4db4433..e08f8b0 100644 --- a/dist/src/util/Command.util.js.map +++ b/dist/src/util/Command.util.js.map @@ -1 +1 @@ -{"version":3,"file":"Command.util.js","sourceRoot":"","sources":["../../../src/util/Command.util.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,SAAgB,cAAc,CAAC,UAAU;IAC7B,IAAA,QAAQ,GAAiI,UAAU,SAA3I,EAAE,GAAG,GAA4H,UAAU,IAAtI,EAAE,GAAG,GAAuH,UAAU,IAAjI,EAAE,WAAW,GAA0G,UAAU,YAApH,EAAE,KAAK,GAAmG,UAAU,MAA7G,EAAE,SAAS,GAAwF,UAAU,UAAlG,EAAE,OAAO,GAA+E,UAAU,QAAzF,EAAE,YAAY,GAAiE,UAAU,aAA3E,EAAE,WAAW,GAAoD,UAAU,YAA9D,EAAE,KAAK,GAA6C,UAAU,MAAvD,EAAE,SAAS,GAAkC,UAAU,UAA5C,EAAE,QAAQ,GAAwB,UAAU,SAAlC,EAAE,KAAK,GAAiB,UAAU,MAA3B,EAAE,KAAK,GAAU,UAAU,MAApB,EAAE,GAAG,GAAK,UAAU,IAAf,CAAgB;IAC5J,qBAAY,CACR,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,KAAK,EACL,SAAS,EACT,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACtB,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAC3B,MAAM,CAAC,WAAW,CAAC,EACnB,MAAM,CAAC,KAAK,CAAC,EACb,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACvB,KAAK,EACL,MAAM,CAAC,KAAK,CAAC,EACb,MAAM,CAAC,GAAG,CAAC,CACd,CAAC;AACN,CAAC;AApBD,wCAoBC"} \ No newline at end of file +{"version":3,"file":"Command.util.js","sourceRoot":"","sources":["../../../src/util/Command.util.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,SAAgB,cAAc,CAAC,UAAU;IAC7B,IAAA,QAAQ,GAAwI,UAAU,SAAlJ,EAAE,GAAG,GAAmI,UAAU,IAA7I,EAAE,GAAG,GAA8H,UAAU,IAAxI,EAAE,WAAW,GAAiH,UAAU,YAA3H,EAAE,KAAK,GAA0G,UAAU,MAApH,EAAE,SAAS,GAA+F,UAAU,UAAzG,EAAE,OAAO,GAAsF,UAAU,QAAhG,EAAE,KAAK,GAA+E,UAAU,MAAzF,EAAE,YAAY,GAAiE,UAAU,aAA3E,EAAE,WAAW,GAAoD,UAAU,YAA9D,EAAE,KAAK,GAA6C,UAAU,MAAvD,EAAE,SAAS,GAAkC,UAAU,UAA5C,EAAE,QAAQ,GAAwB,UAAU,SAAlC,EAAE,KAAK,GAAiB,UAAU,MAA3B,EAAE,KAAK,GAAU,UAAU,MAApB,EAAE,GAAG,GAAK,UAAU,IAAf,CAAgB;IACnK,qBAAY,CACR,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,KAAK,EACL,SAAS,EACT,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACtB,KAAK,EACL,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAC3B,MAAM,CAAC,WAAW,CAAC,EACnB,MAAM,CAAC,KAAK,CAAC,EACb,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACvB,KAAK,EACL,MAAM,CAAC,KAAK,CAAC,EACb,MAAM,CAAC,GAAG,CAAC,CACd,CAAC;AACN,CAAC;AArBD,wCAqBC"} \ No newline at end of file diff --git a/dist/src/util/Log.util.d.ts b/dist/src/util/Log.util.d.ts index e2f8390..be1a0e6 100644 --- a/dist/src/util/Log.util.d.ts +++ b/dist/src/util/Log.util.d.ts @@ -1 +1,4 @@ +import { Response } from 'superagent'; export declare function Log(output: any): void; +export declare function LogRequest(type: string, request: any, payload: Response): void; +export declare function LogArweave(status: number, statusText: string): void; diff --git a/dist/src/util/Log.util.js b/dist/src/util/Log.util.js index 6efa298..7e9b944 100644 --- a/dist/src/util/Log.util.js +++ b/dist/src/util/Log.util.js @@ -1,9 +1,28 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Log = void 0; +exports.LogArweave = exports.LogRequest = exports.Log = void 0; var Config_1 = require("../Config"); function Log(output) { Config_1.SolarweaveConfig.console ? console.log(output) : null; } exports.Log = Log; +function LogRequest(type, request, payload) { + if (Config_1.SolarweaveConfig.debug) { + var code = payload.status; + var body = payload.body; + Log(("[" + code + "] " + type + " Solana RPC Request").yellow.bold); + Log("RPC Request".blue.bold); + Log(JSON.stringify(request, null, 2)); + Log("RPC Response".blue.bold); + Log(JSON.stringify(body, null, 2)); + } +} +exports.LogRequest = LogRequest; +function LogArweave(status, statusText) { + if (Config_1.SolarweaveConfig.debug) { + Log(("[" + status + "] Arweave Upload").yellow.bold); + Log(statusText); + } +} +exports.LogArweave = LogArweave; //# sourceMappingURL=Log.util.js.map \ No newline at end of file diff --git a/dist/src/util/Log.util.js.map b/dist/src/util/Log.util.js.map index d65bda2..ee13f5f 100644 --- a/dist/src/util/Log.util.js.map +++ b/dist/src/util/Log.util.js.map @@ -1 +1 @@ -{"version":3,"file":"Log.util.js","sourceRoot":"","sources":["../../../src/util/Log.util.ts"],"names":[],"mappings":";;;AAAA,oCAA6C;AAE7C,SAAgB,GAAG,CAAC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CAAC,CAAC;KACnB;AACL,CAAC;AALD,gCAKC"} \ No newline at end of file diff --git a/dist/test/Config.test.js b/dist/test/Config.test.js index ac531f4..771cada 100644 --- a/dist/test/Config.test.js +++ b/dist/test/Config.test.js @@ -15,6 +15,7 @@ describe('Config Tests', function () { assert_1.equal(Config_1.SolarweaveConfig.local, false); assert_1.equal(Config_1.SolarweaveConfig.localFile, 'solarweave.cache.json'); assert_1.equal(Config_1.SolarweaveConfig.console, true); + assert_1.equal(Config_1.SolarweaveConfig.debug, false); assert_1.equal(Config_1.SolarweaveConfig.compressed, true); assert_1.equal(Config_1.SolarweaveConfig.parallelize, 1); assert_1.equal(Config_1.SolarweaveConfig.benchmark, false); @@ -22,7 +23,7 @@ describe('Config Tests', function () { assert_1.equal(Config_1.SolarweaveConfig.index, true); }); it('Should be able to update the Solarweave Config', function () { - Config_1.UpdateConfig('2.0', 'solarweave-devnet', 'https://arweave.dev/graphql', 'https://devnet.solana.com', '.arweave.creds.json', false, 'solarweave.cache.json', true, true, 1, 1, false, true, false); + Config_1.UpdateConfig('2.0', 'solarweave-devnet', 'https://arweave.dev/graphql', 'https://devnet.solana.com', '.arweave.creds.json', false, 'solarweave.cache.json', true, false, true, 1, 1, false, true, false); }); }); //# sourceMappingURL=Config.test.js.map \ No newline at end of file diff --git a/dist/test/Config.test.js.map b/dist/test/Config.test.js.map index 8510f4d..ff9acba 100644 --- a/dist/test/Config.test.js.map +++ b/dist/test/Config.test.js.map @@ -1 +1 @@ -{"version":3,"file":"Config.test.js","sourceRoot":"","sources":["../../test/Config.test.ts"],"names":[],"mappings":";;AAAA,iCAA+B;AAC/B,wCAAwE;AAExE,QAAQ,CAAC,cAAc,EAAE;IACrB,EAAE,CAAC,oCAAoC,EAAE;QACrC,cAAK,CAAC,gBAAO,KAAK,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE;QAC3C,cAAK,CAAC,yBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC3C,cAAK,CAAC,yBAAgB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QACtD,cAAK,CAAC,yBAAgB,CAAC,cAAc,EAAE,6BAA6B,CAAC,CAAC;QACtE,cAAK,CAAC,yBAAgB,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;QACzD,cAAK,CAAC,yBAAgB,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;QAC3D,cAAK,CAAC,yBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACrC,cAAK,CAAC,yBAAgB,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QAC3D,cAAK,CAAC,yBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtC,cAAK,CAAC,yBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,cAAK,CAAC,yBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACvC,cAAK,CAAC,yBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACzC,cAAK,CAAC,yBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACrC,cAAK,CAAC,yBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE;QACjD,qBAAY,CACR,KAAK,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,EACL,uBAAuB,EACvB,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,CAAC,EACD,KAAK,EACL,IAAI,EACJ,KAAK,CACR,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Config.test.js","sourceRoot":"","sources":["../../test/Config.test.ts"],"names":[],"mappings":";;AAAA,iCAA+B;AAC/B,wCAAwE;AAExE,QAAQ,CAAC,cA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ACJ,KAAK,EACL,IAAI,EACJ,CAAC,EACD,CAAC,EACD,KAAK,EACL,IAAI,EACJ,KAAK,CACR,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index c4b1e5a..2c0b2f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@theronin/solarweave", - "version": "2.1.2", + "version": "2.2.0", "main": "dist/src/Solarweave.library.js", "repository": "https://github.com/TheLoneRonin/SolarweaveBridge.git", "license": "MIT", @@ -19,7 +19,7 @@ "solarweave": "dist/src/Solarweave.js" }, "dependencies": { - "arweave": "^1.9.1", + "arweave": "^1.10.1", "arweave-bundles": "^1.0.0", "colors": "^1.4.0", "commander": "^6.0.0", diff --git a/src/Config.ts b/src/Config.ts index 62c33c3..dd7df24 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -28,6 +28,7 @@ export const SolarweaveConfig: SolarweaveInterface = { local: false, localFile: `solarweave.cache.json`, console: true, + debug: false, compressed: true, parallelize: 1, batch: 1, @@ -47,6 +48,7 @@ export function UpdateConfig( local: boolean, localFile: string, console: boolean, + debug: boolean, compressed: boolean, parallelize: number, batch: number, @@ -64,6 +66,7 @@ export function UpdateConfig( SolarweaveConfig.local = local; SolarweaveConfig.localFile = localFile; SolarweaveConfig.console = console; + SolarweaveConfig.debug = debug; SolarweaveConfig.compressed = compressed; SolarweaveConfig.parallelize = parallelize; SolarweaveConfig.batch = batch; diff --git a/src/Solarweave.ts b/src/Solarweave.ts index 7a2bfd2..cfdaffc 100644 --- a/src/Solarweave.ts +++ b/src/Solarweave.ts @@ -23,6 +23,7 @@ Solarweave .option('--local', 'cache locally to a JSON file instead of to Arweave', false) .option('--localFile [file path]', 'if caching data locally, specify the file path', 'solarweave.cache.json') .option('--console', 'do not output log data to console', false) + .option('--debug', 'show more verbose debug logs in the console', false) .option('--uncompressed', 'store blocks in an uncompressed format', false) .option('--parallelize [blocks]', 'the amount of blocks to process at a time, 1 processes 1 block at a time, 8, 8 blocks at a time', '1') .option('--batch [number]', 'the number of requests to batch per Arweave transaction', '1') @@ -77,7 +78,7 @@ Solarweave .command('version') .description('Get the current version of Solarweave') .action(() => { - console.log(`Solarweave v2.1.2`.green.bold); + console.log(`Solarweave v2.2.0`.green.bold); }); Solarweave.parse(process.argv); \ No newline at end of file diff --git a/src/interface/Solarweave.interface.ts b/src/interface/Solarweave.interface.ts index c7a63c1..8213988 100644 --- a/src/interface/Solarweave.interface.ts +++ b/src/interface/Solarweave.interface.ts @@ -7,6 +7,7 @@ export interface SolarweaveInterface { local: boolean; localFile: string; console: boolean; + debug: boolean; compressed: boolean; parallelize: number; batch: number; diff --git a/src/service/Arweave.service.ts b/src/service/Arweave.service.ts index 6cff60c..de602cb 100644 --- a/src/service/Arweave.service.ts +++ b/src/service/Arweave.service.ts @@ -1,8 +1,6 @@ -import Transaction from 'arweave/node/lib/transaction'; import { read } from 'fs-jetpack'; - import { SolarweaveConfig, arweave, ArData } from '../Config'; -import { Log } from '../util/Log.util'; +import { Log, LogArweave } from '../util/Log.util'; import { ArweaveTransaction } from '../interface/Arweave.interface'; import { CompressBlock } from '../service/Compression.service'; @@ -49,7 +47,8 @@ export async function SubmitBlocksToArweave(transactions: ArweaveTransaction[], tx.addTag('Content-Type', 'application/json'); await arweave.transactions.sign(tx, key); - await arweave.transactions.post(tx); + const { status, statusText } = await arweave.transactions.post(tx); + LogArweave(status, statusText); Log(`Transmitted Solana ${type === 'index' ? 'Indexed Blocks' : 'Blocks'} with the Slots ${transactions.map(t => t.tags.slot)} to Arweave\n`.green); return true; diff --git a/src/service/Solana.rpc.service.ts b/src/service/Solana.rpc.service.ts index ce55853..511ef28 100644 --- a/src/service/Solana.rpc.service.ts +++ b/src/service/Solana.rpc.service.ts @@ -1,51 +1,60 @@ -import * as superagent from 'superagent'; +import { post } from 'superagent'; import { SolarweaveConfig } from '../Config'; +import { LogRequest } from '../util/Log.util'; export async function GenesisHash(id :number = 1) { - const payload = await superagent - .post(SolarweaveConfig.url) - .send({ - jsonrpc: SolarweaveConfig.rpc_version, - id, - method: `getGenesisHash`, - }); + const request = { + jsonrpc: SolarweaveConfig.rpc_version, + id, + method: `getGenesisHash`, + }; + + const payload = await post(SolarweaveConfig.url).send(request); + + LogRequest('getGenesisHash', request, payload); return payload; } export async function GetFirstSlot(id :number = 1) { - const payload = await superagent - .post(SolarweaveConfig.url) - .send({ - jsonrpc: SolarweaveConfig.rpc_version, - id, - method: `getFirstAvailableBlock`, - }); + const request = { + jsonrpc: SolarweaveConfig.rpc_version, + id, + method: `getFirstAvailableBlock`, + }; + + const payload = await post(SolarweaveConfig.url).send(request); + + LogRequest('getFirstAvailableBlock', request, payload); return payload; } export async function GetSlot(id :number = 1) { - const payload = await superagent - .post(SolarweaveConfig.url) - .send({ - jsonrpc: SolarweaveConfig.rpc_version, - id, - method: `getSlot`, - }); + const request = { + jsonrpc: SolarweaveConfig.rpc_version, + id, + method: `getSlot`, + }; + + const payload = await post(SolarweaveConfig.url).send(request); + + LogRequest('getSlot', request, payload); return payload; } export async function GetBlock(index: number, id?: number) { - const payload = await superagent - .post(SolarweaveConfig.url) - .send({ - jsonrpc: SolarweaveConfig.rpc_version, - id: (id ? id : index), - method: `getConfirmedBlock`, - params: [index], - }); + const request = { + jsonrpc: SolarweaveConfig.rpc_version, + id: (id ? id : index), + method: `getConfirmedBlock`, + params: [index], + }; + + const payload = await post(SolarweaveConfig.url).send(request); + + LogRequest('getConfirmedBlock', request, payload); return payload; } @@ -62,22 +71,24 @@ export async function GetBlocks(Slots: Array) { }); } - const payload = await superagent - .post(SolarweaveConfig.url) - .send(object); + const payload = await post(SolarweaveConfig.url).send(object); + + LogRequest('getConfirmedBlock', object, payload); return payload; } export async function GetConfirmedBlocks(start: number, end: number, id?: number) { - const payload = await superagent - .post(SolarweaveConfig.url) - .send({ - jsonrpc: SolarweaveConfig.rpc_version, - id: (id ? id : start), - method: `getConfirmedBlocks`, - params: [start, end], - }); + const request = { + jsonrpc: SolarweaveConfig.rpc_version, + id: (id ? id : start), + method: `getConfirmedBlocks`, + params: [start, end], + }; + + const payload = await post(SolarweaveConfig.url).send(request); + + LogRequest('getConfirmedBlocks', request, payload); return payload; } \ No newline at end of file diff --git a/src/util/Command.util.ts b/src/util/Command.util.ts index 8106d4d..dd387e8 100644 --- a/src/util/Command.util.ts +++ b/src/util/Command.util.ts @@ -1,7 +1,7 @@ import { UpdateConfig } from '../Config'; export function ProcessCommand(Solarweave) { - const { database, gql, url, credentials, local, localFile, console, uncompressed, parallelize, batch, benchmark, noverify, index, start, end } = Solarweave; + const { database, gql, url, credentials, local, localFile, console, debug, uncompressed, parallelize, batch, benchmark, noverify, index, start, end } = Solarweave; UpdateConfig( `2.0`, database, @@ -11,6 +11,7 @@ export function ProcessCommand(Solarweave) { local, localFile, console ? false : true, + debug, uncompressed ? false : true, Number(parallelize), Number(batch), diff --git a/src/util/Log.util.ts b/src/util/Log.util.ts index 62215e3..bb8210e 100644 --- a/src/util/Log.util.ts +++ b/src/util/Log.util.ts @@ -1,5 +1,26 @@ +import { Response } from 'superagent'; import { SolarweaveConfig } from '../Config'; export function Log(output: any) { SolarweaveConfig.console ? console.log(output) : null; +} + +export function LogRequest(type: string, request: any, payload: Response) { + if (SolarweaveConfig.debug) { + const code = payload.status; + const body = payload.body; + + Log(`[${code}] ${type} Solana RPC Request`.yellow.bold); + Log(`RPC Request`.blue.bold); + Log(JSON.stringify(request, null , 2)); + Log(`RPC Response`.blue.bold); + Log(JSON.stringify(body, null , 2)); + } +} + +export function LogArweave(status: number, statusText: string) { + if (SolarweaveConfig.debug) { + Log(`[${status}] Arweave Upload`.yellow.bold); + Log(statusText); + } } \ No newline at end of file diff --git a/test/Config.test.ts b/test/Config.test.ts index 55882dd..68fe12f 100644 --- a/test/Config.test.ts +++ b/test/Config.test.ts @@ -15,6 +15,7 @@ describe('Config Tests', () => { equal(SolarweaveConfig.local, false); equal(SolarweaveConfig.localFile, 'solarweave.cache.json'); equal(SolarweaveConfig.console, true); + equal(SolarweaveConfig.debug, false); equal(SolarweaveConfig.compressed, true); equal(SolarweaveConfig.parallelize, 1); equal(SolarweaveConfig.benchmark, false); @@ -32,6 +33,7 @@ describe('Config Tests', () => { false, 'solarweave.cache.json', true, + false, true, 1, 1, diff --git a/yarn.lock b/yarn.lock index 7d22833..2480575 100644 --- a/yarn.lock +++ b/yarn.lock @@ -336,6 +336,16 @@ arweave-bundles@^1.0.0: dependencies: arweave "^1.9.1" +arweave@^1.10.1: + version "1.10.1" + resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.10.1.tgz#170c5e1ffc2da13bbe7da39ce7bb2d245be30ab1" + integrity sha512-jhJYiZXQnQLLfj9h3fNxV7eHs+xyFPPDHusgOhyqg0PM6/xeD3zoMMBc+68W743pMQAnioHHne2wQXz29krvSA== + dependencies: + asn1.js "^5.4.1" + axios "^0.21.1" + base64-js "^1.3.1" + bignumber.js "^8.1.1" + arweave@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.9.1.tgz#9b3754eeb38a244ed9abf1024ab0df6bfb76a990" @@ -368,6 +378,13 @@ axios@^0.19.2: dependencies: follow-redirects "1.5.10" +axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -746,6 +763,11 @@ follow-redirects@1.5.10: dependencies: debug "=3.1.0" +follow-redirects@^1.10.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7" + integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg== + foreground-child@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53"