/algodot-build

Release page for Algodot

Primary LanguageGDScriptMIT LicenseMIT

algodot

Algorand integration in Godot

Download the addon

Link coming soon!

Usage

Initializing the Algod object

algod = Algod.new()
algod.url = "http://localhost:4001"
algod.token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
add_child(algod)

Test connections using .health()

assert(yield(algod.health(), "completed") == OK)

Sending transactions

var from_mnemonic = "your twenty five word mnemonic ..."
var from_address = algod.get_address(from_mnemonic)

# Get suggested parameters
var params = yield(algod.suggested_transaction_params(), "completed")

# Generate a new account
var to_account = algod.generate_key()

# Create and sign transaction
var tx = algod.construct_payment(params, from_address, account[0], 123456789)
var stx = algod.sign_transaction(tx, from_mnemonic)
var txid = yield(algod.send_transaction(stx), "completed")

# Wait for confirmation
yield(algod.wait_for_transaction(txid), "completed")
var info = yield(algod.account_information(account[0]), "completed")

assert(info.amount == 123456789)

For more examples, check out the test script.