Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
8f9f28d
feat: intitial support for deploying large contract via blob tx
danielbate Jul 24, 2024
853a442
fix: blob import
danielbate Jul 24, 2024
3173287
feat: remove instanceof checks
danielbate Jul 24, 2024
740745c
feat: blob tx spec and validity fixes
danielbate Jul 24, 2024
2f013fc
feat: correctly get blobIds
danielbate Jul 24, 2024
1e1fbb6
feat: add loader instructions
danielbate Jul 25, 2024
0bbcfdc
feat: append blob ids to loader
danielbate Jul 25, 2024
a0e761e
feat: lots of cleanup
danielbate Jul 25, 2024
584cd22
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Jul 25, 2024
3baba23
feat: fix wait for result in blob tx
danielbate Jul 25, 2024
57e8410
chore: linting
danielbate Jul 25, 2024
e04d773
test: test mods
danielbate Jul 25, 2024
6829095
chore: add demo package build filter
danielbate Jul 25, 2024
cfe4029
test: add max size test for initial deploy method
danielbate Jul 26, 2024
1a04238
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Jul 26, 2024
7d93486
feat: upgrade asm package
danielbate Jul 29, 2024
1b98257
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Jul 30, 2024
b14c753
feat: fix blob cost estimation, funding and blob id handling
danielbate Jul 31, 2024
f683923
feat: dynamic blob sizing
danielbate Jul 31, 2024
fd95a20
chore: lint
danielbate Jul 31, 2024
a7608f7
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 1, 2024
60e7db7
feat: fuel-core with ed19
danielbate Aug 1, 2024
2335817
feat: v4 gas costs, loader fixes and better blob id handling
danielbate Aug 2, 2024
b725b29
feat: simplify funding
danielbate Aug 2, 2024
e60ef9b
feat: loader contract fixes
danielbate Aug 2, 2024
22864f3
chore: remove redundant code
danielbate Aug 2, 2024
adb4548
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 5, 2024
7d3b0fb
feat: isTransactionType helper
danielbate Aug 5, 2024
3bafa2b
chore: doc blocks and pr refactors
danielbate Aug 5, 2024
7c63591
chore: remove math from contract
danielbate Aug 5, 2024
0a97c56
feat: use fuel-core release
danielbate Aug 6, 2024
ebd92fc
chore: isTransactionType cleanups
danielbate Aug 6, 2024
7ecfc8c
feat: use regex for response id check
danielbate Aug 6, 2024
bb24c41
chore: cleanups
danielbate Aug 6, 2024
96b6e0d
feat: chunk size tolerance
danielbate Aug 6, 2024
0ce01e2
test: deploy test cases
danielbate Aug 6, 2024
57adf3d
feat: add ed19 dependent cost to chain
danielbate Aug 6, 2024
d2ebf94
feat: getBytecodeSize
danielbate Aug 6, 2024
dda9dc9
docs: documentation for deploy methods
danielbate Aug 6, 2024
aac2745
chore: use tolerance const
danielbate Aug 7, 2024
36358fa
chore: update docs
danielbate Aug 7, 2024
4194751
chore: update docs
danielbate Aug 7, 2024
bf7ba3b
feat: use [email protected]
danielbate Aug 7, 2024
2aa7735
chore: add test groups
danielbate Aug 7, 2024
82e08fb
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 7, 2024
0ca3c42
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 7, 2024
cf5832c
docs: add chunk tolerance documentation
danielbate Aug 7, 2024
3f76a9a
chore: fix doc
danielbate Aug 7, 2024
90e557e
chore: remove redundant method
danielbate Aug 7, 2024
eac868b
chore: deployContractOptions -> deployOptions
danielbate Aug 7, 2024
60322d6
feat: isTransactionTypeBlob
danielbate Aug 7, 2024
16f9189
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 7, 2024
e6e736c
feat: fail blob deploys for invalid funds
danielbate Aug 7, 2024
563a702
chore: fix casing in gas config
danielbate Aug 7, 2024
29d4aa6
chore: linting
danielbate Aug 7, 2024
648999b
test: add e2e
danielbate Aug 7, 2024
350ca5c
chore: enable e2e
danielbate Aug 7, 2024
e85c688
chore: update e2e timeout
danielbate Aug 7, 2024
1d534ee
chore: add networkUrl to e2e log
danielbate Aug 7, 2024
e1690de
ajust fuel core version
Torres-ssf Aug 7, 2024
5f74186
update fuel core schema
Torres-ssf Aug 7, 2024
dbddb32
fixing test case
Torres-ssf Aug 7, 2024
7cefdb6
fix maxFee tests
Torres-ssf Aug 7, 2024
8dd8d53
simplify some tests
Torres-ssf Aug 7, 2024
a881d65
ajust some tests
Torres-ssf Aug 7, 2024
2e8a396
chore: add missing test groups
danielbate Aug 7, 2024
389d917
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 7, 2024
5000b71
chore: enable devnet test
danielbate Aug 7, 2024
a1d47e9
chore: enable only devnet
danielbate Aug 7, 2024
0ec2b48
add group test
Torres-ssf Aug 7, 2024
75a0606
fix test
Torres-ssf Aug 7, 2024
effa5b7
feat: optimise cost estimation
danielbate Aug 7, 2024
2a1d070
add missing import from suggestion
Torres-ssf Aug 7, 2024
097f4ae
make linter happy
Torres-ssf Aug 7, 2024
6fbbc0a
increate test timeout
Torres-ssf Aug 7, 2024
da27f7d
increase blob tx tests timeout
Torres-ssf Aug 7, 2024
9e966ce
remove .only
Torres-ssf Aug 7, 2024
71cd33e
feat: pass deploy options to size estimation
danielbate Aug 8, 2024
3417fff
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 8, 2024
65b4bae
chore: disable testnet
danielbate Aug 8, 2024
cf1a3c6
test: update isTypeBlob test
danielbate Aug 8, 2024
5208c09
test: use typegend factories in some factory tests
danielbate Aug 8, 2024
a5a4aa8
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 8, 2024
0641c7d
test: add missing properties to test chain config
danielbate Aug 8, 2024
55d0739
chore: lint
danielbate Aug 8, 2024
a321b81
docs: add loader script rference
danielbate Aug 8, 2024
7905c38
chore: improve chunk fuc
danielbate Aug 8, 2024
d4b2f27
chore: remove redundant cast
danielbate Aug 8, 2024
8339d10
docs: update deploying contracts intro
danielbate Aug 8, 2024
6f1d2e1
feat: update max size error message
danielbate Aug 8, 2024
6a9fb26
chore: small refactor for factoryt
danielbate Aug 8, 2024
0d7c34f
chore: refactor
danielbate Aug 8, 2024
339ec6c
chore: nit
danielbate Aug 8, 2024
51901f6
docs: update errors docs
danielbate Aug 8, 2024
f08abe5
test: transactionRequestify tests
danielbate Aug 8, 2024
5091527
test: add another devnet test
danielbate Aug 8, 2024
fd23a7c
doc: add further info around chunk size tolerance
danielbate Aug 8, 2024
13f6dec
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 8, 2024
a86a6ac
chore: return e2e to defualts
danielbate Aug 8, 2024
83bc54b
chore: add spell check words
danielbate Aug 8, 2024
a71e4ba
chore: remove breaking change
danielbate Aug 8, 2024
fda0c11
chore: changeset
danielbate Aug 8, 2024
f9879c8
fix: arrayify bytecode
danielbate Aug 8, 2024
efdc3ed
fix: use workspace version
danielbate Aug 8, 2024
581d662
chore: lock file
danielbate Aug 8, 2024
12ffc55
fix: changeset
danielbate Aug 8, 2024
ab792e9
chore: depsync
danielbate Aug 8, 2024
9dff6c0
chore: update lock
danielbate Aug 8, 2024
7117181
Merge branch 'master' into db/feat/blob-contract-deploys
danielbate Aug 8, 2024
4a3f1c5
docs: fix links
danielbate Aug 8, 2024
a9cbbce
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 8, 2024
09d809c
feat: BytesLike in contract factory
danielbate Aug 9, 2024
63f13f1
chore: disable testnet
danielbate Aug 9, 2024
080df58
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 9, 2024
586a0da
test: fix docs assertion
danielbate Aug 9, 2024
853bf35
feat: account for max tx size consensus param
danielbate Aug 9, 2024
369576b
test: blob configurable test
danielbate Aug 9, 2024
65d6c7c
test: fix assertion
danielbate Aug 9, 2024
469f8d3
test: deploy via blobs with storage
danielbate Aug 9, 2024
15e8510
feat: chunkSizeTolerance -> chunkSizeOverride
danielbate Aug 9, 2024
41da418
feat: manually use v4 gas types
danielbate Aug 9, 2024
83bc39f
chore: update snippet
danielbate Aug 9, 2024
1312fe3
feat: user patch fuel-core, fixes for devnet, blob ID already uploade…
danielbate Aug 9, 2024
434aa92
chore: chunkSizeTolerance ->chunkSizeOverride
danielbate Aug 9, 2024
a405449
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 9, 2024
84a876d
test: e2e updates
danielbate Aug 9, 2024
38db5a5
chore: merge conflict
danielbate Aug 9, 2024
27ee501
chore: restore fuel-core version
danielbate Aug 9, 2024
b592cf9
chore: fix built in version
danielbate Aug 9, 2024
9bf6c1c
chore: 0.32.1 upgrade
danielbate Aug 10, 2024
7d0ecad
chore: changeset
danielbate Aug 10, 2024
9ecb1dc
choer: e2e
danielbate Aug 10, 2024
4d685ef
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 10, 2024
3eb9e1e
chore: lint
danielbate Aug 10, 2024
22013c2
chore: enable testnet
danielbate Aug 10, 2024
c84c76a
chore: lint
danielbate Aug 10, 2024
226455c
chore: update changeset
danielbate Aug 11, 2024
faa4c86
docs: add typegen to snippet
danielbate Aug 12, 2024
da41c8b
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 12, 2024
9a12071
chore: dont export chunk size constant
danielbate Aug 12, 2024
a0991d7
undo test modification after fuel-core patch
Torres-ssf Aug 12, 2024
71dceae
docs: update doc
danielbate Aug 12, 2024
041bbaf
feat: override -> multiplier
danielbate Aug 12, 2024
d2f0987
Merge branch 'db/feat/blob-contract-deploys' of https://github.com/Fu…
danielbate Aug 12, 2024
5223798
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 12, 2024
4cb5ff6
test: add bytecode size check
danielbate Aug 12, 2024
1b17536
test: fix assertion
danielbate Aug 12, 2024
f7737a8
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 13, 2024
05bd455
Merge branch 'master' into db/feat/blob-contract-deploys
danielbate Aug 13, 2024
1ebb3db
increase funding attempts to 5
Torres-ssf Aug 13, 2024
85e98eb
create error code
Torres-ssf Aug 13, 2024
0a5dfb4
throw error if funding attempts are exceed
Torres-ssf Aug 13, 2024
2eb233d
add gasPrice to fund method params to avoid re-fetch
Torres-ssf Aug 13, 2024
4b931ee
chore: remove blob e2e
danielbate Aug 13, 2024
a6d3daf
Merge branch 'db/feat/blob-contract-deploys' of github.com:FuelLabs/f…
Torres-ssf Aug 13, 2024
373dbb1
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Aug 13, 2024
6a4931f
chore: update nomenclature
danielbate Aug 14, 2024
29eafac
chore: note around blob deploys
danielbate Aug 14, 2024
55636bc
doc: typo
danielbate Aug 14, 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
12 changes: 12 additions & 0 deletions .changeset/thirty-steaks-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@fuel-ts/account": minor
"@fuel-ts/contract": minor
"@fuel-ts/errors": minor
"@fuel-ts/program": minor
"@fuel-ts/transactions": minor
"@fuel-ts/utils": minor
"@fuel-ts/versions": minor
"@internal/fuel-core": minor
---

