Examples
Examples of the Rust Manifest Builder can be found in the experimental-examples repository.
You may also wish to read the ManifestBuilder rust docs on docs.rs.
This page will provide information on how to use the Rust ManifestBuilder. The Rust ManifestBuilder is used to easily write transaction manifests without leaving the Rust environment when building your Scrypto package. This page is structured by first teaching you how to import the ManifestBuilder module in your Rust file to begin working with the ManifestBuilder. Then go over a few examples to familiarize the structure of creating transaction manifests with the ManifestBuilder, provide how to generate a manifest String with an .rtm file format for transaction submission, and reference table for each ManifestBuilder method.
Importing the Rust ManifestBuilder
Every Scrypto package generated from scrypto new-package will contain a “tests” folder with a lib.rs file. This lib.rs file will contain the integration tests for your Scrypto package. The generated file already contains the necessary Scrypto crates imports to begin testing and writing transaction manifests which will look like this:
use scrypto::prelude::*;
use scrypto_test::{prelude::*, utils::dump_manifest_to_file_system};
use hello_token::test_bindings::*;
Particularly, with the ManifestBuilder module imported, we can now easily create transaction manifests.
Writing Manifests with the ManifestBuilder
We’ll provide a few examples to help familiarize the general structure of writing manifests with the ManifestBuilder. However, it’s worth noting that the general structure will consist of:
Creating a new instance of the
ManifestBuilderusingManifestBuilder::new()Chaining together a series of instructions for the transaction manifest.
Calling
.build()as the last method to build the transaction manifest.
Calling a Function and Instantiating a Package
let manifest = ManifestBuilder::new() // #1
.lock_fee_from_faucet()
.call_function( // #2
package_address,
"Hello",
"instantiate_hello",
manifest_args!(), // #3
)
.build(); // #4To create a new instance of the
ManifestBuilder.The
call_functionmethod is one of several methods theManifestBuilderprovides to assist us with writing manifest instructions.The
manifest_args!()is a macro which we can use to conveniently pass in function and method arguments. As of RCnet v3, it is optional, and a tuple (…,) can be used for arguments instead. Be careful if using tuples that singleton tuples will require a trailing comma.At the end of the list of manifest instructions, we call the
.build()method to generate aTransactionManifest.
Method Calls
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.call_method( // #1
account_address,
"withdraw",
(
resource_address, // #2
amount,
)
)
.call_method( // #3
account_address,
"deposit_batch",
(
ManifestExpression::EntireWorktop, // #4
)
)
.build();call_methodis another methodManifestBuilderprovides. This method is an instruction to perform a method call.We can pass in several arguments for our method call with different types with each argument separated by commas.
We can chain multiple manifest instructions together within a
TransactionManifest.We can pass expressions as arguments as well. More info here
Special Account Methods
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account( // #1
account_address,
resource_address,
amount
)
.try_deposit_batch_or_abort(account_address) // #2
.build();The
ManifestBuilderalso provides several methods to easily call account component methods.try_deposit_batch_or_abort is also another convenient account method we can use.
The call_method provided by the ManifestBuilder allows us to flexibly write component method call instructions. However, accounts on Radix are native and the ManifestBuilder gives us special methods as a convenience to call account component methods.
Using the Worktop
The ManifestBuilder has several worktop methods we can use to account and manage asset flows between component method calls.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.take_all_from_worktop( // #1
resource_address,
"bucket" // #2
)
.deposit(account_address, "bucket")
.build();take_all_from_worktopis one of several methods theManifestBuilderoffers to allow us to easily work with assets returned to the worktop from component method calls.The
take_all_from_worktopmethod has a second argument which requires us to pass a name for theBucketwhich will hold our resource to create a namedBucket.
Resolving Named Buckets and Proofs
Using the ManifestBuilder provides convenient methods to retrieve resources from the worktop or pop a Proof from the AuthZone to create named buckets and proofs. These are named because we want to refer to them later on by passing them as arguments to methods. Some methods provided by the ManifestBuilder conveniently allow you to pass named buckets and proofs that were previously created. For example, we can withdraw a resource from an account, take the resource from the worktop, and deposit it into an account like so:
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.take_all_from_worktop(resource_address, "bucket")
.deposit(account_address, "bucket") // #1
.build();The
depositmethod provides clean and convenient way to resolve named buckets.
However, particularly when it comes to passing arguments to a call_method or call_function, it’s not as convenient. Therefore, we need to use a lookup function to resolve these named buckets and proofs by using with_name_lookup methods.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_all_from_worktop(
resource_address,
"payment_bucket"
)
.call_method_with_name_lookup( // #1
component_address,
"buy_gumball",
|lookup| ( // #2
lookup.bucket("payment_bucket"), // #3
)
)
.deposit_batch(account_address)
.build();Using
call_method_with_name_lookupallows us to pass named argument such as the named "payment_bucket" we created.lookupis an arbitrary variable we’re using to create our callback function which allows us to resolve our named buckets and proofs.By using
lookup.bucket()and passing"payment_bucket", we can pass it as an argument and resolve the Bucket we created earlier.
Using the AuthZone
The AuthZone has similar mechanics to the worktop where there are things pushed to this layer, except, instead of resources, they are proofs. Most Proof creation methods are automatically pushed to the worktop and popping a Proof, from the AuthZone requires the Proof to be named, much like taking resources from the worktop and into a Bucket.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof") // #1
.call_method_with_name_lookup(
component_address,
"method_requiring_named_proof",
|lookup| (
lookup.proof("proof"),
)
)
.deposit_batch(account_address)
.build();Similar to taking resources from the worktop and placing them in a named
Bucket, popping aProoffrom theAuthZonewill require you to name it (e.g "proof").
Creating Named Proofs
The ManifestBuilder offers instructions to create named proofs. These named proofs are not automatically pushed to the AuthZone and must manually be pushed to the AuthZone or be passed into an argument of a method call.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.create_proof_from_auth_zone_of_amount(
resource_address,
dec!(1),
"proof" // #1
)
.push_to_auth_zone("proof") // #2
.build();Creating a named
Proofcalled"proof".Manually pushing the named
"proof"to theAuthZone.
Common Transaction Manifest Instructions
Transferring Tokens Between Accounts
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(100)
)
.call_method( // #1
account_address2,
"try_deposit_batch_or_abort",
manifest_args!(
ManifestExpression::EntireWorktop
)
)
.build();Previously, we’ve been using
.deposit_batchmethod to conveniently deposit any resources from the worktop to an account. However, since accounts are also components, we can use .call_method to interact with accounts (accounts are components on Radix after all).
Transferring Tokens to Multiple Accounts
We want to withdraw tokens (resources) from an account, equally split them, and send them to two accounts. To do that, we can use the .take_from_worktop method to specify how many tokens we would like to deposit into each account.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account( // #1
account_address,
resource_address,
dec!(200)
)
.take_from_worktop( // #2
resource_address,
dec!(100),
"bucket1"
)
.take_all_from_worktop( // #3
resource_address,
"bucket2"
)
.try_deposit_or_abort( // #4
account_1_address,
"bucket1"
)
.try_deposit_or_abort(
account_2_address,
"bucket2"
)
.build();We are withdrawing 200 tokens from an account to the worktop.
The first
.take_from_worktopinstruction takes 100 of the 200 tokens on the worktop and puts them into aBucketnamedbucket1.Since we know the remainder of tokens on the worktop, we can simply use
.take_all_from_worktopand place in aBucketnamedbucket2.Then we can start depositing the buckets into the other accounts passing our named buckets in with the account address we wish to send to.
Exporting TransactionManifest as a String to an .rtm File Format
Building a transaction on the Radix Network require a transaction manifest to describe the intent of resource movement between component. Therefore, the scrypto_unit module provides a convenient function: dump_manifest_to_file_system, to generate a transaction manifest file as a .rtm file format. Additionally, using this function also comes with a convenient feature to statically validate the transaction manifest before it is converted to a manifest String.
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.try_deposit_batch_or_abort(account_address);
// This generates the .rtm file of the Transaction Manifest.
dump_manifest_to_file_system( // #1
manifest.object_names(), // #2
&manifest.build(), // #3
"./transaction-manifest", // #4
Some("manifest_name"), // #5
&NetworkDefinition::simulator() // #6
).err(); // #6We are using
dump_manifest_to_file_systemto generate a transaction manifestStringas an.rtmfile based on the reference of the manifest we created.Calling
object_namesreturnsManifestObjectNamesto provide the function tracking of named buckets and proofs (if available).Takes a reference of the built
TransactionManifest.Specifying the path directory where this
.rtmfile will be generated, if the directory does not exist, then it will be created.Specifying the Transaction Manifest name.
Specifying the network which entity addresses will be encoded to. Please see addressing page for reference.
Generates an error if the transaction manifest is statically invalid.
Calling the dump_manifest_to_file_system function will generate an .rtm file in the ./transaction-manifest directory which will look like this:
CALL_METHOD
Address("component_sim1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxhkrefh")
"lock_fee"
Decimal("5000")
;
CALL_METHOD
Address("account_sim1c8ng5f2pmcxart0t5y9gftcymuzpkaytavy852mx74txkqamfp9y8w")
"withdraw"
Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3")
Decimal("10")
;
CALL_METHOD
Address("account_sim1c8ng5f2pmcxart0t5y9gftcymuzpkaytavy852mx74txkqamfp9y8w")
"try_deposit_batch_or_abort"
Expression("ENTIRE_WORKTOP")
;The entity addresses encoded in your
.rtmfile will look different based on the addresses inputted and the network specified to be encoded to.
Rust ManifestBuilder Methods
The list below provides the method name, summary and example for each of the methods the Rust ManifestBuilder supports.
If you feel more at home in Rust Docs you can check out the ManifestBuilder here.
Account, Identity, AccessController
new_account
new_accountCreates a new account native component.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_account()
.build();new_account_advanced
new_account_advancedCreates a new account with specified OwnerRole.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_account_advanced(
OwnerRole::Updatable(
rule!(resource_address)
)
)
.build();withdraw_from_account
withdraw_from_accountWithdraws a specified fungible resource from an account component and places into the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.deposit_batch(account_address)
.build();withdraw_non_fungibles_from_account
withdraw_non_fungibles_from_accountWithdraws a specified non-fungible resource from an account component and places into the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_non_fungibles_from_account(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1), NonFungibleLocalId::integer(2))
)
.deposit_batch(account_address)
.build();burn_in_account
burn_in_accountBurns a fungible resource with a burnable resource behavior within the account.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.burn_in_account(
account_address,
resource_address,
dec!(1)
)
.build();deposit_batch
deposit_batchDrains all resources from the worktop and deposits all into a specified account component.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.deposit_batch(account_address)
.build();try_deposit_batch_or_abort
try_deposit_batch_or_abortAttempts to deposit a Bucket of resource to an account or aborts the transaction if the account does not allow the resource to be deposited.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.try_deposit_batch_or_abort(account_address)
.build();try_deposit_batch_or_refund
try_deposit_batch_or_refundAttempts to deposit a Bucket of resource to an account or returns the Bucket of resource to the originator if the account does not allow the resource to be deposited.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.try_deposit_batch_or_refund(account_address)
.build();create_identity_advanced
create_identity_advancedCreates an identity native component with an owner role configuration.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_identity_advanced(
OwnerRole::Fixed(
rule!(require(resource_address)
)
)
.build();create_identity
create_identityCreates an identity native component.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_identity()
.deposit_batch(account_address)
.build();create_access_controller
create_access_controllerCreates an access controller native component with the controlled resource and specified authority roles.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_from_worktop(
resource_address,
dec!(1),
"bucket"
)
.create_access_controller(
"bucket",
rule!(require(primary_role_bage)),
rule!(require(recovery_role_badge)),
rule!(require(confirmation_role_bage)),
None
)
.build();Call Function and Call Method
call_function
call_functionCalls a function where the arguments should be an array of encoded Scrypto value.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.call_function(
package_address,
"Hello",
"instantiate_hello",
manifest_args!()
)
.build();call_function_with_name_lookup
call_function_with_name_lookupCalls a function with a lookup callback function to resolve named Bucket or Proof.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof")
.call_function_with_name_lookup(
package_address,
"ExampleBlueprint",
"instantiate",
|lookup| (
lookup.proof("proof"),
)
)
.deposit_batch(account_address)
.build();call_method
call_methodCalls a component method
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.call_method(
component_address,
"mint",
manifest_args!()
)
.deposit_batch(account_address)
.build();call_method_with_name_lookup
call_method_with_name_lookupCalls a method with a lookup callback function to resolve named Bucket or Proof.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof")
.call_method_with_name_lookup(
component_address,
"method_requiring_named_proof",
|lookup| (
lookup.proof("proof"),
),
)
.deposit_batch(account_address)
.build();Worktop
take_all_from_worktop
take_all_from_worktopTake all of a specified resource from the worktop and place into a Bucket.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.take_all_from_worktop(resource_address, "bucket")
.deposit(account_address, "bucket")
.build();take_from_worktop
take_from_worktopTakes a resource from a worktop and place into a Bucket.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.take_from_worktop(
resource_address,
dec!(10),
"bucket")
.deposit(account_address, "bucket")
.build();take_non_fungibles_from_worktop
take_non_fungibles_from_worktopTakes specified non-fungibles from the worktop and puts into a Bucket
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_non_fungibles_from_account(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.take_non_fungibles_from_worktop(
resource_address,
indexset!(NonFungibleLocalId::integer(1)),
"bucket"
)
.deposit(account_address, "bucket")
.build();return_to_worktop
return_to_worktopReturns a resource back to the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.take_all_from_worktop(
resource_address,
"bucket"
)
.return_to_worktop("bucket")
.deposit_batch(account_address)
.build();assert_worktop_contains
assert_worktop_containsAsserts the worktop contains a particular resource.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.assert_worktop_contains(
resource_address,
dec!(10)
)
.deposit_batch(account_address)
.build();assert_worktop_contains_any
assert_worktop_contains_anyAsserts the worktop contains a specified resource of any amount.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(10)
)
.assert_worktop_contains_any(resource_address)
.deposit_batch(account_address)
.build();assert_worktop_contains_non_fungibles
assert_worktop_contains_non_fungiblesAsserts the worktop contains specified non-fungibles.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_non_fungibles_from_account(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.assert_worktop_contains_non_fungibles(
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.deposit_batch(account_address)
.build();burn_from_worktop
burn_from_worktopBurns a Bucket of resource with a burnable resource behavior.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_from_worktop(
resource_address,
dec!(1),
"bucket"
)
.burn_resource("bucket")
.build();burn_all_from_worktop
burn_all_from_worktopBurns all resources in the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(100)
)
.burn_all_from_worktop(resource_address)
.build();burn_non_fungible_from_worktop
burn_non_fungible_from_worktopBurns a non-fungible resource from worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_non_fungibles_from_account(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.burn_non_fungible_from_worktop(non_fungible_global_id);AuthZone
pop_from_auth_zone
pop_from_auth_zonePops the last Proof entered to the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof")
.drop_proof("proof")
.build();push_to_auth_zone
push_to_auth_zonePushes a named Proof back into the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_from_worktop(
resource_address,
dec!(1),
"bucket"
)
.create_proof_from_bucket_of_amount(
"bucket",
dec!(1),
"proof"
)
.push_to_auth_zone("proof")
.call_method(
component_address,
"authorized_method",
manifest_args!()
)
.pop_from_auth_zone("popped_proof")
.drop_proof("popped_proof")
.deposit(account_address, "bucket")
.build();clear_auth_zone
clear_auth_zoneClears the AuthZone of all proofs.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.clear_auth_zone()
.build();Proof
create_proof_from_bucket_of_amount
create_proof_from_bucket_of_amountCreates a specified number of proofs from a named Bucket containing a fungible resource.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_from_worktop(
resource_address,
dec!(1),
"bucket"
)
.create_proof_from_bucket_of_amount(
"bucket",
dec!(1),
"proof"
)
.call_method_with_name_lookup(
component_address,
"method_requiring_named_proof",
|lookup| (
lookup.proof("proof"),
),
)
.deposit(account_address, "bucket")
.build();create_proof_from_bucket_of_non_fungibles
create_proof_from_bucket_of_non_fungiblesCreate a Proof from a named Bucket containing a non-fungible resource.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_non_fungibles_from_account(
account_address,
resource_address,
indexset!(
NonFungibleLocalId::integer(1),
)
)
.take_non_fungibles_from_worktop(
resource_address,
indexset!(
NonFungibleLocalId::integer(1)
),
"bucket"
)
.create_proof_from_bucket_of_non_fungibles(
"bucket",
indexset!(
NonFungibleLocalId::integer(1)
),
"proof"
)
.call_method_with_name_lookup(
component_address,
"method_requiring_named_proof",
|lookup| (
lookup.proof("proof"),
),
)
.deposit(account_address, "bucket")
.build();create_proof_from_bucket_of_all
create_proof_from_bucket_of_allCreate a composite Proof of all amount of resource contained within a Bucket.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
resource_address,
dec!(1)
)
.take_all_from_worktop(
resource_address,
"bucket"
)
.create_proof_from_bucket_of_all(
"bucket",
"proof"
)
.call_method_with_name_lookup(
component_address,
"method_requiring_named_proof",
|lookup| (
lookup.proof("proof"),
),
)
.deposit(account_address, "bucket")
.build();clone_proof
clone_proofClones a named Proof.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof")
.clone_proof(
"proof",
"cloned_proof"
)
.clear_auth_zone()
.drop_all_proofs()
.build();drop_proof
drop_proofDrops a single named Proof.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.pop_from_auth_zone("proof")
.drop_proof("proof")
.build();drop_all_proofs
drop_all_proofsDrops all named proofs.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(2)
)
.drop_all_proofs()
.build();create_proof_from_account_of_amount
create_proof_from_account_of_amountCreates a specified number of proof's of a specified resource from an account component and push to the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account(
account_address,
resource_address,
dec!(1)
)
.build();create_proof_from_account_of_non_fungibles
create_proof_from_account_of_non_fungiblesCreates a Proof for each specified non-fungibles.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_non_fungibles(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.build();create_proof_from_auth_zone_of_amount
create_proof_from_auth_zone_of_amountCreates a named Proof of an existing Proof from the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.create_proof_from_auth_zone_of_amount(
resource_address,
dec!(1),
"proof"
)
.push_to_auth_zone("proof")
.call_method(
component_address,
"authorized_method_requiring_two_proofs",
manifest_args!()
)
.clear_auth_zone()
.build();create_proof_from_auth_zone_of_non_fungibles
create_proof_from_auth_zone_of_non_fungiblesCreate a named Proof from a specified non-fungible Proof that is currently in the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_non_fungibles(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.create_proof_from_auth_zone_of_non_fungibles(
resource_address,
indexset!(NonFungibleLocalId::integer(1)),
"proof"
)
.push_to_auth_zone("proof")
.call_method(
component_address,
"authorized_method_requiring_two_proofs",
manifest_args!()
)
.clear_auth_zone()
.build();create_proof_from_auth_zone_of_all
create_proof_from_auth_zone_of_allCreates a named Proof from all proofs that are currently in the AuthZone.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.create_proof_from_auth_zone_of_all(
resource_address,
"proof"
)
.push_to_auth_zone("proof")
.call_method(
component_address,
"authorized_method_requiring_two_proofs",
manifest_args!()
)
.clear_auth_zone()
.build();Resources and Badges
create_fungible_resource
create_fungible_resourceCreate a fungible resource with configuration for divisibility, metadata, roles, and an optional initial supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_fungible_resource(
OwnerRole::None,
false,
0u8,
FungibleResourceRoles {
mint_roles: mint_roles!(
minter => rule!(allow_all);
minter_updater => rule!(deny_all);
),
burn_roles: None,
freeze_roles: None,
recall_roles: None,
withdraw_roles: None,
deposit_roles: None
},
Default::default(),
Some(dec!(1000))
)
.deposit_batch(account_address)
.build();create_non_fungible_resource
create_non_fungible_resourceCreate a non-fungible resource with configuration for NonFungibleLocalIdType, metadata, roles, and an optional initial supply. First declare the struct NFT and specify the <T, V> arguments.
Example
#[derive(ScryptoSbor, NonFungibleData, ManifestSbor)]
pub struct NFTData {
name: String,
...
}
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_non_fungible_resource(
OwnerRole::None,
NonFungibleIdType::Integer,
false,
NonFungibleResourceRoles {
mint_roles: mint_roles!(
minter => rule!(allow_all);
minter_updater => rule!(deny_all);
),
burn_roles: None,
freeze_roles: None,
recall_roles: None,
withdraw_roles: None,
deposit_roles: None,
non_fungible_data_update_roles: None
},
Default::default(),
Some(
[(
NonFungibleLocalId::integer(1),
NFTData {
name: "Bob".to_owned(),
}
)]
)
)
.deposit_batch(account_address)
.build();To create a non-fungible resource with no initial supply
Example
#[derive(ScryptoSbor, NonFungibleData, ManifestSbor)]
pub struct NFTData {
name: String,
key_image_url: Url,
...
}
...
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_non_fungible_resource::<Vec<_>, NFTData>(
OwnerRole::None,
NonFungibleIdType::Integer,
false,
NonFungibleResourceRoles {
mint_roles: mint_roles!(
minter => rule!(allow_all);
minter_updater => rule!(deny_all);
),
burn_roles: None,
freeze_roles: None,
recall_roles: None,
withdraw_roles: None,
deposit_roles: None,
non_fungible_data_update_roles: None
},
Default::default(),
None
)
.deposit_batch(account_address)
.build();create_ruid_non_fungible_resource
create_ruid_non_fungible_resourceCreate a non-fungible resource with a NonFungibleLocalId::RUID, metadata, roles, and an optional initial supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_ruid_non_fungible_resource(
OwnerRole::None,
false,
Default::default(),
NonFungibleResourceRoles {
mint_roles: mint_roles!(
minter => rule!(allow_all);
minter_updater => rule!(deny_all);
),
burn_roles: None,
freeze_roles: None,
recall_roles: None,
withdraw_roles: None,
deposit_roles: None,
non_fungible_data_update_roles: None
},
Some([Nft { name: "Bob".to_owned() }])
)
.deposit_batch(account_address)
.build();new_token_mutable
new_token_mutableCreates a fungible resource with a mutable supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_token_mutable(
Default::default(),
AccessRule::AllowAll
)
.build();new_token_fixed
new_token_fixedCreates a fungible resource with a fixed supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_token_fixed(
OwnerRole::None,
Default::default(),
dec!(1000)
)
.deposit_batch(account_address)
.build();new_badge_mutable
new_badge_mutableCreates a badge resource with an updatable OwnerRole and specified initial supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_badge_mutable(
Default::default(),
AccessRule::AllowAll
)
.build();new_badge_fixed
new_badge_fixedCreates a badge resource with a specified OwnerRole and initial supply.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.new_badge_fixed(
OwnerRole::None,
Default::default(),
dec!(1)
)
.deposit_batch(account_address)
.build();mint_fungible
mint_fungibleMints a fungible resource of a specified amount and places into the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.mint_fungible(
resource_address,
dec!(100)
)
.deposit_batch(account_address)
.build();mint_non_fungible
mint_non_fungibleMints a non-fungible resource with a specified non-fungible id and non-fungible data then places into the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.mint_non_fungible(
resource_address,[(NonFungibleLocalId::integer(1), Nft { name: "Bob".into() })])
.deposit_batch(account_address)
.build();mint_ruid_non_fungible
mint_ruid_non_fungibleMints a RUID id type non-fungible resource with a specified non-fungible data and pre-determined non-fungible id then places into the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.mint_ruid_non_fungible(
resource_address,
[Nft { name: "Bob".into() }]
)
.deposit_batch(account_address)
.build();recall
recallRetrieves a fungible resource with a recallable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.recall(
vault_id,
dec!(1)
)
.deposit_batch(account_address)
.build();recall_non_fungibles
recall_non_fungiblesRetrieves a non-fungible resource with a recallable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.recall_non_fungibles(
vault_id,
indexset!(NonFungibleLocalId::integer(1))
)
.deposit_batch(account_address)
.build();freeze_withdraw
freeze_withdrawFreezes withdrawal of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.freeze_withdraw(vault_id)
.build();unfreeze_withdraw
unfreeze_withdrawUnfreezes withdrawal of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.unfreeze_withdraw(vault_id)
.build();freeze_deposit
freeze_depositFreezes deposit of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.freeze_deposit(vault_id)
.build();unfreeze_deposit
unfreeze_depositUnfreezes deposit of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.unfreeze_deposit(vault_id)
.build();freeze_burn
freeze_burnFreezes burn functionality of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.freeze_burn(vault_id)
.build();unfreeze_burn
unfreeze_burnUnfreezes burn functionality of a resource with a freezable resource behavior from a specified Vault.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.unfreeze_burn(vault_id)
.build();Lock Fee
lock_fee
lock_feeLocks a specified amount from an account’s Vault with XRD for fee payment.
Example
let manifest = ManifestBuilder::new()
.lock_fee(
account_address,
dec!(1)
)
.build();lock_standard_fee
lock_standard_feeLocks the standard testing fee from the account’s Vault with XRD.
Example
let manifest = ManifestBuilder::new()
.lock_standard_test_fee(account_address)
.build();lock_fee_from_faucet
lock_fee_from_faucetLocks the standard testing fee from the system faucet.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.build();lock_fee_and_withdraw
lock_fee_and_withdrawLocks a specified amount of XRD from an account for fee payment and withdraw a specified resource and amount to the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_and_withdraw(
account_address,
dec!(1),
resource_address,
dec!(10)
)
.deposit_batch(account_address)
.build();lock_fee_and_withdraw_non_fungibles
lock_fee_and_withdraw_non_fungiblesLocks a specified amount of XRD from an account for fee payment and withdraw specified non-fungibles to the worktop.
Example
let manifest = ManifestBuilder::new()
.lock_fee_and_withdraw_non_fungibles(
account_address,
dec!(10),
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.deposit_batch(account_address)
.build();Validator
stake_validator
stake_validatorStakes a Bucket of XRD to a validator.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
RADIX_TOKEN,
dec!(100)
)
.take_all_from_worktop(
RADIX_TOKEN,
"bucket"
)
.stake_validator(
validator_address,
"bucket"
)
.build();unstake_validator
unstake_validatorUnstakes a Bucket of XRD from a validator.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.withdraw_from_account(
account_address,
stake_units,
dec!(100)
)
.take_all_from_worktop(
stake_units,
"bucket"
)
.unstake_validator(
validator_address,
"bucket"
)
.build();Royalty
claim_package_royalty
claim_package_royaltyClaim royalty from a blueprint package.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_non_fungibles(
account_address,
resource_address,
indexset!(NonFungibleLocalId::integer(1))
)
.claim_package_royalties(package_address)
.deposit_batch(account_address)
.build();set_component_royalty
set_component_royaltyUpdates a component method royalty configuration.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.set_component_royalty(
component_address,
"mint",
RoyaltyAmount::Xrd(dec!(1))
)
.build();lock_component_royalty
lock_component_royaltyLock a component’s method royalty configuration.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.lock_component_royalty(
component_address,
"mint",
)
.build();claim_component_royalty
claim_component_royaltyClaim royalty from a global component.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.claim_component_royalties(component_address)
.deposit_batch(account_address)
.build();Role
set_owner_role
set_owner_roleConfigures an owner role of a global entity (e.g PackageAddress, ComponentAddress, ResourceAddress).
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.set_owner_role(
component_address,
rule!(require(resource_address))
)
.build();update_role
update_roleUpdates a role’s AccessRule of a specified global entity.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.update_role(
component_address,
ObjectModuleId::Main,
RoleKey::from("admin"),
rule!(require(resource_address))
)
.build();get_role
get_roleRetrieve’s a role’s AccessRule of a specified global entity.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.get_role(
component_address,
ObjectModuleId::Main,
RoleKey { key: "admin".to_string() }
)
.build();Metadata
set_metadata
set_metadataSets a metadata field of a global entity (e.g PackageAddress, ComponentAddress, ResourceAddress).
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.set_metadata(
component_address,
"name",
MetadataValue::String("HelloComponent".into())
)
.build();lock_metadata
lock_metadataLock’s a global entity’s metadata from being updated.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.lock_metadata(component_address, "name");freeze_metadata
freeze_metadataFreezes a global entity’s metadata from being updated.
Example
let manifest = ManifestBuilder::new()
.lock_fee_from_faucet()
.create_proof_from_account_of_amount(
account_address,
resource_address,
dec!(1)
)
.freeze_metadata(
component_address,
"name",
)
.build();Publish Package
publish_package
publish_packagePublish a blueprint package.
Example
let (code, definition) = Compile::compile(this_package!());
let manifest = ManifestBuilder::new()
.publish_package(code, definition)
.deposit_batch(account_address)
.build();publish_package_advanced
publish_package_advancedPublishes a blueprint package with custom configuration.
Example
let (code, definition) = Compile::compile(this_package!());
let manifest = ManifestBuilder::new()
.publish_package_advanced(
None,
code,
definition,
metadata_init!(),
OwnerRole::Updatable(rule!(require(resource_address)))
)
.build();publish_package_with_owner
publish_package_with_ownerPublish a blueprint package with a specified owner badge.
Example
let (code, schema) = Compile::compile(this_package!());
let manifest = ManifestBuilder::new()
.publish_package_with_owner(
code,
schema,
NonFungibleGlobalId::new(
resource_address,
NonFungibleLocalId::integer(1)
)
)
.build();