Skip to content

Commit

Permalink
Fix minor typos (#383)
Browse files Browse the repository at this point in the history
* [skip testnet]
  • Loading branch information
Nathan-SL authored Jun 16, 2023
1 parent 91f9d09 commit afc83b3
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 44 deletions.
10 changes: 5 additions & 5 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/adapt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/extend-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},

Expand Down Expand Up @@ -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" +
Expand Down
12 changes: 6 additions & 6 deletions src/recompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export class Cache {

// Loads the cache from the file
public async loadCache(): Promise<void> {
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();
Expand Down Expand Up @@ -92,7 +92,7 @@ export class Recompiler {
const artifactsDir = getArtifactPath(defaultSourcesPath, paths);

const newCacheEntry: Record<string, ContractData> = {};
// 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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}

Expand Down
6 changes: 3 additions & 3 deletions src/types/devnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down Expand Up @@ -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<SetTimeResponse>;

/**
* Fetch the predeployed accounts
* @returns an object containg array of account's metadata
* @returns an object containing array of account's metadata
*/
getPredeployedAccounts: () => Promise<PredeployedAccount[]>;

Expand Down
20 changes: 10 additions & 10 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
Expand All @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/types/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion www/docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions www/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <NAME>] [--path <PATH>] [<DEPENDENCY_PATH> ...] [--address <CONTRACT_ADDRESS>] [--compiler-version <COMPILER_VERSION>] [--license <LICENSE_SCHEME>] [--contract-name <CONTRACT_NAME>] [--acount-contract]
$ npx hardhat starknet-verify [--starknet-network <NAME>] [--path <PATH>] [<DEPENDENCY_PATH> ...] [--address <CONTRACT_ADDRESS>] [--compiler-version <COMPILER_VERSION>] [--license <LICENSE_SCHEME>] [--contract-name <CONTRACT_NAME>] [--account-contract]
```

Queries [Voyager](https://voyager.online/) to [verify the contract](https://voyager.online/verifyContract) deployed at `<CONTRACT_ADDRESS>` using the source files at `<PATH>` and any number of `<DEPENDENCY_PATH>`.
Expand All @@ -92,7 +92,7 @@ Like in the previous command, this plugin relies on `--starknet-network`, but wi

The verifier expects `<COMPILER_VERSION>` 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 `<LICENSE_SCHEME>` 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.

Expand Down

0 comments on commit afc83b3

Please sign in to comment.