'Radix Scrypto: How to send Bucket or BucketRef through resim

I created a blueprint with a method accepting a Bucket and a BucketRef and I don't know how to call it with resim. How can I send buckets when calling a method of my components ?



Solution 1:[1]

You send Buckets (or BucketRefs) to method/functions with resim by using the following format: [amount],[token_resource_def].

For example, if your component have the following method:

pub fn show_amount(&self, tokens: BucketRef) {
    info!("{}", list.amount());
    list.drop();
}

To create a BucketRef of 1000 XRD and send it to this method, you would use resim like this:

resim call-method [component_address] show_amount 1000,030000000000000000000000000000000000000000000000000004 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Clément Bisaillon