Skip to content

Commit

Permalink
Merge branch 'dev' into chore/stardust/remove-identity-resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad committed Jan 22, 2024
2 parents 9739138 + cc23cfb commit 63af8fd
Show file tree
Hide file tree
Showing 37 changed files with 983 additions and 937 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Found a bug?
description: Fill in this form to report it, and help us improve
title: '[Bug]: '
labels: type:bug report
labels: 'bug report'

body:
- type: markdown
Expand Down
29 changes: 0 additions & 29 deletions .github/ISSUE_TEMPLATE/create-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,3 @@ body:
description: Describe the task that needs to be completed.
validations:
required: true

- type: textarea
id: requirements
attributes:
label: Requirements
description: What are the requirements for this task, this could be a checklist of subtasks.
validations:
required: true

- type: textarea
id: acceptance_criteria
attributes:
label: Acceptance criteria
description: What is the criteria for this task to be marked as done? This will help anyone approving any PRs related to this task.
validations:
required: true

- type: checkboxes
id: checklist
attributes:
label: Creation checklist
description: 'Before submitting this task please ensure you have done the following if necessary:'
options:
- label: I have assigned this task to the correct people
required: false
- label: I have added the most appropriate labels
required: false
- label: I have linked the correct milestone and/or project
required: false
19 changes: 19 additions & 0 deletions .github/workflows/add-bugs-to-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Assign Bugs to Project

on:
issues:
types: [labeled]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
assign_to_project:
runs-on: ubuntu-latest
name: Assign bug issue to Bug Management project
steps:
- name: Assign issues with bug report label to 'Tooling - Bug Management' project
uses: srggrs/assign-one-project-github-action@4fc2b23bdaaac08e64dcc590a6e138d2f9b8c86e
if: contains(github.event.issue.labels.*.name, 'bug report')
with:
project: 'https://github.com/orgs/iotaledger/projects/78'
column_name: 'Triage'
29 changes: 29 additions & 0 deletions .github/workflows/pr-build-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR build check

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
build-check:
strategy:
fail-fast: false
matrix:
project: [api, client]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install Dependencies
run: npm install

- name: Build Check
run: npm run build
4 changes: 0 additions & 4 deletions .husky/pre-push

This file was deleted.

29 changes: 15 additions & 14 deletions api/src/initServices.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MqttClient as ChrysalisMqttClient } from "@iota/mqtt.js";
import { Client as StardustClient } from "@iota/sdk";
import { IClientOptions, Client as StardustClient } from "@iota/sdk";
import { ServiceFactory } from "./factories/serviceFactory";
import logger from "./logger";
import { IConfiguration } from "./models/configuration/IConfiguration";
Expand All @@ -24,6 +24,7 @@ import { ChronicleService } from "./services/stardust/chronicleService";
import { StardustFeed } from "./services/stardust/feed/stardustFeed";
import { InfluxDBService } from "./services/stardust/influx/influxDbService";
import { NodeInfoService } from "./services/stardust/nodeInfoService";
import { StardustApiService } from "./services/stardust/stardustApiService";
import { StardustStatsService } from "./services/stardust/stats/stardustStatsService";

