Macro scrypto::import

import!() { /* proc-macro */ }
Expand description

Imports a blueprint from its ABI.

This macro will generate stubs for accessing the blueprint according to its ABI specification.

Example

use scrypto::prelude::*;

import! {
r#"
{
    "package_address": "01a405d3129b61e86c51c3168d553d2ffd7a3f0bd2f66b5a3e9876",
    "blueprint_name": "GumballMachine",
    "functions": [
        {
            "name": "new",
            "inputs": [],
            "output": {
                "type": "Custom",
                "name": "ComponentAddress"
            }
        }
    ],
    "methods": [
        {
            "name": "get_gumball",
            "mutability": "Mutable",
            "inputs": [
                {
                    "type": "Custom",
                    "name": "Bucket"
                }
            ],
            "output": {
                "type": "Custom",
                "name": "Bucket"
            }
        }
    ]
}
"#
}