diff --git a/src/actions/mint.ts b/src/actions/mint.ts index 9cb3ba7..caf56bc 100644 --- a/src/actions/mint.ts +++ b/src/actions/mint.ts @@ -1,7 +1,18 @@ import { Address } from "@planetarium/account"; import { RecordView, Value } from "@planetarium/bencodex"; -import { encodeCurrency } from "@planetarium/tx"; -import { IFungibleAssetValues, IFungibleItems } from "../interfaces/minter"; +import { FungibleAssetValue, encodeCurrency } from "@planetarium/tx"; +import { FungibleItemId } from "../types/fungible-item-id"; + +export interface IFungibleAssetValues { + recipient: string; + amount: FungibleAssetValue; +} + +export interface IFungibleItems { + recipient: string; + fungibleItemId: FungibleItemId; + count: number; +} function encodeMintSpec(value: IFungibleAssetValues | IFungibleItems): Value { if ((value as IFungibleAssetValues).amount !== undefined) { diff --git a/src/events/assets-transferred.ts b/src/events/assets-transferred.ts index f3fb082..5b4370d 100644 --- a/src/events/assets-transferred.ts +++ b/src/events/assets-transferred.ts @@ -1,5 +1,5 @@ import { Address } from "@planetarium/account"; -import { IHeadlessGraphQLClient } from "../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../headless-graphql-client"; import { AssetTransferredEvent } from "../types/asset-transferred-event"; import { TransactionLocation } from "../types/transaction-location"; diff --git a/src/events/garage-unload.ts b/src/events/garage-unload.ts index eeb9bc5..b823aae 100644 --- a/src/events/garage-unload.ts +++ b/src/events/garage-unload.ts @@ -1,5 +1,5 @@ import { Address } from "@planetarium/account"; -import { IHeadlessGraphQLClient } from "../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../headless-graphql-client"; import { GarageUnloadEvent } from "../types/garage-unload-event"; export type ValidatedGarageUnloadEvent = Omit & { diff --git a/src/headless-graphql-client.ts b/src/headless-graphql-client.ts index f34a797..63863e3 100644 --- a/src/headless-graphql-client.ts +++ b/src/headless-graphql-client.ts @@ -14,7 +14,6 @@ import { GetTransactionResultDocument, StageTransactionDocument, } from "./generated/graphql"; -import { IHeadlessGraphQLClient } from "./interfaces/headless-graphql-client"; import { AssetTransferredEvent } from "./types/asset-transferred-event"; import { BlockHash } from "./types/block-hash"; import { GarageUnloadEvent } from "./types/garage-unload-event"; @@ -22,6 +21,26 @@ import { Planet } from "./types/registry"; import { TransactionResult } from "./types/transaction-result"; import { TxId } from "./types/txid"; +export interface IHeadlessGraphQLClient { + getPlanetID(): string; + getBlockIndex(blockHash: BlockHash): Promise; + getTipIndex(): Promise; + getBlockHash(index: number): Promise; + getGarageUnloadEvents( + blockIndex: number, + agentAddress: Address, + avatarAddress: Address, + ): Promise; + getAssetTransferredEvents( + blockIndex: number, + recipient: Address, + ): Promise; + getNextTxNonce(address: string): Promise; + getGenesisHash(): Promise; + stageTransaction(payload: string): Promise; + getTransactionResult(txId: TxId): Promise; +} + export class HeadlessGraphQLClient implements IHeadlessGraphQLClient { private readonly _client: Client; private readonly _planet: Planet; diff --git a/src/index.ts b/src/index.ts index f7d20d0..d0955ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import "dotenv/config"; import { getAccountFromEnv } from "./accounts"; import { getEnv, getRequiredEnv } from "./env"; import { HeadlessGraphQLClient } from "./headless-graphql-client"; -import { IHeadlessGraphQLClient } from "./interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "./headless-graphql-client"; import { PreloadHandler } from "./preload-handler"; import { SlackBot } from "./slack/bot"; import { SlackChannel } from "./slack/channel"; diff --git a/src/interfaces/headless-graphql-client.ts b/src/interfaces/headless-graphql-client.ts deleted file mode 100644 index ff6d4b2..0000000 --- a/src/interfaces/headless-graphql-client.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Address } from "@planetarium/account"; -import { AssetTransferredEvent } from "../types/asset-transferred-event"; -import { BlockHash } from "../types/block-hash"; -import { GarageUnloadEvent } from "../types/garage-unload-event"; -import { TransactionResult } from "../types/transaction-result"; -import { TxId } from "../types/txid"; - -export interface IHeadlessGraphQLClient { - getPlanetID(): string; - getBlockIndex(blockHash: BlockHash): Promise; - getTipIndex(): Promise; - getBlockHash(index: number): Promise; - getGarageUnloadEvents( - blockIndex: number, - agentAddress: Address, - avatarAddress: Address, - ): Promise; - getAssetTransferredEvents( - blockIndex: number, - recipient: Address, - ): Promise; - getNextTxNonce(address: string): Promise; - getGenesisHash(): Promise; - stageTransaction(payload: string): Promise; - getTransactionResult(txId: TxId): Promise; -} diff --git a/src/interfaces/minter.ts b/src/interfaces/minter.ts deleted file mode 100644 index 0e18b57..0000000 --- a/src/interfaces/minter.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { FungibleAssetValue } from "@planetarium/tx"; -import { FungibleItemId } from "../types/fungible-item-id"; - -export interface IFungibleAssetValues { - recipient: string; - amount: FungibleAssetValue; -} - -export interface IFungibleItems { - recipient: string; - fungibleItemId: FungibleItemId; - count: number; -} diff --git a/src/sync/downstream/events/transfer.ts b/src/sync/downstream/events/transfer.ts index 667cdea..d7b7c24 100644 --- a/src/sync/downstream/events/transfer.ts +++ b/src/sync/downstream/events/transfer.ts @@ -4,8 +4,8 @@ import { FungibleAssetValue, signTx } from "@planetarium/tx"; import { ResponseType } from "@prisma/client"; import { encodeBurnAssetAction } from "../../../actions/burn"; import { encodeTransferAssetAction } from "../../../actions/transfer"; -import { encodeMintAssetsAction } from "../../../actions/mint"; import { SUPER_FUTURE_DATETIME, additionalGasTxProperties } from "../../../tx"; +import { encodeMintAssetsAction } from "../../../actions/mint"; import { AssetTransferredEvent } from "../../../types/asset-transferred-event"; import { SignedTx } from "../../../types/signed-tx"; import { BridgeResponse } from "../../types"; diff --git a/src/sync/downstream/index.ts b/src/sync/downstream/index.ts index f6c33c7..5cd0aea 100644 --- a/src/sync/downstream/index.ts +++ b/src/sync/downstream/index.ts @@ -8,7 +8,7 @@ import { ResponseType, } from "@prisma/client"; import { getAssetTransferredEvents } from "../../events/assets-transferred"; -import { IHeadlessGraphQLClient } from "../../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../../headless-graphql-client"; import { SlackBot } from "../../slack/bot"; import { BridgeEvent, diff --git a/src/sync/stage.ts b/src/sync/stage.ts index a8b7631..3ef0c01 100644 --- a/src/sync/stage.ts +++ b/src/sync/stage.ts @@ -1,6 +1,6 @@ import { Account } from "@planetarium/account"; import { PrismaClient } from "@prisma/client"; -import { IHeadlessGraphQLClient } from "../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../headless-graphql-client"; export async function stageTransactionFromDB( account: Account, diff --git a/src/sync/txresult.ts b/src/sync/txresult.ts index 75fb08b..a66fa52 100644 --- a/src/sync/txresult.ts +++ b/src/sync/txresult.ts @@ -1,5 +1,5 @@ import { PrismaClient, TxResult } from "@prisma/client"; -import { IHeadlessGraphQLClient } from "../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../headless-graphql-client"; const LIMIT = 10; diff --git a/src/sync/upstream/events/garage.ts b/src/sync/upstream/events/garage.ts index d5f48e1..88a922d 100644 --- a/src/sync/upstream/events/garage.ts +++ b/src/sync/upstream/events/garage.ts @@ -1,12 +1,12 @@ import { Account, Address } from "@planetarium/account"; import { signTx } from "@planetarium/tx"; import { ResponseType } from "@prisma/client"; -import { ValidatedGarageUnloadEvent } from "../../../events/garage-unload"; import { IFungibleAssetValues, IFungibleItems, -} from "../../../interfaces/minter"; -import { encodeMintAssetsAction } from "../../../actions/mint"; + encodeMintAssetsAction, +} from "../../../actions/mint"; +import { ValidatedGarageUnloadEvent } from "../../../events/garage-unload"; import { SUPER_FUTURE_DATETIME, additionalGasTxProperties } from "../../../tx"; import { BridgeResponse } from "../../types"; diff --git a/src/sync/upstream/index.ts b/src/sync/upstream/index.ts index 03ec437..34f4d6d 100644 --- a/src/sync/upstream/index.ts +++ b/src/sync/upstream/index.ts @@ -7,7 +7,7 @@ import { ValidatedGarageUnloadEvent, getGarageUnloadEvents, } from "../../events/garage-unload"; -import { IHeadlessGraphQLClient } from "../../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../../headless-graphql-client"; import { SlackBot } from "../../slack/bot"; import { BridgeErrorEvent } from "../../slack/messages/bridge-error-event"; import { BridgeEvent } from "../../slack/messages/bridge-event"; diff --git a/src/sync/utils.ts b/src/sync/utils.ts index 1359d83..6d3ed15 100644 --- a/src/sync/utils.ts +++ b/src/sync/utils.ts @@ -1,6 +1,6 @@ import { Account } from "@planetarium/account"; import { ResponseType } from "@prisma/client"; -import { IHeadlessGraphQLClient } from "../interfaces/headless-graphql-client"; +import { IHeadlessGraphQLClient } from "../headless-graphql-client"; import { BridgeEventActionType } from "../slack/messages/bridge-event"; import { PrismaTransactionClient } from "./types";