diff --git a/src/extend-utils.ts b/src/extend-utils.ts index eeba7097..c10a34c7 100644 --- a/src/extend-utils.ts +++ b/src/extend-utils.ts @@ -146,11 +146,11 @@ export async function getTransactionUtil( return txReceipt; } -export async function getTxReceiptUtil( +export async function getTransactionReceiptUtil( txHash: string, hre: HardhatRuntimeEnvironment ): Promise { - const executed = await hre.starknetWrapper.getTxReceipt({ + const executed = await hre.starknetWrapper.getTransactionReceipt({ feederGatewayUrl: hre.config.starknet.networkUrl, gatewayUrl: hre.config.starknet.networkUrl, hash: txHash diff --git a/src/index.ts b/src/index.ts index c501f4f8..63c674a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ import { getAccountFromAddressUtil, getContractFactoryUtil, getTransactionUtil, - getTxReceiptUtil, + getTransactionReceiptUtil, getWalletUtil, shortStringToBigIntUtil } from "./extend-utils"; @@ -213,8 +213,8 @@ extendEnvironment((hre) => { return transaction; }, - getTxReceipt: async (txHash) => { - const txReceipt = await getTxReceiptUtil(txHash, hre); + getTransactionReceipt: async (txHash) => { + const txReceipt = await getTransactionReceiptUtil(txHash, hre); return txReceipt; } }; diff --git a/src/starknet-wrappers.ts b/src/starknet-wrappers.ts index dbf66f12..7d791011 100644 --- a/src/starknet-wrappers.ts +++ b/src/starknet-wrappers.ts @@ -134,10 +134,7 @@ export abstract class StarknetWrapper { public abstract invokeOrCall(options: InvokeOrCallWrapperOptions): Promise; - protected prepareGetTxQueryOptions( - command: string, - options: TxHashQueryWrapperOptions - ): string[] { + protected prepareTxQueryOptions(command: string, options: TxHashQueryWrapperOptions): string[] { return [ command, "--hash", @@ -181,7 +178,9 @@ export abstract class StarknetWrapper { public abstract deployAccount(options: DeployAccountWrapperOptions): Promise; - public abstract getTxReceipt(options: TxHashQueryWrapperOptions): Promise; + public abstract getTransactionReceipt( + options: TxHashQueryWrapperOptions + ): Promise; public abstract getTransaction(options: TxHashQueryWrapperOptions): Promise; } @@ -317,7 +316,7 @@ export class DockerWrapper extends StarknetWrapper { networkMode: "host" }; - const preparedOptions = this.prepareGetTxQueryOptions("tx_status", options); + const preparedOptions = this.prepareTxQueryOptions("tx_status", options); const docker = await this.getDocker(); const executed = await docker.runContainer( @@ -350,7 +349,7 @@ export class DockerWrapper extends StarknetWrapper { return executed; } - public async getTxReceipt(options: TxHashQueryWrapperOptions): Promise { + public async getTransactionReceipt(options: TxHashQueryWrapperOptions): Promise { const binds: String2String = {}; const dockerOptions = { @@ -358,7 +357,7 @@ export class DockerWrapper extends StarknetWrapper { networkMode: "host" }; - const preparedOptions = this.prepareGetTxQueryOptions("get_transaction_receipt", options); + const preparedOptions = this.prepareTxQueryOptions("get_transaction_receipt", options); const docker = await this.getDocker(); const executed = await docker.runContainer( @@ -377,7 +376,7 @@ export class DockerWrapper extends StarknetWrapper { networkMode: "host" }; - const preparedOptions = this.prepareGetTxQueryOptions("get_transaction", options); + const preparedOptions = this.prepareTxQueryOptions("get_transaction", options); const docker = await this.getDocker(); const executed = await docker.runContainer( @@ -455,7 +454,7 @@ export class VenvWrapper extends StarknetWrapper { } public async getTxStatus(options: TxHashQueryWrapperOptions): Promise { - const preparedOptions = this.prepareGetTxQueryOptions("tx_status", options); + const preparedOptions = this.prepareTxQueryOptions("tx_status", options); const executed = await this.execute(this.starknetPath, preparedOptions); return executed; } @@ -466,14 +465,14 @@ export class VenvWrapper extends StarknetWrapper { return executed; } - public async getTxReceipt(options: TxHashQueryWrapperOptions): Promise { - const preparedOptions = this.prepareGetTxQueryOptions("get_transaction_receipt", options); + public async getTransactionReceipt(options: TxHashQueryWrapperOptions): Promise { + const preparedOptions = this.prepareTxQueryOptions("get_transaction_receipt", options); const executed = await this.execute(this.starknetPath, preparedOptions); return executed; } public async getTransaction(options: TxHashQueryWrapperOptions): Promise { - const preparedOptions = this.prepareGetTxQueryOptions("get_transaction", options); + const preparedOptions = this.prepareTxQueryOptions("get_transaction", options); const executed = await this.execute(this.starknetPath, preparedOptions); return executed; } diff --git a/src/type-extensions.ts b/src/type-extensions.ts index db6f0b4b..f97662b2 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -168,7 +168,7 @@ declare module "hardhat/types/runtime" { getTransaction: (txHash: string) => Promise; - getTxReceipt: (txHash: string) => Promise; + getTransactionReceipt: (txHash: string) => Promise; }; } diff --git a/src/types.ts b/src/types.ts index da52bc60..6ec4ae1b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -299,6 +299,7 @@ export class StarknetContractFactory { gatewayUrl: this.gatewayUrl }); contract.address = address; + contract.deployTxHash = txHash; return new Promise((resolve, reject) => { iterativelyCheckStatus( @@ -363,6 +364,7 @@ export class StarknetContract { private gatewayUrl: string; private feederGatewayUrl: string; private _address: string; + public deployTxHash: string; constructor(config: StarknetContractConfig) { this.starknetWrapper = config.starknetWrapper;