Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1787756
undernames init lua file
bhavyagor12 Sep 5, 2025
d4974f2
tested working with aos
bhavyagor12 Sep 8, 2025
ca06ce2
added guide with commands for easy testing
bhavyagor12 Sep 8, 2025
fee85a9
small fix on reserved
bhavyagor12 Sep 9, 2025
c905d22
fix issues with handling requests + throw errors as replies rather th…
bhavyagor12 Sep 9, 2025
11e243b
removed prints + tested everything manually
bhavyagor12 Sep 9, 2025
f235125
init flow demo files
bhavyagor12 Sep 10, 2025
af1dafc
fix issue with badge not showing up well
bhavyagor12 Sep 10, 2025
ba3954f
rejection with reason in the table
bhavyagor12 Sep 10, 2025
cac57bf
a lot of new UI changes to UndernameRequests and display
bhavyagor12 Sep 10, 2025
8313e49
basic stuff with claim username above users requests
bhavyagor12 Sep 10, 2025
b7ec47b
UI changes + cleanup of non used components
bhavyagor12 Sep 11, 2025
bfe73e3
handle basic review approval ui on a request
bhavyagor12 Sep 11, 2025
00c4c57
remove click from username panel (todo later)
bhavyagor12 Sep 11, 2025
1bcd02b
provider and constants for interactions
bhavyagor12 Sep 11, 2025
03738fb
move things around + rename casing for variables in lua
bhavyagor12 Sep 11, 2025
79c047c
handle read and send msg properly
bhavyagor12 Sep 11, 2025
0607b8e
fetch working from process
bhavyagor12 Sep 11, 2025
c1cc66f
working fetch of actual data from process for owners and requesters
bhavyagor12 Sep 11, 2025
d094f41
undernames.lua file more changes after feedback + minor tweaks
bhavyagor12 Sep 11, 2025
28fb926
mock owner data with owners fully working
bhavyagor12 Sep 11, 2025
4b3c8c3
release of name to be possible by owner of the name and the admin
bhavyagor12 Sep 11, 2025
3068cc5
request flow working
bhavyagor12 Sep 11, 2025
61bbe86
working claim flow
bhavyagor12 Sep 12, 2025
31fe704
ui changes, move components around
bhavyagor12 Sep 12, 2025
030f959
loading states + release functionality + stop checkavailabilty on num…
bhavyagor12 Sep 12, 2025
3f3d1f6
release undername flow tested successfully
bhavyagor12 Sep 15, 2025
97179fd
owner changes fix
bhavyagor12 Sep 15, 2025
d89bd6e
claimundername separate component - show username instead of user wal…
bhavyagor12 Sep 16, 2025
774d5b7
added validations before claiming undername - with compute states to …
bhavyagor12 Sep 16, 2025
b9bd0ca
validations made better + self claim flow might work + cleanup
bhavyagor12 Sep 16, 2025
c4487e9
button dont show + import
bhavyagor12 Sep 16, 2025
5bca916
undername self-claim also working
bhavyagor12 Sep 16, 2025
0c2c0d2
move release and approve logic in process + add controller from UI
bhavyagor12 Sep 16, 2025
bfa1b52
rename controller - confirmation modal - undername changed to subdoma…
bhavyagor12 Sep 17, 2025
4a4a031
released showing up in requests table
bhavyagor12 Sep 17, 2025
31956e7
new flow for claiming / request a subdomain when portal is being created
bhavyagor12 Sep 18, 2025
cd0ca68
cleanup + final pushes + made domain page better with conditional ren…
bhavyagor12 Sep 18, 2025
60f5f53
updated guide to work with the new process + added instructions to wo…
bhavyagor12 Sep 18, 2025
c18ed15
show only portal owned names for the portal
bhavyagor12 Sep 18, 2025
f0eadfe
new hyperbeam changes
bhavyagor12 Sep 22, 2025
de3bb46
admin view, fix approve to pass requester, filters added
bhavyagor12 Sep 24, 2025
8f2b5ff
added admin
bhavyagor12 Sep 24, 2025
66a73cf
fix errors showcase + success message while claiming subdomains using…
bhavyagor12 Sep 24, 2025
a03c0e7
admin approve fixed + dont show admin page on non admin wallet
bhavyagor12 Sep 24, 2025
fc9192e
resolve issues with rebase
bhavyagor12 Sep 30, 2025
5e19ad0
language fix
bhavyagor12 Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions lua/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
## Overview
Its a Review Approval flow that allows admins to approve or reject requests for claiming undernames. The flow includes the following steps:
1. User submits a request to claim an undername.
2. Admin reviews the request and either approves or rejects it.
3. If approved, the undername is attached to the user's portal.
4. If rejected, the user is notified of the rejection.
5. The system logs the action for auditing purposes.

