Giter VIP home page Giter VIP logo

ao-lua-weavedrive-template's Introduction

Process on AO

This repository contains the source code to start building on AO and AOS quickly. Includes testing and ci/cd configurations. Testing and building is done in typescript, with the module code designed for eval again AOS-Lua ao modules.

Setup

Install

First install the npm dependencies

yarn

Then install the ao cli - read the docs here Below is latest version as of writing, refer to the docs for the latest version.

curl -L https://arweave.net/iVthglhSN7G9LuJSU_h5Wy_lcEa0RE4VQmrtoBMj7Bw | bash

You may need to follow the instructions in the cli to add the program to your PATH.

Testing

To test the module, you can use the following command to run the testing suites that use AoLoader and node native testing (requires node 20+)

yarn test

Building the AOS code

Build

This bundles the ant-aos code and outputs it to dist folder. This can then be used to send to the Eval method on AOS to load the ANT source code.

yarn aos:build

Publish

Ensure that in the tools directory you place you Arweave JWK as key.json

yarn aos:publish

Load

This will load an AOS module into the loader, followed by the bundled aos Lua file to verify that it is a valid build.

yarn aos:load

Spawn

this will spawn an aos process and load the bundled lua code into it.

yarn aos:spawn

This will deploy the bundled lua file to arweave as an L1 transaction, so your wallet will need AR to pay the gas.

Building the custom module

Using the ao-dev-cli.

Build

This will compile the standalone ANT module to wasm, as a file named process.wasm and loads the module in AO Loader to validate the WASM program is valid.

yarn module:build

Publish

Publishes the custom ANT module to arweave - requires you placed your JWK in the tools directory. May require AR in the wallet to pay gas.

yarn module:publish

Load

Loads the module in AO Loader to validate the WASM program is valid.

yarn module:load

Requires module:build to have been called so that process.wasm exists.

Spawn

Spawns a process with the process.wasm file.

yarn module:spawn

Handler Methods

For interacting with handlers please refer to the AO Cookbook

Read Methods

Info

Retrieves the Name, Ticker, Total supply, Logo, Denomination, and Owner of the ANT.

Tag Name Type Pattern Required Description
Action string "Info" true Action tag for triggering handler

Developers

Requirements

Lua Setup (MacOS)

  1. Clone the repository and navigate to the project directory.

  2. Install lua

  3. Add the following to your .zshrc or .bashrc file:

    echo 'export LDFLAGS="-L/usr/local/opt/[email protected]/lib"' >> ~/.zshrc
    echo 'export CPPFLAGS="-I/usr/local/opt/[email protected]/include"' >> ~/.zshrc
    echo 'export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"' >> ~/.zshrc
    echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  4. Run source ~/.zshrc or source ~/.bashrc to apply the changes.

  5. Run lua -v to verify the installation.

aos

To load the module into the aos REPL, run the following command:

aos --load src/main.lua

Code Formatting

The code is formatted using stylua. To install stylua, run the following command:

cargo install stylua
stylua contract

Testing

To run the tests, execute the following command:

yarn test

Additional Resources

ao-lua-weavedrive-template's People

Contributors

atticusofsparta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.