macro_rules! external_blueprint {
        $blueprint_ident:ident {
    ) => { ... };
Expand description

Generates a bridge/stub to make package calls to a blueprint.

You can also use this to make calls to the component itself. If you just wish to make calls to an instantiated component, see the external_component! macro.


use scrypto::prelude::*;
use sbor::{TypeId, Encode, Decode, Describe};

#[derive(TypeId, Encode, Decode, Describe)]
enum DepositResult {

external_blueprint! {
        package: "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsnznk7n",
        blueprint: "CustomAccount"
    CustomAccount {
        fn instantiate_global(account_name: &str) -> ComponentAddress;
        fn deposit(&mut self, b: Bucket) -> DepositResult;
        fn deposit_no_return(&mut self, b: Bucket);
        fn read_balance(&self) -> Decimal;

fn create_custom_accounts() {
    let new_account_address = CustomAccount::instantiate_global("account_name");
    let mut account = CustomAccount::from(new_account_address);

    let empty_bucket = Bucket::new(ResourceAddress::from_str("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag").unwrap());

fn bridge_to_existing_account(component_address: ComponentAddress) {
    let existing_account = CustomAccount::from(component_address);
    let balance = existing_account.read_balance();
    // ...
  • Replaces the import! macro for importing an abi, using a more concise, readable syntax.
  • Similar to the external_component! macro, which is used for making cross-component calls to an already-instantiated component.