Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: docs snippets utility functions #1011

Merged
merged 50 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0cd936f
feat: create evm address interface
May 10, 2023
78ee89a
feat: create evm address clas
May 10, 2023
ea28ccf
feat: unit tests for evm address wrapper class
May 10, 2023
3d1f8d7
chore: linting
May 10, 2023
c334661
chore: linting
May 10, 2023
19c98a0
feat: support from public key in evm address
May 11, 2023
7c89e41
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
May 19, 2023
0126ad1
feat: remove evm address class and unit tests
May 19, 2023
ed1e49a
feat: create types for B256 Evm and Evm address
May 19, 2023
54cf47c
feat: create address utility function to convert a b256 to an evm b256
May 19, 2023
4898bcd
feat: add address function to return as evm addres
May 19, 2023
0a4ae8f
feat: add unit tests for address to evm address and utility function
May 19, 2023
48ace55
feat: create snippets util function generate test wallet and deploy a…
May 19, 2023
46b579a
test: create docs snippets tests for evm address
May 19, 2023
8d0fc2e
chore: remove redundant gitignore from evm address doc snippet contract
May 19, 2023
3694a16
test: rename evm address docs snippet test
May 19, 2023
252def3
docs: create documentation for evm address
May 22, 2023
888a327
docs: modify docs snippets for evm address
May 22, 2023
b4c084a
docs: add evm address to docs config
May 22, 2023
c306beb
test: alter evm address test asserttions
May 22, 2023
6d3a44a
docs: update evm address title capitalisation
May 22, 2023
cb11146
feat: add evm address type to typegen
May 22, 2023
4e5241b
test: add unit test for evm address type with forc project
May 22, 2023
e81ce63
test: add evm address to full typegen test suit
May 22, 2023
c6b1a34
feat: add ignore evm struct to struct typegen
May 22, 2023
b26ac5f
feat: add evm address type to supported types in typegen
May 22, 2023
7294d62
chore: changeset
May 22, 2023
8d54ca7
feat: add forc projects to workspace
May 22, 2023
560d1a0
Merge branch 'master' into db/feat/support-evm-address
danielbate May 22, 2023
ff57b37
test: add address import to dts test
May 22, 2023
3274b66
refactor: rename helixfied to hexlified
May 22, 2023
b8dda00
refactor: use deploy contract test util in types docs snippets test
May 23, 2023
ae7e70b
chore: changeset
May 23, 2023
3450708
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
May 29, 2023
12edef7
chore: delete redundant gitignore
May 29, 2023
15632f9
feat: remove address from evm dts
May 29, 2023
e17dbe6
refactor: clean up remain helix references
May 29, 2023
f31c0f4
refactor: fix hexlified casing
May 29, 2023
7b25edf
chore: force rebuild
May 29, 2023
048ea5d
chore: force rebuild
May 29, 2023
8dfa755
Merge branch 'master' into db/refactor/docs-snippets-utility-functions
danielbate May 30, 2023
091f69c
Merge branch 'master' into db/refactor/docs-snippets-utility-functions
danielbate May 31, 2023
77213b1
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
May 31, 2023
a5a0d0e
Merge branch 'master' into db/refactor/docs-snippets-utility-functions
danielbate Jun 1, 2023
8f8054d
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
Jun 1, 2023
57f016d
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
Jun 2, 2023
a0a29e1
test: implement deploy project test across more docs tests
Jun 2, 2023
01d0fac
Merge branch 'db/refactor/docs-snippets-utility-functions' of https:/…
Jun 2, 2023
2cdb80d
Merge branch 'master' into db/refactor/docs-snippets-utility-functions
arboleya Jul 23, 2023
2bc5ab2
chore: adjusting residual tyops after merging with master
arboleya Jul 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/tame-cats-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.RETURN_CONTEXT
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.RETURN_CONTEXT
);

const contractFactory = new ContractFactory(binHelixfied, abiContents, wallet);
const contractFactory = new ContractFactory(binHexlified, abiContents, wallet);

