Skip to content

lshoo/rgbonic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rgbonic

Welcome to your new rgbonic project and to the internet computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle.

To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.

To learn more before you start working with rgbonic, see the following documentation available online:

If you want to start working on your project right away, you might want to try the following commands:

cd rgbonic/
dfx help
dfx canister --help

Running the project locally

If you want to test your project locally, you can use the following commands:

# Clone the `wasm-forge/wasi2ic` project:
git clone https://github.com/wasm-forge/wasi2ic

## Enter the wasi2ic directory and install it
cd wasi2ic
cargo install --path .

# Starts the replica, running in the background
dfx start --background

# Compile the project with `wasm-wasi` inside the project folder
cargo build --release --target wasm32-wasi
# or 
just build_wallet

# Translate `wasm32-wasi` target to wasm32-unknown-unknown` under the project directory
wasi2ic ./target/wasm32-wasi/release/wallet.wasm wallet.wasm
# or 
just translate_wasm

# Create canister for `wallet` if first time 
dfx canister create wallet

# Install the new wasm file to IC canister with `regtest` or `testnet` or `mainnet`
dfx canister install --mode reinstall --wasm wallet.wasm wallet --argument '("regtest")' 
# or
just install wallet

# Call the canister to verify 
dfx canister call wallet greet "人生只有一件事:修"

Once the job completes, your application will be available at http://localhost:4943?canisterId={asset_canister_id}.

Note on frontend environment variables

If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:

  • setDFX_NETWORK to ic if you are using Webpack
  • use your own preferred method to replace process.env.DFX_NETWORK in the autogenerated declarations
    • Setting canisters -> {asset_canister_id} -> declarations -> env_override to a string in dfx.json will replace process.env.DFX_NETWORK with the string in the autogenerated declarations
  • Write your own createActor constructor

Releases

No releases published

Packages

No packages published