### Plugin Installation Command Example Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-js/create-js-plugins.mdx Example of how to install a custom plugin using npm. Replace `` with the actual name of the plugin package. ```bash npm install ``` -------------------------------- ### Go SDK Installation Source: https://github.com/hashgraph/hedera-docs/blob/main/skill.md Install the Go SDK using go get. Ensure you specify the latest version and the correct path. ```bash go get github.com/hiero-ledger/hiero-sdk-go/v2@latest ``` -------------------------------- ### Start the Application Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/hedera-wallet-snap-by-metamask/metamask-hedera-wallet-snap-tutorial.mdx Start the dApp locally after installing dependencies. This command runs the application, making it accessible for testing and integration. ```bash npm start ``` -------------------------------- ### Install Dependencies Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/oracle-networks/supra-oracles.mdx Run this command to install the necessary Node.js dependencies for the Supra Oracles example. ```bash npm install ``` -------------------------------- ### Install AI Provider Package (OpenAI Example) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-py/quickstart.mdx Install the package for your chosen AI provider. This example shows OpenAI for LangChain v1. ```bash # for LangChain v1 pip install langchain langchain-openai ``` -------------------------------- ### Run the Python Example Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-py/quickstart.mdx Execute the main Python script to start the AI agent. This command assumes you are in the root directory of your project. ```bash python3 main.py ``` -------------------------------- ### Check Prerequisites Setup Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/more-tutorials/develop-a-hedera-dapp-integrated-with-walletconnect.mdx Verify that Git, a code editor, Node.js, and npm are installed and accessible from your terminal. ```shell git --version code --version node --version npm --version ``` ```shell git --version git version 2.39.2 (Apple Git-143) code --version 1.81.1 6c3e3dba23e8fadc360aed75ce363ba185c49794 arm64 node --version v20.6.1 npm --version 9.8.1 ``` -------------------------------- ### Plugin README Example - Bonzo Plugin Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-js/create-js-plugins.mdx This is an example of the README content required for a third-party plugin. It should include the plugin name, its purpose, installation instructions, and version information. ```markdown ## Plugin Name This plugin was built by for the . It was built to enable to ### Installation '''bash npm install ''' ```Bonzo Plugin is a unified SDK to the Bonzo protocol, exposing the core actions (deposit, withdraw, repay, borrow) for decentralised lending and borrowing on Hedera: NPM: https://www.npmjs.com/package/@bonzofinancelabs/hak-bonzo-plugin Github repository: https://github.com/Bonzo-Labs/bonzoPlugin Version: @bonzofinancelabs/hak-bonzo-plugin@1.0.1 Status: Not validated by HAK team, v3-compatible release ``` ``` -------------------------------- ### Start Individual Node with npm Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/networks/localnet/multinode-configuration.mdx Command to start a specific node within the multinode setup using npm. Useful for testing node synchronization and consensus. ```bash npm run start network-node-3 ``` -------------------------------- ### Clone, Install, and Start Hiero Local Node Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/configuring-hardhat-with-hiero-local-node-a-step-by-step-guide.mdx Use these commands to set up and run the Hiero Local Node, which includes a Consensus Node, Mirror Node, and JSON-RPC Relay. This process also generates accounts for use in Hardhat. ```bash git clone https://github.com/hiero-ledger/hiero-local-node.git cd hiero-local-node npm install npm run start ``` -------------------------------- ### Example Questions for Kapa AI Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-tools-for-developers/kapa-ai.mdx These are example questions to ask Kapa AI to get specific information about Hedera development, including account setup, token types, SDK usage, and smart contract deployment. ```text @kapa.ai How do I set up a Hedera testnet account? ``` ```text @kapa.ai What's the difference between HTS and ERC-20 tokens on Hedera? ``` ```text @kapa.ai Show me how to create a topic using the Java SDK ``` ```text @kapa.ai How do I deploy a smart contract to Hedera testnet? ``` ```text @kapa.ai What are the gas fees for smart contract deployment? ``` -------------------------------- ### Run the example Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-js/quickstart.mdx Executes the index.js file from the project root directory using Node.js. ```bash node index.js ``` -------------------------------- ### Set Up Virtual Environment and Install Dependencies Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-py/quickstart.mdx Create and activate a Python virtual environment, then install the necessary Hedera Agent Kit and LangChain packages. ```bash python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` ```bash pip install hedera-agent-kit langchain langchain-openai python-dotenv ``` -------------------------------- ### Initialize Go Modules and Install SDK (Bash) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/getting-started-hedera-native-developers/create-an-account.mdx Initialize Go modules and install the Hedera Go SDK in your project. ```bash go mod init create_account_demo go get github.com/hiero-ledger/hiero-sdk-go/v2@latest go mod tidy ``` -------------------------------- ### Example Usage Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/queries.mdx Examples of how to get the cost of an AccountBalanceQuery in various SDKs. ```Java //Create the query request AccountBalanceQuery query = new AccountBalanceQuery() .setAccountId(accountId); //Get the cost of the query Hbar queryCost = query.getCost(client); System.out.println("The account balance query cost is " +queryCost); //v2.0.0 ``` ```JavaScript //Create the query request const query = new AccountBalanceQuery() .setAccountId(accountId); //Get the cost of the query const queryCost = await query.getCost(client); console.log("The account balance query cost is " +queryCost); //v2.0.0 ``` ```Go //Create the query request query := hedera.NewAccountBalanceQuery(). SetAccountID(newAccountId) //Get the cost of the query cost, err := query.GetCost(client) if err != nil { panic(err) } fmt.Printf("The account balance query cost is: %v\n ", cost.String()) //v2.0.0 ``` ```Rust // Create the query request let query = AccountBalanceQuery::new() .account_id(account_id); // Get the cost of the query let query_cost = query.get_cost(&client).await?; println!("The account balance query cost is {:?}", query_cost); // v0.34.0 ``` -------------------------------- ### Initialize Project with npm Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdx Create a new directory for your project and initialize it using npm. This sets up the basic project structure. ```bash mkdir basic-erc20-fork-test-hardhat cd basic-erc20-fork-test-hardhat npm init -y ``` -------------------------------- ### Install Local Development Dependencies Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/local-node/setup-hedera-node-cli-npm.mdx Install project dependencies locally and then install the CLI globally. This is for local development setups where you might be making changes to the repository itself. ```bash npm install && npm install -g ``` -------------------------------- ### Clone Hedera Subgraph Example Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/deploy-a-subgraph-using-the-graph-and-json-rpc.mdx Clone the example subgraph repository, navigate into the directory, and install project dependencies. ```bash git clone https://github.com/hashgraph/hedera-subgraph-example.git cd hedera-subgraph-example npm install ``` -------------------------------- ### Start Stablecoin Studio CLI Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/stablecoin-studio/cli-management.mdx Initiate the Stablecoin Studio CLI tool using the 'wizard' command. Ensure your configuration file is properly set up before running. ```bash accelerator wizard ``` -------------------------------- ### Initialize Go Modules and Install SDK Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/getting-started-hedera-native-developers/create-a-topic.mdx Initialize Go modules and install the Hedera Go SDK. Ensure you are in your project's root directory. ```bash go mod init create_topic_demo go get github.com/hiero-ledger/hiero-sdk-go/v2@latest go mod tidy ``` -------------------------------- ### Start Local Preview Server Source: https://github.com/hashgraph/hedera-docs/blob/main/README.md Run the local development server to preview documentation changes. Access the preview at http://localhost:3000. ```bash mint dev ``` -------------------------------- ### Start the Stablecoin Studio Web UI Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/stablecoin-studio/web-ui-application.mdx Command to start the web application after configuring environment variables. This command should be run from the 'web' directory of the project. ```bash npm run start ``` -------------------------------- ### Start Individual Node with Docker Compose Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/networks/localnet/multinode-configuration.mdx Command to start a specific node within the multinode setup using Docker Compose. This is an alternative to npm commands for node management. ```bash docker compose start network-node-3 ``` -------------------------------- ### Plugin README Template - Installation and Usage Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-py/create-py-plugins.mdx This section of the plugin README template shows how to install the plugin using pip and provides a Python code example for initializing the HederaLangchainToolkit with the custom plugin. ```python # pip install # Usage from hedera_agent_kit.langchain.toolkit import HederaLangchainToolkit from hedera_agent_kit.shared.configuration import Configuration, Context, AgentMode from import my_plugin hedera_toolkit = HederaLangchainToolkit( client=client, configuration=Configuration( context=Context( mode=AgentMode.AUTONOMOUS, ), plugins=[ my_plugin, ], ), ) tools = hedera_toolkit.get_tools() ``` -------------------------------- ### Example Client Configuration (JavaScript) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/client.mdx Demonstrates how to initialize a Hedera client for the test network, set an operator account, and configure default maximum transaction fees. ```JavaScript const client = Client.forTestnet(); // Set your account as the client's operator client.setOperator(operatorId, operatorKey); // Set the default maximum transaction fee (in Hbar) client.setDefaultMaxTransactionFee(new Hbar(10)); ``` -------------------------------- ### Initialize Go Modules and Install SDK (Bash) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/getting-started-hedera-native-developers/create-a-token.mdx Initialize Go modules and install the Hedera Go SDK in your project. This command ensures your project is set up to use the SDK. ```bash go mod init create_token_demo go get github.com/hiero-ledger/hiero-sdk-go/v2@latest go mod tidy ``` -------------------------------- ### Get Block by Hash or Number API Response Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/networks/release-notes/mirror-node.mdx Example response from the `/api/v1/blocks/{hashOrNumber}` endpoint, returning details for a single block. ```json { "count": 4, "gas_limit": 150000000, "gas_used": 50000000, "hapi_version": "0.24.0", "hash": "0xa4ef824cd63a325586bfe1a66396424cd33499f895db2ce2292996e2fc5667a69d83a48f3883f2acab0edfb6bfeb23c4", "logs_bloom": "0x549358c4c2e573e02410ef7b5a5ffa5f36dd7398", "name": "2022-04-07T16_59_23.159846673Z.rcd", "number": 19533336, "previous_hash": "0x4fbcefec4d07c60364ac42286d5dd989bc09c57acc7370b46fa8860de4b8721e63a5ed46addf1564e4f8cd7b956a5afa", "size": 8489, "timestamp": { "from": "1649350763.159846673" "to": "1649350763.382130000" } } ``` -------------------------------- ### Initialize Foundry Project Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/foundry/how-to-mint-and-burn-an-erc-721-token-using-foundry-part-1.mdx Sets up a new Foundry project with a standard directory structure. Navigate into the created directory after initialization. ```bash forge init foundry-erc-721-mint-burn cd foundry-erc-721-mint-burn ``` -------------------------------- ### Get Account Info Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-info.mdx This example demonstrates how to create an AccountInfoQuery, set the account ID, and execute the query to retrieve account information. ```APIDOC ## Get Account Info ### Description Retrieves information about a Hedera account. ### Method `AccountInfoQuery` ### Parameters #### Path Parameters - **accountId** (AccountId) - Required - The ID of the account to retrieve information for. ### Request Example ```java //Create the account info query AccountInfoQuery query = new AccountInfoQuery() .setAccountId(newAccountId); //Submit the query to a Hedera network AccountInfo accountInfo = query.execute(client); //Print the account key to the console System.out.println(accountInfo); ``` ### Response #### Success Response (AccountInfo) - **accountId** (AccountId) - The ID of the account. - **contractAccountId** (String) - The contract account ID, if applicable. - **isDeleted** (boolean) - Indicates if the account is deleted. - **key** (Key) - The public key associated with the account. - **balance** (HBAR) - The HBAR balance of the account. - **isReceiverSignatureRequired** (boolean) - Indicates if receiver signature is required. - **ownedNfts** (long) - The number of NFTs owned by the account. - **maxAutomaticTokenAssociations** (int) - The maximum number of automatic token associations. - **accountMemo** (String) - The memo associated with the account. - **expirationTime** (Instant) - The expiration time of the account. - **autoRenewPeriod** (Duration) - The auto-renewal period for the account. - **ledgerId** (LedgerId) - The ID of the ledger the account belongs to. - **ethereumNonce** (long) - The Ethereum nonce for the account. - **stakingInfo** (StakingInfo) - Information about the account's staking status. - **tokenRelationships** (Map) - A map of token relationships for the account. ### Response Example ```json { "accountId": "0.0.12345", "balance": "1000 HBAR", "key": "...", "ownedNfts": 5, "accountMemo": "Example memo" } ``` ``` ```APIDOC ```javascript //Create the account info query const query = new AccountInfoQuery() .setAccountId(newAccountId); //Sign with client operator private key and submit the query to a Hedera network const accountInfo = await query.execute(client); //Print the account info to the console console.log(accountInfo); ``` ``` ```APIDOC ```go //Create the account info query query := hedera.NewAccountInfoQuery(). SetAccountID(newAccountId) //Sign with client operator private key and submit the query to a Hedera network accountInfo, err := query.Execute(client) if err != nil { panic(err) } //Print the account info to the console fmt.Println(accountInfo) ``` ``` ```APIDOC ```rust // Create the account info query let query = AccountInfoQuery::new() .account_id(new_account_id); // Submit the query to a Hedera network let account_info = query.execute(&client).await?; // Print the account info to the console println!("{:?}", account_info); ``` ``` -------------------------------- ### Get Token Info Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/token-service/get-token-info.mdx This example demonstrates how to create a TokenInfoQuery, set the token ID, execute the query, and retrieve the total supply of the token. ```APIDOC ## Get Token Info ### Description Retrieves information about a specific token on the Hedera network. ### Method Signature `TokenInfoQuery().setTokenId(tokenId)` ### Parameters #### Path Parameters - **tokenId** (TokenId) - Required - The ID of the token to retrieve information for. ### Request Example (Java) ```java //Create the query TokenInfoQuery query = new TokenInfoQuery() .setTokenId(newTokenId); //Sign with the client operator private key, submit the query to the network and get the token supply long tokenSupply = query.execute(client).totalSupply; System.out.println("The token info is " +tokenSupply); ``` ### Request Example (JavaScript) ```javascript //Create the query const query = new TokenInfoQuery() .setTokenId(newTokenId); //Sign with the client operator private key, submit the query to the network and get the token supply const tokenSupply = (await query.execute(client)).totalSupply; console.log("The total supply of this token is " +tokenSupply); ``` ### Request Example (Go) ```go //Create the query query := hedera.NewTokenInfoQuery(). SetTokenID(tokenId) //Sign with the client operator private key and submit to a Hedera network tokenInfo, err := query.Execute(client) if err != nil { panic(err) } fmt.Printf("The token info is %v\n", tokenInfo) ``` ### Request Example (Rust) ```rust // Create the query let query = TokenInfoQuery::new() .token_id(token_id); // Sign with the client operator private key, submit the query to the network let token_info = query.execute(&client).await?; // Get the token supply let token_supply = token_info.total_supply; println!("The total supply of this token is {:?}", token_supply); ``` ### Response Fields - **tokenId** (TokenId) - Optional - The ID of the token. - **name** (String) - Optional - The name of the token. - **symbol** (String) - Optional - The symbol of the token. - **decimals** (int) - Optional - The number of decimals for the token. - **customFees** (List) - Optional - A list of custom fees associated with the token. - **totalSupply** (long) - Optional - The total supply of the token. - **treasuryAccountId** (AccountId) - Optional - The account ID of the token's treasury. - **adminKey** (Key) - Optional - The admin key for the token. - **kycKey** (Key) - Optional - The KYC key for the token. - **freezeKey** (Key) - Optional - The freeze key for the token. - **feeScheduleKey** (Key) - Optional - The fee schedule key for the token. - **wipeKey** (Key) - Optional - The wipe key for the token. - **supplyKey** (Key) - Optional - The supply key for the token. - **defaultFreezeStatus** (boolean) - Optional - The default freeze status of the token. - **defaultKycStatus** (boolean) - Optional - The default KYC status of the token. - **isDeleted** (boolean) - Optional - Indicates if the token is deleted. - **tokenType** (TokenType) - Optional - The type of the token (e.g., FUNGIBLE_COMMON, NON_FUNGIBLE_UNIQUE). - **supplyType** (TokenSupplyType) - Optional - The supply type of the token (e.g., FINITE, INFINITE). - **maxSupply** (long) - Optional - The maximum supply of the token if supply type is FINITE. - **pauseKey** (Key) - Optional - The pause key for the token. - **pauseStatus** (boolean) - Optional - The pause status of the token. - **autoRenewAccount** (AccountId) - Optional - The account ID for auto-renewal. - **autoRenewPeriod** (Duration) - Optional - The auto-renewal period for the token. - **ledgerId** (LedgerId) - Optional - The ledger ID associated with the token. - **expiry** (Instant) - Optional - The expiration time of the token. - **metadata** (bytes) - Optional - Metadata associated with the token. ``` -------------------------------- ### Example Client Configuration Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/client.mdx Demonstrates how to initialize a Hedera client for the test network, set an operator account, and configure default maximum transaction fees and query payments. ```Java Client client = Client.forTestnet(); // Set your account as the client's operator client.setOperator(operatorId, operatorKey); // Set the default maximum transaction fee (in Hbar) client.setDefaultMaxTransactionFee(new Hbar(10)); // Set the maximum payment for queries (in Hbar) client.setDefaultMaxQueryPayment(new Hbar(5)); ``` -------------------------------- ### Initialize Foundry Project Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/getting-started-evm-developers/deploy-a-smart-contract-with-foundry.mdx Sets up a new Foundry project with a standard directory structure for smart contract development. ```bash forge init hedera-foundry-erc20-tutorial cd hedera-foundry-erc20-tutorial ``` -------------------------------- ### Get Query Cost in Rust Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/queries.mdx Obtain the cost for an AccountBalanceQuery in Rust. This example demonstrates setting the account ID and awaiting the cost retrieval. ```rust let query = AccountBalanceQuery::new() .account_id(account_id); let query_cost = query.get_cost(&client).await?; println!("The account balance query cost is {:?}", query_cost); // v0.34.0 ``` -------------------------------- ### Get Account Info (JavaScript) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-info.mdx Retrieve account information using the AccountInfoQuery. This example demonstrates asynchronous execution and requires the client to be signed. ```javascript const query = new AccountInfoQuery() .setAccountId(newAccountId); const accountInfo = await query.execute(client); console.log(accountInfo); ``` -------------------------------- ### Initialize Project with npm Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx Initializes a new Node.js project and creates a package.json file. ```bash mkdir advanced-hts-fork-test cd advanced-hts-fork-test npm init -y ``` -------------------------------- ### Initialize Hedera Agent Kit and Run Agent Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-py/quickstart.mdx Sets up the Hedera client, prepares the Hedera toolkit with specified plugins, initializes an LLM, creates an agent, and sends a query to the agent. Ensure your environment variables (ACCOUNT_ID, PRIVATE_KEY, OPENAI_API_KEY) are set. ```python import asyncio import os from dotenv import load_dotenv from hedera_agent_kit.langchain.toolkit import HederaLangchainToolkit from hedera_agent_kit.plugins import ( core_account_plugin, core_account_query_plugin, core_token_plugin, core_consensus_plugin, ) from hedera_agent_kit.shared.configuration import Configuration, Context, AgentMode from hiero_sdk_python import Client, Network, AccountId, PrivateKey from langchain.agents import create_agent from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import MemorySaver load_dotenv() async def main(): # Hedera client setup (Testnet by default) import asyncio account_id = AccountId.from_string(os.getenv("ACCOUNT_ID")) private_key = PrivateKey.from_string(os.getenv("PRIVATE_KEY")) client = Client(Network(network="testnet")) client.set_operator(account_id, private_key) # Prepare Hedera toolkit hedera_toolkit = HederaLangchainToolkit( client=client, configuration=Configuration( tools=[], # Empty = load all tools from plugins plugins=[ core_account_plugin, core_account_query_plugin, core_token_plugin, core_consensus_plugin, ], context=Context( mode=AgentMode.AUTONOMOUS, account_id=str(account_id), ), ), ) tools = hedera_toolkit.get_tools() llm = ChatOpenAI( model="gpt-4o-mini", api_key=os.getenv("OPENAI_API_KEY"), ) agent = create_agent( model=llm, tools=tools, checkpointer=MemorySaver(), system_prompt="You are a helpful assistant with access to Hedera blockchain tools and plugin tools", ) print("Sending a message to the agent...") response = await agent.ainvoke( {"messages": [{"role": "user", "content": "what's my balance?"}]}, config={"configurable": {"thread_id": "1"}}, ) final_message_content = response["messages"][-1].content print("\n--- Agent Response ---") print(final_message_content) print("----------------------") if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Get Transaction Record (Rust) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/transactions/get-a-transaction-record.mdx Retrieve a transaction record after executing a transaction. This example demonstrates creating an account, executing the transaction, and then fetching its record. ```rust // Create a transaction let transaction = AccountCreateTransaction::new() .key_with_alias(ecdsa_public_key) // DO NOT set an alias with your key if you plan to update/rotate keys in the future, Use .key_without_alias instead // .key_without_alias(ecdsa_public_key) .initial_balance(Hbar::new(1)); // Sign with the client operator account key and submit to a Hedera network let tx_response = transaction.execute(&client).await?; // Request the record of the transaction let record = tx_response.get_record(&client)?; println!("The transaction record is {:?}", record); // v0.34.0 ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/more-tutorials/javascript-testing.mdx Clone the tutorial repository and install project dependencies using npm. This sets up the necessary tools and project structure for testing. ```sh git clone git@github.com:hedera-dev/js-testing.git cd js-testing npm install ``` -------------------------------- ### Get Schedule Information Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/schedule-transaction/get-schedule-info.mdx This example demonstrates how to retrieve information about a scheduled transaction using the ScheduleInfoQuery. You need to provide the schedule ID to query for its details. ```APIDOC ## Get Schedule Information ### Description Retrieves information about a scheduled transaction. ### Method `ScheduleInfoQuery` ### Parameters #### Path Parameters - **scheduleId** (ScheduleId) - Required - The ID of the schedule to retrieve information for. #### Request Body None ### Request Example ```java //Create the query ScheduleInfoQuery query = new ScheduleInfoQuery() .setScheduleId(scheduleId); //Sign with the client operator private key and submit the query request to a node in a Hedera network ScheduleInfo info = query.execute(client); ``` ### Response #### Success Response (200) - **scheduleId** (ScheduleId) - The ID of the schedule. - **scheduledTransactionId** (TransactionId) - The ID of the transaction that is scheduled. - **creatorAccountId** (AccountId) - The account ID of the creator of the schedule. - **payerAccountId** (AccountId) - The account ID of the payer for the scheduled transaction. - **adminKey** (Key) - The admin key for the schedule. - **signatories** (Key) - The keys of the signatories for the schedule. - **deletedAt** (Instant) - The time at which the schedule was deleted. - **expirationAt** (Instant) - The time at which the schedule expires. - **memo** (String) - The memo associated with the schedule. - **waitForExpiry** (boolean) - Indicates if the schedule waits for expiry. #### Response Example ```json { "scheduleId": "0.0.12345", "scheduledTransactionId": "0.0.12345@1678886400.000000001", "creatorAccountId": "0.0.123", "payerAccountId": "0.0.456", "adminKey": { "keyType": "ECDSA384", "key": "0x..." }, "signatories": [ { "keyType": "ECDSA384", "key": "0x..." } ], "deletedAt": "2023-03-15T12:00:00Z", "expirationAt": "2023-03-16T12:00:00Z", "memo": "Schedule memo", "waitForExpiry": false } ``` ``` -------------------------------- ### Get Account Info (Rust) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/accounts-and-hbar/get-account-info.mdx Fetch account details using the AccountInfoQuery in Rust. This asynchronous example requires the client to be available and the query to be executed. ```rust let query = AccountInfoQuery::new() .account_id(new_account_id); let account_info = query.execute(&client).await?; println!("{:?}", account_info); ``` -------------------------------- ### Initialize Project and Install Packages (Vercel AI SDK) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/ai-studio-on-hedera/hedera-ai-agent-kit/hedera-agent-kit-js/quickstart.mdx Initializes a Node.js project and installs the necessary packages for using the Hedera Agent Kit with the Vercel AI SDK. ```bash npm init -y ``` ```bash npm install @hiero-ledger/sdk \ @hashgraph/hedera-agent-kit \ @hashgraph/hedera-agent-kit-ai-sdk \ @ai-sdk/openai \ dotenv ``` -------------------------------- ### SimpleStorage Smart Contract Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/deploy-smart-contracts-on-hedera-using-truffle.mdx A basic Solidity smart contract with functions to set and get a uint256 data value. This contract is used as an example for compilation and deployment. ```solidity // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract SimpleStorage { uint256 data; function getData() external view returns (uint256) { return data; } function setData(uint256 _data) external { data = _data; } } ``` -------------------------------- ### Deployment Output Example Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/how-to-mint-and-burn-an-erc-721-token-using-hardhat-and-ethers-part-1.mdx This is an example of the output you can expect after successfully running the deployment script. It shows the compilation status, the deployer's account, and the final deployed contract address. ```bash Compiling your Solidity contracts... Compiled 1 Solidity file with solc 0.8.28 (evm target: cancun) Deploying contract with the account: 0xA98556A4deeB07f21f8a66093989078eF86faa30 Contract deployed at: 0x6035bA3BCa9595637B463Aa514c3a1cE3f67f3de ``` -------------------------------- ### Create Accounts for Airdrop Campaign (Go) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/token/create-your-first-frictionless-airdrop-campaign.mdx Initializes the Hedera client and generates private keys for account creation. This snippet is a starting point for account setup in Go. ```go package main import ( "fmt" "log" "os" "time" hedera "github.com/hiero-ledger/hiero-sdk-go/v2/sdk" "github.com/joho/godotenv" ) func main() { err := godotenv.Load(".env") if err != nil { panic(fmt.Errorf("Unable to load environment variables from .env file. Error:\n%v\n", err)) } operatorId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID")) if err != nil { panic(err) } operatorKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY")) if err != nil { panic(err) } client := hedera.ClientForTestnet() client.SetOperator(operatorId, operatorKey) client.SetDefaultMaxTransactionFee(hedera.HbarFrom(100, hedera.HbarUnits.Hbar)) client.SetDefaultMaxQueryPayment(hedera.HbarFrom(50, hedera.HbarUnits.Hbar)) // Step 1: Create 4 accounts alicePrivateKey, err := hedera.PrivateKeyGenerateEcdsa() if err != nil { log.Fatalf("Error generating private key for Alice: %v", err) } ``` -------------------------------- ### Create, Queue, and Execute a Batch Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/hiero-cli/plugins/batch-plugin.mdx Demonstrates the workflow of creating a batch, queuing two token creation transactions, and then executing the batch. ```sh hcli batch create --name my-batch --key alice hcli token create-ft \ --token-name "Token A" --symbol "TA" \ --treasury alice --decimals 8 \ --initial-supply 1000 --supply-type FINITE --max-supply 10000 \ --admin-key alice --supply-key alice --name token-a \ --batch my-batch hcli token create-ft \ --token-name "Token B" --symbol "TB" \ --treasury alice --decimals 8 \ --initial-supply 500 --supply-type INFINITE \ --admin-key alice --supply-key alice --name token-b \ --batch my-batch hcli batch execute --name my-batch ``` -------------------------------- ### Get Topic Info (Rust) Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/sdks-and-apis/sdks/consensus-service/get-topic-info.mdx Use the TopicInfoQuery to retrieve details about a topic. Ensure the client is initialized and connected to the Hedera network. This example focuses on basic retrieval and printing. ```rust // Create the topic info query let query = TopicInfoQuery::new() .topic_id(topic_id); // Submit the query to a Hedera network let topic_info = query.execute(&client).await?; // Print the topic info to the console println!("{:?}", topic_info); // v0.34.0 ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/open-source-solutions/interoperability-and-bridging/chainlink.mdx Copy the example environment file and add your Hedera Testnet private key. ```bash cp .env.example .env PRIVATE_KEY=0x... ``` -------------------------------- ### HTS Token Manager Test Setup Source: https://github.com/hashgraph/hedera-docs/blob/main/hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx Sets up the test environment for HTSTokenManager, including binding to a deployed contract on a forked network, getting signers, and funding accounts and the contract. ```typescript import { expect } from "chai"; import { ethers, network } from "hardhat"; import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import { HTSTokenManager } from "../typechain-types"; import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; // HTS Success response code const SUCCESS = 22n; describe("HTSTokenManager - HTS Forking Tests", function () { // Increase timeout for network operations this.timeout(120000); // 2 minutes // Add delay between tests to avoid rate limiting afterEach(async function () { await new Promise((resolve) => setTimeout(resolve, 1000)); // 1 second delay }); // ============================================ // UPDATE THESE VALUES AFTER RUNNING deploy.ts // ============================================ // Your deployed testnet contract address const DEPLOYED_CONTRACT = "YOUR_CONTRACT_ADDRESS"; // <--- UPDATE THIS> // The HTS token created during deployment const TOKEN_ADDRESS = "YOUR_TOKEN_ADDRESS"; // <--- UPDATE THIS> // ============================================ let htsManager: HTSTokenManager; let alice: HardhatEthersSigner; let bob: HardhatEthersSigner; async function setupFixture(): Promise<{ htsManager: HTSTokenManager; alice: HardhatEthersSigner; bob: HardhatEthersSigner; }> { // Bind to the deployed contract on the forked network const contract = await ethers.getContractAt( "HTSTokenManager", DEPLOYED_CONTRACT ); // Get local test accounts const [, aliceSigner, bobSigner] = await ethers.getSigners(); // Fund local accounts await network.provider.send("hardhat_setBalance", [ aliceSigner.address, "0x56BC75E2D63100000" // 100 ETH in hex ]); await network.provider.send("hardhat_setBalance", [ bobSigner.address, "0x56BC75E2D63100000" ]); // Fund the contract (it's the treasury and needs gas for operations) await network.provider.send("hardhat_setBalance", [ DEPLOYED_CONTRACT, "0x56BC75E2D63100000" ]); return { htsManager: contract as HTSTokenManager, alice: aliceSigner, bob: bobSigner }; }); beforeEach(async function () { const fixture = await loadFixture(setupFixture); htsManager = fixture.htsManager; alice = fixture.alice; bob = fixture.bob; }); /** * Helper function to get response code from receipt */ function getResponseCodeFromReceipt( receipt: ContractTransactionReceipt | null ): bigint | null { const responseEvent = receipt?.logs.find((log: any) => { try { const parsed = htsManager.interface.parseLog({ topics: log.topics as string[], data: log.data }); return parsed?.name === "ResponseCode"; } catch { return false; } }); if (responseEvent) { const parsed = htsManager.interface.parseLog({ topics: responseEvent.topics as string[], data: responseEvent.data }); return parsed?.args[0]; } return null; } /** * Helper function to get minted token info from receipt */ function getMintedTokenInfoFromReceipt( receipt: any ): { newTotalSupply: bigint } | null { const mintedEvent = receipt?.logs.find((log: any) => { try { const parsed = htsManager.interface.parseLog({ topics: log.topics as string[], data: log.data }); return parsed?.name === "MintedToken"; } catch { return false; } }); if (mintedEvent) { const parsed = htsManager.interface.parseLog({ topics: mintedEvent.topics as string[], data: mintedEvent.data }); return { newTotalSupply: parsed?.args[0] }; } return null; } /* ========================= Token Info Tests ========================= */ describe("Token Info", function () { it("should get token info for the pre-created token", async function () { const tx = await htsManager.getTokenInfoPublic(TOKEN_ADDRESS); const receipt = await tx.wait(); const responseCode = getResponseCodeFromReceipt(receipt); expect(responseCode).to.equal(SUCCESS); console.log("Successfully retrieved token info"); }); it("should get fungible token info for the pre-created token", async function () { const tx = await htsManager.getFungibleTokenInfoPublic(TOKEN_ADDRESS); const receipt = await tx.wait(); const infoEvent = receipt?.logs.find((log) => { try { const parsed = htsManager.interface.parseLog({ topics: log.topics as string[], data: log.data }); ```