Skip to content

Commit

Permalink
style: resolve style guide violations
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U authored and github-actions[bot] committed Nov 28, 2024
1 parent 681e85f commit ca9ecf8
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 96 deletions.
2 changes: 1 addition & 1 deletion packages/api-database/source/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from "./api-node.js";
export * from "./block.js";
export * from "./contract.js";
export * from "./configuration.js";
export * from "./contract.js";
export * from "./peer.js";
export * from "./plugin.js";
export * from "./receipt.js";
Expand Down
14 changes: 7 additions & 7 deletions packages/api-http/source/controllers/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class ContractsController extends Controller {
const contracts = await contractRepository.createQueryBuilder().orderBy("name").addOrderBy("address").getMany();

return {
data: contracts.reduce((acc, prev) => {
acc[prev.name] = {
address: prev.address,
proxy: prev.proxy,
implementations: prev.implementations.map((impl) => impl.address),
activeImplementation: prev.activeImplementation,
data: contracts.reduce((accumulator, previous) => {
accumulator[previous.name] = {
activeImplementation: previous.activeImplementation,
address: previous.address,
implementations: previous.implementations.map((impl) => impl.address),
proxy: previous.proxy,
};
return acc;
return accumulator;
}, {}),
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/source/routes/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const register = (server: Contracts.Api.ApiServer): void => {
options: {
validate: {
params: Joi.object({
name: Joi.string().min(4).max(15),
implementation: address,
name: Joi.string().min(4).max(15),
}),
},
},
Expand Down
45 changes: 19 additions & 26 deletions packages/api-http/test/fixtures/contracts-response.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
{
"consensus": {
"address": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
"proxy": "UUPS",
"implementations": [
"0x522B3294E6d06aA25Ad0f1B8891242E335D3B459",
"0x622B3294E6d06aA25Ad0f1B8891242E335D3B459"
],
"activeImplementation": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459"
},
"multi-payments": {
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"proxy": null,
"implementations": [
"0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f"
],
"activeImplementation": null
},
"usernames": {
"address": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6",
"proxy": "UUPS",
"implementations": [
"0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"
],
"activeImplementation": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"
}
}
"consensus": {
"address": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
"proxy": "UUPS",
"implementations": ["0x522B3294E6d06aA25Ad0f1B8891242E335D3B459", "0x622B3294E6d06aA25Ad0f1B8891242E335D3B459"],
"activeImplementation": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459"
},
"multi-payments": {
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"proxy": null,
"implementations": ["0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f"],
"activeImplementation": null
},
"usernames": {
"address": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6",
"proxy": "UUPS",
"implementations": ["0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"],
"activeImplementation": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"
}
}
98 changes: 49 additions & 49 deletions packages/api-http/test/fixtures/contracts.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
[
{
"name": "consensus",
"address": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
"proxy": "UUPS",
"implementations": [
{
"address": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459",
"abi": {
"consensus": 1
}
},
{
"address": "0x622B3294E6d06aA25Ad0f1B8891242E335D3B459",
"abi": {
"consensus": 2
}
}
],
"activeImplementation": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459"
},
{
"name": "multi-payments",
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"proxy": null,
"implementations": [
{
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"abi": {
"multi-payments": 1
}
}
],
"activeImplementation": null
},
{
"name": "usernames",
"address": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6",
"proxy": "UUPS",
"implementations": [
{
"address": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc",
"abi": {
"usernames": 1
}
}
],
"activeImplementation": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"
}
]
{
"name": "consensus",
"address": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
"proxy": "UUPS",
"implementations": [
{
"address": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459",
"abi": {
"consensus": 1
}
},
{
"address": "0x622B3294E6d06aA25Ad0f1B8891242E335D3B459",
"abi": {
"consensus": 2
}
}
],
"activeImplementation": "0x522B3294E6d06aA25Ad0f1B8891242E335D3B459"
},
{
"name": "multi-payments",
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"proxy": null,
"implementations": [
{
"address": "0x83769BeEB7e5405ef0B7dc3C66C43E3a51A6d27f",
"abi": {
"multi-payments": 1
}
}
],
"activeImplementation": null
},
{
"name": "usernames",
"address": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6",
"proxy": "UUPS",
"implementations": [
{
"address": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc",
"abi": {
"usernames": 1
}
}
],
"activeImplementation": "0xc051134F56d56160E8c8ed9bB3c439c78AB27cCc"
}
]
2 changes: 1 addition & 1 deletion packages/api-sync/source/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Contracts, Identifiers } from "@mainsail/contracts";

import * as ApiSyncContracts from "./contracts.js";
import { ApiNodes } from "./listeners/api-nodes.js";
import { DeployerContracts } from "./listeners/contracts.js";
import { Peers } from "./listeners/peers.js";
import { Plugins } from "./listeners/plugins.js";
import { DeployerContracts } from "./listeners/contracts.js";

@injectable()
export class Listeners implements ApiSyncContracts.Listeners {
Expand Down
6 changes: 3 additions & 3 deletions packages/api-sync/source/listeners/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export class DeployerContracts extends AbstractListener<Contracts.Evm.DeployerCo

protected mapEventToEntity(event: Contracts.Evm.DeployerContract): Models.Contract {
return {
name: event.name,
activeImplementation: event.activeImplementation,
address: event.address,
proxy: event.proxy,
implementations: event.implementations,
activeImplementation: event.activeImplementation,
name: event.name,
proxy: event.proxy,
};
}

Expand Down
16 changes: 8 additions & 8 deletions packages/evm-consensus/source/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ export class Deployer {
);

void this.events.dispatch(Events.DeployerEvent.ContractCreated, {
name: "consensus",
activeImplementation: consensusContractAddress,
address: proxyResult.receipt.deployedContractAddress!,
implementations: [{ abi: ConsensusAbi.abi, address: consensusContractAddress }],
name: "consensus",
proxy: "UUPS",
implementations: [{ address: consensusContractAddress, abi: ConsensusAbi.abi }],
activeImplementation: consensusContractAddress,
});

this.app
Expand Down Expand Up @@ -239,11 +239,11 @@ export class Deployer {
);

void this.events.dispatch(Events.DeployerEvent.ContractCreated, {
name: "usernames",
activeImplementation: usernamesContractAddress,
address: proxyResult.receipt.deployedContractAddress!,
implementations: [{ abi: UsernamesAbi.abi, address: usernamesContractAddress }],
name: "usernames",
proxy: "UUPS",
implementations: [{ address: usernamesContractAddress, abi: UsernamesAbi.abi }],
activeImplementation: usernamesContractAddress,
});

this.app
Expand Down Expand Up @@ -278,9 +278,9 @@ export class Deployer {
);

void this.events.dispatch(Events.DeployerEvent.ContractCreated, {
name: "multi-payments",
address: result.receipt.deployedContractAddress!,
implementations: [{ address: result.receipt.deployedContractAddress!, abi: MultiPaymentAbi.abi }],
implementations: [{ abi: MultiPaymentAbi.abi, address: result.receipt.deployedContractAddress! }],
name: "multi-payments",
});

return result.receipt.deployedContractAddress!;
Expand Down

0 comments on commit ca9ecf8

Please sign in to comment.