Skip to content

Commit

Permalink
remove cyclic imports
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Jun 16, 2023
1 parent 44b8f0c commit 73e9008
Show file tree
Hide file tree
Showing 35 changed files with 49 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import type {
TypedDataDomain,
} from "ethers";

import { MasaSBTModuleBase } from "../../base/masa-sbt-module-base";
import { Messages } from "../../collections";
import type { PaymentMethod, PriceInformation } from "../../interface";
import {
generateSignatureDomain,
isNativeCurrency,
signTypedData,
} from "../../utils";
import { MasaSBTModuleBase } from "./sbt/masa-sbt-module-base";

export class CreditScore extends MasaSBTModuleBase {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import type {
TypedDataDomain,
} from "ethers";

import { MasaSBTModuleBase } from "../../base/masa-sbt-module-base";
import { Messages } from "../../collections";
import type { PaymentMethod, PriceInformation } from "../../interface";
import {
generateSignatureDomain,
isNativeCurrency,
signTypedData,
} from "../../utils";
import { MasaSBTModuleBase } from "./sbt/masa-sbt-module-base";

export class Green extends MasaSBTModuleBase {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
TypedDataDomain,
} from "ethers";

import { MasaSBTModuleBase } from "../../base/masa-sbt-module-base";
import { Messages } from "../../collections";
import type { PaymentMethod } from "../../interface";
import { generateSignatureDomain, isNativeCurrency } from "../../utils";
import { MasaSBTModuleBase } from "./sbt/masa-sbt-module-base";

export class Identity extends MasaSBTModuleBase {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./contract-factory";
export * from "./credit-score";
export * from "./green";
export * from "./identity";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import type {
import { constants, utils } from "ethers";
import { verifyTypedData } from "ethers/lib/utils";

import { Messages } from "../collections";
import { Messages } from "../../collections";
import type {
IIdentityContracts,
MasaInterface,
PaymentMethod,
} from "../interface";
import type { ERC20 } from "../stubs";
import { ERC20__factory } from "../stubs";
import { isERC20Currency, isNativeCurrency } from "../utils";
import { MasaBase } from "./masa-base";
} from "../../interface";
import { MasaBase } from "../../masa-base";
import type { ERC20 } from "../../stubs";
import { ERC20__factory } from "../../stubs";
import { isERC20Currency, isNativeCurrency } from "../../utils";

export abstract class MasaModuleBase extends MasaBase {
constructor(masa: MasaInterface, protected instances: IIdentityContracts) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ReferenceSBTAuthority } from "@masa-finance/masa-contracts-identity";
import { MasaSBTAuthority__factory } from "@masa-finance/masa-contracts-identity";

import { MasaSBTModuleBase } from "../../../../base/masa-sbt-module-base";
import { ContractFactory } from "../../contract-factory";
import { ContractFactory } from "../../../../interface/contract-factory";
import { MasaSBTModuleBase } from "../masa-sbt-module-base";
import { ASBTContractWrapper } from "./asbt-contract-wrapper";

export class ASBTContract extends MasaSBTModuleBase {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { MasaSBT } from "@masa-finance/masa-contracts-identity";

import { MasaSBTModuleBase } from "../../../../base/masa-sbt-module-base";
import type {
IIdentityContracts,
MasaInterface,
PaymentMethod,
PriceInformation,
} from "../../../../interface";
import { MasaSBTModuleBase } from "../masa-sbt-module-base";

export class SBTContractWrapper<
Contract extends MasaSBT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { MasaSBT } from "@masa-finance/masa-contracts-identity";
import { MasaSBT__factory } from "@masa-finance/masa-contracts-identity";

import { MasaSBTModuleBase } from "../../../../base/masa-sbt-module-base";
import type { ContractFactory } from "../../contract-factory";
import type { ContractFactory } from "../../../../interface/contract-factory";
import { MasaSBTModuleBase } from "../masa-sbt-module-base";
import { SBTContractWrapper } from "./sbt-contract-wrapper";

export class SBTContract extends MasaSBTModuleBase {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ReferenceSBTSelfSovereign } from "@masa-finance/masa-contracts-identity";
import { MasaSBTSelfSovereign__factory } from "@masa-finance/masa-contracts-identity";

import { MasaSBTModuleBase } from "../../../../base/masa-sbt-module-base";
import type { ContractFactory } from "../../contract-factory";
import type { ContractFactory } from "../../../../interface/contract-factory";
import { MasaSBTModuleBase } from "../masa-sbt-module-base";
import { SSSBTContractWrapper } from "./sssbt-contract-wrapper";

export class SSSBTContract extends MasaSBTModuleBase {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { BigNumber } from "@ethersproject/bignumber";
import type { MasaSBT } from "@masa-finance/masa-contracts-identity";
import { utils } from "ethers";

import { ContractFactory } from "../contracts/modules/contract-factory";
import type { PaymentMethod, PriceInformation } from "../interface";
import { isNativeCurrency } from "../utils";
import { MasaModuleBase } from "./masa-module-base";
import type { PaymentMethod, PriceInformation } from "../../../interface";
import { ContractFactory } from "../../../interface/contract-factory";
import { isNativeCurrency } from "../../../utils";
import { MasaModuleBase } from "../masa-module-base";

export abstract class MasaSBTModuleBase extends MasaModuleBase {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BigNumber } from "@ethersproject/bignumber";
import type { Contract, PayableOverrides } from "ethers";

import { MasaModuleBase } from "../../base/masa-module-base";
import { Messages } from "../../collections";
import type {
BaseResult,
Expand All @@ -11,6 +10,7 @@ import type {
import type { Link } from "../../modules";
import { loadLinks } from "../../modules";
import { isNativeCurrency, signTypedData } from "../../utils";
import { MasaModuleBase } from "./masa-module-base";

export type BreakLinkResult = BaseResult;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import type {
TypedDataDomain,
} from "ethers";

import { MasaModuleBase } from "../../base/masa-module-base";
import { Messages } from "../../collections";
import type { PaymentMethod, PriceInformation } from "../../interface";
import {
generateSignatureDomain,
isNativeCurrency,
signTypedData,
} from "../../utils";
import { MasaModuleBase } from "./masa-module-base";

export class SoulName extends MasaModuleBase {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./contract-modules";
export * from "./load-Identity-contracts";
export * from "./masa-contracts";
export * from "./modules";
18 changes: 9 additions & 9 deletions src/contracts/masa-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import type { LogDescription } from "@ethersproject/abi";
import type { Log } from "@ethersproject/abstract-provider";
import type { BaseContract } from "ethers";

import { MasaBase } from "../base/masa-base";
import type { IIdentityContracts, MasaInterface } from "../interface";
import { MasaBase } from "../masa-base";
import { CreditScore } from "./contract-modules/credit-score";
import { Green } from "./contract-modules/green";
import { Identity } from "./contract-modules/identity";
import { ASBTContract } from "./contract-modules/sbt/ASBT";
import { SBTContract } from "./contract-modules/sbt/SBT/sbt-contract";
import { SSSBTContract } from "./contract-modules/sbt/SSSBT/sssbt-contract";
import { SoulLinker } from "./contract-modules/soul-linker";
import { SoulName } from "./contract-modules/soul-name";
import { loadIdentityContracts } from "./load-Identity-contracts";
import { CreditScore } from "./modules/credit-score";
import { Green } from "./modules/green";
import { Identity } from "./modules/identity";
import { ASBTContract } from "./modules/sbt/ASBT";
import { SBTContract } from "./modules/sbt/SBT/sbt-contract";
import { SSSBTContract } from "./modules/sbt/SSSBT/sssbt-contract";
import { SoulLinker } from "./modules/soul-linker";
import { SoulName } from "./modules/soul-name";

export class MasaContracts extends MasaBase {
/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/base/masa-base.ts → src/masa-base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MasaInterface } from "../interface";
import type { MasaInterface } from "./interface";

export abstract class MasaBase {
public constructor(protected readonly masa: MasaInterface) {}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/account/account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MasaBase } from "../../base/masa-base";
import { MasaBase } from "../../masa-base";
import { getBalances } from "./get-balances";

export class MasaAccount extends MasaBase {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/credit-score/credit-score.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SoulboundCreditScore } from "@masa-finance/masa-contracts-identity";
import type { BigNumber } from "ethers";

import { MasaLinkable } from "../../base/masa-linkable";
import type { MasaInterface, PaymentMethod } from "../../interface";
import { MasaLinkable } from "../masa-linkable";
import { createCreditScore } from "./create";
import { listCreditScores } from "./list";
import { loadCreditScores } from "./load";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/green/green.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SoulboundGreen } from "@masa-finance/masa-contracts-identity";
import type { BigNumber } from "ethers";

import { MasaLinkable } from "../../base/masa-linkable";
import type { MasaInterface, PaymentMethod } from "../../interface";
import { MasaLinkable } from "..//masa-linkable";
import { createGreen, generateGreen, mintGreen, verifyGreen } from "./create";
import { listGreens } from "./list";
import { loadGreens } from "./load";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/identity/identity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SoulboundIdentity } from "@masa-finance/masa-contracts-identity";

import { MasaLinkable } from "../../base/masa-linkable";
import type { MasaInterface, PaymentMethod } from "../../interface";
import { MasaLinkable } from "..//masa-linkable";
import { burnIdentity } from "./burn";
import { createIdentity, createIdentityWithSoulName } from "./create";
import { loadIdentityByAddress } from "./load";
Expand Down
2 changes: 1 addition & 1 deletion src/base/masa-linkable.ts → src/modules/masa-linkable.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Contract } from "ethers";

import type { MasaInterface } from "../interface";
import { MasaBase } from "../masa-base";
import { MasaSoulLinker } from "../modules/soul-linker/soul-linker";
import { MasaBase } from "./masa-base";

export abstract class MasaLinkable<
LinkContract extends Contract
Expand Down
4 changes: 2 additions & 2 deletions src/modules/sbt/ASBT/masa-asbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
ReferenceSBTAuthority__factory,
} from "@masa-finance/masa-contracts-identity";

import { MasaBase } from "../../../base/masa-base";
import { ContractFactory } from "../../../contracts/modules/contract-factory";
import { ContractFactory } from "../../../interface/contract-factory";
import { MasaBase } from "../../../masa-base";
import { deployASBT } from "./deploy";
import { MasaASBTWrapper } from "./masa-asbt-wrapper";

Expand Down
2 changes: 1 addition & 1 deletion src/modules/sbt/SBT/masa-sbt-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MasaSBT } from "@masa-finance/masa-contracts-identity";
import type { BigNumber } from "ethers";

import { MasaLinkable } from "../../../base/masa-linkable";
import { Messages } from "../../../collections";
import { isBigNumber, patchMetadataUrl } from "../../../utils";
import { MasaLinkable } from "../../masa-linkable";

export class MasaSBTWrapper<
Contract extends MasaSBT
Expand Down
4 changes: 2 additions & 2 deletions src/modules/sbt/SBT/masa-sbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
MasaSBT__factory,
} from "@masa-finance/masa-contracts-identity";

import { MasaBase } from "../../../base/masa-base";
import type { ContractFactory } from "../../../contracts/modules/contract-factory";
import type { ContractFactory } from "../../../interface/contract-factory";
import { MasaBase } from "../../../masa-base";
import { MasaSBTWrapper } from "./masa-sbt-wrapper";

export class MasaSBTBase extends MasaBase {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/sbt/SSSBT/masa-sssbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
ReferenceSBTSelfSovereign__factory,
} from "@masa-finance/masa-contracts-identity";

import { MasaBase } from "../../../base/masa-base";
import { ContractFactory } from "../../../contracts/modules/contract-factory";
import { ContractFactory } from "../../../interface/contract-factory";
import { MasaBase } from "../../../masa-base";
import { deploySSSBT } from "./deploy";
import { MasaSSSBTWrapper } from "./masa-sssbt-wrapper";

Expand Down
2 changes: 1 addition & 1 deletion src/modules/session/session.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MasaBase } from "../../base/masa-base";
import { MasaBase } from "../../masa-base";
import { checkLogin } from "./check-login";
import { getSession } from "./get-session";
import { login } from "./login";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/soul-linker/soul-linker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { BigNumber, Contract } from "ethers";

import { MasaBase } from "../../base/masa-base";
import type { MasaInterface, PaymentMethod } from "../../interface";
import { MasaBase } from "../../masa-base";
import { createLink } from "./create-link";
import { establishLinkFromPassport } from "./establish-link";
import { listLinks } from "./list-links";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/soul-name/soul-name.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { BigNumber } from "@ethersproject/bignumber";

import { MasaBase } from "../../base/masa-base";
import type { PaymentMethod } from "../../interface";
import { MasaBase } from "../../masa-base";
import { burnSoulName } from "./burn";
import { createSoulName } from "./create";
import { getSoulNameMetadataPrefix } from "./helpers";
Expand Down
2 changes: 1 addition & 1 deletion src/utils/clients/masa-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { AxiosError, AxiosInstance, AxiosResponse } from "axios";
import axios from "axios";

import { MasaBase } from "../../base/masa-base";
import type {
ChallengeResult,
ChallengeResultWithCookie,
Expand All @@ -20,6 +19,7 @@ import type {
UpdateCreditScoreResult,
VerifyGreenResult,
} from "../../interface";
import { MasaBase } from "../../masa-base";

const headers = {
"Content-Type": "application/json",
Expand Down

0 comments on commit 73e9008

Please sign in to comment.