Skip to content

leothm/wasm-flipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flipper: WASM dApp for Astar

This is a demo for a simple WASM contract. The contract name is Flipper. Flipper contract has two method.

  1. One transaction method flip
  2. One query method get.

Flipper contract is meant to show a hello world use case for WASM, Swanky and connect the contract via a React frontend.

The contract folder contains the contract code. The UI folder contains the UI code. UI is written in Next.js and React.

Usage

Install swanky cli https://github.com/AstarNetwork/swanky-cli

npm install -g @astar-network/[email protected]

Deploy the Flipper contract

  1. Init
mkdir contract
cd contract
swanky init flipper

and chose ink as a contract language and flipper as template and a chosen contract name. Chose Y when asking to download the Swanky node.

  1. Start the local node
cd flipper
swanky node start
  1. Build the contract
swanky contract compile flipper

(Try rustup update if you face error which Swanky doesn't return error)

  1. Deploy the contract

Local

swanky contract deploy flipper --account alice -g 100000000000 -a true

Shibuya

swanky contract deploy flipper --account alice --gas 100000000000 --args true --network shibuya

Copy paste the contract address.

Run the UI

Install Dependencies

cd ..
yarn

Start Next.js server

yarn dev

Go to http://localhost:3000 and enter the contract address. Flip button flips the boolean value.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 74.1%
  • CSS 24.8%
  • JavaScript 1.1%