const CURRENCY_UPDATE_INTERVAL_MS = 5 * 60000;
Expand Down Expand Up @@ -141,30 +142,30 @@ function initChrysalisServices(networkConfig: INetwork): void {
*/
function initStardustServices(networkConfig: INetwork): void {
logger.verbose(`Initializing Stardust services for ${networkConfig.network}`);
const stardustClient = new StardustClient({
nodes: [networkConfig.provider],
brokerOptions: { useWs: true },
});
ServiceFactory.register(`client-${networkConfig.network}`, () => stardustClient);

const stardustClientParams: IClientOptions = {
primaryNode: networkConfig.provider,
};

if (networkConfig.permaNodeEndpoint) {
// Client with permanode needs the ignoreNodeHealth as chronicle is considered "not healthy" by the sdk
// Related: https://github.com/iotaledger/inx-chronicle/issues/1302
const stardustPermanodeClient = new StardustClient({
nodes: [networkConfig.permaNodeEndpoint],
ignoreNodeHealth: true,
});
ServiceFactory.register(`permanode-client-${networkConfig.network}`, () => stardustPermanodeClient);
stardustClientParams.nodes = [networkConfig.permaNodeEndpoint];
stardustClientParams.ignoreNodeHealth = true;

const chronicleService = new ChronicleService(networkConfig);
ServiceFactory.register(`chronicle-${networkConfig.network}`, () => chronicleService);
}

const stardustClient = new StardustClient(stardustClientParams);
ServiceFactory.register(`client-${networkConfig.network}`, () => stardustClient);

const stardustApiService = new StardustApiService(networkConfig);
ServiceFactory.register(`api-service-${networkConfig.network}`, () => stardustApiService);

// eslint-disable-next-line no-void
void NodeInfoService.build(networkConfig).then((nodeInfoService) => {
ServiceFactory.register(`node-info-${networkConfig.network}`, () => nodeInfoService);

const stardustFeed = new StardustFeed(networkConfig.network);
const stardustFeed = new StardustFeed(networkConfig);
ServiceFactory.register(`feed-${networkConfig.network}`, () => stardustFeed);
});

Expand Down
5 changes: 3 additions & 2 deletions api/src/routes/stardust/address/balance/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IAddressDetailsWithBalance from "../../../../models/api/stardust/IAddress
import { IConfiguration } from "../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../services/networkService";
import { StardustTangleHelper } from "../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../utils/validationHelper";

/**
Expand All @@ -24,5 +24,6 @@ export async function get(config: IConfiguration, request: IAddressBalanceReques
return undefined;
}

return StardustTangleHelper.addressDetails(networkConfig, request.address);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.addressDetails(request.address);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/address/outputs/alias/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IAddressDetailsResponse } from "../../../../../models/api/stardust/IAdd
import { IConfiguration } from "../../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../../services/networkService";
import { StardustTangleHelper } from "../../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../../utils/validationHelper";

/**
Expand All @@ -24,5 +24,6 @@ export async function get(config: IConfiguration, request: IAddressDetailsReques
return {};
}

return StardustTangleHelper.aliasOutputDetailsByAddress(networkConfig, request.address);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.aliasOutputDetailsByAddress(request.address);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/address/outputs/basic/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IAddressDetailsResponse } from "../../../../../models/api/stardust/IAdd
import { IConfiguration } from "../../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../../services/networkService";
import { StardustTangleHelper } from "../../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../../utils/validationHelper";

/**
Expand All @@ -24,5 +24,6 @@ export async function get(config: IConfiguration, request: IAddressDetailsReques
return {};
}

return StardustTangleHelper.basicOutputDetailsByAddress(networkConfig, request.address);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.basicOutputDetailsByAddress(request.address);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/address/outputs/nft/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IAddressDetailsResponse } from "../../../../../models/api/stardust/IAdd
import { IConfiguration } from "../../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../../services/networkService";
import { StardustTangleHelper } from "../../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../../utils/validationHelper";

/**
Expand All @@ -24,5 +24,6 @@ export async function get(config: IConfiguration, request: IAddressDetailsReques
return {};
}

return StardustTangleHelper.nftOutputDetailsByAddress(networkConfig, request.address);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.nftOutputDetailsByAddress(request.address);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/alias/foundries/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IFoundriesResponse } from "../../../../models/api/stardust/foundry/IFou
import { IConfiguration } from "../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../services/networkService";
import { StardustTangleHelper } from "../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(config: IConfiguration, request: IFoundriesRequest): P
return {};
}

return StardustTangleHelper.aliasFoundries(networkConfig, request.aliasAddress);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.aliasFoundries(request.aliasAddress);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/alias/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IAliasResponse } from "../../../models/api/stardust/IAliasResponse";
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(config: IConfiguration, request: IAliasRequest): Promi
return {};
}

return StardustTangleHelper.aliasDetails(networkConfig, request.aliasId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.aliasDetails(request.aliasId);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/block/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IBlockResponse } from "../../../models/api/stardust/IBlockResponse";
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(_: IConfiguration, request: IBlockRequest): Promise<IB
return {};
}

return StardustTangleHelper.block(networkConfig, request.blockId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.block(request.blockId);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/block/metadata/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IBlockRequest } from "../../../../models/api/stardust/IBlockRequest";
import { IConfiguration } from "../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../services/networkService";
import { StardustTangleHelper } from "../../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(_: IConfiguration, request: IBlockRequest): Promise<IB
return {};
}

return StardustTangleHelper.blockDetails(networkConfig, request.blockId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.blockDetails(request.blockId);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/foundry/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IFoundryResponse } from "../../../models/api/stardust/foundry/IFoundryR
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(config: IConfiguration, request: IFoundryRequest): Pro
return {};
}

return StardustTangleHelper.foundryDetails(networkConfig, request.foundryId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.foundryDetails(request.foundryId);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/milestone/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IMilestoneDetailsResponse } from "../../../models/api/stardust/mileston
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,7 +25,8 @@ export async function get(config: IConfiguration, request: IMilestoneDetailsRequ
return {};
}

const milestoneDetails = await StardustTangleHelper.milestoneDetailsByIndex(networkConfig, Number(request.milestoneIndex));
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
const milestoneDetails = await stardustApiService.milestoneDetailsByIndex(Number(request.milestoneIndex));

return milestoneDetails;
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/nft/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { INftDetailsResponse } from "../../../models/api/stardust/nft/INftDetail
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(config: IConfiguration, request: INftDetailsRequest):
return {};
}

return StardustTangleHelper.nftDetails(networkConfig, request.nftId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.nftDetails(request.nftId);
}
5 changes: 3 additions & 2 deletions api/src/routes/stardust/output/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IOutputDetailsResponse } from "../../../models/api/stardust/IOutputDeta
import { IConfiguration } from "../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../models/db/protocolVersion";
import { NetworkService } from "../../../services/networkService";
import { StardustTangleHelper } from "../../../utils/stardust/stardustTangleHelper";
import { StardustApiService } from "../../../services/stardust/stardustApiService";
import { ValidationHelper } from "../../../utils/validationHelper";

/**
Expand All @@ -25,5 +25,6 @@ export async function get(config: IConfiguration, request: IOutputDetailsRequest
return {};
}

return StardustTangleHelper.outputDetails(networkConfig, request.outputId);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);
return stardustApiService.outputDetails(request.outputId);
}
7 changes: 4 additions & 3 deletions api/src/routes/stardust/output/tagged/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { INftOutputsResponse } from "../../../../models/api/stardust/nft/INftOut
import { IConfiguration } from "../../../../models/configuration/IConfiguration";
import { STARDUST } from "../../../../models/db/protocolVersion";
import { NetworkService } from "../../../../services/networkService";
import { StardustApiService } from "../../../../services/stardust/stardustApiService";
import { Converter } from "../../../../utils/convertUtils";
import { StardustTangleHelper } from "../../../../utils/stardust/stardustTangleHelper";
import { ValidationHelper } from "../../../../utils/validationHelper";

/**
Expand All @@ -29,11 +29,12 @@ export async function get(_: IConfiguration, request: ITaggedOutputsRequest): Pr
}

const tagHex = Converter.utf8ToHex(request.tag, true);
const stardustApiService = ServiceFactory.get<StardustApiService>(`api-service-${networkConfig.network}`);

if (request.outputType === "basic") {
return StardustTangleHelper.taggedBasicOutputs(networkConfig, tagHex, 10, request.cursor);
return stardustApiService.taggedBasicOutputs(tagHex, 10, request.cursor);
} else if (request.outputType === "nft") {
return StardustTangleHelper.taggedNftOutputs(networkConfig, tagHex, 10, request.cursor);
return stardustApiService.taggedNftOutputs(tagHex, 10, request.cursor);
}

return { error: "Unsupported output type" };
Expand Down
Loading

0 comments on commit 63af8fd

Please sign in to comment.