Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions combined.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"level":"info","message":"[+]Logging Service Started","timestamp":"2025-07-02T00:00:04.163Z"}
{"level":"info","message":"[+] CLOUD Server Running ... on Port -> 8002","timestamp":"2025-07-02T00:00:04.166Z"}
{"level":"error","message":"{\"name\":\"AggregateError\",\"message\":\"\",\"path1\":\"at internalConnectMultiple (node:net:1117:18)\",\"path2\":\"at afterConnectMultiple (node:net:1684:7)\"}","timestamp":"2025-07-02T00:00:04.171Z"}
28 changes: 28 additions & 0 deletions dist/appMiddlewares/fingerprint.middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const crypto_1 = __importDefault(require("crypto"));
const utils_1 = require("../utils");
const fingerprintMiddleware = (req, _res, next) => {
const userAgent = req.headers['user-agent'] || '';
const accept = req.headers['accept'] || '';
const acceptLanguage = req.headers['accept-language'] || '';
const ipAddress = (0, utils_1.getIpAddress)(req);
const components = [userAgent, ipAddress, acceptLanguage, accept];
const fingerprintString = components.join('||');
const hash = crypto_1.default.createHash('sha256');
hash.update(fingerprintString);
const fingerprint = hash.digest('hex');
req.fingerprint = {
hash: fingerprint,
components: {
userAgent: components[0] || '',
language: components[2] || '',
ip: ipAddress,
},
};
return next();
};
exports.default = fingerprintMiddleware;
17 changes: 17 additions & 0 deletions dist/appMiddlewares/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyAllowedMethods = void 0;
const verifyAllowedMethods = (req, res, next) => {
try {
if (req.method === 'OPTIONS') {
res.header('Access-Control-Allow-Methods', 'POST, PUT, PATCH, GET, DELETE');
return res.status(403).json('Invalid header method');
}
else
return next();
}
catch (err) {
return next(err);
}
};
exports.verifyAllowedMethods = verifyAllowedMethods;
25 changes: 25 additions & 0 deletions dist/appMiddlewares/policy.middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const policyMiddleware = (schema, fieldType = 'body') => (req, _res, next) => {
try {
const parsedData = schema.parse(req[fieldType]);
req[fieldType] = parsedData;
return next();
}
catch (err) {
if (err instanceof zod_1.z.ZodError) {
const issue = err.issues[0];
const message = `${issue.path.join('.')} ${issue.message}`.toLowerCase();
const error = {
name: 'BadRequestError',
httpCode: 400,
type: 'API',
message,
};
return next(error);
}
next(err);
}
};
exports.default = policyMiddleware;
175 changes: 175 additions & 0 deletions dist/components/v1/distribution/distribution.entity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DistributionEntity = void 0;
const typeorm_1 = require("typeorm");
const utils_1 = require("../../../utils");
const enums_1 = require("../../../types/enums");
let DistributionEntity = class DistributionEntity {
id;
userAddress;
transactionHash;
tokenAddress;
tokenSymbol;
tokenDecimals;
totalAmount;
feeAmount;
usdRate;
totalUsdAmount;
totalRecipients;
distributionType;
chainName;
status;
blockNumber;
blockTimestamp;
network;
createdAt;
metadata;
generateId() {
if (!this.id) {
this.id = (0, utils_1.uuid)();
}
}
};
exports.DistributionEntity = DistributionEntity;
__decorate([
(0, typeorm_1.PrimaryColumn)("text"),
__metadata("design:type", String)
], DistributionEntity.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "user_address", nullable: false }),
__metadata("design:type", String)
], DistributionEntity.prototype, "userAddress", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "transaction_hash", nullable: true }),
__metadata("design:type", Object)
], DistributionEntity.prototype, "transactionHash", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "token_address", nullable: false }),
__metadata("design:type", String)
], DistributionEntity.prototype, "tokenAddress", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "token_symbol", nullable: false }),
__metadata("design:type", String)
], DistributionEntity.prototype, "tokenSymbol", void 0);
__decorate([
(0, typeorm_1.Column)("integer", { name: "token_decimals", nullable: false }),
__metadata("design:type", Number)
], DistributionEntity.prototype, "tokenDecimals", void 0);
__decorate([
(0, typeorm_1.Column)("decimal", {
name: "total_amount",
precision: 65,
scale: 30,
nullable: false,
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "totalAmount", void 0);
__decorate([
(0, typeorm_1.Column)("decimal", {
name: "fee_amount",
precision: 65,
scale: 30,
nullable: false,
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "feeAmount", void 0);
__decorate([
(0, typeorm_1.Column)("decimal", {
name: "usd_rate",
precision: 65,
scale: 30,
default: "0",
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "usdRate", void 0);
__decorate([
(0, typeorm_1.Column)("decimal", {
name: "total_usd_amount",
precision: 65,
scale: 30,
default: "0",
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "totalUsdAmount", void 0);
__decorate([
(0, typeorm_1.Column)("integer", { name: "total_recipients", nullable: false }),
__metadata("design:type", Number)
], DistributionEntity.prototype, "totalRecipients", void 0);
__decorate([
(0, typeorm_1.Column)({
type: "enum",
enum: enums_1.DistributionType,
name: "distribution_type",
nullable: false,
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "distributionType", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "chain_name", default: "" }),
__metadata("design:type", String)
], DistributionEntity.prototype, "chainName", void 0);
__decorate([
(0, typeorm_1.Column)({
type: "enum",
enum: enums_1.DistributionStatus,
default: enums_1.DistributionStatus.PENDING,
nullable: false,
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)("bigint", { name: "block_number", nullable: true }),
__metadata("design:type", Object)
], DistributionEntity.prototype, "blockNumber", void 0);
__decorate([
(0, typeorm_1.Column)("timestamp", {
name: "block_timestamp",
precision: 3,
nullable: true,
}),
__metadata("design:type", Object)
], DistributionEntity.prototype, "blockTimestamp", void 0);
__decorate([
(0, typeorm_1.Column)({
type: "enum",
enum: enums_1.Network,
default: enums_1.Network.MAINNET,
nullable: false,
}),
__metadata("design:type", String)
], DistributionEntity.prototype, "network", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({
name: "created_at",
type: "timestamp",
precision: 3,
}),
__metadata("design:type", Date)
], DistributionEntity.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)("jsonb", { nullable: true }),
__metadata("design:type", Object)
], DistributionEntity.prototype, "metadata", void 0);
__decorate([
(0, typeorm_1.BeforeInsert)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DistributionEntity.prototype, "generateId", null);
exports.DistributionEntity = DistributionEntity = __decorate([
(0, typeorm_1.Entity)("Distribution"),
(0, typeorm_1.Index)("Distribution_created_at_idx", ["createdAt"]),
(0, typeorm_1.Index)("Distribution_status_idx", ["status"]),
(0, typeorm_1.Index)("Distribution_transaction_hash_idx", ["transactionHash"]),
(0, typeorm_1.Index)("Distribution_user_address_idx", ["userAddress"])
], DistributionEntity);
exports.default = DistributionEntity;
85 changes: 85 additions & 0 deletions dist/components/v1/feeConfig/feeConfig.entity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeeConfigEntity = void 0;
const typeorm_1 = require("typeorm");
const utils_1 = require("../../../utils");
const enums_1 = require("../../../types/enums");
let FeeConfigEntity = class FeeConfigEntity {
id;
network;
chainId;
chainName;
amount;
createdAt;
updatedAt;
generateId() {
if (!this.id) {
this.id = (0, utils_1.uuid)();
}
}
};
exports.FeeConfigEntity = FeeConfigEntity;
__decorate([
(0, typeorm_1.PrimaryColumn)("text"),
__metadata("design:type", String)
], FeeConfigEntity.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({
type: "enum",
enum: enums_1.Network,
nullable: false,
}),
__metadata("design:type", String)
], FeeConfigEntity.prototype, "network", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "chain_id", nullable: false }),
__metadata("design:type", String)
], FeeConfigEntity.prototype, "chainId", void 0);
__decorate([
(0, typeorm_1.Column)("text", { name: "chain_name", nullable: false }),
__metadata("design:type", String)
], FeeConfigEntity.prototype, "chainName", void 0);
__decorate([
(0, typeorm_1.Column)("decimal", {
precision: 65,
scale: 30,
nullable: false,
}),
__metadata("design:type", String)
], FeeConfigEntity.prototype, "amount", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({
name: "created_at",
type: "timestamp",
default: () => "CURRENT_TIMESTAMP",
}),
__metadata("design:type", Date)
], FeeConfigEntity.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({
name: "updated_at",
type: "timestamp",
default: () => "CURRENT_TIMESTAMP",
}),
__metadata("design:type", Date)
], FeeConfigEntity.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.BeforeInsert)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], FeeConfigEntity.prototype, "generateId", null);
exports.FeeConfigEntity = FeeConfigEntity = __decorate([
(0, typeorm_1.Entity)("FeeConfig"),
(0, typeorm_1.Unique)("unique_network_config", ["chainName", "network", "chainId"])
], FeeConfigEntity);
exports.default = FeeConfigEntity;
8 changes: 8 additions & 0 deletions dist/components/v1/platform/platform.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const enhancedRouter_1 = __importDefault(require("../../../utils/enhancedRouter"));
const platformRouter = new enhancedRouter_1.default();
exports.default = platformRouter.getRouter();
Loading