Skip to content

Agent009/bc-ic-bc23-05

Repository files navigation

Motoko Bootcamp - 2023-05 Edition

Day 1

Day 2

Day 3

Day 4

Day 5

Day 6

Running the project locally

To test the project locally, use the following commands:

# Set rust backtrace to get more useful debug info when things go wrong
export RUST_BACKTRACE=full

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

# Install packages for front-end
npm i -S @connect2ic/core @connect2ic/svelte

# First time, canisters will need to be created, built and the back-end deployed and the declarations generated.
npm run create
npm run backend
npm run deploy

# Deploys the canisters to the replica and generates the candid interface
dfx deploy

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

Additionally, if you are making frontend changes, you can start a development server with

npm run dev

Which will start a server at http://localhost:8080, proxying API requests to the replica at port 4943.

To debug the vite.config.js if it's failing to build, add in console.log declarations and run npx vite build.

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:

  • setNODE_ENV to production if you are using Webpack
  • use your own preferred method to replace process.env.NODE_ENV in the autogenerated declarations
  • Write your own createActor constructor

Useful commands

  • Check on-chain balance: dfx wallet --network=ic balance
  • Get principal ID: dfx identity get-principal
  • Get ledger ID: dfx ledger account-id
  • Get on-chain wallet ID: dfx identity --network=ic get-wallet

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published