Skip to content

Commit

Permalink
chore: aggregate typo changes (#870)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: CI <noreply@github.com>
Co-authored-by: BorkBorked <107079055+BorkBorked@users.noreply.github.com>
Co-authored-by: script-money <74860630+script-money@users.noreply.github.com>
Co-authored-by: Ivan Pavičić <ivan.pavicic@live.com>
Co-authored-by: kongtaoxing <xyf8658@163.com>
Co-authored-by: Dhruv Kelawala <dhruvrk2000@gmail.com>
  • Loading branch information
7 people authored Feb 1, 2024
1 parent 9986362 commit 418bc11
Show file tree
Hide file tree
Showing 49 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ If you consider to contribute to this project please read [CONTRIBUTING.md](http

Special thanks to all the [contributors](https://github.com/starknet-io/starknet.js/graphs/contributors), especially to:

- Sean ([@0xs34n](https://github.com/0xs34n)), the original creator of Straknet.js!
- Sean ([@0xs34n](https://github.com/0xs34n)), the original creator of Starknet.js!

- Janek ([@janek26](https://github.com/janek26)) and Dhruv ([@dhruvkelawala](https://github.com/dhruvkelawala)) from [Argent](https://github.com/argentlabs)

Expand Down
2 changes: 1 addition & 1 deletion __mocks__/cairo/helloCairo2/hellocairo
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ mod HelloStarknet {
}
}

// return Option<litteral>
// return Option<literal>
fn option_u8_output(self: @ContractState, val1: u8) -> Option<u8> {
if val1 < 100 {
return Option::None(());
Expand Down
2 changes: 1 addition & 1 deletion __tests__/cairo1v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Cairo 1', () => {
expect(balance).toBe(200n);
});

test('Cairo 1 Contract Interaction - uint 8, 16, 32, 64, 128, litterals', async () => {
test('Cairo 1 Contract Interaction - uint 8, 16, 32, 64, 128, literals', async () => {
const tx = await cairo1Contract.increase_balance_u8(255n);
await account.waitForTransaction(tx.transaction_hash);
const balance = await cairo1Contract.get_balance_u8();
Expand Down
2 changes: 1 addition & 1 deletion __tests__/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ describe('Complex interaction', () => {
expect(json.stringify(compiled)).toBe(reference);
expect(json.stringify(doubleCompiled)).toBe(reference);

// mix of complex and litteral
// mix of complex and literal
const mySetArgs = {
validators: [234, 235],
powers: { a1: 562, a2: 567 },
Expand Down
10 changes: 5 additions & 5 deletions src/account/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ export abstract class AccountInterface extends ProviderInterface {
): Promise<DeployContractResponse>;

/**
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
* This adds a message prefix so it cant be interchanged with transactions
* Signs a JSON object for off-chain usage with the Starknet private key and returns the signature
* This adds a message prefix so it can't be interchanged with transactions
*
* @param json - JSON object to be signed
* @returns the signature of the JSON object
Expand All @@ -271,8 +271,8 @@ export abstract class AccountInterface extends ProviderInterface {
public abstract signMessage(typedData: TypedData): Promise<Signature>;

/**
* Hash a JSON object with pederson hash and return the hash
* This adds a message prefix so it cant be interchanged with transactions
* Hash a JSON object with Pedersen hash and return the hash
* This adds a message prefix so it can't be interchanged with transactions
*
* @param json - JSON object to be hashed
* @returns the hash of the JSON object
Expand Down Expand Up @@ -322,7 +322,7 @@ export abstract class AccountInterface extends ProviderInterface {
): Promise<bigint>;

/**
* Simulates an array of transaction and returns an array of transaction trace and estimated fee.
* Simulates an array of transactions and returns an array of transaction trace and estimated fee.
*
* @param invocations Invocations containing:
* - type - transaction type: DECLARE, (multi)DEPLOY, DEPLOY_ACCOUNT, (multi)INVOKE_FUNCTION
Expand Down
2 changes: 1 addition & 1 deletion src/contract/contractFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ export class ContractFactory {
return new Contract(this.abi, address, this.account);
}

// ethers.js' getDeployTransaction cant be supported as it requires the account or signer to return a signed transaction which is not possible with the current implementation
// ethers.js' getDeployTransaction can't be supported as it requires the account or signer to return a signed transaction which is not possible with the current implementation
}
2 changes: 1 addition & 1 deletion src/provider/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export abstract class ProviderInterface {

/**
* Invokes a function on starknet
* @deprecated This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
* @deprecated This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class
*
* @param invocation the invocation object containing:
* - contractAddress - the address of the contract
Expand Down
4 changes: 2 additions & 2 deletions src/provider/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class SequencerProvider implements ProviderInterface {
: [undefined, Sequencer.Endpoints[T]['REQUEST']]
: Sequencer.Endpoints[T]['REQUEST'] extends never
? [Sequencer.Endpoints[T]['QUERY']] // when no request is needed, we can omit the request parameter
: [Sequencer.Endpoints[T]['QUERY'], Sequencer.Endpoints[T]['REQUEST']] // when both query and request are needed, we cant omit anything
: [Sequencer.Endpoints[T]['QUERY'], Sequencer.Endpoints[T]['REQUEST']] // when both query and request are needed, we can't omit anything
): Promise<Sequencer.Endpoints[T]['RESPONSE']> {
const baseUrl = this.getFetchUrl(endpoint);
const method = this.getFetchMethod(endpoint);
Expand Down Expand Up @@ -370,7 +370,7 @@ export class SequencerProvider implements ProviderInterface {
} else if (classHash) {
contractClass = await this.getClassByHash(classHash, blockIdentifier);
} else {
throw Error('getContractVersion require contractAddress or classHash');
throw Error('getContractVersion requires contractAddress or classHash');
}

if (isSierra(contractClass)) {
Expand Down
2 changes: 1 addition & 1 deletion src/types/calldata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export enum Uint {
u256 = 'core::integer::u256', // This one is struct
}

export enum Litteral {
export enum Literal {
ClassHash = 'core::starknet::class_hash::ClassHash',
ContractAddress = 'core::starknet::contract_address::ContractAddress',
}
2 changes: 1 addition & 1 deletion src/types/lib/contract/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type LegacyContractClass = {
};

/**
* format produced after compile .cairo to .json
* format produced after compiling .cairo to .json
*/
export type LegacyCompiledContract = Omit<LegacyContractClass, 'program'> & {
program: Program;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/calldata/cairo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
AbiStructs,
BigNumberish,
ContractVersion,
Litteral,
Literal,
Uint,
Uint256,
} from '../../types';
Expand All @@ -26,7 +26,7 @@ export const isTypeEnum = (type: string, enums: AbiEnums) => type in enums;
export const isTypeOption = (type: string) => type.startsWith('core::option::Option::');
export const isTypeResult = (type: string) => type.startsWith('core::result::Result::');
export const isTypeUint = (type: string) => Object.values(Uint).includes(type as Uint);
export const isTypeLitteral = (type: string) => Object.values(Litteral).includes(type as Litteral);
export const isTypeLiteral = (type: string) => Object.values(Literal).includes(type as Literal);
export const isTypeUint256 = (type: string) => type === 'core::integer::u256';
export const isTypeBool = (type: string) => type === 'core::bool';
export const isTypeContractAddress = (type: string) =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/calldata/enum/CairoCustomEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CairoCustomEnum {
constructor(enumContent: CairoEnumRaw) {
const variantsList = Object.values(enumContent);
if (variantsList.length === 0) {
throw new Error('This Enum must have a least 1 variant');
throw new Error('This Enum must have at least 1 variant');
}
const nbActiveVariants = variantsList.filter(
(content) => typeof content !== 'undefined'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/calldata/propertyOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function orderPropsByAbi(
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return orderStruct(unorderedItem, abiOfStruct);
}
// litterals
// literals
return unorderedItem;
};

Expand Down
12 changes: 6 additions & 6 deletions src/utils/calldata/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
AbiStructs,
BigNumberish,
FunctionAbi,
Litteral,
Literal,
Uint,
} from '../../types';
import assert from '../assert';
Expand All @@ -22,7 +22,7 @@ import {
isTypeBool,
isTypeEnum,
isTypeFelt,
isTypeLitteral,
isTypeLiteral,
isTypeOption,
isTypeResult,
isTypeStruct,
Expand Down Expand Up @@ -105,15 +105,15 @@ const validateUint = (parameter: any, input: AbiEntry) => {
);
break;

case Litteral.ClassHash:
case Literal.ClassHash:
assert(
// from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1670
param >= 0n && param <= 2n ** 252n - 1n,
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^252-1]`
);
break;

case Litteral.ContractAddress:
case Literal.ContractAddress:
assert(
// from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1245
param >= 0n && param <= 2n ** 252n - 1n,
Expand Down Expand Up @@ -235,7 +235,7 @@ const validateArray = (parameter: any, input: AbiEntry, structs: AbiStructs, enu
case isTypeEnum(baseType, enums):
parameter.forEach((it: any) => validateEnum(it, { name: input.name, type: baseType }));
break;
case isTypeUint(baseType) || isTypeLitteral(baseType):
case isTypeUint(baseType) || isTypeLiteral(baseType):
parameter.forEach((param: BigNumberish) => validateUint(param, input));
break;
case isTypeBool(baseType):
Expand Down Expand Up @@ -263,7 +263,7 @@ export default function validateFields(
case isTypeFelt(input.type):
validateFelt(parameter, input);
break;
case isTypeUint(input.type) || isTypeLitteral(input.type):
case isTypeUint(input.type) || isTypeLiteral(input.type):
validateUint(parameter, input);
break;
case isTypeBool(input.type):
Expand Down
2 changes: 1 addition & 1 deletion www/docs/guides/connect_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ const myTestContract = new Contract(compiledTest.abi, testAddress, provider);

## Typechecking and autocompletion

If you want to have typechecking and autocompletion for your contracts functions calls and catch typing errors early, you can use Abiwan!
If you want to have typechecking and autocompletion for your contracts functions calls and catch typing errors early, you can use Abiwan!

See [this guide](./automatic_cairo_ABI_parsing.md) for more details.
2 changes: 1 addition & 1 deletion www/docs/guides/create_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const argentXaccountClassHash = "0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d
// Generate public and private key pair.
const privateKeyAX = stark.randomAddress();
console.log('AX_ACCOUNT_PRIVATE_KEY=', privateKeyAX);
const starkKeyPubAX = ec.starkCurve.getStarkKey(privateKey);
const starkKeyPubAX = ec.starkCurve.getStarkKey(privateKeyAX);
console.log('AX_ACCOUNT_PUBLIC_KEY=', starkKeyPubAX);

// Calculate future address of the ArgentX account
Expand Down
2 changes: 1 addition & 1 deletion www/docs/guides/estimate_fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ To estimate the cost to deploy an account in the network:

```typescript
const { suggestedMaxFee: estimatedFee1 } = await account0.estimateAccountDeployFee({
classHash: OZaccountClashHass,
classHash: OZaccountClassHash,
constructorCalldata: OZaccountConstructorCallData,
contractAddress: OZcontractAddress
});
Expand Down
8 changes: 4 additions & 4 deletions www/versioned_docs/version-5.14.1/API/classes/Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ a confirmation of sending a transaction on the starknet contract
**signMessage**(`typedData`): `Promise`<[`Signature`](../namespaces/types.md#signature)\>

Sign an JSON object for off-chain usage with the starknet private key and return the signature
This adds a message prefix so it cant be interchanged with transactions
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down Expand Up @@ -606,8 +606,8 @@ the signature of the JSON object

**hashMessage**(`typedData`): `Promise`<`string`\>

Hash a JSON object with pederson hash and return the hash
This adds a message prefix so it cant be interchanged with transactions
Hash a JSON object with Pedersen hash and return the hash
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down Expand Up @@ -1307,7 +1307,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ a confirmation of sending a transaction on the starknet contract
`Abstract` **signMessage**(`typedData`): `Promise`<[`Signature`](../namespaces/types.md#signature)\>

Sign an JSON object for off-chain usage with the starknet private key and return the signature
This adds a message prefix so it cant be interchanged with transactions
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down Expand Up @@ -391,8 +391,8 @@ the signature of the JSON object

`Abstract` **hashMessage**(`typedData`): `Promise`<`string`\>

Hash a JSON object with pederson hash and return the hash
This adds a message prefix so it cant be interchanged with transactions
Hash a JSON object with Pedersen hash and return the hash
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down Expand Up @@ -898,7 +898,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
2 changes: 1 addition & 1 deletion www/versioned_docs/version-5.14.1/API/classes/Provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ Invokes a function on starknet

**`Deprecated`**

This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

#### Parameters

Expand Down
2 changes: 1 addition & 1 deletion www/versioned_docs/version-5.14.1/API/classes/Signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public key of signer as hex string with 0x prefix
**signMessage**(`typedData`, `accountAddress`): `Promise`<[`Signature`](../namespaces/types.md#signature)\>

Sign an JSON object for off-chain usage with the starknet private key and return the signature
This adds a message prefix so it cant be interchanged with transactions
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public key of signer as hex string with 0x prefix
`Abstract` **signMessage**(`typedData`, `accountAddress`): `Promise`<[`Signature`](../namespaces/types.md#signature)\>

Sign an JSON object for off-chain usage with the starknet private key and return the signature
This adds a message prefix so it cant be interchanged with transactions
This adds a message prefix so it can't be interchanged with transactions

**`Throws`**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ The _transactionsDetail_ object may include any of:

account.**signMessage**(typedData) => _Promise < Signature >_

Sign an JSON object for off-chain usage with the starknet private key and return the signature. This adds a message prefix so it cant be interchanged with transactions.
Sign an JSON object for off-chain usage with the starknet private key and return the signature. This adds a message prefix so it can't be interchanged with transactions.

_typedData_ - JSON object to be signed

Expand All @@ -476,7 +476,7 @@ string[];

account.**hashMessage**(typedData) => _Promise < string >_

Hash a JSON object with pederson hash and return the hash. This adds a message prefix so it cant be interchanged with transactions.
Hash a JSON object with Pedersen hash and return the hash. This adds a message prefix so it can't be interchanged with transactions.

_typedData_ - JSON object to be signed

Expand Down
2 changes: 1 addition & 1 deletion www/versioned_docs/version-5.14.1/guides/create_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const argentXaccountClassHash = "0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d
// Generate public and private key pair.
const privateKeyAX = stark.randomAddress();
console.log('AX_ACCOUNT_PRIVATE_KEY=', privateKeyAX);
const starkKeyPubAX = ec.starkCurve.getStarkKey(privateKey);
const starkKeyPubAX = ec.starkCurve.getStarkKey(privateKeyAX);
console.log('AX_ACCOUNT_PUBLIC_KEY=', starkKeyPubAX);

// Calculate future address of the ArgentX account
Expand Down
2 changes: 1 addition & 1 deletion www/versioned_docs/version-5.14.1/guides/estimate_fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To estimate the cost to deploy an account in the network:

```typescript
const { suggestedMaxFee: estimatedFee1 } = await account0.estimateAccountDeployFee({
classHash: OZaccountClashHass,
classHash: OZaccountClassHash,
constructorCalldata: OZaccountConstructorCallData,
contractAddress: OZcontractAddress
});
Expand Down
Loading

0 comments on commit 418bc11

Please sign in to comment.