Skip to content

Commit

Permalink
docs: updated experimental docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobinstein committed Mar 22, 2024
1 parent d8bf80d commit 94fb476
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 6 deletions.
18 changes: 14 additions & 4 deletions docs/src/experimental/ao-ant.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,28 @@ If things work successfully, your aos terminal will print "undefined".

Simply loading the script into your process will set variables and handlers to make your process conform to the ant standard, but you will still need to send an initiate request to add your ANT into the ao registry.

### Set Controler
### Set Controller

Only authorized people can make updates to your ArNS name. Because of this, you will need to add your process ID as a 'controller' under your ArNS name at [arns.app](https://arns.app). This will give your process permissions needed to make these updates

### Initiate Record Update
### Initiate Record Sync and Update

When you purchase an ArNS name on arns.app, that name is not automatically synced to the ao-ArNS registry. Anyone can initiate a sync, which loads the data of an ArNS name from the smartweave contract into the ao-ArNS registry:

```shell
Send({ Target = "COnVYFiqpycAJrFQbrKIgUEAZ1L98sF0h_26G8GxRpQ", Tags = { Action = "Initiate-Record-Sync", Name = "<ArNS-name-to-sync" }})
```
Be sure to replace `<ArNS-name-to-sync>` with the correct ArNS name.
**NOTE**: Syncing data from the ArNS smartweave contract relies on the [Orbit Oracle](https://0rbit.co/). ao and Orbit are still in early development, and may not perform exactly as expected.
Once your process is a controller, and you have loaded the ANT script, you can initiate an update to the ao-ArNS registry by running the following command:
```shell
Send({ Target = ARNS_PROCESS_ID, Tags = { Action = "Initiate-Record-Update", Name = "<your-arns-name", ProcessId = ao.id }})
Send({ Target = ARNS_PROCESS_ID, Tags = { Action = "Initiate-Record-Update", Name = "<your-arns-name>", ProcessId = ao.id }})
```
Make sure to change `<your-arns-name` to the ArNS name you are trying to update.
Make sure to change `<your-arns-name` to the ArNS name you are trying to update. When you load the arns.lua script, the variable `ARNS_PROCESS_ID` is set to `COnVYFiqpycAJrFQbrKIgUEAZ1L98sF0h_26G8GxRpQ`, which is the process id of the ao-ArNS registry.
Once this is done, anyone will be able to resolve your ArNS name from inside ao and have easy access to your process Id.
113 changes: 111 additions & 2 deletions docs/src/experimental/ao-resolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ NAMES['ardrive']
```


and use that variable in other commands that need to reference any of the data.



The resolve command will first check the ao-ArNS registry for any information on the name. If there is a `contractTxId` field present, it will then make a request to the ArNS smartweave contract, using the [Orbit Oracle](https://0rbit.co/), in order to try and get more information about the contract state for the underlying ANT. Then, if there is a processId field, a request will be made to that process to try and get ao specific information. This loads information into your local process at each step. For example, The first bit of information coming from the ao-Arns registry will look like this:

```js
ardrive = {
contractTxId = "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
Expand All @@ -69,7 +75,98 @@ NAMES['ardrive']
}
```

and use that variable in other commands that need to reference any of the data.
After Orbit returns the information from the ArNS smartweave contract, that data will be added under a `contract` key:

```js
ardrive = {
contractTxId = "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
contract = {
controller = "6Z-ifqgVi1jOwMvSNwKWs6ewUEQ0gU9eo4aHYC3rN1M",
ticker = "ANT-ARDRIVE",
name = "ArDrive.io",
lastUpdated = 1711118753890,
owner = "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
balances = {
QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ = 1
},
records = {
@ = {
ttlSeconds = 3600,
transactionId = "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y"
},
cn = {
ttlSeconds = 3300,
transactionId = "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k"
},
og = {
ttlSeconds = 3600,
transactionId = "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo"
},
logo = {
ttlSeconds = 3600,
transactionId = "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A"
},
og_logo = {
ttlSeconds = 3600,
transactionId = "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co"
},
dapp = {
ttlSeconds = 3600,
transactionId = "qrWdhy_PxrniBUlYn0macF-YbNgbmnmV5OVSrVRxxV8"
},
og_dapp = {
ttlSeconds = 3600,
transactionId = "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI"
}
}
},
lastUpdated = 1711118166407,
record = {
type = "lease",
contractTxId = "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
undernames = 100,
startTimestamp = 1694101828,
endTimestamp = 1711122739,
purchasePrice = 0
}
}
```

and an ArNS name with ao process information could look like this:

```js
blackjack = {
contractTxId = "ydbc4JLjKeurnbTBp15vlZX1Zz9StgfpZ7prVZOGA3I",
process = {
denomination = "1",
lastUpdated = 1711049563689,
ticker = "ANT-BlackJack",
name = "BlackJack",
logo = "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A",
owner = "cF0H0SKdnaDTqWKY9iJKBktTpdEWgb3GnlndE7ABv0Q",
controllers = "["iKryOeZQMONi2965nKz528htMMN_sBcjlhc-VncoRjA","w4AORX9fhPbICNgbgTzq-uLyAsut4pKw_TJSFS-K3Tc","oEy0Wkxod2DAngJby28dhyiaD150SAJLqAfFNrbbEbY"]",
records = {
@ = {
ttlSeconds = 3600,
transactionId = "Lt3pyCXSdM9R2_lxhnqj3rzzhuLszT8s-p8vM1fpeJc"
}
}
},
lastUpdated = 1711049561377,
processId = "Vo7O7WJ2OPlKBtudjfeOdzjcjpi_-V_RLE27VpZP8jA",
record = {
type = "lease",
contractTxId = "ydbc4JLjKeurnbTBp15vlZX1Zz9StgfpZ7prVZOGA3I",
undernames = 10,
processId = "Vo7O7WJ2OPlKBtudjfeOdzjcjpi_-V_RLE27VpZP8jA",
startTimestamp = 1710964910,
endTimestamp = 1742500910,
purchasePrice = 875
}
}
```

**NOTE**: Syncing data from the ArNS smartweave contract relies on the [Orbit Oracle](https://0rbit.co/). ao and Orbit are still in early development, and may not perform exactly as expected.

### Data

Expand All @@ -82,6 +179,18 @@ ARNS.data('blackjack')
```
would give the output `Vo7O7WJ2OPlKBtudjfeOdzjcjpi_-V_RLE27VpZP8jA`, which is the process id of an ao black jack game. The command `ARNS.data('blackjack')` can be used in place of anywhere that you would normally have to input that process id.

Process Id information will be prioritized over contract information, so if an ArNS name has both, the process id will be returned instead of the contract id.

#### Undernames

ArNS supports undernames, which are subdomains that exist on an ArNS name. They are separated by underscores (`_`) instead of dots (`.`) like a subdomain on a traditional domain would be. the `data` method can return information about a specific undername on an ArNS name if you specify it.

```shell
ARNS.data('dapp_ardrive')
```

will return `qrWdhy_PxrniBUlYn0macF-YbNgbmnmV5OVSrVRxxV8`, which is the transaction id for the `dapp` undername on the `ardrive` ArNS name.

### Owner

Owner will, as its name indicates, return the Arweave wallet address that owns an ArNS name. It also uses the same syntax as the other commands:
Expand Down Expand Up @@ -115,7 +224,7 @@ does not have the fields "contract" or "process", so if you tried to get `ARNS.d
ARNS.id('ardrive')
```

instead will get the contractTxId value from the top level, and return that value.
instead will get the contractTxId value from the top level, and return that value. Just like with `data`, a process id is prioritized over a contract id.

### Clear

Expand Down

0 comments on commit 94fb476

Please sign in to comment.