### Install Completium CLI and Initialize Configuration (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Installs the Completium CLI globally using npm and then initializes its configuration files. Requires Node.js and npm. ```Shell $ npm install -g @completium/completium-cli $ completium-cli init ``` -------------------------------- ### Install Archetype Binary Compiler via Opam (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Installs the Archetype compiler binary using the Opam package manager. Requires Opam to be installed and configured. ```Shell opam install archetype ``` -------------------------------- ### Installing Beacon Wallet Integration Libraries Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/index.md Installs the necessary npm packages (@taquito/beacon-wallet and @airgap/beacon-sdk) to enable interaction with Tezos wallets using the Beacon standard. ```Shell npm install @taquito/beacon-wallet @airgap/beacon-sdk ``` -------------------------------- ### Build Archetype Binary Compiler from Source (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Clones the Archetype compiler source code from GitHub, navigates into the directory, installs build dependencies using make and opam, and then builds the project. Requires Git, make, and Opam. ```Shell git clone https://github.com/completium/archetype-lang.git -b master cd archetype-lang make build-deps eval $(opam env) make all ``` -------------------------------- ### Installing constate package Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/index.md Installs the constate package using npm, which is recommended for setting up contexts in React applications to manage application data and singleton instances. ```completium npm install constate ``` -------------------------------- ### Configure Archetype Binary Compiler Path and Mode (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Configures Completium CLI to use a locally installed binary version of the Archetype compiler. The first command sets the path to the executable, and the second switches the mode to 'binary'. Requires the Archetype binary to be installed separately. ```Shell $ completium-cli set binary path archetype $ completium-cli set mode archetype binary ``` -------------------------------- ### Install Archetype Docker Compiler (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Installs the Archetype compiler as a Docker container using Completium CLI. Requires Docker to be installed and running. This command also updates the container if it's already installed. ```Shell completium-cli install archetype ``` -------------------------------- ### Show Current Archetype Compiler Mode (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Prints the currently configured Archetype compiler mode (js, docker, or binary) used by Completium CLI to the console. ```Shell completium-cli show mode archetype ``` -------------------------------- ### Interactively Switch Archetype Compiler Mode (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Opens an interactive menu in the terminal to easily switch between different Archetype compiler modes (js, docker, binary) configured in Completium CLI. ```Shell $ completium-cli switch mode archetype ``` -------------------------------- ### Installing Taquito Tezos Library Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/index.md Installs the core Taquito library via npm, which is the main JavaScript/TypeScript library for interacting with the Tezos blockchain from a web DApp. ```Shell npm install @taquito/taquito ``` -------------------------------- ### Show Archetype Compiler Version (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Executes the configured Archetype compiler via Completium CLI and prints its version number to the console. ```Shell completium-cli archetype version ``` -------------------------------- ### Installing Completium CLI via npm Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/introduction.md Installs the Completium CLI globally on your system using the npm package manager. ```completium npm install -g @completium/completium-cli ``` -------------------------------- ### Example: Showing Entrypoints for Remote Contract Address Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli show entries` command with a remote contract address, showing the output listing the available entrypoints and their parameters. ```completium completium-cli show entries KT1EFgRdrT4r6QLx2riZiPNHjo7gcQM8n7f7 %confirm (_ : unit) %submit (%ckey : address, %pscore : int) %decide (_ : unit) ``` -------------------------------- ### Check Archetype Binary Compiler Version (Bash) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Executes the compiled Archetype binary directly from its build path to verify its installation and print its version. This command is typically run after building from source. ```Bash _build/default/src/compiler.exe -v ``` -------------------------------- ### Initializing Completium CLI Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/introduction.md Initializes the Completium CLI environment. This command must be run after the initial installation and every time a new version is installed. ```completium completium-cli init ``` -------------------------------- ### Example Contract Import (TS) Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/contract.md Provides an example of how to import a specific contract binding (e.g., 'Poll') generated by Completium, replacing the generic `FIXME` placeholder in the context setup. ```ts import { Poll as Contract } from '../bindings/poll'; ``` -------------------------------- ### Call Example Contract Entrypoint in Archetype Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/operation.md Demonstrates calling the `exec` entrypoint of the example `called_contract` (`c`) with 0 tez and a tuple `(4,5)` as the argument, matching the `nat * nat` signature. ```Archetype transfer 0tz to c call exec((4,5)) ``` -------------------------------- ### Starting Local Development Server with Yarn (Bash) Source: https://github.com/completium/archetype-docs/blob/main/README.md Starts a local development server for the Docusaurus website. This command typically watches for file changes and automatically refreshes the browser, enabling live development. ```bash $ yarn start ``` -------------------------------- ### Example: Deploying Archetype Contract with Parameters Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli deploy` command to deploy the `payment.arl` contract and provide the required `fee` parameter value using the `--parameters` option. ```completium $ completium-cli deploy payment.arl --parameters '{ "fee" : "5tz" }' ``` -------------------------------- ### Install Project Dependencies using npm Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/writingtests.md Navigates into the newly created project directory and runs `npm i` to install the necessary Node.js packages declared in the `package.json` file, which are required for running tests and generating bindings. ```completium $ cd myproject npm i ``` -------------------------------- ### Installing Completium DApp TypeScript Dependencies Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/index.md Installs the required npm packages (@completium/dapp-ts and @completium/archetype-ts-types) that are dependencies for using the TypeScript contract bindings generated by Completium CLI. ```Shell npm install @completium/dapp-ts @completium/archetype-ts-types ``` -------------------------------- ### Archetype Contract Entry Point Example Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/writingtests.md An example of an Archetype contract entry point definition (`mint`) demonstrating access control (`called by owner`), providing context for the failing test example. ```Archetype entry mint(tow : address, tid : nat, tmd: map) { called by owner effect { /* ... */ } } ``` -------------------------------- ### Example: Showing Contract Information for 'demo' Alias Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli show contract` command with the alias `demo`, showing the output including the contract's name, network, address, source path, language, version, and a link to a block explorer. ```completium $ completium-cli show contract demo Name: demo Network: edo Address: KT1CQmaCLLdEQ3X9PmxoqEAy3Xusvs1J5wW1 Source: /home/dev/.completium/sources/demo.arl Language: archetype Version: 1.2.2 Url: https://better-call.dev/edo2net/KT1CQmaCLLdEQ3X9PmxoqEAy3Xusvs1J5wW1 ``` -------------------------------- ### Switch Archetype Compiler Mode to JS (Shell) Source: https://github.com/completium/archetype-docs/blob/main/docs/installation.md Configures Completium CLI to use the JavaScript version of the Archetype compiler. This is the default mode but can be used to switch back from other modes. ```Shell completium-cli set mode archetype js ``` -------------------------------- ### Installing Dependencies with Yarn (Bash) Source: https://github.com/completium/archetype-docs/blob/main/README.md Installs project dependencies using the Yarn package manager. This command reads the package.json file and downloads the required packages into the node_modules directory. ```bash $ yarn ``` -------------------------------- ### Call Example Current Contract Entrypoint in Archetype Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/operation.md Provides a concrete example of calling the `exec` entrypoint within the current contract (`self`) with 0 tez and arguments `4` and `5`. Note the tuple syntax is implicit here. ```Archetype transfer 0tz to entry self.exec(4,5) ``` -------------------------------- ### Creating React App with TypeScript Template Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/index.md Initializes a new React project named 'my-dapp' using the create-react-app tool and specifies the TypeScript template for language support. ```Shell npx create-react-app my-dapp --template TypeScript ``` -------------------------------- ### Full launch.json Example for Archetype Debugging (JSON) Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/debug.md Provides a complete example of a `launch.json` configuration for debugging an Archetype contract in VS Code. It includes settings for environment variables, constant parameters, and default storage. ```json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "archetype", "request": "launch", "name": "Archetype : debug", "program": "${file}", "env": { "now": "2023-10-27 09:25:11", "level": "10000", "caller": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "source": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "transferred": "0", "balance": "1000000", "inputs": { "spender": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "from": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "to": "tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6", "value": "500" }, "const_params": { "initial_holder": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "total_supply": "1000", "metadata_coin": "0x00" }, "storage": { "ledger": "{ Elt \"tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb\" (Pair 1000 { }) }", "token_metadata": "{ Elt 0 (Pair 0 { Elt \"\" 0x00 }) }" } } } ] } ``` -------------------------------- ### Example: Deploying FA 1.2 Contract with Metadata File Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli deploy` command to deploy an FA 1.2 contract (`fa12.arl`) and attach metadata by providing the path to a JSON file using the `--metadata-storage` option. ```completium $ completium-cli deploy fa12.arl --metadata-storage fa12_metadata.json ``` -------------------------------- ### Archetype: Example Contract with Entrypoint Source: https://github.com/completium/archetype-docs/blob/main/src/components/desc/getentrypoint_desc.md Defines a simple Archetype contract named 'example' with a single entrypoint 'exec' that takes a natural number 'n' as an argument. This contract serves as an example for demonstrating how to retrieve an entrypoint. ```archetype archetype example entry exec(n : nat) { /* ... */ } ``` -------------------------------- ### Retrieving Events with Completium Crank (TypeScript) Source: https://github.com/completium/archetype-docs/blob/main/blog/2022-03-21-events.md Provides a TypeScript example using the `@completium/event-well-crank` library to listen for and handle events. It shows how to register a handler function (`handleHBI`) for a specific event type (`HighestBidIncreased`) from a contract and start the crank process. ```typescript import { startCrank } from '@completium/event-well-crank' import { HighestBidIncreased, register_HighestBidIncreased } from './bid-bindings.ts' const contract = "KT1..." // address of the emitter contract const handleHBI = (hbi : HighestBidIncreased) => { // ... console.log(`${hbi.bidder} is now the highest bid bidder.`) } // register Handler register_HighestBidIncreased(contract, handleHBI); // Start crank await startCrank(); ``` -------------------------------- ### Payback Entrypoint Example - Archetype Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Illustrates an Archetype entrypoint named 'payback' that accepts two parameters: an integer 'i' and a natural number 'n'. This example is used to demonstrate calling contracts with arguments using the Completium CLI. ```archetype archetype entry payback (i : int, n : nat) { // ... } ``` -------------------------------- ### Example: Metadata JSON File for FA 1.2 Contract Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example content of a JSON file (`fa12_metadata.json`) used to provide metadata for an FA 1.2 compliant contract, including fields like symbol, name, decimals, description, and thumbnail URI. ```shell $ cat fa12_metadata.json { "symbol": "MTK", "name": "MyToken", "decimals": "1", "description": "description of MyToken", "thumbnailUri": "https://completium.com/img/logo_completium_128.png" } ``` -------------------------------- ### Example `while` Loop in Archetype Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/control.md This provides a concrete example of a `while` loop that increments a variable `i` from 0 up to 19. The loop continues as long as `i` is less than 20. ```Archetype var i = 0; while i < 20 do instr1; i += 1 done ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/completium/archetype-docs/blob/main/blog/2023-01-02-binding.md Standard npm command to install project dependencies listed in package.json, including those required for the test framework and binding. ```completium $ npm install ``` -------------------------------- ### Deploying an Archetype contract with Completium CLI Source: https://github.com/completium/archetype-docs/blob/main/docs/introduction.md This command uses the Completium CLI to deploy the 'hello.arl' Archetype contract file to the Tezos blockchain. It assumes the Completium CLI is installed and configured. ```Completium completium-cli deploy hello.arl ``` -------------------------------- ### Example Archetype Contract for Calling Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/operation.md Defines a simple Archetype contract named `called_contract` with a variable `r` and an entrypoint `exec` that takes two `nat` arguments and updates `r`. Used as an example target for `transfer` calls. ```Archetype archetype called_contract\n\nvariable r : nat = 0\n\nentry exec(x : nat, y : nat) {\n r := r * x + y\n} ``` -------------------------------- ### Example: Registering Global Constant 'Pair 2 1' Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli register global constant` command with sample Michelson data, showing the output including the generated global address (hash). ```completium $ completium-cli register global constant 'Pair 2 1' ... Global address: exprungfiFAFCszmNHNCDMtNkxiiHDpJUp128aLCJ5YxdsQZmyYt6S ``` -------------------------------- ### Using useTezosToolkit Hook to Access Taquito (TSX) Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/taquito.md This example shows how to consume the `TezosToolkit` instance provided by the `Taquito` context. It imports the `useTezosToolkit` hook and calls it to get the toolkit instance, which is then used to query an account balance on the Tezos blockchain. ```tsx import { useTezosToolkit } from '../store/Taquito' const ttk = useTezosToolkit() const balance = await ttk.tz.getBalance('tz1h4CiqWxNe4UxSpkwXy617RM6DaK6NU76P'); ``` -------------------------------- ### Example Mocha Test Structure (TypeScript) Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/writingtests.md This example demonstrates how to use `describe` and `it` to structure tests for contract entry points, including asynchronous calls and assertions. ```TypeScript describe('[HELLO] Call entries', async () => { it("Call 'exec'", async () => { await hello.exec({ as : alice }) const s_after = await hello.get_s() assert(s_after === "Hello Archetype World!") }) it("Call 'exec2'", async () => { await hello.exec2({ as : alice }) const s_after = await hello.get_s() assert(s_after === "Hello TS Binding World!") }) }) ``` -------------------------------- ### Example: Deploying Archetype Contract with Amount Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/contract.md Example usage of the `completium-cli deploy` command to deploy an Archetype contract named `mycontract.arl` and send 15.5 tez during deployment. This command also creates a contract alias `mycontract`. ```completium $ completium-cli deploy mycontract.arl --amount 15.5tz ``` -------------------------------- ### Deploying Archetype Contract with completium-cli Parameters Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/declarations/contract.md Example command using `completium-cli` to deploy an Archetype contract (`escrow.arl`) and provide values for its variable parameters (`seller`, `buyer`) via a JSON string. ```bash completium-cli deploy escrow.arl --parameters '{ "seller" : "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", "buyer" : "tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6" }' ``` -------------------------------- ### Emit Example Event in Archetype Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/operation.md Demonstrates emitting the `HighestBidIncreased` event, populating its fields with the contract's `source` address and the `transferred` amount from the current call. ```Archetype emit({ source; transferred }) ``` -------------------------------- ### Example Archetype Event Declaration Source: https://github.com/completium/archetype-docs/blob/main/docs/reference/instructions/operation.md Defines an example event type `HighestBidIncreased` with fields for the bidder's address and the bid amount in tez. This event can then be emitted by the contract. ```Archetype event HighestBidIncreased {\n bidder : address;\n amount : tez\n} ``` -------------------------------- ### Example Test Output (Completium) Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/writingtests.md This shows the typical output format when running tests structured with `describe` and `it` using the Completium test runner. ```completium [HELLO] Call entry ✔ Call 'exec' ✔ Call 'exec2' ``` -------------------------------- ### Showing Tezos Client Binary Path in Completium CLI Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/network.md Displays the currently configured absolute path to the Tezos client binary that `completium-cli` is set to use. An example output shows the path. ```completium completium-cli show binary path tezos-client ``` -------------------------------- ### Declaring Archetype Event and Entry Point Source: https://github.com/completium/archetype-docs/blob/main/docs/tests/binding.md Defines an Archetype contract named 'example' containing an event 'HelloEvent' with a string field and an entry point 'exec' that emits an instance of 'HelloEvent'. This serves as the Archetype source for demonstrating event handling. ```archetype archetype example event HelloEvent { msg : string } entry exec() { emit({ "Hello from exec!" }) } ``` -------------------------------- ### Displaying Completium CLI Help Source: https://github.com/completium/archetype-docs/blob/main/docs/cli/introduction.md Shows the list of available commands and options for the Completium CLI tool. ```completium completium-cli help ``` -------------------------------- ### Deploying Contract from Archetype with Variable Parameter (Archetype) Source: https://github.com/completium/archetype-docs/blob/main/src/components/desc/create_contract.md Shows how to originate a contract from an Archetype source file (`simple.arl`) using `create_contract`. Contract parameters are passed as a record. This example sets a variable parameter `owner` to the current caller's address. ```archetype archetype anothercontract import "simple.arl" entry exec() { const op_addr : (operation * address) = create_contract(simple, none, 0tz, { owner = caller }); operations := [op_addr[0]] } ``` -------------------------------- ### Using useConnect Hook for Wallet Login (TSX) Source: https://github.com/completium/archetype-docs/blob/main/docs/dapps/project/beacon.md This example demonstrates how to consume the `useConnect` hook from the `Beacon` context. It retrieves the `connect` function and attaches it to a button's `onClick` event handler, allowing the user to initiate the wallet connection process. ```tsx import { useConnect } from '../store/Beacon' const LoginButton = () => { const connect = useConnect() return