Skip to content

Commit

Permalink
Added unregister asset definition id (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingela authored Jun 14, 2024
1 parent 6e7746e commit bf6bac1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ object Instructions {
*/
fun unregisterAsset(id: AssetId) = unregisterSome { IdBox.AssetId(id) }

/**
* Unregister an asset definition
*/
fun unregisterAssetDefinition(id: AssetDefinitionId) = unregisterSome { IdBox.AssetDefinitionId(id) }

/**
* Unregister an account
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ class TransactionBuilder(builder: TransactionBuilder.() -> Unit = {}) {
instructions.value.add(Instructions.unregisterAsset(id))
}

fun unregisterAssetDefinition(id: AssetDefinitionId) = this.apply {
instructions.value.add(Instructions.unregisterAssetDefinition(id))
}

fun unregisterTrigger(id: TriggerId) = this.apply {
instructions.value.add(
Instructions.unregisterTrigger(id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,16 @@ class InstructionsTest : IrohaTest<Iroha2Client>() {
.let { query -> client.sendQuery(query) }
}
}

client.tx { unregisterAssetDefinition(definitionId) }
assertThrows<IrohaClientException> {
runBlocking {
QueryBuilder.findAssetDefinitionById(definitionId)
.account(super.account)
.buildSigned(super.keyPair)
.let { query -> client.sendQuery(query) }
}
}
}

@Test
Expand Down

0 comments on commit bf6bac1

Please sign in to comment.