Skip to content

Commit

Permalink
fix: remove unused cairoVersion from Contract
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Apr 25, 2023
1 parent d920dbe commit e4fcf24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/contract/contractFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class ContractFactory {
}

/**
* Attaches to new Provider or Account
* Attaches to new Account
*
* @param account - new Provider or Account to attach to
* @returns ContractFactory
Expand All @@ -91,7 +91,7 @@ export class ContractFactory {
}

/**
* Attaches current abi and provider or account to the new address
* Attaches current abi and account to the new address
*
* @param address - Contract address
* @returns Contract
Expand Down
14 changes: 6 additions & 8 deletions src/contract/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ function buildEstimate(contract: Contract, functionAbi: FunctionAbi): ContractFu
};
}

const detectCairoVersion = (abi: Abi) => {
/**
* Not used at the moment
*/
/* const detectCairoVersion = (abi: Abi) => {
if (!abi) return '0';
return abi.find((it) => 'state_mutability' in it) ? '1' : '0';
};
}; */

export class Contract implements ContractInterface {
abi: Abi;
Expand All @@ -115,28 +118,23 @@ export class Contract implements ContractInterface {

private callData: CallData;

private version: string = '0';

/**
* Contract class to handle contract methods
*
* @param abi - Abi of the contract object
* @param address (optional) - address to connect to
* @param providerOrAccount (optional) - Provider or Account to attach to
* @param cairoVersion (optional) - default '0', for Cairo 1 set '1'
*/
constructor(
abi: Abi,
address: string,
providerOrAccount: ProviderInterface | AccountInterface = defaultProvider,
cairoVersion: string = detectCairoVersion(abi)
providerOrAccount: ProviderInterface | AccountInterface = defaultProvider
) {
this.address = address && address.toLowerCase();
this.providerOrAccount = providerOrAccount;
this.callData = new CallData(abi);
this.structs = CallData.getAbiStruct(abi);
this.abi = abi;
this.version = cairoVersion;

const options = { enumerable: true, value: {}, writable: false };
Object.defineProperties(this, {
Expand Down

0 comments on commit e4fcf24

Please sign in to comment.