Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glihm/kipt
Channel some Ki with Lua scripts for sending transactions to Starknet, powered by Rust.
https://github.com/glihm/kipt
lua rust starknet web3
Last synced: 24 days ago
JSON representation
Channel some Ki with Lua scripts for sending transactions to Starknet, powered by Rust.
- Host: GitHub
- URL: https://github.com/glihm/kipt
- Owner: glihm
- Created: 2023-11-02T03:04:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-24T18:31:07.000Z (11 months ago)
- Last Synced: 2024-08-04T01:03:54.473Z (4 months ago)
- Topics: lua, rust, starknet, web3
- Language: Rust
- Homepage: https://glihm.github.io/kipt/
- Size: 121 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starknet - kipt - Collections of Lua scripts to manage contracts. (Additional developer resources)
README
# Kipt
Kipt is leveraging the simplicity of Lua scripts to manage Starknet contracts using `starknet-rs` under the hood.
With few lines, you can declare, deploy, invoke and call contracts.The main focus of Kipt is to be used in the CI, without the need
to write bash script using Cast from Starknet Foundry or Starkli.Under the hood, Kipt is using `starknet-rs` to interact with Starknet.
Please take 5 min to read the book here, it's short and very helpful to get started!
# Lua, an other language to learn?
You don't know Lua? No problem at all, it's a very small and easy scripting language, [beginner guide here](https://github.com/pohka/Lua-Beginners-Guide) and [full documentation here](https://www.lua.org/manual/5.4/manual.html). And to use Kipt, you only need to know very few element of the language.
If you prefer a short cheatsheet, go [here](https://devhints.io/lua) or [here](https://gist.github.com/nilesh-tawari/02078ae5b83ce3c90f476c4858c60693).
(For those who have already written an add-on for a famous MMO, welcome home!)
# Quick start
To test Kipt, the easiest way is:
1. Install Kipt
```bash
# 1. Install
curl https://raw.githubusercontent.com/glihm/kipt/main/kiptup/install | sh
source ~/.bashrc
kiptup
```2. Create a simple "demo.lua" script copying the example below, replacing with the name of your contract.
3. Spin up katana in an other terminal.
4. Run `kipt --lua ./demo.lua`.# Example
```lua
RPC = "KATANA"
ACCOUNT_ADDRESS = "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03"
ACCOUNT_PRIVKEY = "0x1800000000300000180000000000030000000000003006001800006600"-- No args -> kipt.out
local logger = logger_init()local decl_res, err = declare(
"mycontract",
{ watch_interval = 300, artifacts_path = "./target/dev" }
)if err then
print(err)
os.exit(1)
endprint("Declared class_hash: " .. decl_res.class_hash)
-- Deploy with no constructor args.
local depl_res, err = deploy(decl_res.class_hash, {}, { watch_interval = 300, salt = "0x1234" })if err then
print(err)
os.exit(2)
endlocal contract_address = depl_res.deployed_address
print("Contract deployed at: " .. contract_address)-- Invoke to set a value.
local invk_res, err = invoke(
{
{
to = contract_address,
func = "set_a",
calldata = { "0x1234" },
},
},
{ watch_interval = 300 }
)if err then
print(err)
os.exit(3)
endprint("Invoke TX hash: " .. invk_res.tx_hash)
local call_res, err = call(contract_address, "get_a", {}, {})
print_str_array(call_res)
```