Skip to content

Commit

Permalink
chore: fixing code typos (#3701)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf authored Feb 12, 2025
1 parent 75d7f39 commit 7b79da3
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .changeset/dull-feet-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: fixing code typos
20 changes: 10 additions & 10 deletions packages/account/src/mnemonic/mnemonic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,36 @@ describe('Mnemonic', () => {
});

test('Validate a 12 complete Mnemonic phrase', () => {
const mnemonicphrase =
const mnemonicPhrase =
'aware fringe excess tank asset quick suffer second cloth deliver file above';
const validation = Mnemonic.isMnemonicValid(mnemonicphrase);
const validation = Mnemonic.isMnemonicValid(mnemonicPhrase);
expect(validation).toEqual(true);
});
test('Validate a 15 complete Mnemonic phrase', () => {
const mnemonicphrase =
const mnemonicPhrase =
'lucky buzz drink topic lunar proud warfare pass silver police chef liberty soap about process';
const validation = Mnemonic.isMnemonicValid(mnemonicphrase);
const validation = Mnemonic.isMnemonicValid(mnemonicPhrase);
expect(validation).toEqual(true);
});

test('Validate a 18 complete Mnemonic phrase', () => {
const mnemonicphrase =
const mnemonicPhrase =
'aware fringe excess tank asset quick suffer second cloth deliver file above';
const validation = Mnemonic.isMnemonicValid(mnemonicphrase);
const validation = Mnemonic.isMnemonicValid(mnemonicPhrase);
expect(validation).toEqual(true);
});

test('Validate a 21 complete Mnemonic phrase', () => {
const mnemonicphrase =
const mnemonicPhrase =
'movie fold other broccoli deliver bleak rookie record walnut coin decline blossom wheat thing silk group library absorb';
const validation = Mnemonic.isMnemonicValid(mnemonicphrase);
const validation = Mnemonic.isMnemonicValid(mnemonicPhrase);
expect(validation).toEqual(true);
});

test('Validate a 24 complete Mnemonic phrase', () => {
const mnemonicphrase =
const mnemonicPhrase =
'trick modify monster anger volcano thrive jealous lens warm program milk flavor bike torch fish eye aspect cable loan little bachelor town office sound';
const validation = Mnemonic.isMnemonicValid(mnemonicphrase);
const validation = Mnemonic.isMnemonicValid(mnemonicPhrase);
expect(validation).toEqual(true);
});

Expand Down
12 changes: 6 additions & 6 deletions packages/account/src/providers/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ describe('Provider', () => {

/**
* Mocking and initializing Provider with an invalid fetcher just
* to ensure it'll be properly overriden in `connect` method below
* to ensure it'll be properly overridden in `connect` method below
*/
const fetchChainAndNodeInfo = vi
.spyOn(Provider.prototype, 'fetchChainAndNodeInfo')
Expand Down Expand Up @@ -763,7 +763,7 @@ describe('Provider', () => {
code: ErrorCode.SCRIPT_REVERTED,
});

// Ensure user's resouces were unset from the cache
// Ensure user's resources were unset from the cache
[...utxos, ...messages].forEach((key) => {
expect(provider.cache?.isCached(key)).toBeFalsy();
});
Expand Down Expand Up @@ -1343,7 +1343,7 @@ describe('Provider', () => {

const { error } = await safeExec(async () => {
for await (const iterator of await provider.operations.statusChange({
transactionId: 'doesnt matter, will be aborted',
transactionId: "doesn't matter, will be aborted",
})) {
// shouldn't be reached and should fail if reached
expect(iterator).toBeFalsy();
Expand All @@ -1355,7 +1355,7 @@ describe('Provider', () => {
message: 'The operation was aborted due to timeout',
});
});
it('should ensure calculateMaxgas considers gasLimit for ScriptTransactionRequest', async () => {
it('should ensure calculateMaxGas considers gasLimit for ScriptTransactionRequest', async () => {
using launched = await setupTestProviderAndWallets();
const { provider } = launched;
const { gasPerByte, maxGasPerTx } = await provider.getGasConfig();
Expand Down Expand Up @@ -1385,7 +1385,7 @@ describe('Provider', () => {
});
});

it('should ensure calculateMaxgas does NOT considers gasLimit for CreateTransactionRequest', async () => {
it('should ensure calculateMaxGas does NOT considers gasLimit for CreateTransactionRequest', async () => {
using launched = await setupTestProviderAndWallets();
const { provider } = launched;
const { gasPerByte, maxGasPerTx } = await provider.getGasConfig();
Expand Down Expand Up @@ -1897,7 +1897,7 @@ describe('Provider', () => {

await safeExec(async () => {
for await (const iterator of await provider.operations.statusChange({
transactionId: 'doesnt matter, will be aborted',
transactionId: "doesn't matter, will be aborted",
})) {
// Just running a subscription to trigger the middleware
// shouldn't be reached and should fail if reached
Expand Down
4 changes: 2 additions & 2 deletions packages/account/src/providers/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,8 @@ export default class Provider {
if (commitBlockHeight) {
inputObject = {
...inputObject,
// Conver BN into a number string required on the query
// This should problably be fixed on the fuel client side
// Convert BN into a number string required on the query
// This should probably be fixed on the fuel client side
commitBlockHeight: commitBlockHeight.toNumber().toString(),
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/account/src/providers/resource-cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Resource Cache', () => {
);
});

it('can validade if it is cached [UTXO]', () => {
it('can validate if it is cached [UTXO]', () => {
const resourceCache = new ResourceCache(1000);
const utxoId = randomValue();

Expand All @@ -45,7 +45,7 @@ describe('Resource Cache', () => {
expect(resourceCache.isCached(utxoId)).toBeTruthy();
});

it('can validade if it is cached [Message]', () => {
it('can validate if it is cached [Message]', () => {
const resourceCache = new ResourceCache(1000);
const messageNonce = randomValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getDecodedLogs<T = unknown>(
* The "mainAbi" parameter represents the ABI of the main contract used to create the transaction
* or the ABI from a script used within a "BaseInvocationScope" context.
* The "externalAbis" parameter is a record of contract ABIs that are also part of the transaction.
* These ABIs were added using `contract.addContracts` or through a multicall with `contract.multiCall`.
* These ABIs were added using `contract.addContracts` or through a multi-call with `contract.multiCall`.
*
* @param receipts - The array of transaction result receipts.
* @param mainAbi - The ABI of the script or main contract.
Expand Down
8 changes: 4 additions & 4 deletions packages/account/src/providers/utils/extract-tx-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ export const assembleRevertError = (
}

case FAILED_ASSERT_EQ_SIGNAL: {
const sufix =
const suffix =
logs.length >= 2
? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.`
: '.';

reason = 'assert_eq';
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
break;
}

case FAILED_ASSERT_NE_SIGNAL: {
const sufix =
const suffix =
logs.length >= 2
? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.`
: '.';

reason = 'assert_ne';
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
break;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/address/src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class Address {
* Takes a dynamic string or `Address` and creates an `Address`
*
* @param addressId - A string containing B256, or Public Key
* @throws Error - Unknown address if the format is not recognised
* @throws Error - Unknown address if the format is not recognized
* @returns A new `Address` instance
*
* @deprecated Use `new Address` instead
Expand Down
4 changes: 2 additions & 2 deletions packages/fuel-gauge/src/advanced-logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('Advanced Logging', () => {
]);
});

describe('should properly decode all logs in a multicall with inter-contract calls', () => {
describe('should properly decode all logs in a multiCall with inter-contract calls', () => {
const testStruct = {
a: true,
b: 100000,
Expand All @@ -161,7 +161,7 @@ describe('Advanced Logging', () => {
'fuelfuel',
];

it('when using InvacationScope', async () => {
it('when using InvocationScope', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{ factory: AdvancedLoggingFactory },
Expand Down
20 changes: 10 additions & 10 deletions packages/fuel-gauge/src/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('Contract', () => {
expect(value.toHex()).toEqual(toHex(1338));
});

it('adds multiple contracts on multicalls', async () => {
it('adds multiple contracts on multi-calls', async () => {
using launched = await launchTestNode({
contractsConfigs,
});
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('Contract', () => {
expect(failed).toEqual(true);
});

it('adds multiple contracts on multicalls', async () => {
it('adds multiple contracts on multi-calls', async () => {
using launched = await launchTestNode({
contractsConfigs,
});
Expand Down Expand Up @@ -354,7 +354,7 @@ describe('Contract', () => {
);
});

it('can forward gas to multicall calls', async () => {
it('can forward gas to multi-call calls', async () => {
using contract = await setupTestContract();

const { waitForResult } = await contract
Expand Down Expand Up @@ -611,7 +611,7 @@ describe('Contract', () => {
expect(result.status).toBe('success');
});

it('should ensure multicall allows multiple heap types', async () => {
it('should ensure multi-call allows multiple heap types', async () => {
using contract = await setupTestContract();

const vector = [5, 4, 3, 2, 1];
Expand Down Expand Up @@ -891,7 +891,7 @@ describe('Contract', () => {
expect(bn(maxFeePolicy?.data).toNumber()).toBe(maxFee);
});

it('should ensure gas price and gas limit are validated when transfering to contract', async () => {
it('should ensure gas price and gas limit are validated when transferring to contract', async () => {
using launched = await launchTestNode({
contractsConfigs,
});
Expand All @@ -915,7 +915,7 @@ describe('Contract', () => {
}).rejects.toThrowError(/Gas limit '1' is lower than the required: ./);
});

it('should tranfer asset to a deployed contract just fine (NOT NATIVE ASSET)', async () => {
it('should transfer asset to a deployed contract just fine (NOT NATIVE ASSET)', async () => {
const asset = '0x0101010101010101010101010101010101010101010101010101010101010101';

using launched = await launchTestNode({
Expand All @@ -939,7 +939,7 @@ describe('Contract', () => {
expect(finalBalance).toBe(initialBalance + amountToContract);
});

it('should tranfer asset to a deployed contract just fine (FROM PREDICATE)', async () => {
it('should transfer asset to a deployed contract just fine (FROM PREDICATE)', async () => {
using launched = await launchTestNode({
contractsConfigs,
});
Expand Down Expand Up @@ -994,7 +994,7 @@ describe('Contract', () => {
);
});

it('should ensure assets can be transfered to wallets (SINGLE TRANSFER)', async () => {
it('should ensure assets can be transferred to wallets (SINGLE TRANSFER)', async () => {
using contract = await setupTestContract();
const { provider } = contract;

Expand All @@ -1017,7 +1017,7 @@ describe('Contract', () => {
expect(finalBalance.toNumber()).toBe(amountToTransfer);
});

it('should ensure assets can be transfered to wallets (MULTI TRANSFER)', async () => {
it('should ensure assets can be transferred to wallets (MULTI TRANSFER)', async () => {
using launched = await launchTestNode();
const {
provider,
Expand Down Expand Up @@ -1271,7 +1271,7 @@ describe('Contract', () => {
expect(bn(maxFeePolicy?.data).toNumber()).toBe(maxFee);
});

it('should ensure "maxFee" and "gasLimit" can be set on a multicall', async () => {
it('should ensure "maxFee" and "gasLimit" can be set on a multi-call', async () => {
using contract = await setupTestContract();

const gasLimit = 500_000;
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/dry-run-multiple-txs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('dry-run-multiple-txs', () => {
},
});

// request 4 we dry run it 1 time because it has reveted
// request 4 we dry run it 1 time because it has reverted
expect(estimatedRequests[3]).toStrictEqual<EstimateTxDependenciesReturns>({
receipts: expect.any(Array<TransactionResultReceipt>),
missingContractIds: [],
Expand Down
4 changes: 2 additions & 2 deletions packages/fuel-gauge/src/edge-cases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ describe('Edge Cases', () => {

await response.waitForResult();

const subsciption = await provider.operations.statusChange({ transactionId });
const subscription = await provider.operations.statusChange({ transactionId });

// eslint-disable-next-line @typescript-eslint/no-unused-vars
for await (const iterator of subsciption) {
for await (const iterator of subscription) {
// we leave this intentionally empty so that we test that the subscription will end the loop when the connection is closed
}
});
Expand Down
8 changes: 4 additions & 4 deletions packages/fuel-gauge/src/funding-transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ describe('Funding Transactions', () => {
});

// sender has 2 UTXOs for 200_000 each, so it has enough resources to spend 1000 of baseAssetId
const enoughtResources = await sender.getResourcesToSpend([
const enoughResources = await sender.getResourcesToSpend([
[100, await provider.getBaseAssetId()],
]);

// confirm we only fetched 1 UTXO from the expected amount
expect(enoughtResources.length).toBe(1);
expect(enoughtResources[0].amount.toNumber()).toBe(200_000);
expect(enoughResources.length).toBe(1);
expect(enoughResources[0].amount.toNumber()).toBe(200_000);

const request = new ScriptTransactionRequest({
gasLimit: 1_000,
Expand All @@ -134,7 +134,7 @@ describe('Funding Transactions', () => {
const amountToTransfer = 100;

request.addCoinOutput(receiver.address, amountToTransfer, await provider.getBaseAssetId());
request.addResources(enoughtResources);
request.addResources(enoughResources);

const txCost = await sender.getTransactionCost(request);

Expand Down
4 changes: 2 additions & 2 deletions packages/fuel-gauge/src/predicate-conditional-inputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ describe('PredicateConditionalInputs', () => {
const request = new ScriptTransactionRequest();

// fetch predicate resources to spend
const predicateResoruces = await predicate.getResourcesToSpend([[amountToTransfer, ASSET_A]]);
const predicateResources = await predicate.getResourcesToSpend([[amountToTransfer, ASSET_A]]);
const aliceResources = await aliceWallet.getResourcesToSpend([
[1, await provider.getBaseAssetId()],
]);

request
.addResources(aliceResources)
.addResources(predicateResoruces)
.addResources(predicateResources)
.addCoinOutput(aliceWallet.address, amountToTransfer, ASSET_A);

const txCost = await aliceWallet.getTransactionCost(request);
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/token-test-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('TokenTestContract', () => {
expect(tokenBalance?.amount.toHex()).toEqual(toHex(50));
});

it('Automatically add variableOuputs', async () => {
it('Automatically add variableOutputs', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/fuel-gauge/src/transaction-response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ describe('TransactionResponse', () => {
expect(getLatestGasPriceSpy).toHaveBeenCalledTimes(1);
expect(result.id).toBe(tx.id);

const finalisedResult = await tx.waitForResult();
expect(finalisedResult.fee.toNumber()).toBeGreaterThan(0);
const finalizedResult = await tx.waitForResult();
expect(finalizedResult.fee.toNumber()).toBeGreaterThan(0);
expect(getLatestGasPriceSpy).toHaveBeenCalledTimes(1);
expect(finalisedResult.id).toBe(tx.id);
expect(finalizedResult.id).toBe(tx.id);
});

it('builds response and assembles result [from contract call]', async () => {
Expand Down

0 comments on commit 7b79da3

Please sign in to comment.