Repository: 0xs34n/starknet.js
Pull request #455 (2022-12-14 11:15:58)

fix: rpc deployAccountContract request, rpc nonce hotfix
## Motivation and Resolution
RPC deployAccountContract has misformatted request data.
~~RPC nonce for non-existing account return error and sequencer return "0x0" which cause a problem when deploying account true RPC.~~
Fixture deploy Account nonce to 0
Fixture estimateAccountDeployFee nonce to 0

### RPC version (if applicable)
0.2.1

## Usage related changes
RPC deployAccount fixed

## Development related changes
~~Include hotfix for RPC-spec deviation (but this will be discussed for standardization)~~

## Checklist:

- [x] Performed a self-review of the code
- [x] Rebased to the last commit of the target branch (or merged it into my branch)
- [ ] Linked the issues which this PR resolves
- [x] Documented the changes
- [ ] Updated the docs (www)
- [ ] Updated the tests
- [x] All tests are passing



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92a1b018..3a4b3068 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,3 @@
-# [4.17.0](https://github.com/0xs34n/starknet.js/compare/v4.16.0...v4.17.0) (2022-12-13)
-
-### Bug Fixes
-
-- merge conflicts ([92a3be8](https://github.com/0xs34n/starknet.js/commit/92a3be8500153d4b87b888f454bb4140edb88411))
-
-### Features
-
-- contract factory deploy arguments ([9eff7f4](https://github.com/0xs34n/starknet.js/commit/9eff7f4ccc74cb5f0c0594e88c0292600f20ec09))
-- update contractFactory docs ([76f8440](https://github.com/0xs34n/starknet.js/commit/76f8440233c4a1e24e3dfff25fe02525e86a8258))
-
 # [4.16.0](https://github.com/0xs34n/starknet.js/compare/v4.15.1...v4.16.0) (2022-12-12)
 
 ### Bug Fixes
diff --git a/package-lock.json b/package-lock.json
index 88a671d3..5ad55ccb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "starknet",
-  "version": "4.17.0",
+  "version": "4.16.0",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "starknet",
-      "version": "4.17.0",
+      "version": "4.16.0",
       "license": "MIT",
       "dependencies": {
         "@ethersproject/bytes": "^5.6.1",
diff --git a/package.json b/package.json
index a9a8aa0c..18b04e45 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "starknet",
-  "version": "4.17.0",
+  "version": "4.16.0",
   "description": "JavaScript library for StarkNet",
   "main": "dist/index.js",
   "module": "dist/index.mjs",
@@ -21,14 +21,13 @@
     "build:esm": "tsup --clean false --format esm --platform node",
     "build:iife": "tsup --clean false --format iife --platform browser",
     "build:dts": "tsup --clean false --dts-only",
-    "pretest": "npm run lint && npm run ts:check",
+    "pretest": "npm run lint",
     "test": "jest -i",
     "posttest": "npm run format",
     "test:watch": "jest --watch",
     "docs": "cd www && npm run start",
     "format": "prettier --loglevel warn --write \"**/*.{ts,js,md,yml,json}\"",
-    "lint": "eslint . --cache --fix --ext .ts",
-    "ts:check": "tsc --noEmit --resolveJsonModule --project tsconfig.eslint.json"
+    "lint": "eslint . --cache --fix --ext .ts"
   },
   "keywords": [
     "starknet",
diff --git a/src/account/default.ts b/src/account/default.ts
index 2bc02b09..955d3d31 100644
--- a/src/account/default.ts
+++ b/src/account/default.ts
@@ -187,9 +187,9 @@ export class Account extends Provider implements AccountInterface {
       constructorCalldata = [],
       contractAddress: providedContractAddress,
     }: DeployAccountContractPayload,
-    { blockIdentifier, nonce: providedNonce }: EstimateFeeDetails = {}
+    { blockIdentifier }: EstimateFeeDetails = {}
   ): Promise<EstimateFee> {
-    const nonce = toBN(providedNonce ?? (await this.getNonce()));
+    const nonce = '0x0';
     const version = toBN(feeTransactionVersion);
     const chainId = await this.getChainId();
     const contractAddress =
@@ -400,7 +400,7 @@ export class Account extends Provider implements AccountInterface {
     }: DeployAccountContractPayload,
     transactionsDetail: InvocationsDetails = {}
   ): Promise<DeployContractResponse> {
-    const nonce = toBN(transactionsDetail.nonce ?? (await this.getNonce()));
+    const nonce = '0x0';
     const version = toBN(transactionVersion);
     const chainId = await this.getChainId();
 
diff --git a/src/account/interface.ts b/src/account/interface.ts
index c5e46927..9e5f1782 100644
--- a/src/account/interface.ts
+++ b/src/account/interface.ts
@@ -77,10 +77,12 @@ export abstract class AccountInterface extends ProviderInterface {
   /**
    * Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
    *
-   * @param contractPayload the payload object containing:
+   * @param contractPayload -
    * - contract - the compiled contract to be deployed
    * - classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
-   *
+   * @param estimateFeeDetails -
+   * - optional blockIdentifier
+   * - constant nonce = 0
    * @returns response from estimate_fee
    */
   public abstract estimateAccountDeployFee(
@@ -236,7 +238,7 @@ export abstract class AccountInterface extends ProviderInterface {
   - optional address salt  
   - optional contractAddress
    * @param transactionsDetail Invocation Details containing:
-  - optional nonce
+  - constant nonce = 0
   - optional version
   - optional maxFee
    * @returns a confirmation of sending a transaction on the starknet contract
diff --git a/src/contract/contractFactory.ts b/src/contract/contractFactory.ts
index 18c8679a..748932e5 100644
--- a/src/contract/contractFactory.ts
+++ b/src/contract/contractFactory.ts
@@ -1,8 +1,7 @@
 import assert from 'minimalistic-assert';
 
 import { AccountInterface } from '../account';
-import { Abi, CompiledContract, FunctionAbi } from '../types';
-import { CheckCallData } from '../utils/calldata';
+import { Abi, CompiledContract, RawArgs } from '../types';
 import { Contract } from './default';
 
 export class ContractFactory {
@@ -14,8 +13,6 @@ export class ContractFactory {
 
   account: AccountInterface;
 
-  private checkCalldata: CheckCallData;
-
   constructor(
     compiledContract: CompiledContract,
     classHash: string,
@@ -26,23 +23,19 @@ export class ContractFactory {
     this.compiledContract = compiledContract;
     this.account = account;
     this.classHash = classHash;
-    this.checkCalldata = new CheckCallData(abi);
   }
 
   /**
    * Deploys contract and returns new instance of the Contract
    *
-   * @param args - Array of the constructor arguments for deployment
+   * @param constructorCalldata - Constructor Calldata
    * @param addressSalt (optional) - Address Salt for deployment
    * @returns deployed Contract
    */
-  public async deploy(args: Array<any> = [], addressSalt?: string | undefined): Promise<Contract> {
-    this.checkCalldata.validateMethodAndArgs('DEPLOY', 'constructor', args);
-    const { inputs } = this.abi.find((abi) => abi.type === 'constructor') as FunctionAbi;
-
-    // compile calldata
-    const constructorCalldata = this.checkCalldata.compileCalldata(args, inputs);
-
+  public async deploy(
+    constructorCalldata?: RawArgs,
+    addressSalt?: string | undefined
+  ): Promise<Contract> {
     const {
       deploy: { contract_address, transaction_hash },
     } = await this.account.declareDeploy({
diff --git a/src/contract/default.ts b/src/contract/default.ts
index 72e527e1..7c1d0ff3 100644
--- a/src/contract/default.ts
+++ b/src/contract/default.ts
@@ -10,6 +10,7 @@ import {
   AsyncContractFunction,
   BlockTag,
   Call,
+  Calldata,
   ContractFunction,
   FunctionAbi,
   InvokeFunctionResponse,
@@ -18,8 +19,7 @@ import {
   Result,
   StructAbi,
 } from '../types';
-import { CheckCallData } from '../utils/calldata';
-import { BigNumberish, toBN } from '../utils/number';
+import { BigNumberish, toBN, toFelt } from '../utils/number';
 import { CallOptions, ContractInterface } from './interface';
 
 function parseFelt(candidate: string): BN {
@@ -121,8 +121,6 @@ export class Contract implements ContractInterface {
 
   readonly [key: string]: AsyncContractFunction | any;
 
-  private checkCalldata: CheckCallData;
-
   /**
    * Contract class to handle contract methods
    *
@@ -147,7 +145,6 @@ export class Contract implements ContractInterface {
         }),
         {}
       );
-    this.checkCalldata = new CheckCallData(abi);
 
     Object.defineProperty(this, 'functions', {
       enumerable: true,
@@ -243,11 +240,11 @@ export class Contract implements ContractInterface {
     assert(this.address !== null, 'contract is not connected to an address');
 
     // validate method and args
-    this.checkCalldata.validateMethodAndArgs('CALL', method, args);
+    this.validateMethodAndArgs('CALL', method, args);
     const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
 
     // compile calldata
-    const calldata = this.checkCalldata.compileCalldata(args, inputs);
+    const calldata = this.compileCalldata(args, inputs);
     return this.providerOrAccount
       .callContract(
         {
@@ -268,7 +265,7 @@ export class Contract implements ContractInterface {
     // ensure contract is connected
     assert(this.address !== null, 'contract is not connected to an address');
     // validate method and args
-    this.checkCalldata.validateMethodAndArgs('INVOKE', method, args);
+    this.validateMethodAndArgs('INVOKE', method, args);
 
     const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
     const inputsLength = inputs.reduce((acc, input) => {
@@ -284,7 +281,7 @@ export class Contract implements ContractInterface {
       );
     }
     // compile calldata
-    const calldata = this.checkCalldata.compileCalldata(args, inputs);
+    const calldata = this.compileCalldata(args, inputs);
 
     const invocation = {
       contractAddress: this.address,
@@ -321,7 +318,7 @@ export class Contract implements ContractInterface {
     assert(this.address !== null, 'contract is not connected to an address');
 
     // validate method and args
-    this.checkCalldata.validateMethodAndArgs('INVOKE', method, args);
+    this.validateMethodAndArgs('INVOKE', method, args);
     const invocation = this.populateTransaction[method](...args);
     if ('estimateInvokeFee' in this.providerOrAccount) {
       return this.providerOrAccount.estimateInvokeFee(invocation);
@@ -334,10 +331,167 @@ export class Contract implements ContractInterface {
     return {
       contractAddress: this.address,
       entrypoint: method,
-      calldata: this.checkCalldata.compileCalldata(args, inputs),
+      calldata: this.compileCalldata(args, inputs),
     };
   }
 
+  /**
+   * Deep parse of the object that has been passed to the method
+   *
+   * @param struct - struct that needs to be calculated
+   * @return {number} - number of members for the given struct
+   */
+  private calculateStructMembers(struct: string): number {
+    return this.structs[struct].members.reduce((acc, member) => {
+      if (member.type === 'felt') {
+        return acc + 1;
+      }
+      return acc + this.calculateStructMembers(member.type);
+    }, 0);
+  }
+
+  /**
+   * Validates if all arguments that are passed to the method are corresponding to the ones in the abi
+   *
+   * @param type - type of the method
+   * @param method  - name of the method
+   * @param args - arguments that are passed to the method
+   */
+  protected validateMethodAndArgs(type: 'INVOKE' | 'CALL', method: string, args: Array<any> = []) {
+    // ensure provided method exists
+    const invocableFunctionNames = this.abi
+      .filter((abi) => {
+        if (abi.type !== 'function') return false;
+        const isView = abi.stateMutability === 'view';
+        return type === 'INVOKE' ? !isView : isView;
+      })
+      .map((abi) => abi.name);
+    assert(
+      invocableFunctionNames.includes(method),
+      `${type === 'INVOKE' ? 'invocable' : 'viewable'} method not found in abi`
+    );
+
+    // ensure args match abi type
+    const methodAbi = this.abi.find(
+      (abi) => abi.name === method && abi.type === 'function'
+    ) as FunctionAbi;
+    let argPosition = 0;
+    methodAbi.inputs.forEach((input) => {
+      if (/_len$/.test(input.name)) {
+        return;
+      }
+      if (input.type === 'felt') {
+        assert(
+          typeof args[argPosition] === 'string' ||
+            typeof args[argPosition] === 'number' ||
+            args[argPosition] instanceof BN,
+          `arg ${input.name} should be a felt (string, number, BigNumber)`
+        );
+        argPosition += 1;
+      } else if (input.type in this.structs && typeof args[argPosition] === 'object') {
+        if (Array.isArray(args[argPosition])) {
+          const structMembersLength = this.calculateStructMembers(input.type);
+          assert(
+            args[argPosition].length === structMembersLength,
+            `arg should be of length ${structMembersLength}`
+          );
+        } else {
+          this.structs[input.type].members.forEach(({ name }) => {
+            assert(
+              Object.keys(args[argPosition]).includes(name),
+              `arg should have a property ${name}`
+            );
+          });
+        }
+        argPosition += 1;
+      } else {
+        assert(Array.isArray(args[argPosition]), `arg ${input.name} should be an Array`);
+        if (input.type === 'felt*') {
+          args[argPosition].forEach((felt: BigNumberish) => {
+            assert(
+              typeof felt === 'string' || typeof felt === 'number' || felt instanceof BN,
+              `arg ${input.name} should be an array of string, number or BigNumber`
+            );
+          });
+          argPosition += 1;
+        } else if (/\(felt/.test(input.type)) {
+          const tupleLength = input.type.split(',').length;
+          assert(
+            args[argPosition].length === tupleLength,
+            `arg ${input.name} should have ${tupleLength} elements in tuple`
+          );
+          args[argPosition].forEach((felt: BigNumberish) => {
+            assert(
+              typeof felt === 'string' || typeof felt === 'number' || felt instanceof BN,
+              `arg ${input.name} should be an array of string, number or BigNumber`
+            );
+          });
+          argPosition += 1;
+        } else {
+          const arrayType = input.type.replace('*', '');
+          args[argPosition].forEach((struct: any) => {
+            this.structs[arrayType].members.forEach(({ name }) => {
+              if (Array.isArray(struct)) {
+                const structMembersLength = this.calculateStructMembers(arrayType);
+                assert(
+                  struct.length === structMembersLength,
+                  `arg should be of length ${structMembersLength}`
+                );
+              } else {
+                assert(
+                  Object.keys(struct).includes(name),
+                  `arg ${input.name} should be an array of ${arrayType}`
+                );
+              }
+            });
+          });
+          argPosition += 1;
+        }
+      }
+    });
+  }
+
+  /**
+   * Deep parse of the object that has been passed to the method
+   *
+   * @param element - element that needs to be parsed
+   * @param type  - name of the method
+   * @return {string | string[]} - parsed arguments in format that contract is expecting
+   */
+
+  protected parseCalldataValue(
+    element: ParsedStruct | BigNumberish | BigNumberish[],
+    type: string
+  ): string | string[] {
+    if (element === undefined) {
+      throw Error('Missing element in calldata');
+    }
+    if (Array.isArray(element)) {
+      const structMemberNum = this.calculateStructMembers(type);
+      if (element.length !== structMemberNum) {
+        throw Error('Missing element in calldata');
+      }
+      return element.map((el) => toFelt(el));
+    }
+    // checking if the passed element is struct or element in struct
+    if (this.structs[type] && this.structs[type].members.length) {
+      // going through all the members of the struct and parsing the value
+      return this.structs[type].members.reduce((acc, member: AbiEntry) => {
+        // if the member of the struct is another struct this will return array of the felts if not it will be single felt
+        // TODO: refactor types so member name can be used as keyof ParsedStruct
+        /* @ts-ignore */
+        const parsedData = this.parseCalldataValue(element[member.name], member.type);
+        if (typeof parsedData === 'string') {
+          acc.push(parsedData);
+        } else {
+          acc.push(...parsedData);
+        }
+        return acc;
+      }, [] as string[]);
+    }
+    return toFelt(element as BigNumberish);
+  }
+
   /**
    * Parse of the response elements that are converted to Object (Struct) by using the abi
    *
@@ -360,6 +514,67 @@ export class Contract implements ContractInterface {
     return parseFelt(responseIterator.next().value);
   }
 
+  /**
+   * Parse one field of the calldata by using input field from the abi for that method
+   *
+   * @param args - value of the field
+   * @param input  - input(field) information from the abi that will be used to parse the data
+   * @return {string | string[]} - parsed arguments in format that contract is expecting
+   */
+  protected parseCalldataField(argsIterator: Iterator<any>, input: AbiEntry): string | string[] {
+    const { name, type } = input;
+    const { value } = argsIterator.next();
+
+    const parsedCalldata: string[] = [];
+    switch (true) {
+      case /\*/.test(type):
+        if (Array.isArray(value)) {
+          parsedCalldata.push(toFelt(value.length));
+          return (value as (BigNumberish | ParsedStruct)[]).reduce((acc, el) => {
+            if (/felt/.test(type)) {
+              acc.push(toFelt(el as BigNumberish));
+            } else {
+              acc.push(...this.parseCalldataValue(el, type.replace('*', '')));
+            }
+            return acc;
+          }, parsedCalldata);
+        }
+        throw Error(`Expected ${name} to be array`);
+      case type in this.structs:
+        return this.parseCalldataValue(value as ParsedStruct | BigNumberish[], type);
+      case /\(felt/.test(type):
+        if (Array.isArray(value)) {
+          return value.map((el) => toFelt(el as BigNumberish));
+        }
+        throw Error(`Expected ${name} to be array`);
+      default:
+        return toFelt(value as BigNumberish);
+    }
+  }
+
+  /**
+   * Parse the calldata by using input fields from the abi for that method
+   *
+   * @param args - arguments passed the the method
+   * @param inputs  - list of inputs(fields) that are in the abi
+   * @return {Calldata} - parsed arguments in format that contract is expecting
+   */
+  protected compileCalldata(args: Array<any>, inputs: AbiEntry[]): Calldata {
+    const argsIterator = args[Symbol.iterator]();
+    return inputs.reduce((acc, input) => {
+      if (/_len$/.test(input.name)) {
+        return acc;
+      }
+      const parsedData = this.parseCalldataField(argsIterator, input);
+      if (Array.isArray(parsedData)) {
+        acc.push(...parsedData);
+      } else {
+        acc.push(parsedData);
+      }
+      return acc;
+    }, [] as Calldata);
+  }
+
   /**
    * Parse elements of the response and structuring them into one field by using output property from the abi for that method
    *
diff --git a/src/provider/default.ts b/src/provider/default.ts
index a0e16e17..5e8ba311 100644
--- a/src/provider/default.ts
+++ b/src/provider/default.ts
@@ -67,7 +67,7 @@ export class Provider implements ProviderInterface {
 
   public async getClassAt(
     contractAddress: string,
-    blockIdentifier?: BlockIdentifier
+    blockIdentifier: BlockIdentifier
   ): Promise<ContractClass> {
     return this.provider.getClassAt(contractAddress, blockIdentifier);
   }
@@ -113,7 +113,7 @@ export class Provider implements ProviderInterface {
   public async getStorageAt(
     contractAddress: string,
     key: BigNumberish,
-    blockIdentifier?: BlockIdentifier
+    blockIdentifier: BlockIdentifier
   ): Promise<BigNumberish> {
     return this.provider.getStorageAt(contractAddress, key, blockIdentifier);
   }
diff --git a/src/provider/rpc.ts b/src/provider/rpc.ts
index ca11ee59..faaeecb3 100644
--- a/src/provider/rpc.ts
+++ b/src/provider/rpc.ts
@@ -335,14 +335,16 @@ export class RpcProvider implements ProviderInterface {
     details: InvocationsDetailsWithNonce
   ): Promise<DeployContractResponse> {
     return this.fetchEndpoint('starknet_addDeployAccountTransaction', {
-      constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
-      class_hash: toHex(toBN(classHash)),
-      contract_address_salt: toHex(toBN(addressSalt || 0)),
-      type: 'DEPLOY',
-      max_fee: toHex(toBN(details.maxFee || 0)),
-      version: toHex(toBN(details.version || 0)),
-      signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
-      nonce: toHex(toBN(details.nonce)),
+      deploy_account_transaction: {
+        constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
+        class_hash: toHex(toBN(classHash)),
+        contract_address_salt: toHex(toBN(addressSalt || 0)),
+        type: 'DEPLOY_ACCOUNT',
+        max_fee: toHex(toBN(details.maxFee || 0)),
+        version: toHex(toBN(details.version || 0)),
+        signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
+        nonce: toHex(toBN(details.nonce)),
+      },
     });
   }
 
diff --git a/src/types/api/openrpc.ts b/src/types/api/openrpc.ts
index 5a81c517..a88f4849 100644
--- a/src/types/api/openrpc.ts
+++ b/src/types/api/openrpc.ts
@@ -500,7 +500,9 @@ export namespace OPENRPC {
       errors: Errors.INVALID_CONTRACT_CLASS;
     };
     starknet_addDeployAccountTransaction: {
-      params: BROADCASTED_DEPLOY_ACCOUNT_TXN;
+      params: {
+        deploy_account_transaction: BROADCASTED_DEPLOY_ACCOUNT_TXN;
+      };
       result: {
         transaction_hash: TXN_HASH;
         contract_address: FELT;
diff --git a/src/utils/calldata.ts b/src/utils/calldata.ts
deleted file mode 100644
index 7266a542..00000000
--- a/src/utils/calldata.ts
+++ /dev/null
@@ -1,250 +0,0 @@
-import BN from 'bn.js';
-import assert from 'minimalistic-assert';
-
-import { Abi, AbiEntry, Calldata, FunctionAbi, ParsedStruct, StructAbi } from '../types';
-import { BigNumberish, toFelt } from './number';
-
-export class CheckCallData {
-  abi: Abi;
-
-  protected readonly structs: { [name: string]: StructAbi };
-
-  constructor(abi: Abi) {
-    this.abi = abi;
-    this.structs = abi
-      .filter((abiEntry) => abiEntry.type === 'struct')
-      .reduce(
-        (acc, abiEntry) => ({
-          ...acc,
-          [abiEntry.name]: abiEntry,
-        }),
-        {}
-      );
-  }
-
-  /**
-   * Parse the calldata by using input fields from the abi for that method
-   *
-   * @param args - arguments passed the the method
-   * @param inputs  - list of inputs(fields) that are in the abi
-   * @return {Calldata} - parsed arguments in format that contract is expecting
-   */
-  public compileCalldata(args: Array<any>, inputs: AbiEntry[]): Calldata {
-    const argsIterator = args[Symbol.iterator]();
-    return inputs.reduce((acc, input) => {
-      if (/_len$/.test(input.name)) {
-        return acc;
-      }
-      const parsedData = this.parseCalldataField(argsIterator, input);
-      if (Array.isArray(parsedData)) {
-        acc.push(...parsedData);
-      } else {
-        acc.push(parsedData);
-      }
-      return acc;
-    }, [] as Calldata);
-  }
-
-  /**
-   * Validates if all arguments that are passed to the method are corresponding to the ones in the abi
-   *
-   * @param type - type of the method
-   * @param method  - name of the method
-   * @param args - arguments that are passed to the method
-   */
-  public validateMethodAndArgs(
-    type: 'INVOKE' | 'CALL' | 'DEPLOY',
-    method: string,
-    args: Array<any> = []
-  ) {
-    // ensure provided method exists
-    if (type !== 'DEPLOY') {
-      const invocableFunctionNames = this.abi
-        .filter((abi) => {
-          if (abi.type !== 'function') return false;
-          const isView = abi.stateMutability === 'view';
-          return type === 'INVOKE' ? !isView : isView;
-        })
-        .map((abi) => abi.name);
-      assert(
-        invocableFunctionNames.includes(method),
-        `${type === 'INVOKE' ? 'invocable' : 'viewable'} method not found in abi`
-      );
-    }
-
-    // ensure args match abi type
-    const methodAbi = this.abi.find((abi) =>
-      type === 'DEPLOY'
-        ? abi.name === method && abi.type === method
-        : abi.name === method && abi.type === 'function'
-    ) as FunctionAbi;
-    let argPosition = 0;
-    methodAbi.inputs.forEach((input) => {
-      if (/_len$/.test(input.name)) {
-        return;
-      }
-      if (input.type === 'felt') {
-        assert(
-          typeof args[argPosition] === 'string' ||
-            typeof args[argPosition] === 'number' ||
-            args[argPosition] instanceof BN,
-          `arg ${input.name} should be a felt (string, number, BigNumber)`
-        );
-        argPosition += 1;
-      } else if (input.type in this.structs && typeof args[argPosition] === 'object') {
-        if (Array.isArray(args[argPosition])) {
-          const structMembersLength = this.calculateStructMembers(input.type);
-          assert(
-            args[argPosition].length === structMembersLength,
-            `arg should be of length ${structMembersLength}`
-          );
-        } else {
-          this.structs[input.type].members.forEach(({ name }) => {
-            assert(
-              Object.keys(args[argPosition]).includes(name),
-              `arg should have a property ${name}`
-            );
-          });
-        }
-        argPosition += 1;
-      } else {
-        assert(Array.isArray(args[argPosition]), `arg ${input.name} should be an Array`);
-        if (input.type === 'felt*') {
-          args[argPosition].forEach((felt: BigNumberish) => {
-            assert(
-              typeof felt === 'string' || typeof felt === 'number' || felt instanceof BN,
-              `arg ${input.name} should be an array of string, number or BigNumber`
-            );
-          });
-          argPosition += 1;
-        } else if (/\(felt/.test(input.type)) {
-          const tupleLength = input.type.split(',').length;
-          assert(
-            args[argPosition].length === tupleLength,
-            `arg ${input.name} should have ${tupleLength} elements in tuple`
-          );
-          args[argPosition].forEach((felt: BigNumberish) => {
-            assert(
-              typeof felt === 'string' || typeof felt === 'number' || felt instanceof BN,
-              `arg ${input.name} should be an array of string, number or BigNumber`
-            );
-          });
-          argPosition += 1;
-        } else {
-          const arrayType = input.type.replace('*', '');
-          args[argPosition].forEach((struct: any) => {
-            this.structs[arrayType].members.forEach(({ name }) => {
-              if (Array.isArray(struct)) {
-                const structMembersLength = this.calculateStructMembers(arrayType);
-                assert(
-                  struct.length === structMembersLength,
-                  `arg should be of length ${structMembersLength}`
-                );
-              } else {
-                assert(
-                  Object.keys(struct).includes(name),
-                  `arg ${input.name} should be an array of ${arrayType}`
-                );
-              }
-            });
-          });
-          argPosition += 1;
-        }
-      }
-    });
-  }
-
-  /**
-   * Parse one field of the calldata by using input field from the abi for that method
-   *
-   * @param args - value of the field
-   * @param input  - input(field) information from the abi that will be used to parse the data
-   * @return {string | string[]} - parsed arguments in format that contract is expecting
-   */
-  protected parseCalldataField(argsIterator: Iterator<any>, input: AbiEntry): string | string[] {
-    const { name, type } = input;
-    const { value } = argsIterator.next();
-
-    const parsedCalldata: string[] = [];
-    switch (true) {
-      case /\*/.test(type):
-        if (Array.isArray(value)) {
-          parsedCalldata.push(toFelt(value.length));
-          return (value as (BigNumberish | ParsedStruct)[]).reduce((acc, el) => {
-            if (/felt/.test(type)) {
-              acc.push(toFelt(el as BigNumberish));
-            } else {
-              acc.push(...this.parseCalldataValue(el, type.replace('*', '')));
-            }
-            return acc;
-          }, parsedCalldata);
-        }
-        throw Error(`Expected ${name} to be array`);
-      case type in this.structs:
-        return this.parseCalldataValue(value as ParsedStruct | BigNumberish[], type);
-      case /\(felt/.test(type):
-        if (Array.isArray(value)) {
-          return value.map((el) => toFelt(el as BigNumberish));
-        }
-        throw Error(`Expected ${name} to be array`);
-      default:
-        return toFelt(value as BigNumberish);
-    }
-  }
-
-  /**
-   * Deep parse of the object that has been passed to the method
-   *
-   * @param element - element that needs to be parsed
-   * @param type  - name of the method
-   * @return {string | string[]} - parsed arguments in format that contract is expecting
-   */
-
-  protected parseCalldataValue(
-    element: ParsedStruct | BigNumberish | BigNumberish[],
-    type: string
-  ): string | string[] {
-    if (element === undefined) {
-      throw Error('Missing element in calldata');
-    }
-    if (Array.isArray(element)) {
-      const structMemberNum = this.calculateStructMembers(type);
-      if (element.length !== structMemberNum) {
-        throw Error('Missing element in calldata');
-      }
-      return element.map((el) => toFelt(el));
-    }
-    // checking if the passed element is struct or element in struct
-    if (this.structs[type] && this.structs[type].members.length) {
-      // going through all the members of the struct and parsing the value
-      return this.structs[type].members.reduce((acc, member: AbiEntry) => {
-        // if the member of the struct is another struct this will return array of the felts if not it will be single felt
-        // TODO: refactor types so member name can be used as keyof ParsedStruct
-        /* @ts-ignore */
-        const parsedData = this.parseCalldataValue(element[member.name], member.type);
-        if (typeof parsedData === 'string') {
-          acc.push(parsedData);
-        } else {
-          acc.push(...parsedData);
-        }
-        return acc;
-      }, [] as string[]);
-    }
-    return toFelt(element as BigNumberish);
-  }
-
-  /**
-   * Deep parse of the object that has been passed to the method
-   *
-   * @param struct - struct that needs to be calculated
-   * @return {number} - number of members for the given struct
-   */
-  private calculateStructMembers(struct: string): number {
-    return this.structs[struct].members.reduce((acc, member) => {
-      if (member.type === 'felt') {
-        return acc + 1;
-      }
-      return acc + this.calculateStructMembers(member.type);
-    }, 0);
-  }
-}
diff --git a/www/docs/API/account.md b/www/docs/API/account.md
index 3f4f5e43..0ca03889 100644
--- a/www/docs/API/account.md
+++ b/www/docs/API/account.md
@@ -24,8 +24,6 @@ The address of the account contract.
 
 ## Methods
 
-### getNonce()
-
 account.**getNonce(blockIdentifier)** => _Promise < BigNumberish >_
 
 Gets the nonce of the account with respect to a specific block.
@@ -34,9 +32,7 @@ _blockIdentifier_ - optional blockIdentifier. Defaults to 'pending'.
 
 Returns the nonce of the account.
 
----
-
-### estimateInvokeFee()
+<hr />
 
 account.**estimateInvokeFee**(calls [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
 
@@ -63,9 +59,7 @@ The _estimateFeeDetails_ object may include any of:
 }
 ```
 
----
-
-### estimateDeclareFee()
+<hr />
 
 account.**estimateDeclareFee**(contractPayload [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
 
@@ -91,9 +85,7 @@ The _estimateFeeDetails_ object may include any of:
 }
 ```
 
----
-
-### estimateAccountDeployFee()
+<hr />
 
 account.**estimateAccountDeployFee**(contractPayload [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
 
@@ -119,9 +111,7 @@ The _estimateFeeDetails_ object may include any of:
 }
 ```
 
----
-
-### execute()
+<hr />
 
 account.**execute**(transactions [ , abi , transactionsDetail ]) => _Promise < InvokeFunctionResponse >_
 
@@ -150,9 +140,9 @@ The _transactionsDetail_ object may include any of:
 };
 ```
 
----
+<hr />
 
-### declare()
+### Declare
 
 account.**declare**(contractPayload [ , transactionsDetail ]) => _Promise < DeclareContractResponse >_
 
@@ -190,13 +180,13 @@ const declareTx = await account.declare({
 };
 ```
 
----
+<hr />
 
-### deploy()
+### Deploy
 
 Deploys a given compiled contract (json) to starknet, wrapper around _execute_ invoke function
 
-account.**deploy**(deployContractPayload [ , transactionsDetail ]) => _Promise < InvokeFunctionResponse >_
+**deploy**(deployContractPayload [ , transactionsDetail ]) => _Promise < InvokeFunctionResponse >_
 
 @param object **_deployContractPayload_**
 
@@ -236,14 +226,14 @@ Example multi-call:
 TODO Example with multi-call
 ```
 
----
+<hr />
 
-### deployContract()
+### DeployContract
 
 ✅ NEW
 High level wrapper for deploy. Doesn't require waitForTransaction. Response similar to deprecated provider deployContract.
 
-account.**deployContract**(payload [ , details ]) => _Promise < DeployContractUDCResponse >_
+**deployContract**(payload [ , details ]) => _Promise < DeployContractUDCResponse >_
 
 @param object **_payload_** UniversalDeployerContractPayload
 
@@ -283,14 +273,14 @@ Example:
   });
 ```
 
----
+<hr />
 
-### declareDeploy()
+### DeclareDeploy
 
 ✅ NEW
 High level wrapper for declare & deploy. Doesn't require waitForTransaction. Functionality similar to deprecated provider deployContract. Declare and Deploy contract using single function.
 
-account.**declareDeploy**(payload [ , details ]) => _Promise < DeclareDeployUDCResponse >_
+**declareDeploy**(payload [ , details ]) => _Promise < DeclareDeployUDCResponse >_
 
 @param object **_payload_** DeclareDeployContractPayload
 
@@ -321,7 +311,7 @@ account.**declareDeploy**(payload [ , details ]) => _Promise < DeclareDeployUDCR
   - calldata_len
   - calldata
   - salt
-  ***
+  <hr />
 
 Example:
 
@@ -340,9 +330,7 @@ Example:
   const erc20Address = declareDeploy.deploy.contract_address;
 ```
 
----
-
-### deployAccount()
+### deployAccount
 
 account.**deployAccount**(contractPayload [ , transactionsDetail ]) => _Promise < DeployContractResponse >_
 
@@ -372,9 +360,7 @@ The _transactionsDetail_ object may include any of:
 };
 ```
 
----
-
-### signMessage()
+<hr/>
 
 account.**signMessage**(typedData) => _Promise < Signature >_
 
@@ -388,9 +374,7 @@ _typedData_ - JSON object to be signed
 string[];
 ```
 
----
-
-### hashMessage()
+<hr />
 
 account.**hashMessage**(typedData) => _Promise < string >_
 
@@ -400,9 +384,7 @@ _typedData_ - JSON object to be signed
 
 Returns the hash of the JSON object.
 
----
-
-### verifyMessageHash()
+<hr />
 
 account.**verifyMessageHash**(hash, signature) => _Promise < boolean >_
 
@@ -412,9 +394,7 @@ Verify a signature of a given hash.
 >
 > This method is not recommended, use `verifyMessage` instead
 
----
-
-### verifyMessage()
+<hr />
 
 account.**verifyMessage**(typedData, signature) => _Promise < boolean >_
 
@@ -425,9 +405,7 @@ _signature_ - signature of the JSON object
 
 Returns true if the signature is valid, false otherwise
 
----
-
-### getSuggestedMaxFee()
+<hr />
 
 account.**getSuggestedMaxFee**(estimateFeeAction, details) => _Promise < BigNumberish >_
 
@@ -438,9 +416,7 @@ The _details_ object may include any of:
 - details.**blockIdentifier**
 - details.**nonce**
 
----
-
-### getStarkName()
+<hr />
 
 account.**getStarkName**(StarknetIdContract) => _Promise<string | Error>_
 
@@ -450,9 +426,7 @@ The _StarknetIdContract_ argument can be undefined, if it is, the function will
 
 Returns directly a string (Example: `vitalik.stark`).
 
----
-
-### getAddressFromStarkName()
+<hr />
 
 account.**getAddressFromStarkName**(name, StarknetIdContract) => _Promise<string | Error>_
 
diff --git a/www/docs/API/contract.md b/www/docs/API/contract.md
index 2f1fb351..987c4114 100644
--- a/www/docs/API/contract.md
+++ b/www/docs/API/contract.md
@@ -36,57 +36,43 @@ If the Contract object is the result of a ContractFactory deployment, this is th
 
 ## Methods
 
-### attach()
-
 contract.**attach**(address) => void
 
 Saves the address of the contract deployed on network that will be used for interaction.
 
 _address_ - address of the contract.
 
----
-
-### connect()
+<br></br>
 
 contract.**connect**(providerOrAccount) => void
 
 Attaches to new Provider or Account
 
----
-
-### deployed()
+<br></br>
 
 contract.**deployed**() => _Promise < Contract >_
 
 If the Contract object is the result of a ContractFactory deployment, this method will wait for the transaction to be resolved.
 
----
-
-### call()
+<br></br>
 
 contract.**call**(method, args, options) => _Promise < Result >_
 
 Calls a method on a contract.
 
----
-
-### invoke()
+<br></br>
 
 contract.**invoke**(method, args, options) => _Promise < InvokeFunctionResponse >_
 
 Invokes a method on a contract.
 
----
-
-### estimate()
+<br></br>
 
 contract.**estimate**(method, args, options) => _Promise < any >_
 
 Estimates a method on a contract.
 
----
-
-### populate()
+<br></br>
 
 contract.**populate**(method, args, options) => _Invocation_
 
diff --git a/www/docs/API/contractFactory.md b/www/docs/API/contractFactory.md
index 6d739682..78749792 100644
--- a/www/docs/API/contractFactory.md
+++ b/www/docs/API/contractFactory.md
@@ -28,18 +28,14 @@ contractFactory.**abi** => _Abi_ (the ABI the contractFactory was constructed wi
 
 ## Methods
 
-### attach()
-
 contractFactory.**attach**( address ) ⇒ _Contract_
 
 Return an instance of a _Contract_ attached to address. This is the same as using the _Contract_ constructor with address and this _compiledContract_ and _account_ passed in when creating the ContractFactory.
 
----
-
-### deploy()
+<hr />
 
-contractFactory.**deploy**( args, addressSalt ) ⇒ _Promise < Contract >_
+contractFactory.**deploy**( constructorCalldata, addressSalt ) ⇒ _Promise < Contract >_
 
-Uses the provider to deploy the Contract with _args_ passed into the constructor and returns a _Contract_ which is attached to the address where this contract will be deployed.
+Uses the provider to deploy the Contract with _constructorCalldata_ passed into the constructor and returns a _Contract_ which is attached to the address where this contract will be deployed.
 
 The transaction hash can be found at _contract.deployTransactionHash_, and no interactions should be made until the transaction is resolved.
diff --git a/www/docs/API/provider.md b/www/docs/API/provider.md
index 2c05094e..2dd56363 100644
--- a/www/docs/API/provider.md
+++ b/www/docs/API/provider.md
@@ -57,15 +57,13 @@ These are also the default options for the Provider constructor with `network: '
 
 ### Methods
 
-#### getChainId()
+<hr/>
 
 provider.**getChainId**() => _Promise < StarknetChainId >_
 
 Returns the chain Id for the current network.
 
----
-
-#### callContract()
+<hr/>
 
 provider.**callContract**(call [ , blockIdentifier ]) => _Promise < CallContractResponse >_
 
@@ -85,9 +83,7 @@ The call object structure:
 }
 ```
 
----
-
-#### getBlock()
+<hr/>
 
 provider.**getBlock**(blockIdentifier) => _Promise < GetBlockResponse >_
 
@@ -111,9 +107,7 @@ Gets the block information.
 }
 ```
 
----
-
-#### getClassAt()
+<hr/>
 
 provider.**getClassAt**(contractAddress, blockIdentifier) => _Promise < ContractClass >_
 
@@ -129,9 +123,7 @@ Gets the contract class of the deployed contract.
 }
 ```
 
----
-
-#### getInvokeEstimateFee()
+<hr/>
 
 provider.**getInvokeEstimateFee**(invocationWithTxType, invocationDetails, blockIdentifier) => _Promise < EstimateFeeResponse >_
 
@@ -147,25 +139,19 @@ Estimate fee for invoke transaction.
 }
 ```
 
----
-
-#### getNonceForAddress()
+<hr/>
 
 provider.**getNonceForAddress**(contractAddress, blockIdentifier) => _Promise < BigNumberish >_
 
 Gets the nonce of the provided contractAddress. This was renamed from `getNonce` to `getNonceForAddress` to avoid confusion when inheriting an Account from the Provider class.
 
----
-
-#### getStorageAt()
+<hr/>
 
 provider.**getStorageAt**(contractAddress, key, blockIdentifier) => _Promise < string >_
 
 Gets the contract's storage variable at a specific key.
 
----
-
-#### getTransactionReceipt()
+<hr/>
 
 provider.**getTransactionReceipt**(txHash) => _Promise < GetTransactionReceiptResponse >_
 
@@ -185,9 +171,7 @@ Gets the status of a transaction.
 }
 ```
 
----
-
-#### getTransaction()
+<hr/>
 
 provider.**getTransaction**(txHash) => _Promise < GetTransactionResponse >_
 
@@ -210,9 +194,7 @@ Gets the transaction information from a tx hash.
 }
 ```
 
----
-
-#### declareContract()
+<hr/>
 
 provider.**declareContract**(transaction, details) => _Promise < DeclareContractResponse >_
 
@@ -227,9 +209,7 @@ Declare a contract on Starknet.
 };
 ```
 
----
-
-#### getDeclareEstimateFee()
+<hr/>
 
 provider.**getDeclareEstimateFee**(transaction, details, blockIdentifier) => _Promise < EstimateFeeResponse >_
 
@@ -245,9 +225,9 @@ Estimate fee for declare transaction.
 };
 ```
 
----
+<hr/>
 
-#### waitForTransaction()
+### waitForTransaction
 
 provider.**waitForTransaction**(txHash [ , retryInterval]) => _Promise < GetTransactionReceiptResponse >_
 
@@ -285,9 +265,7 @@ const provider = new starknet.SequencerProvider({
 
 ### Methods
 
----
-
-#### getContractAddresses()
+<hr/>
 
 provider.**getContractAddresses**() => _Promise < GetContractAddressesResponse >_
 
@@ -302,9 +280,7 @@ Gets the smart contract address on the network.
 }
 ```
 
----
-
-#### getCode()
+<hr/>
 
 provider.**getCode**(contractAddress, blockIdentifier) => _Promise < GetCodeResponse >_
 
@@ -319,9 +295,7 @@ Gets the smart contract address on the network.
 }
 ```
 
----
-
-#### estimateMessageFee()
+<hr/>
 
 provider.**estimateMessageFee**(CallL1Handler, blockIdentifier) => _Promise < EstimateFeeResponse >_
 
@@ -348,9 +322,7 @@ type CallL1Handler = {
 }
 ````
 
----
-
-#### getTransactionStatus()
+<hr/>
 
 provider.**getTransactionStatus**(txHash) => _Promise < GetTransactionStatusResponse >_
 
@@ -370,9 +342,7 @@ Gets the status of a transaction.
 }
 ```
 
----
-
-#### getTransactionTrace()
+<hr/>
 
 provider.**getTransactionTrace**(txHash) => _Promise < GetTransactionTraceResponse >_
 
@@ -429,29 +399,21 @@ const provider = new starknet.RpcProvider({
 
 ### Methods
 
----
-
-#### fetch()
+<hr/>
 
 provider.**fetch**(method: any, params: any) => _Promise < any >_
 
 Generic method for users to be able to experiment with RPC methods.
 
----
-
-#### getChainId()
+<hr/>
 
 provider.**getChainId**() => _Promise < any >_
 
----
-
-#### getBlock()
+<hr/>
 
 provider.**getBlock**(blockIdentifier) => _Promise < GetBlockResponse >_
 
----
-
-#### getBlockHashAndNumber()
+<hr/>
 
 provider.**getBlockHashAndNumber**() => _Promise < BlockHashAndNumber >_
 
@@ -464,9 +426,7 @@ provider.**getBlockHashAndNumber**() => _Promise < BlockHashAndNumber >_
 }
 ```
 
----
-
-#### getBlockWithTxHashes()
+<hr/>
 
 provider.**getBlockWithTxHashes**(blockIdentifier) => _Promise < GetBlockWithTxHashesResponse >_
 
@@ -476,9 +436,7 @@ provider.**getBlockWithTxHashes**(blockIdentifier) => _Promise < GetBlockWithTxH
 OPENRPC.BlockWithTxHashes
 ```
 
----
-
-#### getBlockWithTxs()
+<hr/>
 
 provider.**getBlockWithTxs**(blockIdentifier) => _Promise < GetBlockWithTxs >_
 
@@ -488,31 +446,23 @@ provider.**getBlockWithTxs**(blockIdentifier) => _Promise < GetBlockWithTxs >_
 OPENRPC.BlockWithTxs
 ```
 
----
-
-#### getClassHashAt()
+<hr/>
 
 provider.**getClassHashAt**(blockIdentifier) => _Promise < ContractAddress >_
 
----
-
-#### getTransactionCount()
+<hr/>
 
 provider.**getTransactionCount**(blockIdentifier) => _Promise < number >_
 
 Gets the transaction count from a block.
 
----
-
-#### getBlockNumber()
+<hr/>
 
 provider.**getBlockNumber**() => _Promise < number >_
 
 Gets the latest block number.
 
----
-
-#### getPendingTransactions()
+<hr/>
 
 provider.**getPendingTransactions**() => _Promise < PendingTransactions >_
 
@@ -522,9 +472,7 @@ provider.**getPendingTransactions**() => _Promise < PendingTransactions >_
 OPENRPC.PendingTransactions;
 ```
 
----
-
-#### getStateUpdate()
+<hr/>
 
 provider.**getStateUpdate**(blockIdentifier) => _Promise < StateUpdate >_
 
@@ -534,21 +482,15 @@ provider.**getStateUpdate**(blockIdentifier) => _Promise < StateUpdate >_
 OPENRPC.StateUpdate;
 ```
 
----
-
-#### getStorageAt()
+<hr/>
 
 provider.**getStorageAt**(contractAddress, key, blockIdentifier) => _Promise < BigNumberish >_
 
----
-
-#### getTransaction()
+<hr/>
 
 provider.**getTransaction**(txHash) => _Promise < GetTransactionResponse >_
 
----
-
-#### getTransactionByHash()
+<hr/>
 
 provider.**getTransactionByHash**(txHash) => _Promise < GetTransactionByHashResponse >_
 
@@ -558,9 +500,7 @@ provider.**getTransactionByHash**(txHash) => _Promise < GetTransactionByHashResp
 OPENRPC.Transaction;
 ```
 
----
-
-#### getTransactionByBlockIdAndIndex()
+<hr/>
 
 provider.**getTransactionByBlockIdAndIndex**(blockIdentifier, index) => _Promise < GetTransactionByBlockIdAndIndex >_
 
@@ -570,15 +510,11 @@ provider.**getTransactionByBlockIdAndIndex**(blockIdentifier, index) => _Promise
 OPENRPC.Transaction;
 ```
 
----
-
-#### getTransactionReceipt()
+<hr/>
 
 provider.**getTransactionReceipt**(txHash) => _Promise < GetTransactionReceiptResponse >_
 
----
-
-#### getClass()
+<hr/>
 
 provider.**getClass**(classHash) => _Promise < ContractClass >_
 
@@ -588,9 +524,7 @@ provider.**getClass**(classHash) => _Promise < ContractClass >_
 OPENRPC.ContractClass;
 ```
 
----
-
-#### getClassAt()
+<hr/>
 
 provider.**getClassAt**(contractAddress, blockIdentifier) => _Promise < ContractClass >_
 
@@ -600,9 +534,7 @@ provider.**getClassAt**(contractAddress, blockIdentifier) => _Promise < Contract
 OPENRPC.ContractClass;
 ```
 
----
-
-#### getInvokeEstimateFee()
+<hr/>
 
 provider.**getInvokeEstimateFee**(invocation, invocationDetails, blockIdentifier) => _Promise < EstimateFeeResponse >_
 
@@ -614,9 +546,7 @@ provider.**getInvokeEstimateFee**(invocation, invocationDetails, blockIdentifier
   gas_price?: BN;
 ```
 
----
-
-#### getDeclareEstimateFee()
+<hr/>
 
 provider.**getDeclareEstimateFee**(DeclareContractTransaction, details, blockIdentifier) => _Promise < EstimateFeeResponse >_
 
@@ -628,9 +558,7 @@ provider.**getDeclareEstimateFee**(DeclareContractTransaction, details, blockIde
   gas_price?: BN;
 ```
 
----
-
-#### declareContract()
+<hr/>
 
 provider.**declareContract**(DeclareContractTransaction, details) => _Promise < DeclareContractResponse >_
 
@@ -641,15 +569,11 @@ provider.**declareContract**(DeclareContractTransaction, details) => _Promise <
   class_hash: string;
 ```
 
----
-
-#### callContract()
+<hr/>
 
 provider.**callContract**(call, blockIdentifier) => _Promise < CallContractResponse >_
 
----
-
-#### getContractAddresses()
+<hr/>
 
 provider.**traceTransaction**(transactionHash) => _Promise < Trace >_
 
@@ -659,9 +583,7 @@ provider.**traceTransaction**(transactionHash) => _Promise < Trace >_
 OPENRPC.Trace;
 ```
 
----
-
-#### traceBlockTransactions()
+<hr/>
 
 provider.**traceBlockTransactions**(blockHash) => _Promise < Traces >_
 
@@ -671,9 +593,7 @@ provider.**traceBlockTransactions**(blockHash) => _Promise < Traces >_
 OPENRPC.Traces;
 ```
 
----
-
-#### getSyncingStats()
+<hr/>
 
 provider.**getSyncingStats**() => _Promise < GetSyncingStatsResponse >_
 
@@ -693,9 +613,7 @@ boolean |
 }
 ```
 
----
-
-#### getEvents()
+<hr/>
 
 provider.**getEvents**(eventFilter) => _Promise < GetEventsResponse >_
 
diff --git a/www/docs/API/signer.md b/www/docs/API/signer.md
index e694f47d..0ca5b463 100644
--- a/www/docs/API/signer.md
+++ b/www/docs/API/signer.md
@@ -12,15 +12,11 @@ The **Signer** API allows you to sign transactions and messages, and also allows
 
 ## Methods
 
-### getPubKey()
-
 signer.**getPubKey**() => _Promise < string >_
 
 Returns the public key of the signer.
 
----
-
-### signTransaction()
+<hr />
 
 signer.**signTransaction**(transactions, transactionsDetail [ , abi ]) => _Promise < Signature >_
 
@@ -40,9 +36,7 @@ _abi_ - (optional) the abi of the contract for better displaying
 string[]
 ```
 
----
-
-### signMessage()
+<hr />
 
 signer.**signMessage**(typedData, accountAddress) => _Promise < Signature >_
 
@@ -57,9 +51,7 @@ _accountAddress_ - calldata to be passed in deploy constructor
 string[]
 ```
 
----
-
-### signDeployAccountTransaction()
+<hr />
 
 signer.**signDeployAccountTransaction**(transaction) => _Promise < Signature >_
 
@@ -81,9 +73,7 @@ The _transactions_ object for write methods may include any of:
 string[]
 ```
 
----
-
-### signDeclareTransaction()
+<hr />
 
 signer.**signDeclareTransaction**(transaction, transactionsDetail [ , abi ]) => _Promise < Signature >_
 
diff --git a/www/docs/API/utils.md b/www/docs/API/utils.md
index 71a79666..e8fd143e 100644
--- a/www/docs/API/utils.md
+++ b/www/docs/API/utils.md
@@ -41,7 +41,7 @@ This function validates the checksum address.
 
 Returns true if the address is valid, false otherwise.
 
----
+<hr />
 
 ## **stark**
 
@@ -102,7 +102,7 @@ Function that calculates and returns maximum fee based on the previously estimat
 
 Returns a BN.
 
----
+<hr />
 
 ## **number**
 
@@ -190,7 +190,7 @@ const signature = await this.signer.signTransaction(transactions, signerDetails)
 
 Convert BigNumberish array to hexadecimal string array. Used for signature conversion.
 
----
+<hr />
 
 ## **uint256**
 
@@ -222,7 +222,7 @@ Function to check if `BN` is smaller or equal to `2**256-1`.
 
 Function to convert `BN` to `Uint256`.
 
----
+<hr />
 
 ## **hash**
 
@@ -301,7 +301,7 @@ Function that calculates contract address from hash.
 
 Returns a string.
 
----
+<hr />
 
 ## **ellipticCurve**
 
@@ -354,21 +354,3 @@ keyPair should be an KeyPair with a valid public key.
 sig should be an Signature.
 
 Returns true if the verification succeeds.
-
-<hr />
-
-## **calldata**
-
-Functions to compile and validate arguments passed in invoke, call and deploy functions.
-
-### compile
-
-`compileCalldata(args: Array<any>, inputs: AbiEntry[]): Calldata`
-
-Parse the calldata by using input fields from the abi for that method.
-
-### validate
-
-`validateMethodAndArgs(type: 'INVOKE' | 'CALL' | 'DEPLOY', method: string, args: Array<any> = [])`
-
-Validates if all arguments that are passed to the method are corresponding to the ones in the abi.


Test patch:
diff --git a/__tests__/contract.test.ts b/__tests__/contract.test.ts
index b7638dca..9247a619 100644
--- a/__tests__/contract.test.ts
+++ b/__tests__/contract.test.ts
@@ -220,24 +220,12 @@ describe('contract module', () => {
     });
     test('deployment of new contract', async () => {
       const factory = new ContractFactory(compiledErc20, classHash, account);
-      const erc20 = await factory.deploy(
-        compileCalldata({
-          name: encodeShortString('Token'),
-          symbol: encodeShortString('ERC20'),
-          recipient: wallet,
-        })
-      );
+      const erc20 = await factory.deploy(constructorCalldata);
       expect(erc20 instanceof Contract);
     });
     test('wait for deployment transaction', async () => {
       const factory = new ContractFactory(compiledErc20, classHash, account);
-      const contract = await factory.deploy(
-        compileCalldata({
-          name: encodeShortString('Token'),
-          symbol: encodeShortString('ERC20'),
-          recipient: wallet,
-        })
-      );
+      const contract = await factory.deploy(constructorCalldata);
       expect(contract.deployed()).resolves.not.toThrow();
     });
     test('attach new contract', async () => {
diff --git a/__tests__/defaultProvider.test.ts b/__tests__/defaultProvider.test.ts
index 4bb6eb98..bb7f42d5 100644
--- a/__tests__/defaultProvider.test.ts
+++ b/__tests__/defaultProvider.test.ts
@@ -1,11 +1,11 @@
-import { BlockNumber, GetBlockResponse, Provider, stark } from '../src';
+import { BlockNumber, GetBlockResponse, stark } from '../src';
 import { toBN } from '../src/utils/number';
 import { encodeShortString } from '../src/utils/shortString';
 import { compiledErc20, erc20ClassHash, getTestAccount, getTestProvider } from './fixtures';
 
 const { compileCalldata } = stark;
 
-const testProvider = new Provider(getTestProvider());
+const testProvider = getTestProvider();
 
 describe('defaultProvider', () => {
   let exampleTransactionHash: string;
@@ -17,8 +17,6 @@ describe('defaultProvider', () => {
   const account = getTestAccount(testProvider);
 
   beforeAll(async () => {
-    expect(testProvider).toBeInstanceOf(Provider);
-
     const { deploy } = await account.declareDeploy({
       contract: compiledErc20,
       classHash: '0x54328a1075b8820eb43caf0caa233923148c983742402dcfc38541dd843d01a',
diff --git a/__tests__/fixtures.ts b/__tests__/fixtures.ts
index 7d3aaaf4..de707b85 100644
--- a/__tests__/fixtures.ts
+++ b/__tests__/fixtures.ts
@@ -47,7 +47,7 @@ export const getTestProvider = (): ProviderInterface => {
   if (IS_LOCALHOST_DEVNET) {
     // accelerate the tests when running locally
     const originalWaitForTransaction = provider.waitForTransaction.bind(provider);
-    provider.waitForTransaction = (txHash: string, retryInterval?: number) => {
+    provider.waitForTransaction = (txHash, retryInterval) => {
       return originalWaitForTransaction(txHash, retryInterval || 1000);
     };
   }
diff --git a/__tests__/rpcProvider.test.ts b/__tests__/rpcProvider.test.ts
index f80db5ce..7b6fe0a9 100644
--- a/__tests__/rpcProvider.test.ts
+++ b/__tests__/rpcProvider.test.ts
@@ -86,8 +86,8 @@ describeIfRpc('RPCProvider', () => {
     });
 
     describe('deploy contract related tests', () => {
-      let contract_address: string;
-      let transaction_hash: string;
+      let contract_address;
+      let transaction_hash;
 
       beforeAll(async () => {
         const { deploy } = await account.declareDeploy({