diff --git a/developer-docs-site/docs/tutorials/first-coin.md b/developer-docs-site/docs/tutorials/first-coin.md index f1ba497b50652..a0117a19ec608 100644 --- a/developer-docs-site/docs/tutorials/first-coin.md +++ b/developer-docs-site/docs/tutorials/first-coin.md @@ -130,7 +130,7 @@ Update the module with Alice's address, build, copy to the provided path, and pr ## Step 2) Initialize MoonCoin -The MoonCoin module has alreayd been deployed. The next step is to initialize MoonCoin. In this example, we'll be using 0x1::ManagedCoin::initialize since we want the ability to mint/burn our new MoonCoin. This adds standard functionalities to MoonCoin such as transfer, mint, burn and standard events (register, deposit, withdraw). +The MoonCoin module has alreayd been deployed. The next step is to initialize MoonCoin. In this example, we'll be using 0x1::managed_coin::initialize since we want the ability to mint/burn our new MoonCoin. This adds standard functionalities to MoonCoin such as transfer, mint, burn and standard events (register, deposit, withdraw). <Tabs> <TabItem value="python" label="Python" default> @@ -188,7 +188,7 @@ To register, the recipient just needs to call ```0x1::coin::register<CoinType>`` ## Step 4) Mint MoonCoin to the recipient as the owner of the MoonCoin -When initializing a new Coin (Step 2), the owning account receives capabilities to mint/burn the new coin. The owner account can mint MoonCoin by calling 0x1::ManagedCoin::mint. +When initializing a new Coin (Step 2), the owning account receives capabilities to mint/burn the new coin. The owner account can mint MoonCoin by calling 0x1::managed_coin::mint. <Tabs> <TabItem value="python" label="Python" default> diff --git a/developer-docs-site/static/examples/python/first_coin.py b/developer-docs-site/static/examples/python/first_coin.py index 5211b4c833ff0..513d8b256c09b 100644 --- a/developer-docs-site/static/examples/python/first_coin.py +++ b/developer-docs-site/static/examples/python/first_coin.py @@ -16,7 +16,7 @@ def initialize_coin(self, account_from: Account) -> Optional[str]: """ Initialize a new coin with the given coin type. """ payload = { "type": "script_function_payload", - "function": "0x1::ManagedCoin::initialize", + "function": "0x1::managed_coin::initialize", "type_arguments": [f"0x{account_from.address()}::MoonCoin::MoonCoin"], "arguments": [ "Moon Coin".encode("utf-8").hex(), @@ -54,7 +54,7 @@ def mint_coin( payload = { "type": "script_function_payload", - "function": "0x1::ManagedCoin::mint", + "function": "0x1::managed_coin::mint", "type_arguments": [f"0x{account_coin_owner.address()}::MoonCoin::MoonCoin"], "arguments": [ receiver_address, @@ -73,7 +73,8 @@ def get_balance( ) -> str: """ Returns the coin balance of the given account """ - return self.account_resource(account_address, f"0x1::coin::CoinStore<0x{coin_type_address}::MoonCoin::MoonCoin>") + balance = self.account_resource(account_address, f"0x1::coin::CoinStore<0x{coin_type_address}::MoonCoin::MoonCoin>") + return balance["data"]["coin"]["value"] #<:!:section_4 if __name__ == "__main__": diff --git a/developer-docs-site/static/examples/rust/first_coin/src/lib.rs b/developer-docs-site/static/examples/rust/first_coin/src/lib.rs index cfa55b5873246..b0c497a7479a2 100644 --- a/developer-docs-site/static/examples/rust/first_coin/src/lib.rs +++ b/developer-docs-site/static/examples/rust/first_coin/src/lib.rs @@ -20,7 +20,7 @@ impl FirstCoinClient { pub fn initialize_coin(&self, account_from: &mut Account) -> String { let payload = serde_json::json!({ "type": "script_function_payload", - "function": "0x1::ManagedCoin::initialize", + "function": "0x1::managed_coin::initialize", "type_arguments": [format!("0x{}::MoonCoin::MoonCoin", account_from.address())], "arguments": [ hex::encode("Moon Coin".as_bytes()), @@ -58,7 +58,7 @@ impl FirstCoinClient { ) -> String { let payload = serde_json::json!({ "type": "script_function_payload", - "function": "0x1::ManagedCoin::mint", + "function": "0x1::managed_coin::mint", "type_arguments": [format!("0x{}::MoonCoin::MoonCoin", account_owner.address())], "arguments": [ receiver_address, diff --git a/developer-docs-site/static/examples/typescript/first_coin.ts b/developer-docs-site/static/examples/typescript/first_coin.ts index 4cf53c9b65609..b3076212458ac 100644 --- a/developer-docs-site/static/examples/typescript/first_coin.ts +++ b/developer-docs-site/static/examples/typescript/first_coin.ts @@ -17,7 +17,7 @@ class FirstCoinClient extends RestClient { async initializeCoin(accountFrom: Account, coinTypeAddress: string): Promise<string> { let payload: { function: string; arguments: any[]; type: string; type_arguments: any[] } = { type: "script_function_payload", - function: `0x1::ManagedCoin::initialize`, + function: `0x1::managed_coin::initialize`, type_arguments: [`0x${coinTypeAddress}::MoonCoin::MoonCoin`], arguments: [ Buffer.from("Moon Coin", "utf-8").toString("hex"), @@ -55,7 +55,7 @@ class FirstCoinClient extends RestClient { let payload: { function: string; arguments: string[]; type: string; type_arguments: any[] }; payload = { type: "script_function_payload", - function: `0x1::ManagedCoin::mint`, + function: `0x1::managed_coin::mint`, type_arguments: [`0x${coinTypeAddress}::MoonCoin::MoonCoin`], arguments: [receiverAddress, amount.toString()], };