You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, I'd like to remove array of account owning objects in one transaction programmatically.
Here is my code.
public struct Receipt has key {
id: UID
}
public fun burn_receipts(receipts: &mut vector<Receipt>) {
while(!vectory::is_empty(receipts)) {
let Receipt { id } = vector::pop_back(receipts);
id.delete();
}
}
when I run this code, its returning UnusedvaluewithoutDrop.
The text was updated successfully, but these errors were encountered:
Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links!
I believe that the issue is that your Receipt type does not have a drop ability. If you want to keep it like that, you will need to transfer the receipts object (that is passed into burn_receipts function) or somehow burn it/ drop it.
The UnusedValueWithoutDrop tells you while receipts might be empty, as you deleted all its elements, it's still an object, I think. However, I don't do a lot of Move so I might be off. Hope it helps!
Maybe sui PTB could be solution I think. So instead of taking vector, I might need to create function to take Receipt and burn it in. I can call this function multiple times for the receipts I need to be burned using PTB. so It can be triggered in one transaction.
Here, I'd like to remove array of account owning objects in one transaction programmatically.
Here is my code.
when I run this code, its returning UnusedvaluewithoutDrop.
The text was updated successfully, but these errors were encountered: