1.2.7 • Published 6 months ago

@permaweb/aos-cli v1.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

AOS REPL

NOTE: This is very experimental, use for research and development purposes only.

The repl is a thin client to access and execute ao contracts on the permaweb.

Getting Started

# create new project add arweave
yarn init -y
yarn add arweave

# Generate Wallet
node -e "require('arweave').init({}).wallets.generate().then(JSON.stringify).then(console.log.bind(console))" > wallet.json

# Boot up AOS
npx @permaweb/aos-cli@latest wallet.json

The wallet creates a personal process that allows you to use as a repl, you can send it commands and it will evaluate and return output.

About

AOS-CLI is a simple REPL that connects to a Personal AOS Process in the AO network. The AO network is a messaging passing process architecture. A Personal AOS Process is like a CPU on the Arweave Network. This repl will allow you to pass LUA expressions to your process, and those expressions get evaluated and return output to your screen.

Examples

When you boot up the OS, you can use https://lua.org to run expressions on your AOS Process.

First try "Hello AOS" - the return keyword sets the output variable that is passed to the output on the screen.

"Hello AOS"

You should get Hello AOS

What is happening here? You input, is getting wrapped in an signed AO message and submitted to a mu or messenger unit, which then forwards it to a su or Sequencer Unit, then the REPL app, calls the cu compute unit to evaluate the AO Message with your Personal Process. This generates output to be returned for display.

Lets try another expression:

1 + 41

You should get 42 the answer to the universe :P

So, thats cool, you can send expressions to the AO network and get them evaluated and get a response.

You can also set variables:

a = "Hello AOS"

Then type return a and you should get Hello AOS, neat

You can also create functions:

sayHi = function (name) return "Hello " .. name end
return sayHi("Sam")

You should get Hello Sam

Woohoo!

We can also pass messages to other AOS Processes!

return send("9ps7pnC7hpdCYJGJujAg_QY-cyKbQ1GoaE5h-4elI9c", { body = "Hi Tom!" })

Or you can check your messages ( by creating a message check function)

function checkInbox() local o = ""; for i,v in ipairs(inbox) do o = o .. v.body .. '\n' end; return o; end
checkInbox()

[{"from":"9ps7pnC7hpdCYJGJujAg_QY-cyKbQ1GoaE5h-4elI9c","body":"Hi"}]

1.2.7

6 months ago

1.2.6

6 months ago

1.2.5

6 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

7 months ago

1.1.15

7 months ago

1.1.14

7 months ago

1.1.13

7 months ago

1.1.12

7 months ago

1.1.11

7 months ago

1.1.10

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago