Skip to content

Commit

Permalink
Remove interfaces on network
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Jan 29, 2025
1 parent caa7bc3 commit 21f3f0b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 106 deletions.
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export * from "./delegation";
export * from "./entrypoints";
export * from "./errors";
export * from "./interface";
export * from "./interfaceOfNetwork";
export * from "./logger";
export * from "./message";
export * from "./networkParams";
Expand Down
7 changes: 7 additions & 0 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ export interface IPlainTransactionObject {
guardianSignature?: string;
relayerSignature?: string;
}

export interface INetworkConfig {
MinGasLimit: number;
GasPerDataByte: number;
GasPriceModifier: number;
ChainID: string;
}
95 changes: 0 additions & 95 deletions src/interfaceOfNetwork.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/testutils/mockNetworkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Address } from "../address";
import { AsyncTimer } from "../asyncTimer";
import * as errors from "../errors";
import { ErrMock } from "../errors";
import { IAccountOnNetwork } from "../interfaceOfNetwork";
import {
AccountOnNetwork,
DefinitionOfFungibleTokenOnNetwork,
Expand Down Expand Up @@ -123,7 +122,7 @@ export class MockNetworkProvider implements INetworkProvider {
throw new Error("Method not implemented.");
}

mockUpdateAccount(address: Address, mutate: (item: IAccountOnNetwork) => void) {
mockUpdateAccount(address: Address, mutate: (item: AccountOnNetwork) => void) {
let account = this.accounts.get(address.toBech32());
if (account) {
mutate(account);
Expand Down
4 changes: 2 additions & 2 deletions src/testutils/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "fs";
import * as path from "path";
import { Account } from "../accounts";
import { Address } from "../address";
import { IAccountOnNetwork } from "../interfaceOfNetwork";
import { AccountOnNetwork } from "../networkProviders";
import { getAxios } from "../utils";
import { UserSecretKey, UserSigner } from "./../wallet";
import { readTestFile } from "./files";
Expand All @@ -11,7 +11,7 @@ import { isOnBrowserTests } from "./utils";
export const DummyMnemonicOf12Words = "matter trumpet twenty parade fame north lift sail valve salon foster cinnamon";

interface IAccountFetcher {
getAccount(address: Address): Promise<IAccountOnNetwork>;
getAccount(address: Address): Promise<AccountOnNetwork>;
}

export async function loadAndSyncTestWallets(provider: IAccountFetcher): Promise<Record<string, TestWallet>> {
Expand Down
3 changes: 1 addition & 2 deletions src/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { BigNumber } from "bignumber.js";
import { Address } from "./address";
import { TRANSACTION_MIN_GAS_PRICE, TRANSACTION_OPTIONS_DEFAULT, TRANSACTION_VERSION_DEFAULT } from "./constants";
import { IPlainTransactionObject } from "./interface";
import { INetworkConfig } from "./interfaceOfNetwork";
import { INetworkConfig, IPlainTransactionObject } from "./interface";
import { interpretSignatureAsBuffer } from "./signature";
import { TransactionComputer } from "./transactionComputer";

Expand Down
2 changes: 1 addition & 1 deletion src/transactionComputer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TRANSACTION_OPTIONS_TX_HASH_SIGN,
} from "./constants";
import * as errors from "./errors";
import { INetworkConfig } from "./interfaceOfNetwork";
import { INetworkConfig } from "./interface";
import { ProtoSerializer } from "./proto";
import { Transaction } from "./transaction";

Expand Down
6 changes: 3 additions & 3 deletions src/transactionWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
ErrIsCompletedFieldIsMissingOnTransaction,
} from "./errors";
import { ITransactionFetcher } from "./interface";
import { ITransactionStatus } from "./interfaceOfNetwork";
import { Logger } from "./logger";
import { TransactionEvent } from "./transactionEvents";
import { TransactionOnNetwork } from "./transactionOnNetwork";
import { TransactionStatus } from "./transactionStatus";

export type PredicateIsAwaitedStatus = (status: ITransactionStatus) => boolean;
export type PredicateIsAwaitedStatus = (status: TransactionStatus) => boolean;

/**
* Internal interface: a transaction, as seen from the perspective of a {@link TransactionWatcher}.
Expand All @@ -29,7 +29,7 @@ export class TransactionWatcher {
static DefaultTimeout: number = TransactionWatcher.DefaultPollingInterval * 15;
static DefaultPatience: number = 0;

static NoopOnStatusReceived = (_: ITransactionStatus) => {};
static NoopOnStatusReceived = (_: TransactionStatus) => {};

protected readonly fetcher: ITransactionFetcher;
protected readonly pollingIntervalMilliseconds: number;
Expand Down

0 comments on commit 21f3f0b

Please sign in to comment.