Skip to content

Commit bf6bac1

Browse files
authored
Added unregister asset definition id (#424)
1 parent 6e7746e commit bf6bac1

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/transaction/Instructions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ object Instructions {
230230
*/
231231
fun unregisterAsset(id: AssetId) = unregisterSome { IdBox.AssetId(id) }
232232

233+
/**
234+
* Unregister an asset definition
235+
*/
236+
fun unregisterAssetDefinition(id: AssetDefinitionId) = unregisterSome { IdBox.AssetDefinitionId(id) }
237+
233238
/**
234239
* Unregister an account
235240
*/

modules/client/src/main/kotlin/jp/co/soramitsu/iroha2/transaction/TransactionBuilder.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class TransactionBuilder(builder: TransactionBuilder.() -> Unit = {}) {
215215
instructions.value.add(Instructions.unregisterAsset(id))
216216
}
217217

218+
fun unregisterAssetDefinition(id: AssetDefinitionId) = this.apply {
219+
instructions.value.add(Instructions.unregisterAssetDefinition(id))
220+
}
221+
218222
fun unregisterTrigger(id: TriggerId) = this.apply {
219223
instructions.value.add(
220224
Instructions.unregisterTrigger(id),

modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/InstructionsTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ class InstructionsTest : IrohaTest<Iroha2Client>() {
260260
.let { query -> client.sendQuery(query) }
261261
}
262262
}
263+
264+
client.tx { unregisterAssetDefinition(definitionId) }
265+
assertThrows<IrohaClientException> {
266+
runBlocking {
267+
QueryBuilder.findAssetDefinitionById(definitionId)
268+
.account(super.account)
269+
.buildSigned(super.keyPair)
270+
.let { query -> client.sendQuery(query) }
271+
}
272+
}
263273
}
264274

265275
@Test

0 commit comments

Comments
 (0)