权限合约接口
权限合约接口
inPermission
检查资源是否在权限中
参数
address
- 资源的合约地址bytes4
- 资源的函数签名返回值
bool
- 成功返回为真,反之则反示例
$ scm Permission inPermission \
--contract 0x1e041ec9a18590924d84a1f011eb0749c03fc41a \
--function-hash 0x60fe47b1 \
--permission 0xca645d2b0d2e4c451a2dd546dbd7ab8c29c3dcee \
输出:
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
queryInfo
查询权限信息,包括权限名称及包含的资源列表
参数
空
返回值
bytes32
- 权限名称address[]
- 所包含资源的合约地址列表bytes4[]
- 所包含资源的函数签名列表示例
$ scm Permission queryInfo --permission 0xca645d2b0d2e4c451a2dd546dbd7ab8c29c3dcee
输出:
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x0000000000000000000000000000000000000000000000000000000060fe47b2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005839153e0efe76efe0c974b728c4f49ca7ed75cc0000000000000000000000001e041ec9a18590924d84a1f011eb0749c03fc41a000000000000000000000000000000000000000000000000000000000000000260fe47b10000000000000000000000000000000000000000000000000000000060fe47b100000000000000000000000000000000000000000000000000000000"
}
queryName
查询权限的名称
参数
空
返回值
bytes32
- 权限名称示例
$ scm Permission queryName --permission 0xca645d2b0d2e4c451a2dd546dbd7ab8c29c3dcee
输出:
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x0000000000000000000000000000000000000000000000000000000060fe47b2"
}
queryResource
查询权限的资源
参数
空
返回值
bool
- True, if successfully, otherwise false.address[]
- 所包含资源的合约地址列表bytes4[]
- 所包含资源的函数签名列表示例
$ scm Permission queryResource --permission 0xca645d2b0d2e4c451a2dd546dbd7ab8c29c3dcee
输出:
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005839153e0efe76efe0c974b728c4f49ca7ed75cc0000000000000000000000001e041ec9a18590924d84a1f011eb0749c03fc41a000000000000000000000000000000000000000000000000000000000000000260fe47b10000000000000000000000000000000000000000000000000000000060fe47b100000000000000000000000000000000000000000000000000000000"
}