feat!: `[email protected]` and large contract deployments
103 changes: 59 additions & 44 deletions .fuel-core/configs/chainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,47 @@
},
"chain_id": 0,
"gas_costs": {
"V1": {
"V4": {
"add": 2,
"addi": 2,
"aloc": 2,
"and": 2,
"andi": 2,
"bal": 86,
"bal": 29,
"bhei": 2,
"bhsh": 2,
"burn": 25770,
"burn": 19976,
"cb": 2,
"cfei": 2,
"cfsi": 2,
"div": 2,
"divi": 2,
"eck1": 3114,
"ecr1": 42270,
"ed19": 2878,
"eck1": 1907,
"ecr1": 26135,
"eq": 2,
"exp": 2,
"expi": 2,
"flag": 1,
"flag": 2,
"gm": 2,
"gt": 2,
"gtf": 12,
"gtf": 13,
"ji": 2,
"jmp": 2,
"jne": 2,
"jnei": 2,
"jnzi": 2,
"jmpf": 1,
"jmpb": 1,
"jnzf": 1,
"jnzb": 1,
"jnef": 1,
"jneb": 1,
"jmpf": 2,
"jmpb": 2,
"jnzf": 2,
"jnzb": 2,
"jnef": 2,
"jneb": 2,
"lb": 2,
"log": 165,
"log": 102,
"lt": 2,
"lw": 2,
"mint": 29024,
"mint": 18042,
"mlog": 2,
"mod_op": 2,
"modi": 2,
"move_op": 2,
"mod_op": 2,
"movi": 2,
"mroo": 4,
"mul": 2,
Expand All @@ -96,55 +92,68 @@
"ori": 2,
"poph": 3,
"popl": 3,
"pshh": 4,
"pshl": 4,
"ret": 134,
"rvrt": 153,
"pshh": 5,
"pshl": 5,
"move_op": 2,
"ret": 53,
"sb": 2,
"sll": 2,
"slli": 2,
"srl": 2,
"srli": 2,
"srw": 209,
"srw": 177,
"sub": 2,
"subi": 2,
"sw": 2,
"sww": 22501,
"time": 50,
"tr": 33912,
"tro": 24294,
"sww": 17302,
"time": 35,
"tr": 27852,
"tro": 19718,
"wdcm": 2,
"wqcm": 3,
"wqcm": 2,
"wdop": 3,
"wqop": 3,
"wdml": 3,
"wqml": 4,
"wddv": 5,
"wqdv": 6,
"wdmd": 10,
"wqmd": 17,
"wdam": 9,
"wqam": 11,
"wdmm": 10,
"wqmm": 10,
"wqml": 3,
"wddv": 4,
"wqdv": 5,
"wdmd": 8,
"wqmd": 12,
"wdam": 7,
"wqam": 8,
"wdmm": 8,
"wqmm": 8,
"xor": 2,
"xori": 2,
"alocDependentCost": {
"rvrt": 2,
"aloc": {
"HeavyOperation": {
"base": 2,
"gasPerUnit": 0
"gas_per_unit": 0
}
},
"bsiz": {
"LightOperation": {
"base": 17,
"units_per_gas": 790
}
},
"bldd": {
"LightOperation": {
"base": 15,
"units_per_gas": 272
}
},
"cfe": {
"HeavyOperation": {
"base": 2,
"gasPerUnit": 0
"gas_per_unit": 0
}
},
"cfeiDependentCost": {
"cfei": {
"HeavyOperation": {
"base": 2,
"gasPerUnit": 0
"gas_per_unit": 0
}
},
"call": {
Expand All @@ -171,6 +180,12 @@
"units_per_gas": 237
}
},
"ed19": {
"LightOperation": {
"base": 45,
"units_per_gas": 237
}
},
"k256": {
"LightOperation": {
"base": 37,
Expand Down
1 change: 1 addition & 0 deletions .fuel-core/configs/stateConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
}
],
"contracts": [],
"blobs": [],
"block_height": 0,
"da_block_height": 0
}
2 changes: 1 addition & 1 deletion apps/demo-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"pretest": "pnpm original:build"
},
"dependencies": {
"@fuels/vm-asm": "0.55.0",
"@fuels/vm-asm": "0.56.0",
"@types/node": "^22.2.0",
"@types/react-dom": "^18.3",
"@types/react": "^18.3.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-react-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.29",
"private": true,
"dependencies": {
"@fuels/vm-asm": "0.55.0",
"@fuels/vm-asm": "0.56.0",
"@testing-library/react": "^16.0.0",
"@types/node": "^22.2.0",
"@types/react": "^18.3.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"pretest": "pnpm original:build"
},
"dependencies": {
"@fuels/vm-asm": "0.55.0",
"@fuels/vm-asm": "0.56.0",
"fuels": "workspace:*",
"react-dom": "^18.3.1",
"react": "^18.3.1"
Expand Down
145 changes: 95 additions & 50 deletions apps/docs-snippets/src/guide/contracts/deploying-contracts.test.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,110 @@
import { readFileSync } from 'fs';
import { Provider, FUEL_NETWORK_URL, Wallet, ContractFactory } from 'fuels';
import { join } from 'path';
/* eslint-disable @typescript-eslint/no-shadow */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Provider, TESTNET_NETWORK_URL, Wallet, ContractFactory, hexlify } from 'fuels';
import { launchTestNode } from 'fuels/test-utils';

import { DocSnippetProjectsEnum } from '../../../test/fixtures/forc-projects';
import { getTestWallet } from '../../utils';
import { EchoValuesFactory as TypegenFactory, EchoValues } from '../../../test/typegen';

/**
* @group node
* @group browser
*/
describe(__filename, () => {
let PRIVATE_KEY: string;
let projectsPath: string;
let contractName: string;
describe('Deploying Contracts', () => {
it('gets the max contract size for the chain', async () => {
using launched = await launchTestNode();

beforeAll(async () => {
const wallet = await getTestWallet();
PRIVATE_KEY = wallet.privateKey;
projectsPath = join(__dirname, '../../../test/fixtures/forc-projects');
const { provider: testProvider } = launched;
const TESTNET_NETWORK_URL = testProvider.url;

contractName = DocSnippetProjectsEnum.ECHO_VALUES;
});

it('should successfully deploy and execute contract function', async () => {
// #region contract-setup-1
// #context const PRIVATE_KEY = "..."

const provider = await Provider.create(FUEL_NETWORK_URL);

const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider);
// #endregion contract-setup-1

// #region contract-setup-2
// #context const contractsDir = join(__dirname, '../path/to/contracts/dir')
// #context const contractName = "contract-name"

const byteCodePath = join(projectsPath, `${contractName}/out/release/${contractName}.bin`);
const byteCode = readFileSync(byteCodePath);

const abiJsonPath = join(projectsPath, `${contractName}/out/release/${contractName}-abi.json`);
const abi = JSON.parse(readFileSync(abiJsonPath, 'utf8'));
// #endregion contract-setup-2
// #region get-contract-max-size
// #import { Provider, TESTNET_NETWORK_URL };

// #region contract-setup-3
const factory = new ContractFactory(byteCode, abi, wallet);

const { contractId, transactionId, waitForResult } = await factory.deploy();
// #endregion contract-setup-3
const provider = await Provider.create(TESTNET_NETWORK_URL);
const { consensusParameters } = provider.getChain();
const contractSizeLimit = consensusParameters.contractParameters.contractMaxSize;
// #endregion get-contract-max-size
expect(contractSizeLimit).toBeDefined();
});

// #region contract-setup-4
it('deploys a contract', async () => {
using launched = await launchTestNode();

const {
provider: testProvider,
wallets: [testWallet],
} = launched;
const TESTNET_NETWORK_URL = testProvider.url;
const WALLET_PVT_KEY = testWallet.privateKey;
const bytecode = TypegenFactory.bytecode;

// #region setup
// #import { Provider, TESTNET_NETWORK_URL, Wallet };
// #context import { WALLET_PVT_KEY } from 'path/to/my/env/file';
// #context import { TypegenFactory } from 'path/to/typegen/outputs';

const provider = await Provider.create(TESTNET_NETWORK_URL);
const wallet = Wallet.fromPrivateKey(WALLET_PVT_KEY, provider);
const factory = new TypegenFactory(wallet);
// #endregion setup
expect(hexlify(factory.bytecode)).toBe(hexlify(bytecode));

// #region deploy
// Deploy the contract
const { waitForResult, contractId, transactionId } = await factory.deploy();
// Await it's deployment
const { contract, transactionResult } = await waitForResult();
// #endregion contract-setup-4

// #region contract-setup-5
const call = await contract.functions.echo_u8(15).call();
// #endregion deploy
expect(contract).toBeDefined();
expect(transactionId).toBeDefined();
expect(transactionResult.status).toBeTruthy();
expect(contractId).toBe(contract.id.toB256());

// #region call
// Call the contract
const { waitForResult: waitForCallResult } = await contract.functions.echo_u8(10).call();
// Await the result of the call
const { value } = await waitForCallResult();
// #endregion call
expect(value).toBe(10);
});

const { value } = await call.waitForResult();
// #endregion contract-setup-5
it('deploys a large contract as blobs', async () => {
using launched = await launchTestNode();

const {
provider: testProvider,
wallets: [testWallet],
} = launched;
const TESTNET_NETWORK_URL = testProvider.url;
const WALLET_PVT_KEY = testWallet.privateKey;
const abi = EchoValues.abi;
const bytecode = TypegenFactory.bytecode;

// #region blobs
// #import { Provider, TESTNET_NETWORK_URL, Wallet, ContractFactory };
// #context import { WALLET_PVT_KEY } from 'path/to/my/env/file';
// #context import { bytecode, abi } from 'path/to/typegen/outputs';

const provider = await Provider.create(TESTNET_NETWORK_URL);
const wallet = Wallet.fromPrivateKey(WALLET_PVT_KEY, provider);
const factory = new ContractFactory(bytecode, abi, wallet);

// Deploy the contract as blobs
const { waitForResult, contractId, transactionId } = await factory.deployAsBlobTx({
// Increasing chunk size multiplier to be 90% of the max chunk size
chunkSizeMultiplier: 0.9,
});
// Await it's deployment
const { contract, transactionResult } = await waitForResult();
// #endregion blobs

expect(contract).toBeDefined();
expect(transactionId).toBeDefined();
expect(contractId).toBeDefined();
expect(transactionResult.isStatusSuccess).toBeTruthy();
expect(value).toBe(15);
expect(transactionResult.status).toBeTruthy();
expect(contractId).toBe(contract.id.toB256());

const { waitForResult: waitForCallResult } = await contract.functions.echo_u8(10).call();
const { value } = await waitForCallResult();
expect(value).toBe(10);
});
});
1 change: 1 addition & 0 deletions apps/docs/spell-check-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,4 @@ Vitest
CODEOWNERS
incentivise
URI
reuploaded
Loading