All functions

An example using all functions:

RPC = "KATANA"
ACCOUNT_ADDRESS = "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973"
ACCOUNT_PRIVKEY = "0x1800000000300000180000000000030000000000003006001800006600"

-- No args -> kipt.out
local logger = logger_init()

-- Reuse this opts in each one as each function
-- only looks for it's configuration options. The other
-- are ignored.

local decl_res, err = declare(
    "mycontract",
    { watch_interval = 300, artifacts_path = "./target/dev" }
)

if err then
  print(err)
  os.exit(1)
end

print("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)
end

local 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)
end

print("Invoke TX hash: " .. invk_res.tx_hash)

local call_res, err = call(contract_address, "get_a", {}, {})
print_str_array(call_res)

The output auto-generated by Kipt due to the use of logger_init() is the following:

-- Friday, November  3, 2023 02:24:58 --

> declare: mycontract
|     tx_hash      |  0x003fc5e719e67eedcefd3f1ac9902f5d09a1e1839d99441b8d52e4564879255f  |
|    class_hash    |  0x06013bb81a928bd226416a34bdfabd7a69b43bab2911a8ae3647a4ba9706bfc0  |

> deploy: 0x06013bb81a928bd226416a34bdfabd7a69b43bab2911a8ae3647a4ba9706bfc0
|     tx_hash      |  0x008fdb1a82b1f5b76597a45919def8d592c6a4de99378897090031d4c63ab712  |
| deployed address |  0x0128c14a284dac9224afff4ad9c8a071e561932166c2ced2544ed0c67b4cecce  |

> invoke: 1
call #0 -> 0x0128c14a284dac9224afff4ad9c8a071e561932166c2ced2544ed0c67b4cecce set_a
|     tx_hash      |  0x00420beed7f7395f29ce81595ffc35cb97732a6d83b298208cf8f3df621e8f95  |