deployedContract = await contractFactory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getTestWallet } from '../../utils';
describe(__filename, () => {
let wallet: WalletUnlocked;

const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts(
const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_CONFIGURABLES
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.TRANSFER_TO_ADDRESS
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.RETURN_CONTEXT
);

const contractFactory = new ContractFactory(binHelixfied, abiContents, wallet);
const contractFactory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await contractFactory.deployContract();
});
Expand Down
4 changes: 2 additions & 2 deletions apps/docs-snippets/src/guide/contracts/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ describe(__filename, () => {
const depositorArtifacts = getSnippetProjectArtifacts(SnippetProjectEnum.TOKEN_DEPOSITOR);

simpleToken = await new ContractFactory(
tokenArtifacts.binHelixfied,
tokenArtifacts.binHexlified,
tokenArtifacts.abiContents,
wallet
).deployContract();

tokenDepositor = await new ContractFactory(
depositorArtifacts.binHelixfied,
depositorArtifacts.binHexlified,
depositorArtifacts.abiContents,
wallet
).deployContract();
Expand Down
4 changes: 2 additions & 2 deletions apps/docs-snippets/src/guide/contracts/logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.LOG_VALUES);
const { abiContents, binHexlified } = getSnippetProjectArtifacts(SnippetProjectEnum.LOG_VALUES);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(__filename, () => {
let contract: Contract;
let contractId: AbstractAddress;
let wallet: WalletUnlocked;
const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts(
const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

Expand Down
6 changes: 3 additions & 3 deletions apps/docs-snippets/src/guide/contracts/multicalls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ describe(__filename, () => {
const contextArtifacts = getSnippetProjectArtifacts(SnippetProjectEnum.RETURN_CONTEXT);

const factory1 = new ContractFactory(
echoArtifacts.binHelixfied,
echoArtifacts.binHexlified,
echoArtifacts.abiContents,
wallet
);
const factory2 = new ContractFactory(
counterArtifacts.binHelixfied,
counterArtifacts.binHexlified,
counterArtifacts.abiContents,
wallet
);
const factory3 = new ContractFactory(
contextArtifacts.binHelixfied,
contextArtifacts.binHexlified,
contextArtifacts.abiContents,
wallet
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
const { abiContents, binHexlified } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe(__filename, () => {
beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.COUNTER);
const { abiContents, binHexlified } = getSnippetProjectArtifacts(SnippetProjectEnum.COUNTER);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);
const factory = new ContractFactory(binHexlified, abiContents, wallet);

contract = await factory.deployContract();
});
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-snippets/src/guide/predicates/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FUEL_NETWORK_URL, Provider, Predicate } from 'fuels';
import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects';

describe(__filename, () => {
const { abiContents: jsonAbi, binHelixfied: binary } = getSnippetProjectArtifacts(
const { abiContents: jsonAbi, binHexlified: binary } = getSnippetProjectArtifacts(
SnippetProjectEnum.RETURN_TRUE_PREDICATE
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getTestWallet } from '../../utils';
describe(__filename, () => {
let wallet: WalletUnlocked;

const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts(
const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts(
SnippetProjectEnum.WHITELISTED_ADDRESS_PREDICATE
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getTestWallet } from '../../utils';
describe(__filename, () => {
let walletWithFunds: WalletUnlocked;

const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts(
const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts(
SnippetProjectEnum.SIMPLE_PREDICATE
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { getTestWallet } from '../../utils';
describe(__filename, () => {
let wallet: WalletUnlocked;

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.SUM_SCRIPT);
const { abiContents, binHexlified } = getSnippetProjectArtifacts(SnippetProjectEnum.SUM_SCRIPT);

beforeAll(async () => {
wallet = await getTestWallet();
});

it('should successfully sum setted configurable constant with inpputed value', async () => {
// #region script-with-configurable-contants-2
const script = new Script(binHelixfied, abiContents, wallet);
const script = new Script(binHexlified, abiContents, wallet);

const configurableConstants = {
AMOUNT: 81,
Expand Down
16 changes: 4 additions & 12 deletions apps/docs-snippets/src/guide/types/arrays.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import type { Contract } from 'fuels';
import { BN, ContractFactory } from 'fuels';
import { BN } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_U64_ARRAY
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_U64_ARRAY);
});

it('should successfully demonstrate typed arrays examples', () => {
Expand Down
16 changes: 4 additions & 12 deletions apps/docs-snippets/src/guide/types/bits512.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import type { Contract } from 'fuels';
import { ContractFactory, Wallet } from 'fuels';
import { Wallet } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES);
});

it('should successfully call contract function and validate b512', async () => {
Expand Down
17 changes: 4 additions & 13 deletions apps/docs-snippets/src/guide/types/enums.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import type { Contract } from 'fuels';
import { ContractFactory } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_ENUM
);

const factory = new ContractFactory(bin, abi, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_ENUM);
});

it('should successfully echo a simple enum in a contract call', async () => {
Expand Down
15 changes: 3 additions & 12 deletions apps/docs-snippets/src/guide/types/options.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import type { Contract } from 'fuels';
import { ContractFactory } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
SnippetProjectEnum.SUM_OPTION_U8
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.SUM_OPTION_U8);
});

it('should successfully execute contract call to sum 2 option inputs (2 INPUTS)', async () => {
Expand Down
15 changes: 3 additions & 12 deletions apps/docs-snippets/src/guide/types/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import type { Contract } from 'fuels';
import { ContractFactory } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES);
});

it('should validate string', () => {
Expand Down
16 changes: 4 additions & 12 deletions apps/docs-snippets/src/guide/types/tuples.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import type { Contract } from 'fuels';
import { BN, ContractFactory } from 'fuels';
import { BN } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
SnippetProjectEnum.ECHO_VALUES
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES);
});

it('should successfully echo tuple in a contract call', async () => {
Expand Down
14 changes: 4 additions & 10 deletions apps/docs-snippets/src/guide/types/vector.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import type { Contract } from 'fuels';
import { BN, getRandomB256, ContractFactory } from 'fuels';
import { BN, getRandomB256 } from 'fuels';

import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects';
import { getTestWallet } from '../../utils';
import { SnippetProjectEnum } from '../../../projects';
import { createAndDeployContractFromProject } from '../../utils';

describe(__filename, () => {
let contract: Contract;

beforeAll(async () => {
const wallet = await getTestWallet();

const { abiContents, binHelixfied } = getSnippetProjectArtifacts(
contract = await createAndDeployContractFromProject(
SnippetProjectEnum.ECHO_EMPLOYEE_DATA_VECTOR
);

const factory = new ContractFactory(binHelixfied, abiContents, wallet);

contract = await factory.deployContract();
});

it('should successfully execute and validate contract call', async () => {
Expand Down
Loading