Skip to content

Commit 2b5058d

Browse files
author
Jagrut Kosti
committed
Grant command added for asset permissions.
1 parent 3892481 commit 2b5058d

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/main/java/multichain/command/GrantCommand.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ public static String grant(String address, int permissions) throws MultichainExc
9999
return executeGrant(address, permissions);
100100
}
101101

102+
/**
103+
* Grants permissions to addresses
104+
* grantfrom "to-address(es)" "permission(s)" ( native-amount "comment" "comment-to" startblock endblock )
105+
*
106+
* @param address address to which the permission should be granted
107+
* @param assetPermission asset permission in the format: assetName.permission e.g. rootStream.write. Possible values are write, admin and issue for assets
108+
* @return transaction ID
109+
* @throws MultichainException
110+
*/
111+
public static String grant(String address, String assetPermission) throws MultichainException {
112+
return executeGrant(address, assetPermission);
113+
}
114+
102115
/**
103116
* Grants permissions to addresses From an address
104117
*

src/main/java/multichain/command/builders/QueryBuilderGrant.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,22 @@ protected static String executeGrant(String address, int permissions) throws Mul
130130
return execute(CommandEnum.GRANT, formatJson(address), formatJson(permissionsFormated));
131131
}
132132

133+
/**
134+
* Grants permissions to addresses From an address
135+
* grantfrom "from-address" "to-address(es)" "permission(s)" ( native-amount "comment" "comment-to" startblock endblock )
136+
*
137+
* @param address address to which the permission should be granted
138+
* @param assetPermission asset permission in the format: assetName.permission e.g. rootStream.write. Possible values are write, admin and issue for assets
139+
* @return transaction ID
140+
* @throws MultichainException
141+
*/
142+
protected static String executeGrant(String address, String assetPermission) throws MultichainException {
143+
MultichainTestParameter.isNotNullOrEmpty("address", address);
144+
MultichainTestParameter.isNotNullOrEmpty("assetPermission", assetPermission);
145+
146+
return execute(CommandEnum.GRANT, address, assetPermission);
147+
}
148+
133149
/**
134150
* Grants permissions to addresses From an address
135151
*
@@ -190,6 +206,7 @@ protected static String executeGrantFrom(String addressFrom, String address, Str
190206

191207
return execute(CommandEnum.GRANTFROM, addressFrom, address, assetPermission);
192208
}
209+
193210
/**
194211
*
195212
* listpermissions ("permission(s)" "address" verbose)

0 commit comments

Comments
 (0)