Skip to content

Commit

Permalink
change factories constructor to ensure consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Feb 23, 2024
1 parent ef8c7ca commit f2ec87a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/transaction.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe("test transaction", function () {
const network = await provider.getNetworkConfig();

const config = new TransactionsFactoryConfig({ chainID: network.ChainID });
const factory = new NextTransferTransactionsFactory(config, new TokenComputer());
const factory = new NextTransferTransactionsFactory({ config: config, tokenComputer: new TokenComputer() });

await alice.sync(provider);
await bob.sync(provider);
Expand Down
8 changes: 4 additions & 4 deletions src/transactionsFactories/smartContractTransactionsFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export class SmartContractTransactionsFactory {
private readonly tokenComputer: TokenComputer;
private readonly dataArgsBuilder: TokenTransfersDataBuilder;

constructor({ config, abi, tokenComputer }: { config: Config; abi?: Abi; tokenComputer: TokenComputer }) {
this.config = config;
this.abiRegistry = abi;
this.tokenComputer = tokenComputer;
constructor(options: { config: Config; abi?: Abi; tokenComputer: TokenComputer }) {
this.config = options.config;
this.abiRegistry = options.abi;
this.tokenComputer = options.tokenComputer;
this.dataArgsBuilder = new TokenTransfersDataBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { NextTransferTransactionsFactory } from "./transferTransactionsFactory";

describe("test transfer transcations factory", function () {
const config = new TransactionsFactoryConfig({ chainID: "D" });
const nextTransferFactory = new NextTransferTransactionsFactory(config, new TokenComputer());
const nextTransferFactory = new NextTransferTransactionsFactory({
config: config,
tokenComputer: new TokenComputer(),
});

const alice = Address.fromBech32("erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th");
const bob = Address.fromBech32("erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx");
Expand Down
6 changes: 3 additions & 3 deletions src/transactionsFactories/transferTransactionsFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class NextTransferTransactionsFactory {
private readonly dataArgsBuilder: TokenTransfersDataBuilder;
private readonly tokenComputer: TokenComputer;

constructor(config: IConfig, tokenComputer: TokenComputer) {
this.config = config;
this.tokenComputer = tokenComputer;
constructor(options: { config: IConfig; tokenComputer: TokenComputer }) {
this.config = options.config;
this.tokenComputer = options.tokenComputer;
this.dataArgsBuilder = new TokenTransfersDataBuilder();
}

Expand Down

0 comments on commit f2ec87a

Please sign in to comment.