Blended App template SDK for Solidity and Rust WASM contracts with Javascript ethers.js test scripts.
https://docs.fluent.xyz/developer-guides/building-a-blended-app/
Change directory to rust
contract folder
cd rust
Compile Rust contract for WASM binary
gblend build rust -r
Deploy Rust contract with WASM binary
gblend deploy \
--private-key $devTestnetPrivateKey \
--dev lib.wasm \
--gas-limit 3000000
Copy this deployed Rust contract address, since this will be used for the Solidity contract communication.
fluentbase-sdk
if there are issues:
cargo clean
cargo update -p fluentbase-sdk
Switch back to the root of this repo, then switch to the solidity
contract folder
cd ../
cd solidity
Deploy the Solidity contract with the Rust contract address
with the Forge flag which defines path to constructor input text file --constructor-args-path
forge create src/FluentSdkRustTypesTest.sol:FluentSdkRustTypesTest \
--constructor-args-path src/deployConstructor/FluentSdkRustTypesTest.txt \
--private-key $devTestnetPrivateKey \
--rpc-url https://rpc.dev.gblend.xyz/ \
--broadcast \
--verify \
--verifier blockscout \
--verifier-url https://blockscout.dev.gblend.xyz/api/
Foundry test fork deployed contracts on Fluent testnet
forge coverage --fork-url https://rpc.dev.gblend.xyz/
Switch back to the root of this repo, then switch to the javascript
folder
cd ../
cd javascript
Install packages such as ethers.js with package.json
with
npm i
Run the ethers.js test script to have the Solidity contract call the Rust contract
node solidity.js
Run the ethers.js test script to call the Rust contract directly (using Solidity interface ABI)
node rust.js
This ethers.js Javascript example can be modified from node.js to a frontend application for users to interact with.