AR.IO SDKANT Contracts
State
getInfo()
Retrieves the information of the ANT process.
const info = await ant.getInfo();Output:
{
"name": "ArDrive",
"ticker": "ANT-ARDRIVE",
"description": "This is the ANT for the ArDrive decentralized web app.",
"keywords": ["File-sharing", "Publishing", "dApp"],
"owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ"
}getHandlers()
Retrieves the handlers supported on the ANT
const handlers = await ant.getHandlers();Output:
[
"_eval",
"_default",
"transfer",
"balance",
"balances",
"totalSupply",
"info",
"addController",
"removeController",
"controllers",
"setRecord",
"removeRecord",
"record",
"records",
"setName",
"setTicker",
"initializeState",
"state"
]getState()
Retrieves the state of the ANT process.
const state = await ant.getState();Output:
{
"TotalSupply": 1,
"Balances": {
"98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY": 1
},
"Controllers": [],
"Records": {
"v1-0-0_whitepaper": {
"transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
"ttlSeconds": 900
},
"@": {
"transactionId": "2rMLb2uHAyEt7jSu6bXtKx8e-jOfIf7E-DOgQnm8EtU",
"ttlSeconds": 3600
},
"alice": {
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
"ttlSeconds": 900,
"owner": "alice-wallet-address-123...",
"displayName": "Alice's Portfolio",
"logo": "avatar-tx-id-456...",
"description": "Personal portfolio and blog",
"keywords": ["portfolio", "personal", "blog"]
},
"whitepaper": {
"transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
"ttlSeconds": 900
}
},
"Initialized": true,
"Ticker": "ANT-AR-IO",
"Description": "A friendly description for this ANT.",
"Keywords": ["keyword1", "keyword2", "keyword3"],
"Logo": "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A",
"Denomination": 0,
"Name": "AR.IO Foundation",
"Owner": "98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY"
}getOwner()
Returns the owner of the configured ANT process.
const owner = await ant.getOwner();Output:
"ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4"getName()
Returns the name of the ANT (not the same as ArNS name).
const name = await ant.getName();Output:
"ArDrive"getTicker()
Returns the ticker symbol of the ANT.
const ticker = await ant.getTicker();Output:
"ANT-ARDRIVE"getControllers()
Returns the controllers of the configured ANT process.
const controllers = await ant.getControllers();Output:
["ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4"]getRecords()
Returns all records on the configured ANT process, including the required @ record that resolve connected ArNS names.
const records = await ant.getRecords();Output:
{
"@": {
"transactionId": "UyC5P5qKPZaltMmmZAWdakhlDXsBF6qmyrbWYFchRTk",
"ttlSeconds": 3600
},
"alice": {
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
"ttlSeconds": 900,
"owner": "alice-wallet-address-123...",
"displayName": "Alice's Portfolio",
"logo": "avatar-tx-id-456...",
"description": "Personal portfolio and blog",
"keywords": ["portfolio", "personal", "blog"]
},
"zed": {
"transactionId": "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI",
"ttlSeconds": 900
},
"ardrive": {
"transactionId": "-cucucachoodwedwedoiwepodiwpodiwpoidpwoiedp",
"ttlSeconds": 900
}
}getRecord()
Returns a specific record by its undername.
const record = await ant.getRecord({ undername: 'dapp' });Output:
{
"transactionId": "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
"ttlSeconds": 900,
"owner": "alice-wallet-address-123...",
"displayName": "Alice's Site",
"logo": "avatar-tx-id-456...",
"description": "Personal portfolio and blog",
"keywords": ["portfolio", "personal", "blog"]
}How is this guide?