accountpermissionupdate

How to use it

// yarn add @tatumio/tatum

import { TatumSDK, Tron, Network, TronPermission, AccountPermissionUpdateOptions } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Tron>({network: Network.TRON})

const owner: TronPermission = {
  type: 0,
  permissionName: "owner",
  threshold: 1,
  operations: "",
  keys: [
    {
      address: "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
      weight: 1
    }
  ]
}

const active: TronPermission = {
  "type": 2,
  "permission_name": "active0",
  "threshold": 2,
  "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000",
  "keys": [
    {
      "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
      "weight": 1
    },
    {
      "address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1",
      "weight": 1
    }
  ]
}

const res = await tatum.rpc.accountPermissionUpdate('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', [active], owner, {
  visible: true
})

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Overview

The accountPermissionUpdate method is used to update an account's permissions on the TRON network. These permissions include the owner permission, account witness permissions, and a list of active permissions. The response is an unsigned transaction, with the transaction type being AccountPermissionUpdateContract.

Parameters

  • ownerAddress (string): The address of the owner.

  • actives (TronPermission[]): An array of active permissions for the account.

  • owner (TronPermission): The owner permission for the account.

  • options (object, optional): This optional parameter contains the following properties:

    • visible (boolean, optional): Optional parameter to specify whether the address is in base58 format.

Each TronPermission object has the following properties:

  • type (number): The permission type.

  • permissionName (string): The permission name.

  • threshold (number): The threshold.

  • operations (string): The operations the permission has.

  • keys (Array<{ address: string, weight: number }>): An array of objects that represent the addresses and their respective weights that jointly own the permission. Up to 5 keys are allowed.