updateAccountPermissions

更新账户权限

用法

let ownerAddress = 'your address';
let ownerPk = 'your private key';
let ownerPermission = { type: 0, permission_name: 'owner' };
ownerPermission.threshold = 2;
ownerPermission.keys  = [];

let activePermission = { type: 2, permission_name: 'active0' };
activePermission.threshold = 3;
activePermission.operations = '7fff1fc0037e0000000000000000000000000000000000000000000000000000';
activePermission.keys = [];

ownerPermission.keys.push({ address: 'address1', weight: 1 });
ownerPermission.keys.push({ address: 'address2', weight: 1 });
activePermission.keys.push({ address: 'address1', weight: 1 });
activePermission.keys.push({ address: 'address2', weight: 1 });


const updateTransaction = await tronWeb.transactionBuilder.updateAccountPermissions(ownerAddress, ownerPermission, null, [activePermission]);

参数类型

ParameterDescriptionData Type
owner_address拥有owner 权限的地址。如果不传,该字段值默认为构造tronweb时传入的私钥所对应的地址。String
ownerPermissionsowner权限;其中type参数必须为0,表示owner。示例:
{
type: 0,
permission_name: 'owner',
threshold: 2,
keys: [
{
address: 'xxxxxxxx',
weight: 1
},
{
address: 'xxxxxxxx',
weight: 1
}
]
}
Object
witnessPermissionswitness权限,超级代表才需要设置该权限;普通用户应该传入 null。示例:
{
type: 1,
permission_name: 'witness'
}
Object
activesPermissionsactive权限;type字段不能是0和1,应该从2开始,表示active权限。示例:
[{
type: 2,
permission_name: 'active0',
threshold: 2,
operations: '7fff1fc0037e0000000000000000000000000000000000000000000000000000',
keys: [
{
address: 'xxxxxxxx',
weight: 1
},
{
address: 'xxxxxxxx',
weight: 1
}
]
}]
Array

返回值

object - 未签名的更新账户权限的交易

{
  "visible": false,
  "txID": "7f06b2e887dd9703ad481c6a7cafc1cd8857b354d0c45ebdf5eb82bfd0cf6d68",
  "raw_data": {
    "contract": [
      {
        "parameter": {
          "value": {
            "owner": {
              "keys": [
                {
                  "address": "413dd5ec509f7f5bf381070b7bbac66d24b4631bd4",
                  "weight": 1
                },
                {
                  "address": "410a0e30b7e7a75a0a4f74388e456406edeb557134",
                  "weight": 1
                },
                {
                  "address": "414d66511bf52280f9be386747e53f172e15b01815",
                  "weight": 1
                }
              ],
              "threshold": 3,
              "permission_name": "owner"
            },
            "owner_address": "413dd5ec509f7f5bf381070b7bbac66d24b4631bd4",
            "actives": [
              {
                "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000",
                "keys": [
                  {
                    "address": "413dd5ec509f7f5bf381070b7bbac66d24b4631bd4",
                    "weight": 1
                  },
                  {
                    "address": "410a0e30b7e7a75a0a4f74388e456406edeb557134",
                    "weight": 1
                  },
                  {
                    "address": "414d66511bf52280f9be386747e53f172e15b01815",
                    "weight": 1
                  }
                ],
                "threshold": 3,
                "type": "Active",
                "permission_name": "active0"
              }
            ]
          },
          "type_url": "type.googleapis.com/protocol.AccountPermissionUpdateContract"
        },
        "type": "AccountPermissionUpdateContract"
      }
    ],
    "ref_block_bytes": "000b",
    "ref_block_hash": "07653cf4b79aa839",
    "expiration": 1565312682000,
    "timestamp": 1565312624396
  },
  "raw_data_hex": "0a02000b220807653cf4b79aa839409090a09fc72d5abc02082e12b7020a3c747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e745065726d697373696f6e557064617465436f6e747261637412f6010a15413dd5ec509f7f5bf381070b7bbac66d24b4631bd4125a1a056f776e657220033a190a15413dd5ec509f7f5bf381070b7bbac66d24b4631bd410013a190a15410a0e30b7e7a75a0a4f74388e456406edeb55713410013a190a15414d66511bf52280f9be386747e53f172e15b01815100122800108021a0761637469766530200332207fff1fc0037e00000000000000000000000000000000000000000000000000003a190a15413dd5ec509f7f5bf381070b7bbac66d24b4631bd410013a190a15410a0e30b7e7a75a0a4f74388e456406edeb55713410013a190a15414d66511bf52280f9be386747e53f172e15b018151001708cce9c9fc72d"
}