setController

setController is a method on the ANT class that adds a new controller to the ANT's list of approved controllers. Controllers have permissions to set records and modify the ANT process's ticker and name.

setController requires authentication.

Parameters

ParameterTypeDescriptionOptional
controllerstring - WalletAddressThe public wallet address of the controller to be addedfalse
tagsarrayAn array of GQL tag objects to attach to the transfer AO messagetrue

Examples

setController

 const fs = require("fs");
 const { ANT, ArweaveSigner } = require("@ar.io/sdk");

 async function main() {
 const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
 const ant = ANT.init({
     signer: new ArweaveSigner(jwk),
     processId: "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM"
 });

 const { id: txId } = await ant.setController(
         { controller: 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f' },
         // optional additional tags
         { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
     );
 }

 main();