diff --git a/__tests__/account.test.ts b/__tests__/account.test.ts index b5b7b52cf..aba91e35e 100644 --- a/__tests__/account.test.ts +++ b/__tests__/account.test.ts @@ -180,7 +180,7 @@ describe('deploy and test Wallet', () => { }); test('UDC DeployContract', async () => { - const deployResponse = await account.deployContract2({ + const deployResponse = await account.deployContract({ classHash: erc20ClassHash, constructorCalldata: [ encodeShortString('Token'), diff --git a/src/account/default.ts b/src/account/default.ts index 0dd0f2956..64d7a49d2 100644 --- a/src/account/default.ts +++ b/src/account/default.ts @@ -7,8 +7,8 @@ import { Abi, Call, DeclareContractResponse, - DeployContract2Response, DeployContractResponse, + DeployContractUDCResponse, EstimateFeeAction, InvocationsDetails, InvocationsSignerDetails, @@ -327,10 +327,10 @@ export class Account extends Provider implements AccountInterface { * @param detials InvocationsDetails * @returns Promise */ - public async deployContract2( + public async deployContract( payload: UniversalDeployerContractPayload, details: InvocationsDetails = {} - ): Promise { + ): Promise { const deployTx = await this.deploy(payload, details); const txReceipt = await this.waitForTransaction(deployTx.transaction_hash); return parseUDCEvent(txReceipt); @@ -342,7 +342,7 @@ export class Account extends Provider implements AccountInterface { ) { const { transaction_hash } = await this.declare({ contract, classHash }, details); const declare = await this.waitForTransaction(transaction_hash); - const deploy = await this.deployContract2({ classHash, constructorCalldata }, details); + const deploy = await this.deployContract({ classHash, constructorCalldata }, details); return { declare: { ...declare, class_hash: classHash }, deploy }; } diff --git a/src/account/interface.ts b/src/account/interface.ts index dd3d82420..8148f0457 100644 --- a/src/account/interface.ts +++ b/src/account/interface.ts @@ -7,6 +7,7 @@ import { DeclareContractResponse, DeclareDeployContractResponse, DeployContractResponse, + DeployContractUDCResponse, EstimateFeeAction, EstimateFeeDetails, EstimateFeeResponse, @@ -164,6 +165,18 @@ export abstract class AccountInterface extends ProviderInterface { transactionsDetail?: InvocationsDetails ): Promise; + /** + * Simplify deploy simulating old DeployContract with same response + UDC specific response + * + * @param payload UniversalDeployerContractPayload + * @param detials InvocationsDetails + * @returns Promise + */ + public abstract deployContract( + payload: UniversalDeployerContractPayload, + details: InvocationsDetails + ): Promise; + /** * Declares and Deploy a given compiled contract (json) to starknet using UDC * diff --git a/src/provider/default.ts b/src/provider/default.ts index ab3f90b09..f9ec0f59c 100644 --- a/src/provider/default.ts +++ b/src/provider/default.ts @@ -147,7 +147,7 @@ export class Provider implements ProviderInterface { * @deprecated This method won't be supported, use Account.deploy instead */ public async deployContract( - payload: DeployContractPayload, + payload: DeployContractPayload | any, details: InvocationsDetails ): Promise { return this.provider.deployContract(payload, details); diff --git a/src/provider/interface.ts b/src/provider/interface.ts index 950e40aca..00e2e89f6 100644 --- a/src/provider/interface.ts +++ b/src/provider/interface.ts @@ -149,7 +149,7 @@ export abstract class ProviderInterface { * @returns a confirmation of sending a transaction on the starknet contract */ public abstract deployContract( - payload: DeployContractPayload, + payload: DeployContractPayload | any, details?: InvocationsDetails ): Promise; diff --git a/src/types/account.ts b/src/types/account.ts index 9e1d1b1fe..d429ec57f 100644 --- a/src/types/account.ts +++ b/src/types/account.ts @@ -18,7 +18,7 @@ export interface DeployContractResponse { transaction_hash: string; } -export interface DeployContract2Response extends DeployContractResponse { +export interface DeployContractUDCResponse extends DeployContractResponse { address: string; deployer: string; unique: string; @@ -30,5 +30,5 @@ export interface DeployContract2Response extends DeployContractResponse { export type DeclareDeployContractResponse = { declare: DeclareTransactionReceiptResponse; - deploy: DeployContract2Response; + deploy: DeployContractUDCResponse; };