match tx {
case tx:TransferTransaction =>
let assetId = tx.assetId
toBase58String(assetId) == base58'9vg1hJidBhsyDq6FVgdeMjZPfAcqz5EdgU7VsnyY2Tnw'
case _ => true
}
But the Waves IDE gives the following error
“Compilation failed: Undefined field assetId of variable of type Union(List(TransferTransaction)) in 65-75”
hmm, Waves IDE didn’t showed any errors, but after sending it to the blockchain, I get the following error, if I make a transaction in WavesJ with the smart account
“{
“error” : 1,
“message” : “failed to parse json message”,
“cause” : “java.util.NoSuchElementException: key not found: transferAssetId”,
“validationErrors” : { }
}”
thanks @alexey.kiselev
But if I use assetId in Waves IDE, I get the error
“Compilation failed: Undefined field assetId of variable of type Union(List(TransferTransaction)) in 51-61” and if I compile the code with WavesJ, I get the error
“Exception in thread “main” java.io.IOException: {
“error” : 305,
“message” : “Too many expressions”
}”
My code is:
match tx {
case tx:TransferTransaction =>
tx.assetId != base58'9vg1hJidBhsyDq6FVgdeMjZPfAcqz5EdgU7VsnyY2Tnw'
case _ => true
}
BTW it’s dangerous to return true without checking signature, because this way you allow anyone to send transactions from your account. I realize this is test code, but don’t push this to mainnet accidentally
@peterz
thanks. So you used my smart contract code for compiling? Strange, I always get an error:
Exception in thread “main” java.io.IOException: {
“error” : 305,
“message” : “Too many expressions”
}
at com.wavesplatform.wavesj.Node.exec(Node.java:297)
at com.wavesplatform.wavesj.Node.compileScript(Node.java:222)
at Main.main(Main.java:74)
Other smart contract code compiles without problems.