sway-by-example
Examples of Sway programs
Development
npm i
nom run start
Production
npm run deploy
Memo
# md to react
npx ts-node --project ./scripts/tsconfig.json scripts/md-to-react.ts src/pages/array
# build routes
npx ts-node --project ./scripts/tsconfig.json scripts/build-routes.ts
TODO
-
update npm
-
Basic
- variables (immutable,
mut
, type annotations) - built-in
- primitive types (
u64
,bool
,str[]
,b256
) - compound type (tuple, struct, array)
- primitive types (
- blockchain types (
Address
,ContractId
andIdentity
) - functions (return outputs,
ref mut
) - structs
- tuples
- enums
- constants
- configurable constants
- std lib types - option
- std lib types - result
- control flow
- if
- match
- while loop
- logging
- test in sway
- variables (immutable,
-
Blockchain
- msg_sender (ownership)
- base asset (wallet)
- native support for assets (wrapped token)
- events
- storage map (simple, nested)
- vector (storage, heap) (nft)
- hash
- crypto signature (air drop)
- calling contracts (multi sig)
- call
- low level call
- function purity
- identifier (address and contract id)
-
rename sway files from
.rs
to.sw
-
move
hello-sway
repo to here? -
Integrate https://github.com/t4sk/hello-sway