From afc83b3a5892caab6cfbc64701422521f4de43af Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 16 Jun 2023 12:31:23 +0300 Subject: [PATCH] Fix minor typos (#383) * [skip testnet] --- src/account.ts | 10 +++++----- src/adapt.ts | 6 +++--- src/extend-utils.ts | 12 ++++++------ src/index.ts | 10 +++++----- src/recompiler.ts | 12 ++++++------ src/task-actions.ts | 2 +- src/types/devnet.ts | 6 +++--- src/types/index.ts | 20 ++++++++++---------- src/types/starknet.ts | 4 ++-- www/docs/dev.md | 2 +- www/docs/intro.md | 4 ++-- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/account.ts b/src/account.ts index 1ff9d6e9..6ef61965 100644 --- a/src/account.ts +++ b/src/account.ts @@ -297,8 +297,8 @@ export abstract class Account { } /** - * Performes multiple invokes as a single transaction through this account - * @param callParameters an array with the paramaters for each invoke + * Performs multiple invokes as a single transaction through this account + * @param callParameters an array with the parameters for each invoke * @returns the transaction hash of the invoke */ async multiInvoke(callParameters: CallParameters[], options?: InvokeOptions): Promise { @@ -307,7 +307,7 @@ export abstract class Account { } /** - * Etimate the fee of the multicall. + * Estimate the fee of the multicall. * @param callParameters an array with the parameters for each call * @returns the total estimated fee */ @@ -362,7 +362,7 @@ export abstract class Account { * Prepares the calldata and hashes the message for the multicall execution * * @param accountAddress address of the account contract - * @param callParameters array witht the call parameters + * @param callParameters array with the call parameters * @param nonce current nonce * @param maxFee the maximum fee amount set for the contract interaction * @param version the transaction version @@ -1044,7 +1044,7 @@ export class ArgentAccount extends Account { /** * Returns an account previously deployed to `address`. * A check is performed if the public key stored in the account matches the provided `privateKey`. - * No check is done for the optoinal guardian private key. + * No check is done for the optional guardian private key. * @param address * @param privateKey * @param options diff --git a/src/adapt.ts b/src/adapt.ts index 7fe7edf2..0bf44f69 100644 --- a/src/adapt.ts +++ b/src/adapt.ts @@ -119,7 +119,7 @@ function extractMemberTypes(s: string): string[] { while (i < s.length) { if (s[i] === "(") { let counter = 1; - const openningBracket = i; + const openingBracket = i; // Move to next element after '(' i++; @@ -137,7 +137,7 @@ function extractMemberTypes(s: string): string[] { i++; } - replacedSubStrings.push(s.substring(openningBracket, i)); + replacedSubStrings.push(s.substring(openingBracket, i)); // replace tuple with special symbol tmp += specialSymbol; @@ -424,7 +424,7 @@ function adaptStructInput( /** * Adapts the string resulting from a Starknet CLI function call or server purpose of adapting event - * This is done according to the actual output type specifed by the called function. + * This is done according to the actual output type specified by the called function. * * @param rawResult the actual result in the form of an unparsed string * @param outputSpecs array of starknet types in the expected function output diff --git a/src/extend-utils.ts b/src/extend-utils.ts index 5aa5daa4..278a6817 100644 --- a/src/extend-utils.ts +++ b/src/extend-utils.ts @@ -56,19 +56,19 @@ export async function getContractFactoryUtil(hre: HardhatRuntimeEnvironment, con }); } -export function shortStringToBigIntUtil(convertableString: string) { - if (!convertableString) { +export function shortStringToBigIntUtil(convertibleString: string) { + if (!convertibleString) { throw new StarknetPluginError("A non-empty string must be provided"); } - if (convertableString.length > SHORT_STRING_MAX_CHARACTERS) { + if (convertibleString.length > SHORT_STRING_MAX_CHARACTERS) { const msg = `Short strings must have a max of ${SHORT_STRING_MAX_CHARACTERS} characters.`; throw new StarknetPluginError(msg); } const invalidChars: { [key: string]: boolean } = {}; const charArray = []; - for (const c of convertableString.split("")) { + for (const c of convertibleString.split("")) { const charCode = c.charCodeAt(0); if (charCode > 127) { invalidChars[c] = true; @@ -87,8 +87,8 @@ export function shortStringToBigIntUtil(convertableString: string) { return BigInt("0x" + charArray.join("")); } -export function bigIntToShortStringUtil(convertableBigInt: bigint) { - return Buffer.from(convertableBigInt.toString(16), "hex").toString(); +export function bigIntToShortStringUtil(convertibleBigInt: bigint) { + return Buffer.from(convertibleBigInt.toString(16), "hex").toString(); } export function getWalletUtil(name: string, hre: HardhatRuntimeEnvironment) { diff --git a/src/index.ts b/src/index.ts index 832a7e4e..2fddcb7b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -275,13 +275,13 @@ extendEnvironment((hre) => { return contractFactory; }, - shortStringToBigInt: (convertableString) => { - const convertedString = shortStringToBigIntUtil(convertableString); + shortStringToBigInt: (convertibleString) => { + const convertedString = shortStringToBigIntUtil(convertibleString); return convertedString; }, - bigIntToShortString: (convertableBigInt) => { - const convertedBigInt = bigIntToShortStringUtil(convertableBigInt); + bigIntToShortString: (convertibleBigInt) => { + const convertedBigInt = bigIntToShortStringUtil(convertibleBigInt); return convertedBigInt; }, @@ -336,7 +336,7 @@ task("starknet-verify", "Verifies a contract on a Starknet network.") .addParam("address", "The address where the contract is deployed") .addParam("compilerVersion", "The compiler version used to compile the cairo contract") .addFlag("accountContract", "The contract type which specifies it's an account contract.") - .addOptionalParam("license", "The licence of the contract (e.g No License (None))") + .addOptionalParam("license", "The license of the contract (e.g No License (None))") .addOptionalVariadicPositionalParam( "paths", "The paths of the dependencies of the contract specified in --path\n" + diff --git a/src/recompiler.ts b/src/recompiler.ts index f7169077..2d3bbc98 100644 --- a/src/recompiler.ts +++ b/src/recompiler.ts @@ -47,10 +47,10 @@ export class Cache { // Loads the cache from the file public async loadCache(): Promise { - const cacheDirpath = this.getCacheDirPath(); + const cacheDirPath = this.getCacheDirPath(); // Creates cache directory if it doesn't exist - if (!fs.existsSync(cacheDirpath)) { - fs.mkdirSync(cacheDirpath, { recursive: true }); + if (!fs.existsSync(cacheDirPath)) { + fs.mkdirSync(cacheDirPath, { recursive: true }); } const cacheFilePath = this.getCacheFilePath(); @@ -92,7 +92,7 @@ export class Recompiler { const artifactsDir = getArtifactPath(defaultSourcesPath, paths); const newCacheEntry: Record = {}; - // Get soucrces from source path. Check only cairo file extensions + // Get sources from source path. Check only cairo file extensions const filesList = await traverseFiles(defaultSourcesPath, "*.cairo"); // Select file name for (const cairoContract of filesList) { @@ -202,7 +202,7 @@ export class Recompiler { paths: [changedContract], disableHintValidation: entry?.disableHintValidation, accountContract: entry?.accountContract, - carioPath: entry?.cairoPath + cairoPath: entry?.cairoPath }; await starknetDeprecatedCompileAction(compileArguments, this.hre); @@ -222,7 +222,7 @@ export class Recompiler { continue; } - // Add contracts that contiain a change in content + // Add contracts that contain a change in content if (newCacheEntry[contractName].contentHash !== cache[contractName].contentHash) { changed.add(contractName); } diff --git a/src/task-actions.ts b/src/task-actions.ts index 55a3b74d..7b6316c1 100644 --- a/src/task-actions.ts +++ b/src/task-actions.ts @@ -354,7 +354,7 @@ ${ ); }); - console.log(`Contract has been successfuly verified at address ${args.address}`); + console.log(`Contract has been successfully verified at address ${args.address}`); console.log(`Check it out on Voyager: ${verifiedUrl}`); } diff --git a/src/types/devnet.ts b/src/types/devnet.ts index d326c1f2..7c5a4e8c 100644 --- a/src/types/devnet.ts +++ b/src/types/devnet.ts @@ -29,7 +29,7 @@ export interface Devnet { * Deploys or loads the L1 messaging contract. * @param {string} networkUrl - L1 network url. * @param {string} [address] - Address of the contract to be loaded. - * @param {string} [networkId] - Determines if the ganache or tesnet should be used/ + * @param {string} [networkId] - Determines if the ganache or testnet should be used/ * @returns */ loadL1MessagingContract: ( @@ -80,13 +80,13 @@ export interface Devnet { /** * Sets the timestamp of next block * @param seconds timestamp in seconds - * @returns an object containg next block timestamp + * @returns an object containing next block timestamp */ setTime: (seconds: number) => Promise; /** * Fetch the predeployed accounts - * @returns an object containg array of account's metadata + * @returns an object containing array of account's metadata */ getPredeployedAccounts: () => Promise; diff --git a/src/types/index.ts b/src/types/index.ts index 5fefa3a8..12a24b56 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -62,7 +62,7 @@ export interface StringMap { } /** - * Object holding the event name and have a proprety data of type StingMap. + * Object holding the event name and have a property data of type StingMap. */ export interface DecodedEvent { name: string; @@ -343,13 +343,13 @@ export interface BlockIdentifier { blockHash?: string; } -export type SieraEntryPointsByType = { - CONSTRUCTOR: SieraContractEntryPointFields[]; - EXTERNAL: SieraContractEntryPointFields[]; - L1_HANDLER: SieraContractEntryPointFields[]; +export type SierraEntryPointsByType = { + CONSTRUCTOR: SierraContractEntryPointFields[]; + EXTERNAL: SierraContractEntryPointFields[]; + L1_HANDLER: SierraContractEntryPointFields[]; }; -export type SieraContractEntryPointFields = { +export type SierraContractEntryPointFields = { selector: string; function_idx: number; }; @@ -372,11 +372,11 @@ export class StarknetContractFactory { this.metadataPath = config.metadataPath; this.casmPath = config.casmPath; - const constructorPredicate = this.resolveContructorPredicate(); + const constructorPredicate = this.resolveConstructorPredicate(); this.constructorAbi = findConstructor(this.abi, constructorPredicate); } - private resolveContructorPredicate(): (abiEntry: starknet.AbiEntry) => boolean { + private resolveConstructorPredicate(): (abiEntry: starknet.AbiEntry) => boolean { if (!this.isCairo1()) { return (abiEntry: starknet.AbiEntry): boolean => { return abiEntry.type === "constructor"; @@ -779,13 +779,13 @@ export class StarknetContract { export interface ContractClassConfig extends StarknetContractConfig { sierraProgram: string; contractClassVersion: string; - entryPointsByType: SieraEntryPointsByType; + entryPointsByType: SierraEntryPointsByType; } export class Cairo1ContractClass extends StarknetContract { protected sierraProgram: string; protected contractClassVersion: string; - protected entryPointsByType: SieraEntryPointsByType; + protected entryPointsByType: SierraEntryPointsByType; constructor(config: ContractClassConfig) { super(config); diff --git a/src/types/starknet.ts b/src/types/starknet.ts index de334193..f4205994 100644 --- a/src/types/starknet.ts +++ b/src/types/starknet.ts @@ -24,14 +24,14 @@ export interface Starknet { * @param input the input short string * @returns the numeric equivalent of the input short string, wrapped in a `BigInt` */ - shortStringToBigInt: (convertableString: string) => bigint; + shortStringToBigInt: (convertibleString: string) => bigint; /** * Converts a BigInt to a string. The opposite of {@link shortStringToBigInt}. * @param input the input BigInt * @returns a string which is the result of converting a BigInt's hex value to its ASCII equivalent */ - bigIntToShortString: (convertableBigInt: bigint) => string; + bigIntToShortString: (convertibleBigInt: bigint) => string; /** * The selected starknet-network name. diff --git a/www/docs/dev.md b/www/docs/dev.md index c3ce4b41..e8a5726b 100644 --- a/www/docs/dev.md +++ b/www/docs/dev.md @@ -130,7 +130,7 @@ There are two wrappers around Starknet CLI. They are defined in [starknet-wrappe ### Accessing HardhatRuntimeEnvironment (hre) -Before v0.7.0 we didn't know how to export classes to users, since every class needed to have access to `hre`, which was passed on in `extendEnvironment`. After introducing dynamic `hre` importing, exporting clases has become a possibility: +Before v0.7.0 we didn't know how to export classes to users, since every class needed to have access to `hre`, which was passed on in `extendEnvironment`. After introducing dynamic `hre` importing, exporting classes has become a possibility: ```typescript const hre = await import("hardhat"); diff --git a/www/docs/intro.md b/www/docs/intro.md index 502e44c7..86b0102e 100644 --- a/www/docs/intro.md +++ b/www/docs/intro.md @@ -83,7 +83,7 @@ By default, the dockerized Cairo 1 compiler is used. In [venv mode](#existing-vi ### `starknet-verify` ``` -$ npx hardhat starknet-verify [--starknet-network ] [--path ] [ ...] [--address ] [--compiler-version ] [--license ] [--contract-name ] [--acount-contract] +$ npx hardhat starknet-verify [--starknet-network ] [--path ] [ ...] [--address ] [--compiler-version ] [--license ] [--contract-name ] [--account-contract] ``` Queries [Voyager](https://voyager.online/) to [verify the contract](https://voyager.online/verifyContract) deployed at `` using the source files at `` and any number of ``. @@ -92,7 +92,7 @@ Like in the previous command, this plugin relies on `--starknet-network`, but wi The verifier expects `` to be passed on request. Supported compiler versions are listed [here](https://voyager.online/verifyContract) in the dropdown menu. -We pass `--acount-contract` to tell the verifier that the contract is of type account. +We pass `--account-contract` to tell the verifier that the contract is of type account. For `` the command takes [_No License (None)_](https://github.com/github/choosealicense.com/blob/a40ef42140d137770161addf4fefc715709d8ccd/no-permission.md) as default license scheme. [Here](https://goerli.voyager.online/cairo-licenses) is a list of available options.