7 releases
new 0.8.0 | May 23, 2024 |
---|---|
0.7.0 | Mar 22, 2024 |
0.6.6 | Jan 9, 2024 |
0.6.5 | Sep 24, 2023 |
0.6.2 | Aug 31, 2023 |
#180 in #cargo-build
468 downloads per month
19KB
345 lines
loam-cli
Build smart contracts authored with Loam SDK, manage smart contract dependencies from a frontend, initialize new loam projects.
Loam CLI comes with three main commands:
loam init
- Generates a Loam frontend that includes anenvironments.toml
file describing the network settings, accounts, and contracts for each environment your team builds against.loam build
- Two build processes in one:- Build smart contracts. Essentially, this is a wrapper around
soroban build
that can be used to build any Soroban project's contracts. Likesoroban build
, this will build contracts using suggested settings, meaning that it functions as a shorthand for something likecargo build --target wasm32-unknown-unknown
. But on top of that,loam build
will also find all Loam dependencies, resolve interdependencies, and build them all in the correct order. - Build frontend clients. If the project contains an
environments.toml
file,loam build
will match the environment specified by theLOAM_ENV
environment variable (forloam build
, the default isproduction
) to a predictable starting state. It will turn the contracts you depend on (contract dependencies) into frontend packages (NPM dependencies), getting your frontend app to the point where it is ready to build or run with its own dev server. This is done in as low-intrusive a way as possible (for example, if contracts are already deployed, are they using the correct Wasm hash? Do they need to have their TTL extended? It will update these things, rather than re-deploy every time.)
- Build smart contracts. Essentially, this is a wrapper around
loam dev
- Monitorscontracts/*
andenvironments.toml
for changes and re-runsloam build
as needed. It also defaults toLOAM_ENV=development
, rather thanproduction
.
loam dev
and loam build
in Depth
loam dev
and loam build
essentially work the same, except that one is for testing and another for production.
loam dev
loam dev
accomplishes the following when run:
- defaults to development environment
- looks at
environment.toml
, which specifies:- if environment uses local or live network
- binds contracts
- imports contracts to frontend
- watches
contracts/*
for any changes
loam build
Suggestions
We suggest that each frontend have separate contract dependencies, deployed on separate networks.
So, you should build one version of your frontend for mainnet and host it at the root domain, say, example.com
. Then build a separate version for testnet and host it at a separate domain, maybe staging.example.com
.
Dependencies
~5–17MB
~180K SLoC