With this basic flow in mind, some additional considerations:
1. Maximum number of undernames a user can claim. (this could be a fixed number and admin should be able to change it)
2. Reserved undernames for certain users or groups (e.g., verified users, premium members) => map user address to a list of reserved undernames (admin can manage this list)
3. Undername format validation (e.g., no special characters, minimum/maximum length)
4. A Policy block that can have some admin rules / configs (maxPerAddr, requireApproval) => say initially admins want to allow everyone to directly claim

## Roles
1. User: requests an undername.
2. Controller: reviews requests, approves/rejects, reserves names, changes policy.

## State
1. Owners: name -> ownerAddress (the source of truth for “taken”).
2. Reserved: name -> { to?: address, by, at }
If to matches the requester, they auto-claim on request. (this is useful for users that have names reserved for them)
3. Requests: pending/approved/rejected/cancelled items with timestamps.
4. Policy: { maxPerAddr, requireApproval }.

## Flow
1. UI will call the process to `CheckAvailability(name)` to see if the undername is available or not. (Before this do validations directly from ARNS)
2. If available, user can `RequestUndername(name)`.
- If reserved for them, it auto-claims.
- If not reserved and requireApproval is false, it auto-claims.
- Otherwise, it goes to pending state.
3. Controller view can see all pending requests.
- Approve → assign ownership and clear any reservation.
- Reject → store reason; user stays unassigned.
4. If name reserved / already taken - show try another name message.
5. User can `CancelRequest(name)` if pending.
6. User can `ReleaseUndername(name)` if owned.
7. If User hit cap → “per-address limit reached.”

## Policy (Admin Config)
Allow for dynamic flags to be added so that the core flow can be adjusted without a lot of code changes.
Basic considerations here -
1. requireApproval:
- true → all non-reserved requests go to review.
- false → anyone can self-claim (still respects maxPerAddr).
2. Future-proof: add more flags without changing the flow.
3. maxPerAddr: cap on how many undernames one address can own (e.g., 1, 2, 4…).

## Before starting
1. Make sure to make the process as a controller in the arns record.
2. Update 'TESTING_UNDERNAME' to the record you known that you just added the process as a controller.


## Commands to work with the lua file

### Super Admin

``` bash
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.Bootstrap" } }) # init the process with current caller as super admin
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.AddController", ["Addr"]="<ADDR>" } }) # add a controller replace <ADDR> with the address
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.RemoveController", ["Addr"]="<ADDR>" } }) # remove a controller replace <ADDR> with the address
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.ListControllers" } }) # list all controllers
```

### Reserved undernames (Admin action)

``` bash
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.AddReserved", ["Name"]="<UNDERNAME>", ["To"]="<ADDR>" } }) # reserve <UNDERNAME> for <ADDR> replace <UNDERNAME> and <ADDR>
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.RemoveReserved", ["Name"]="<UNDERNAME>" } }) # remove reservation for <UNDERNAME> replace <UNDERNAME>
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.ListReserved" } })
```

### Availability check (User action)

``` bash
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.CheckAvailability", ["Name"]="<UNDERNAME>" } }) # check if <UNDERNAME> is available replace <UNDERNAME>
```

### Request undername

``` bash
Send({ Target = ao.id, Tags = {
["Action"]="PortalRegistry.Request",
["Name"]="<UNDERNAME>",
["Ant-Process-Id"]="<ANT_PROCESS_ID>", # parent ANT process id (ArNS name’s process)
["Record-Transaction-Id"]="<TX_ID_43CHARS>", # target tx for the undername
["Record-TTL-Seconds"]="<TTL:60..86400>", # e.g. "900"
["Record-Priority"]="<OPTIONAL_NUMBER>" # optional
} })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.Cancel", ["Id"]="<ID>" } })
Send({ Target = ao.id, Tags = {
["Action"]="PortalRegistry.Approve",
["Id"]="<REQUEST_ID>",
["Ant-Process-Id"]="<ANT_PROCESS_ID>",
["Record-Transaction-Id"]="<TX_ID_43CHARS>",
["Record-TTL-Seconds"]="<TTL:60..86400>",
["Record-Priority"]="<OPTIONAL_NUMBER>"
} })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.Reject", ["Id"]="<ID>", ["Reason"]="<REASON>" } })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.ListRequests" } })
```


### Read state

``` bash
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.ListUndernames" } })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.Audit" } })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.Export" } })
```

### Ownership Read + Release

``` bash
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.OwnerOf", ["Name"]="<UNDERNAME>" } })
Send({ Target = ao.id, Tags = {
["Action"]="PortalRegistry.ForceRelease",
["Name"]="<UNDERNAME>",
["Reason"]="<REASON>",
["Ant-Process-Id"]="<ANT_PROCESS_ID>"
} })
```



### Policy
``` bash
# Set both (example)
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.SetPolicy", ["MaxPerEntity"]="1", ["RequireApproval"]="true" } })

# Set individually
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.SetPolicy", ["MaxPerEntity"]="<POS_INT>" } })
Send({ Target = ao.id, Tags = { ["Action"]="PortalRegistry.SetPolicy", ["RequireApproval"]="true|false" } })
```
Loading