Skip to content

Commit

Permalink
fix(types): add alias for unsafe addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Dec 4, 2024
1 parent a44924e commit 2242e41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/common/balances.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ local utils = require(".common.utils")

local balances = {}

---@alias AllowUnsafeAddresses boolean Whether to allow unsafe addresses

--- Transfers the ANT to a specified wallet.
---@param to string - The wallet address to transfer the balance to.
---@param allowUnsafeAddresses boolean Whether to allow unsafe addresses
---@param allowUnsafeAddresses AllowUnsafeAddresses
---@return table<string, integer>
function balances.transfer(to, allowUnsafeAddresses)
assert(utils.isValidAOAddress(to, allowUnsafeAddresses), "Invalid AO Address")
Expand All @@ -21,7 +23,7 @@ end

--- Retrieves the balance of a specified wallet.
---@param address string - The wallet address to retrieve the balance from.
---@param allowUnsafeAddresses boolean Whether to allow unsafe addresses
---@param allowUnsafeAddresses AllowUnsafeAddresses
---@return integer - Returns the balance of the specified wallet.
function balances.balance(address, allowUnsafeAddresses)
assert(utils.isValidAOAddress(address, allowUnsafeAddresses), "Invalid AO Address")
Expand Down
2 changes: 1 addition & 1 deletion src/common/controllers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local controllers = {}

--- Set a controller.
---@param controller string The controller to set.
---@param allowUnsafeAddresses boolean Whether to allow unsafe addresses
---@param allowUnsafeAddresses AllowUnsafeAddresses
---@return string[]
function controllers.setController(controller, allowUnsafeAddresses)
assert(utils.isValidAOAddress(controller, allowUnsafeAddresses), "Invalid AO Address")
Expand Down
2 changes: 2 additions & 0 deletions src/common/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@
--- Initialized: boolean,
--- Records: table<string, Record>,
---}

---@alias AllowUnsafeAddresses boolean Whether to allow unsafe addresses

0 comments on commit 2242e41

Please sign in to comment.