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

feat!: enabling v1 encoding for everything #2050

Merged
merged 139 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 132 commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
5ad7472
Upgrading `forc` to `0.51.1`
arboleya Mar 28, 2024
c7a87ef
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
arboleya Mar 28, 2024
8c84082
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
petertonysmith94 Mar 29, 2024
08241a9
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
arboleya Apr 4, 2024
d622856
Upgrading `forc` to `0.52.1`
arboleya Apr 5, 2024
cca95fe
Updating `prt()` accessor for `Vec`s
arboleya Apr 5, 2024
93e2d91
Applying new format for `AssetId`
arboleya Apr 5, 2024
ac1684f
Removing obsolete `forc` exceptions
arboleya Apr 5, 2024
eeffb2e
Adding [empty] changeset
arboleya Apr 5, 2024
2e60a57
Removing obsolete CI steps
arboleya Apr 5, 2024
42713ef
Temporarily disabling workflow step
arboleya Apr 5, 2024
de5abaf
Deleting obsolete changeset
arboleya Apr 5, 2024
abf4cd4
Adjusting changeset
arboleya Apr 5, 2024
e0bd6a6
Marking PR as a breaking change
arboleya Apr 5, 2024
65d7fff
Lintfix
arboleya Apr 7, 2024
8c3d18b
Re-enabling workflow step
arboleya Apr 7, 2024
cb78ab3
Increasing verbosity for debugging purposes
arboleya Apr 7, 2024
856b2f5
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 7, 2024
56215b3
Debugging forc build
arboleya Apr 7, 2024
3c3dd80
More debugging
arboleya Apr 7, 2024
40826df
Fixing directory path
arboleya Apr 7, 2024
9ba6300
More paths adjustments
arboleya Apr 7, 2024
5be60b4
Polishing test assertions
arboleya Apr 8, 2024
1b97fc9
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 10, 2024
5097ac7
Enabling PR auto-release
arboleya Apr 10, 2024
5b768e9
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 11, 2024
47c511e
Temporarily commenting failing tests
arboleya Apr 11, 2024
1fa4e24
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 11, 2024
001229d
Upgrading `forc` to `0.53.0`
arboleya Apr 11, 2024
574e682
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 11, 2024
e26dc07
Adjusting changeset
arboleya Apr 11, 2024
c0d13cd
Rolling back debugging workflow steps
arboleya Apr 11, 2024
73d6a2a
Fixing broken tests (applying breaking changes)
arboleya Apr 11, 2024
7080ea5
Adjusting changeset
arboleya Apr 11, 2024
ac13cef
Grouping all skipped tests into a single `describe` block
arboleya Apr 11, 2024
d53c837
Fixing test; updating vector pointer assertion
arboleya Apr 11, 2024
82a656c
Skipping grouped tests
arboleya Apr 11, 2024
2d66ae6
Disabling PR auto-release
arboleya Apr 11, 2024
f67d868
chore: use experimental build for all workspaces
danielbate Apr 12, 2024
d8f4141
chore: use correct casing for exhaustive example
danielbate Apr 12, 2024
b31ee6f
fix: use new vec capacity
danielbate Apr 12, 2024
29897ee
chore: use raw ptr patch branch
danielbate Apr 12, 2024
b0a9377
feat: fix for vec capacity and remove pointer encoding
danielbate Apr 12, 2024
f55e5e9
feat: correctly set script return type for coding
danielbate Apr 12, 2024
7b5c9cf
chore: remove experimental from ABI coder
danielbate Apr 12, 2024
26fccf1
feat: add multicall test to experimental contract
danielbate Apr 12, 2024
2a4fa0a
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Apr 15, 2024
9213c9c
chore: forc format
danielbate Apr 15, 2024
b180bde
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
petertonysmith94 Apr 15, 2024
db8a1f5
fix: multicall issue in contract call script
danielbate Apr 16, 2024
6abc885
docs: remove redundant revert error docs
danielbate Apr 16, 2024
035102f
feat: update typegen templates
danielbate Apr 16, 2024
69fd3b2
test: update tx id for new encoding
danielbate Apr 16, 2024
68946e8
feat: enable vector tests
danielbate Apr 16, 2024
8ee87ba
Merge branch 'master' of http://github.com/FuelLabs/fuels-ts into db/…
danielbate Apr 16, 2024
654c1e3
test: adjust call params gas limits
danielbate Apr 16, 2024
b9c1621
chore: use call in std string lib tests
danielbate Apr 16, 2024
3a97943
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 16, 2024
9eadc6a
Re-generating changeset
arboleya Apr 16, 2024
2a7ceda
Merge branch 'aa/chore/upgrading-forc-0.53.0' of https://github.com/F…
danielbate Apr 16, 2024
9af7ade
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
petertonysmith94 Apr 17, 2024
3547b16
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
danielbate Apr 17, 2024
2bce803
chore: linting
danielbate Apr 17, 2024
19913b7
Merge branch 'db/chore/experimental-forc-in-all-projects' of https://…
danielbate Apr 17, 2024
5bda0c4
feat: use correct number type in script demo test
danielbate Apr 17, 2024
faf02f5
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into aa…
danielbate Apr 18, 2024
bb691e3
docs: pinned version of fuels for `beta-5` docs
petertonysmith94 Apr 18, 2024
d19a3de
chore: added changeset
petertonysmith94 Apr 18, 2024
0ff8743
chore: added fuelsVersion to create-fuels
petertonysmith94 Apr 18, 2024
7b58acc
chore: pinned back the create-fuels version to 0.81.0
petertonysmith94 Apr 18, 2024
4a4f3e6
fix spelling
petertonysmith94 Apr 18, 2024
35f52c8
chore: lint
petertonysmith94 Apr 18, 2024
99b93b1
chore: lint :'(
petertonysmith94 Apr 18, 2024
4de6c39
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 19, 2024
519ccd6
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Apr 19, 2024
20a4875
test: skip failing tests to do with gas, arithemtic overflow and abi …
danielbate Apr 19, 2024
7508d6d
Fix spelling
petertonysmith94 Apr 19, 2024
b8d0722
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into aa…
danielbate Apr 19, 2024
3c3e47a
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
petertonysmith94 Apr 19, 2024
31f710e
chore: upgrade reentrant test to `forc@0.53.0` (#2121)
danielbate Apr 19, 2024
2261ae1
Merge branch 'aa/chore/upgrading-forc-0.53.0' of https://github.com/F…
danielbate Apr 19, 2024
9a94804
chore: update reentrant call test to check for return data reciept
danielbate Apr 19, 2024
11fb617
feat: correctly set heap registers and return data for v1 heaps
danielbate Apr 19, 2024
6eaa17e
Revert "test: skip failing tests to do with gas, arithemtic overflow …
danielbate Apr 19, 2024
b9d876a
chore: skip interface test
danielbate Apr 19, 2024
654d8d5
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Apr 22, 2024
e507916
Upgrading `forc` to `0.55.0`
arboleya Apr 22, 2024
b457a67
Fixing broken tests
arboleya Apr 22, 2024
058601e
feat: enable option vecs and vecs in multicall
danielbate Apr 22, 2024
c147979
test: enable last multicall heap test
danielbate Apr 22, 2024
3304171
chore: linting
danielbate Apr 22, 2024
4cef4d7
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Apr 22, 2024
6438abb
Adjusting changeset
arboleya Apr 22, 2024
5186989
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 22, 2024
9e14db5
Lintfix
arboleya Apr 22, 2024
862f8d4
Merge branch 'aa/chore/upgrading-forc-0.53.0' of https://github.com/F…
danielbate Apr 23, 2024
90c0aeb
chore: change std string doc test to use simulate
danielbate Apr 23, 2024
31c7f5d
chore: use correct return type in e2e test
danielbate Apr 23, 2024
aefd045
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 23, 2024
91b8bb8
Removing useless changeset
arboleya Apr 23, 2024
442534e
chore: remove sway patch branch
danielbate Apr 23, 2024
74e7b72
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
danielbate Apr 23, 2024
bdbd7e6
chore: use experimental encoding for abi coder
danielbate Apr 23, 2024
325c125
Merge branch 'aa/chore/upgrading-forc-0.53.0' of https://github.com/F…
danielbate Apr 23, 2024
348dff9
Merge branch 'db/chore/experimental-forc-in-all-projects' of https://…
danielbate Apr 23, 2024
3dbabdf
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Apr 23, 2024
b6cc48b
Added fuelsInstallVersion
petertonysmith94 Apr 23, 2024
9810efa
Finalised fuels install version
petertonysmith94 Apr 23, 2024
80eeb74
Reverted changes to fuels template version
petertonysmith94 Apr 23, 2024
ba55261
Removed @ prefix from note about version
petertonysmith94 Apr 23, 2024
f091610
Added verbose note
petertonysmith94 Apr 23, 2024
3c6286e
Altered version to accept patches
petertonysmith94 Apr 23, 2024
a2152e4
Updated install version 0.82.0
petertonysmith94 Apr 23, 2024
a6c1510
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
petertonysmith94 Apr 23, 2024
d337203
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
Dhaiwat10 Apr 24, 2024
1d5fc2b
test: used named constant for tx id tx request test
danielbate Apr 24, 2024
c87509b
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Apr 24, 2024
bbbca19
Merge branch 'aa/chore/upgrading-forc-0.53.0' of https://github.com/F…
danielbate Apr 24, 2024
c52b728
chore: changeset
danielbate Apr 24, 2024
34b4f48
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 24, 2024
64b5133
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
Torres-ssf Apr 24, 2024
710f154
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
Torres-ssf Apr 24, 2024
d529874
Rolling back verbosity increase
arboleya Apr 24, 2024
c13e148
Tyop
arboleya Apr 24, 2024
f627c3a
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 24, 2024
a9bc90b
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
danielbate Apr 24, 2024
adeccb4
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
danielbate Apr 24, 2024
a5b1407
Removed `fuelsInstallVersion`
petertonysmith94 Apr 25, 2024
6896e59
Update apps/docs/src/guide/fuels-cli/commands.md
petertonysmith94 Apr 25, 2024
c57b6c9
Update apps/docs/src/guide/fuels-cli/commands.md
petertonysmith94 Apr 25, 2024
bad37a1
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
arboleya Apr 25, 2024
9592ca2
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
arboleya Apr 25, 2024
bdebab4
chore: fix changeset
danielbate Apr 25, 2024
be3accd
Using hardcoded snippet temporarily
arboleya Apr 25, 2024
b6b0a87
Removing region notations from hardcoded snippet
arboleya Apr 25, 2024
9c08722
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
Torres-ssf Apr 25, 2024
d00b56d
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 25, 2024
e726f09
Merge branch 'aa/chore/upgrading-forc-0.53.0' into db/chore/experimen…
danielbate Apr 25, 2024
8f8bf60
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Apr 25, 2024
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
9 changes: 9 additions & 0 deletions .changeset/calm-mails-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fuel-ts/abi-typegen": minor
"@fuel-ts/abi-coder": minor
"@fuel-ts/program": minor
"@fuel-ts/script": minor
"@fuel-ts/utils": minor
---

feat!: enabling v1 encoding for everything
9 changes: 9 additions & 0 deletions .changeset/ninety-hotels-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fuel-ts/abi-typegen": patch
"@fuel-ts/interfaces": patch
"@fuel-ts/versions": patch
"@fuel-ts/address": patch
"@fuel-ts/forc": patch
---

chore!: upgrading `forc` to `0.55.0`
2 changes: 2 additions & 0 deletions .changeset/sixty-actors-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
18 changes: 0 additions & 18 deletions .github/actions/test-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,3 @@ runs:
- name: Build
run: pnpm build
shell: bash

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"

- name: Install forc for experimental builds
shell: bash
run: |
curl https://install.fuel.network > install-fuelup.sh
chmod +x install-fuelup.sh
./install-fuelup.sh --no-modify-path --skip-toolchain-installation
export PATH="${HOME}/.fuelup/bin:${PATH}"
fuelup toolchain new forc-experimental
fuelup component add forc@$(cat ./packages/forc/VERSION_EXPERIMENTAL)
6 changes: 3 additions & 3 deletions apps/demo-typegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"scripts": {
"pretest": "run-s build:forc build:types",
"build:forc": "run-p forc:*",
"forc:contract": "pnpm fuels-forc build -p contract --release",
"forc:script": "pnpm fuels-forc build -p script --release",
"forc:predicate": "pnpm fuels-forc build -p predicate --release",
"forc:contract": "pnpm fuels-forc build -p contract --release --experimental-new-encoding",
"forc:script": "pnpm fuels-forc build -p script --release --experimental-new-encoding",
"forc:predicate": "pnpm fuels-forc build -p predicate --release --experimental-new-encoding",
"build:types": "run-p types:*",
"types:contract": "pnpm fuels typegen -i contract/out/release/demo-contract-abi.json -o src/contract-types",
"types:script": "pnpm fuels typegen -i script/out/release/script-abi.json -o src/script-types --script",
Expand Down
3 changes: 1 addition & 2 deletions apps/demo-typegen/src/demo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ test('Example script', async () => {
const script = ScriptAbi__factory.createInstance(wallet);
const { value } = await script.functions.main().call();
// #endregion typegen-demo-script
// @ts-expect-error TODO: investitage - typegen is expecting value to be a number but the value being returned is the string '0xa'
expect(value.toNumber()).toBe(10);
expect(value).toBe(10);
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
});

test('Example predicate', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"pretest": "pnpm build:forc",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release"
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release --experimental-new-encoding"
},
"devDependencies": {
"@fuel-ts/account": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ describe(__filename, () => {
// #region call-params-3
const { minGasPrice } = provider.getGasConfig();
const amountToForward = 10;
const contractCallGasLimit = 100;
const transactionGasLimit = 3_000_000;
const contractCallGasLimit = 1000;
const transactionGasLimit = 100_000;

const result = await contract.functions
.return_context_amount()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe(__filename, () => {
});

const asset: AssetId = {
value: BaseAssetId,
bits: BaseAssetId,
};

await contract.functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe(__filename, () => {

await contract.functions.mint_coins(subId, 100).call();

const address = { value: Wallet.generate().address.toB256() };
const assetId = { value: getMintedAssetId(contract.id.toB256(), subId) };
const address = { bits: Wallet.generate().address.toB256() };
const assetId = { bits: getMintedAssetId(contract.id.toB256(), subId) };

// #region variable-outputs-2
const { transactionResult } = await contract.functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe(__filename, () => {
const assetId = getMintedAssetId(contractId, subId);

await liquidityPoolContract.functions
.deposit({ value: liquidityOwner.address.toB256() })
.deposit({ bits: liquidityOwner.address.toB256() })
.callParams({ forward: [depositAmount, BaseAssetId] })
.txParams({ variableOutputs: 1 })
.call();
Expand All @@ -51,7 +51,7 @@ describe(__filename, () => {

// #region deposit-and-withdraw-cookbook-3
await liquidityPoolContract.functions
.withdraw({ value: liquidityOwner.address.toB256() })
.withdraw({ bits: liquidityOwner.address.toB256() })
.callParams({ forward: [depositAmount, BaseAssetId] })
.txParams({ variableOutputs: 1 })
.call();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Signing transactions', () => {
.call<BN>();
// #endregion multiple-signers-2

expect(value.toNumber()).toEqual(1);
expect(value).toBe(true);
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
expect((await receiver.getBalance()).toNumber()).toEqual(amountToReceiver);
});

Expand Down
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ describe(__filename, () => {
// 2. Instantiate the script main arguments
const scriptArguments = [
contract.id.toB256(),
{ value: ASSET_A },
{ bits: ASSET_A },
new BN(1000),
{ value: ASSET_B },
{ bits: ASSET_B },
new BN(500),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,24 @@ describe('Transaction Request', () => {
expect(transactionRequest.witnesses.length).toEqual(2);
});

it('gets the transaction ID', async () => {
it('gets the transaction ID', () => {
// #region transaction-request-7
// #import { ScriptTransactionRequest };

// Instantiate the transaction request
const transactionRequest = new ScriptTransactionRequest({ script: scriptBytecode });

// Get the chain ID
const chainId = await provider.getChainId();
const chainId = provider.getChainId();

// Get the transaction ID using the Chain ID
const transactionId = transactionRequest.getTransactionId(chainId);
// TX ID: 0x55667d...
// TX ID: 0x420f6...
// #endregion transaction-request-7

expect(transactionId).toBe(
'0x35cd6a10e917d5d0223413c1fb9863d27da40e5d602a7f37cfbcefb570172f6c'
);
const expectedTransactionId =
'0x420f6093f32975eec3bd505e1a124be5e7352146841017b6142b34923e563f4b';

expect(transactionId).toBe(expectedTransactionId);
});
});
10 changes: 5 additions & 5 deletions apps/docs-snippets/src/guide/types/asset-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};
// #endregion asset-id-1

expect(assetId.value).toBe(Bits256);
expect(assetId.bits).toBe(Bits256);
});

it('should create an AssetId from a B256Address', async () => {
Expand All @@ -48,7 +48,7 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_asset_id_comparison(assetId).simulate();
Expand All @@ -62,14 +62,14 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_asset_id().simulate();

expect(value).toEqual(assetId);
// #endregion asset-id-4

expect(value.value).toEqual(Bits256);
expect(value.bits).toEqual(Bits256);
});
});
20 changes: 10 additions & 10 deletions apps/docs-snippets/src/guide/types/contract-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ describe(__filename, () => {
// #region address-input
// #import { Address };
const address = Address.fromRandom();
const addressInput = { value: address.toB256() };
const addressInput = { bits: address.toB256() };
// #endregion address-input
const callResponse = await contract.functions.address(addressInput).simulate();

// #region address-output
// #import { Address };
const addressOutput = callResponse.value;
const addressFromOutput: Address = Address.fromB256(addressOutput.value);
const addressFromOutput: Address = Address.fromB256(addressOutput.bits);
// #endregion address-output
expect(addressFromOutput).toEqual(address);
});

it('should successfully call a function with a ContractId type input and output parameters', async () => {
// #region contract-id-input
const contractId = '0x7296ff960b5eb86b5f79aa587d7ebe1bae147c7cac046a16d062fbd7f3a753ec';
const contractIdInput = { value: contractId.toString() };
const contractIdInput = { bits: contractId.toString() };
// #endregion contract-id-input
const callResponse = await contract.functions.contract_id(contractIdInput).simulate();

// #region contract-id-output
const contractIdOutput = callResponse.value;
const contractIdFromOutput: string = contractIdOutput.value;
const contractIdFromOutput: string = contractIdOutput.bits;
// #endregion contract-id-output

expect(contractIdFromOutput).toEqual(contractId);
Expand All @@ -49,28 +49,28 @@ describe(__filename, () => {
// #region identity-address-input
// #import { Address };
const address = Address.fromRandom();
const addressInput = { value: address.toB256() };
const addressInput = { bits: address.toB256() };
const addressIdentityInput = { Address: addressInput };
// #endregion identity-address-input
const callResponse1 = await contract.functions.identity(addressIdentityInput).simulate();

// #region identity-address-output
// #import { Address };
const identityFromOutput1 = callResponse1.value;
const addressStringFromOutput = identityFromOutput1.Address.value;
const addressStringFromOutput = identityFromOutput1.Address.bits;
const addressFromOutput: Address = Address.fromB256(addressStringFromOutput);
// #endregion identity-address-output

// #region identity-contract-input
const contractId = '0x7296ff960b5eb86b5f79aa587d7ebe1bae147c7cac046a16d062fbd7f3a753ec';
const contractIdInput = { value: contractId.toString() };
const contractIdInput = { bits: contractId.toString() };
const contractIdentityInput = { ContractId: contractIdInput };
// #endregion identity-contract-input
const callResponse2 = await contract.functions.identity(contractIdentityInput).simulate();

// #region identity-contract-output
const identityFromOutput2 = callResponse2.value;
const contractIdFromOutput: string = identityFromOutput2.ContractId.value;
const contractIdFromOutput: string = identityFromOutput2.ContractId.bits;
// #endregion identity-contract-output

expect(addressFromOutput).toEqual(address);
Expand All @@ -80,13 +80,13 @@ describe(__filename, () => {
it('should successfully call a function with an AssetId type input and output parameters', async () => {
// #region asset-id-input
const assetId = '0x0cfabde7bbe58d253cf3103d8f55d26987b3dc4691205b9299ac6826c613a2e2';
const assetIdInput = { value: assetId };
const assetIdInput = { bits: assetId };
// #endregion asset-id-input
const callResponse = await contract.functions.asset_id(assetIdInput).simulate();

// #region asset-id-output
const assetIdOutput = callResponse.value;
const assetIdFromOutput: string = assetIdOutput.value;
const assetIdFromOutput: string = assetIdOutput.bits;
// #endregion asset-id-output

expect(assetIdFromOutput).toEqual(assetId);
Expand Down
16 changes: 7 additions & 9 deletions apps/docs-snippets/src/guide/types/evm-address.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};
// #endregion evm-address-1

// #region addresses-3
// #import { EvmAddress };

const address: EvmAddress = {
value: '0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6',
bits: '0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6',
};
// #endregion addresses-3

expect(evmAddress.value).toBe(Bits256);
expect(address.value).toBe(
'0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6'
);
expect(evmAddress.bits).toBe(Bits256);
expect(address.bits).toBe('0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6');
});

it('should create an Evm Address from a B256Address', async () => {
Expand All @@ -60,7 +58,7 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_address_comparison(evmAddress).simulate();
Expand All @@ -74,14 +72,14 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_address().simulate();

expect(value).toEqual(evmAddress);
// #endregion evm-address-4

expect(value.value).toEqual(Bits256);
expect(value.bits).toEqual(Bits256);
});
});
Loading
Loading