### Run Setup Script Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Executes the setup script for Honeycomb Protocol demos. This script is designed to automate dependency installation and environment generation. It is a Unix shell script and may require Bash on Windows. ```bash ./setup.sh ``` -------------------------------- ### Create Honeycomb User and Profile with Edge Client (TypeScript) Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This code example illustrates how to create a new user and their associated profile within a specific Honeycomb project using the edge client. It involves defining user information, linking it to a wallet address and project, generating the transaction, and then signing and sending it. The snippet also shows how to retrieve the created user and profile details. ```typescript import { UserInfoInput, ProfileInfoInput } from "@honeycomb-protocol/edge-client"; const userKeypair = web3.Keypair.generate(); // User's wallet const projectAddress = "8xK7...9vQz"; // From previous example const userInfo: UserInfoInput = { name: "PlayerOne", bio: "Competitive gamer and NFT collector", pfp: "https://example.com/avatar.png", }; // Create user with initial profile const { createNewUserWithProfileTransaction: txResponse } = await client.createNewUserWithProfileTransaction({ userInfo, payer: userKeypair.publicKey.toString(), wallet: userKeypair.publicKey.toString(), project: projectAddress, }); // Send transaction const tx = web3.VersionedTransaction.deserialize( Buffer.from(txResponse.transaction, "base64") ); tx.sign([userKeypair]); await connection.sendTransaction(tx); // Fetch created user const user = await client .findUsers({ wallets: [userKeypair.publicKey.toString()] }) .then(({ user: [user] }) => user); // Fetch profile for this project const profile = await client .findProfiles({ userIds: [user.id], projects: [projectAddress], }) .then(({ profile: [profile] }) => profile); console.log("User ID:", user.id); console.log("Profile Address:", profile.address); // Output: User ID: 123456 // Output: Profile Address: 9yL8...4kPq ``` -------------------------------- ### Multi-Standard NFT Minting (TypeScript) Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This example demonstrates how to mint Non-Fungible Tokens (NFTs) using different Metaplex standards, specifically Metaplex Core and the Token Metadata standard (Programmable NFTs). It utilizes the UMI (Universal Mutability Interface) from the Metaplex foundation. Dependencies include '@metaplex-foundation/mpl-core', '@metaplex-foundation/mpl-token-metadata', and '@metaplex-foundation/umi-bundle-defaults'. ```typescript import { createCollection, createV1, } from "@metaplex-foundation/mpl-core"; import { createProgrammableNft, verifyCollectionV1, findMetadataPda, } from "@metaplex-foundation/mpl-token-metadata"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; import { generateSigner, percentAmount } from "@metaplex-foundation/umi"; const umi = createUmi(RPC_URL).use(/* plugins */); // Mint Metaplex Core NFT Collection const collectionSigner = generateSigner(umi); await createCollection(umi, { collection: collectionSigner, name: "Game Characters", uri: "https://arweave.net/collection-metadata.json", }).sendAndConfirm(umi); const assetSigner = generateSigner(umi); await createV1(umi, { asset: assetSigner, uri: "https://arweave.net/character-1.json", name: "Warrior #1", collection: collectionSigner.publicKey, owner: userKeypair.publicKey, }).sendAndConfirm(umi); // Mint Programmable NFT (Token Metadata standard) const pnftMint = generateSigner(umi); await createProgrammableNft(umi, { mint: pnftMint, uri: "https://arweave.net/character-2.json", name: "Mage #1", collection: { key: collectionSigner.publicKey, verified: false }, sellerFeeBasisPoints: percentAmount(5.5), tokenOwner: userKeypair.publicKey, }) .add( verifyCollectionV1(umi, { collectionMint: collectionSigner.publicKey, metadata: findMetadataPda(umi, { mint: pnftMint.publicKey }), }) ) .sendAndConfirm(umi); console.log("Core NFT:", assetSigner.publicKey); console.log("pNFT:", pnftMint.publicKey); // Output: Core NFT: 7xM9...3pQw // Output: pNFT: 5kL2...8rTv ``` -------------------------------- ### Create Staking Pool with Reward Multipliers - TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This code example illustrates the process of creating a staking pool and then configuring reward multipliers based on NFT metadata. It defines parameters such as reward rates, durations, and cooldown periods for staking. The snippet also shows how to add custom multipliers, like a 1.5x reward boost for rare NFTs, using provided metadata URIs. Transactions are handled using Web3.js. ```typescript const projectAddress = "8xK7...9vQz"; const resourceAddress = "6kP3...5nWr"; const characterModelAddress = "4pR7...2wXs"; // Create staking pool const { createInitializeStakingPoolTransaction: { tx: txResponse, stakingPool: stakingPoolAddress, }, } = await client.createInitializeStakingPoolTransaction({ project: projectAddress, resource: resourceAddress, rewardsPerDuration: String(100 * 10 ** 6), // 100 GOLD per duration rewardsDuration: 86400, // 24 hours maxRewardsDuration: 2592000, // 30 days max minStakeDuration: 3600, // 1 hour minimum cooldownDuration: 1800, // 30 minutes cooldown resetStakeDuration: false, startTime: Math.floor(Date.now() / 1000), endTime: Math.floor(Date.now() / 1000) + 31536000, // 1 year authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), characterModel: characterModelAddress, }); const tx = web3.VersionedTransaction.deserialize(Buffer.from(txResponse.transaction, "base64")); tx.sign([adminKeypair]); await connection.sendTransaction(tx); // Add multipliers based on NFT metadata const multiplierMetadata = [ { metadataUri: "https://arweave.net/rare-character.json", multiplierType: { kind: "StakingMultiplier" }, value: 150, // 1.5x rewards (basis points) }, ]; const { createCreateMultiplierTransaction: { tx: multiplierTx }, } = await client.createCreateMultiplierTransaction({ stakingPool: stakingPoolAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), multipliers: multiplierMetadata, }); const tx2 = web3.VersionedTransaction.deserialize(Buffer.from(multiplierTx.transaction, "base64")); tx2.sign([adminKeypair]); await connection.sendTransaction(tx2); console.log("Staking Pool:", stakingPoolAddress); console.log("Base reward rate:", "100 GOLD per 24h"); console.log("Rare NFT multiplier:", "1.5x"); // Output: Staking Pool: 3mN7...9qTu // Output: Base reward rate: 100 GOLD per 24h // Output: Rare NFT multiplier: 1.5x ``` -------------------------------- ### Run All Demos (NPM) Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Executes all Honeycomb Protocol demos using NPM. This command runs the test script defined in the project's package.json. ```bash npm run test ``` -------------------------------- ### Run All Demos (Yarn) Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Executes all Honeycomb Protocol demos using Yarn. This command runs the test suite defined in the project's package.json. ```bash yarn test ``` -------------------------------- ### Create Honeycomb Project with Edge Client (TypeScript) Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This snippet demonstrates how to create a new Honeycomb project using the @honeycomb-protocol/edge-client. It involves initializing the client, defining project parameters like name, authority, and fee subsidization, constructing the transaction, and then signing and confirming it on the Solana network. It also shows how to fetch the created project details. ```typescript import createEdgeClient from "@honeycomb-protocol/edge-client"; import * as web3 from "@solana/web3.js"; const API_URL = "https://edge.test.honeycombprotocol.com/"; const RPC_URL = "https://rpc.test.honeycombprotocol.com/"; const connection = new web3.Connection(RPC_URL, { commitment: "processed" }); const client = createEdgeClient(API_URL, false); const adminKeypair = web3.Keypair.generate(); // Load your keypair // Create a new project const { createCreateProjectTransaction: { project: projectAddress, tx: txResponse, }, } = await client.createCreateProjectTransaction({ name: "My Game Project", authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), subsidizeFees: true, // Project pays transaction fees for users }); // Sign and send transaction const versionedTx = web3.VersionedTransaction.deserialize( Buffer.from(txResponse.transaction, "base64") ); versionedTx.sign([adminKeypair]); const signature = await connection.sendTransaction(versionedTx); await connection.confirmTransaction({ signature, blockhash: txResponse.blockhash, lastValidBlockHeight: txResponse.lastValidBlockHeight, }); // Fetch the created project const project = await client .findProjects({ addresses: [projectAddress] }) .then((res) => res.project[0]); console.log("Project created:", project.address); // Output: Project created: 8xK7...9vQz (Solana address) ``` -------------------------------- ### Generate Solana Keys Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Generates new keypair files required for Honeycomb Protocol demos using the Solana CLI. The generated keys are saved to the './keys/' directory. ```bash solana-keygen new --outfile ./keys/admin.json ``` ```bash solana-keygen new --outfile ./keys/user.json ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Sets up the necessary environment variables for Honeycomb Protocol demos by creating a `.env` file. These variables specify API endpoints and logging configurations. ```env API_URL="https://edge.test.honeycombprotocol.com/" RPC_URL="https://rpc.test.honeycombprotocol.com/" DAS_API_URL="https://rpc.test.honeycombprotocol.com/" DEBUG_LOGS=false ERROR_LOGS=true ``` -------------------------------- ### Airdrop SOL to Accounts Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Airdrops SOL to specified accounts on the Honeycomb Protocol testnet using the Solana CLI. This is necessary to fund the accounts for demo transactions. Requires a keypair file. ```bash solana airdrop 1000 --url https://rpc.test.honeycombprotocol.com/ --keypair ./keys/admin.json ``` ```bash solana airdrop 1000 --url https://rpc.test.honeycombprotocol.com/ --keypair ./keys/user.json ``` -------------------------------- ### Run Specific Demo (Yarn) Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/README.mdx Executes a specific Honeycomb Protocol demo using Yarn. The demo is identified by its file or folder name, excluding the '.test.ts' extension. This allows for targeted testing of individual use-cases. ```bash yarn test ``` -------------------------------- ### Create and Execute Resource Trading Recipe with TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Defines a recipe for transforming resources, such as crafting gold from silver, and then demonstrates how a user can execute this recipe. This involves creating the recipe transaction, signing, and sending it, followed by crafting the recipe with user-specific keys and authorization. ```typescript const projectAddress = "8xK7...9vQz"; const goldResourceAddress = "6kP3...5nWr"; const silverResourceAddress = "7pL4...2xQs"; // Another resource // Create trading recipe const { createAddRecipeTransaction: { tx: txResponse, recipe: recipeAddress } } = await client.createAddRecipeTransaction({ xp: 10, // XP gained per craft ingredients: [ { resourceAddress: silverResourceAddress, amount: String(100 * 10 ** 6), // 100 silver required }, ], meal: { resourceAddress: goldResourceAddress, amount: String(10 * 10 ** 6), // Produces 10 gold }, project: projectAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), }); const tx = web3.VersionedTransaction.deserialize(Buffer.from(txResponse.transaction, "base64")); tx.sign([adminKeypair]); await connection.sendTransaction(tx); // User executes recipe const { createCraftRecipeTransaction: craftTx } = await client.createCraftRecipeTransaction( { recipe: recipeAddress, owner: userKeypair.publicKey.toString(), payer: userKeypair.publicKey.toString(), }, { fetchOptions: { headers: { authorization: `Bearer ${accessToken}`, }, }, } ); const craftTransaction = web3.VersionedTransaction.deserialize(Buffer.from(craftTx.transaction, "base64")); craftTransaction.sign([userKeypair]); await connection.sendTransaction(craftTransaction); console.log("Recipe:", recipeAddress); console.log("Trade: 100 silver → 10 gold (+10 XP)"); // Output: Recipe: 5qW9...3kLp // Output: Trade: 100 silver → 10 gold (+10 XP) ``` -------------------------------- ### Create Mission Pool and Quests with Rewards - TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This snippet demonstrates how to initialize a mission pool and subsequently create new missions (quests) within that pool. It includes defining rewards with resource types, amounts, and probabilities, along with participation requirements like minimum XP and duration. The code utilizes the `@honeycomb-protocol/edge-client` for transaction generation and Web3.js for transaction handling. ```typescript import { RewardKind } from "@honeycomb-protocol/edge-client"; const projectAddress = "8xK7...9vQz"; const resourceAddress = "6kP3...5nWr"; // GOLD resource const characterModelAddress = "4pR7...2wXs"; // Create mission pool const { createInitializeMissionPoolTransaction: { tx: txResponse, missionPool: missionPoolAddress, }, } = await client.createInitializeMissionPoolTransaction({ project: projectAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), name: "Daily Quests", characterModel: characterModelAddress, delegateAuthority: null, }); const tx1 = web3.VersionedTransaction.deserialize(Buffer.from(txResponse.transaction, "base64")); tx1.sign([adminKeypair]); await connection.sendTransaction(tx1); // Create mission/quest const { createNewMissionTransaction: { tx: missionTx, mission: missionAddress }, } = await client.createNewMissionTransaction({ params: { name: "Gather Resources", minXp: 0, // Minimum XP required duration: 3600, // 1 hour in seconds cost: null, rewards: [ { rewardType: { kind: RewardKind.Resource }, resource: resourceAddress, amount: String(50 * 10 ** 6), // 50 GOLD reward probability: 1.0, // 100% chance }, ], }, missionPool: missionPoolAddress, project: projectAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), }); const tx2 = web3.VersionedTransaction.deserialize(Buffer.from(missionTx.transaction, "base64")); tx2.sign([adminKeypair]); await connection.sendTransaction(tx2); console.log("Mission Pool:", missionPoolAddress); console.log("Mission:", missionAddress); // Output: Mission Pool: 9xQ8...4vYz // Output: Mission: 2kL9...7pWx ``` -------------------------------- ### Generate Solana User Keypair Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/keys/README.mdx Generates a new Solana keypair and saves it to `keys/user.json`. This keypair represents a standard user account for interacting with the application. ```bash solana-keygen new --outfile keys/user.json ``` -------------------------------- ### Fund User Account with SOL Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/keys/README.mdx Airdrops 100 SOL to the user account from the Honeycomb Protocol's testnet RPC. This command requires the user's keypair file to be present. ```bash solana airdrop 100 --url https://rpc.test.honeycombprotocol.com/ -k ./keys/user.json ``` -------------------------------- ### Create and Mint Fungible Resources with TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Establishes fungible resources (currencies) for in-game economies, supporting flexible storage. This includes creating a new resource with specified parameters and minting it to a user. It requires the '@honeycomb-protocol/edge-client' and 'web3' libraries. The storage can be 'AccountState' or 'LedgerState'. ```typescript import { ResourceStorageEnum } from "@honeycomb-protocol/edge-client"; const projectAddress = "8xK7...9vQz"; // Create resource with AccountState storage (standard SPL Token) const { createCreateNewResourceTransaction: { tx: initResourceTx, resource: resourceAddress, }, } = await client.createCreateNewResourceTransaction({ project: projectAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), params: { name: "Gold Coins", symbol: "GOLD", decimals: 6, uri: "https://arweave.net/gold-metadata.json", storage: ResourceStorageEnum.AccountState, // or LedgerState for compressed }, }); // Send transaction const tx = web3.VersionedTransaction.deserialize(Buffer.from(initResourceTx.transaction, "base64")); tx.sign([adminKeypair]); await connection.sendTransaction(tx); // Mint resources to user const { createMintResourceTransaction: mintResourceTx } = await client.createMintResourceTransaction({ resource: resourceAddress, owner: userKeypair.publicKey.toString(), authority: adminKeypair.publicKey.toString(), amount: String(1000 * 10 ** 6), // 1000 GOLD }); const mintTx = web3.VersionedTransaction.deserialize(Buffer.from(mintResourceTx.transaction, "base64")); mintTx.sign([adminKeypair]); await connection.sendTransaction(mintTx); // Fetch resource const resource = await client .findResources({ addresses: [resourceAddress] }) .then(({ resources }) => resources[0]); console.log("Resource:", resource.mint.address); console.log("Storage type:", resource.storage); // Output: Resource: 6kP3...5nWr // Output: Storage type: AccountState ``` -------------------------------- ### Fund Admin Account with SOL Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/keys/README.mdx Airdrops 100 SOL to the admin account from the Honeycomb Protocol's testnet RPC. This command requires the admin's keypair file to be present. ```bash solana airdrop 100 --url https://rpc.test.honeycombprotocol.com/ -k ./keys/admin.json ``` -------------------------------- ### Generate Solana Admin Keypair Source: https://github.com/honeycomb-protocol/hpl-starter-kit/blob/main/keys/README.mdx Generates a new Solana keypair and saves it to `keys/admin.json`. This keypair is typically used for administrative purposes within the application. ```bash solana-keygen new --outfile keys/admin.json ``` -------------------------------- ### Manage Delegate Authority with TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Demonstrates how to grant and modify delegated permissions for project operations. This includes creating a delegate with specific service permissions and subsequently altering those permissions. ```typescript import { HiveControlPermissionInput } from "@honeycomb-protocol/edge-client"; const projectAddress = "8xK7...9vQz"; const delegateKeypair = web3.Keypair.generate(); // Create delegate with specific permissions const { createCreateDelegateAuthorityTransaction: txResponse } = await client.createCreateDelegateAuthorityTransaction({ project: projectAddress, delegate: delegateKeypair.publicKey.toString(), serviceDelegations: { HiveControl: [ { permission: HiveControlPermissionInput.ManageServices, }, ], CharacterManager: [ { permission: "ManageCharacters", }, ], }, authority: adminKeypair.publicKey.toString(), }); const tx = web3.VersionedTransaction.deserialize(Buffer.from(txResponse.transaction, "base64")); tx.sign([adminKeypair]); await connection.sendTransaction(tx); // Modify existing delegation const { createModifyDelegationTransaction: modifyTx } = await client.createModifyDelegationTransaction({ project: projectAddress, delegate: delegateKeypair.publicKey.toString(), modifyDelegation: { delegation: { HiveControl: { permission: HiveControlPermissionInput.ManageProfiles, }, }, }, authority: adminKeypair.publicKey.toString(), }); const tx2 = web3.VersionedTransaction.deserialize(Buffer.from(modifyTx.transaction, "base64")); tx2.sign([adminKeypair]); await connection.sendTransaction(tx2); console.log("Delegate:", delegateKeypair.publicKey.toString()); console.log("Permissions: ManageServices, ManageCharacters, ManageProfiles"); // Output: Delegate: 8rP2...6wLm // Output: Permissions: ManageServices, ManageCharacters, ManageProfiles ``` -------------------------------- ### Wallet-Based Authentication for API Operations (TypeScript) Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt This snippet shows how to generate access tokens using wallet signatures for authenticated API calls. It involves requesting a challenge, signing it with the user's wallet, confirming authentication, and then using the obtained access token in subsequent requests. Dependencies include 'tweetnacl' for signing and 'bs58' for encoding. ```typescript import nacl from "tweetnacl"; import base58 from "bs58"; const userKeypair = web3.Keypair.generate(); // User's wallet // Step 1: Request authentication challenge const { authRequest: { message: authRequest } } = await client.authRequest({ wallet: userKeypair.publicKey.toString(), }); // Step 2: Sign the challenge message const messageBytes = new TextEncoder().encode(authRequest); const signatureBytes = nacl.sign.detached(messageBytes, userKeypair.secretKey); const signature = base58.encode(signatureBytes); // Step 3: Confirm authentication and receive token const { authConfirm } = await client.authConfirm({ wallet: userKeypair.publicKey.toString(), signature, }); const accessToken = authConfirm.accessToken; // Step 4: Use access token in authenticated requests const { createNewProfileTransaction: txResponse } = await client.createNewProfileTransaction( { project: projectAddress, info: { name: "My Profile" }, payer: userKeypair.publicKey.toString(), }, { fetchOptions: { headers: { authorization: `Bearer ${accessToken}`, }, }, } ); console.log("Access token:", accessToken.substring(0, 20) + "..."); // Output: Access token: eyJhbGciOiJIUzI1NiI... ``` -------------------------------- ### Create Character Model and Merkle Tree with TypeScript Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Defines character models by specifying asset criteria for wrapping NFTs into game characters. It then sets up a Merkle tree for these characters. This process involves creating a character model, establishing a Merkle tree configuration, and sending the respective transactions. Dependencies include '@honeycomb-protocol/edge-client' and 'web3'. ```typescript import { AdvancedTreeConfig } from "@honeycomb-protocol/edge-client"; const projectAddress = "8xK7...9vQz"; const collectionAddress = "7xM9...3pQw"; // From NFT minting // Create character model with collection criteria const { createCreateCharacterModelTransaction: { tx: createTx, characterModel: characterModelAddress, }, } = await client.createCreateCharacterModelTransaction({ config: { kind: "Wrapped", criterias: [ { kind: "Collection", // Accept NFTs from this collection params: collectionAddress, }, ], }, project: projectAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), }); // Send transaction const tx1 = web3.VersionedTransaction.deserialize(Buffer.from(createTx.transaction, "base64")); tx1.sign([adminKeypair]); await connection.sendTransaction(tx1); // Create merkle tree for characters const treeConfig: AdvancedTreeConfig = { maxDepth: 14, maxBufferSize: 64, canopyDepth: 11, }; const { createCreateCharactersTreeTransaction: { tx: createTreeTx }, } = await client.createCreateCharactersTreeTransaction({ treeConfig: { advanced: treeConfig }, project: projectAddress, characterModel: characterModelAddress, authority: adminKeypair.publicKey.toString(), payer: adminKeypair.publicKey.toString(), }); const tx2 = web3.VersionedTransaction.deserialize(Buffer.from(createTreeTx.transaction, "base64")); tx2.sign([adminKeypair]); await connection.sendTransaction(tx2); // Fetch character model const characterModel = await client .findCharacterModels({ addresses: [characterModelAddress] }) .then((res) => res.characterModel[0]); console.log("Character Model:", characterModel.address); console.log("Accepted criteria:", characterModel.config.criterias.length); // Output: Character Model: 4pR7...2wXs // Output: Accepted criteria: 1 ``` -------------------------------- ### Mint Compressed NFTs (cNFT) with Metaplex Bubblegum Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Mints space-efficient compressed NFTs using Metaplex Bubblegum and SPL Account Compression. This involves creating a compression tree and then minting the NFT, with the option to fetch compressed assets via the DAS API. ```typescript import { createTree } from "@solana/spl-account-compression"; import { mintV1 } from "@metaplex-foundation/mpl-bubblegum"; // Create compression tree const treeKeypair = web3.Keypair.generate(); const maxDepth = 14; // Max 16,384 NFTs const maxBufferSize = 64; const allocTreeIx = await createTree( connection, treeKeypair.publicKey, adminKeypair.publicKey, { maxDepth, maxBufferSize } ); const tx1 = new web3.Transaction().add(allocTreeIx); tx1.sign([adminKeypair, treeKeypair]); await connection.sendTransaction(tx1); // Mint compressed NFT const collectionMint = "7xM9...3pQw"; // Collection from previous example const userPublicKey = userKeypair.publicKey; await mintV1(umi, { leafOwner: userPublicKey, merkleTree: treeKeypair.publicKey, metadata: { name: "Compressed Warrior #1", symbol: "cNFT", uri: "https://arweave.net/compressed-nft.json", sellerFeeBasisPoints: 500, collection: { key: collectionMint, verified: false }, creators: [ { address: adminKeypair.publicKey, verified: false, share: 100, }, ], }, }).sendAndConfirm(umi); // Fetch compressed assets via DAS API (Helius/RPC) const response = await fetch(RPC_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: "1", method: "getAssetsByOwner", params: { ownerAddress: userPublicKey.toString(), page: 1, limit: 100, }, }), }); const { result } = await response.json(); const compressedAssets = result.items.filter((asset) => asset.compression); console.log("Merkle tree:", treeKeypair.publicKey.toString()); console.log("Compressed assets owned:", compressedAssets.length); // Output: Merkle tree: 2xK8...9vQp // Output: Compressed assets owned: 1 ``` -------------------------------- ### Batch Submit Transactions with SSE Confirmation Source: https://context7.com/honeycomb-protocol/hpl-starter-kit/llms.txt Submits multiple transactions efficiently using the Edge client with SSE-based confirmation tracking. This function allows for real-time status updates on each transaction within the batch. ```typescript import createEdgeClient, { Transactions } from "@honeycomb-protocol/edge-client"; import { sendTransactionsForTests } from "@honeycomb-protocol/edge-client/client/helpers"; const sseClient = createEdgeClient(API_URL, true); // Enable SSE // Prepare multiple transactions const transactions: Transactions = { transactions: [ { transaction: "base64-encoded-tx-1", blockhash: "blockhash1", lastValidBlockHeight: 123456, }, { transaction: "base64-encoded-tx-2", blockhash: "blockhash2", lastValidBlockHeight: 123457, }, ], }; // Send batch with real-time status updates const responses = await sendTransactionsForTests( sseClient, transactions, [adminKeypair], { skipPreflight: true, commitment: "processed", }, (response) => { console.log(`Transaction ${response.signature}: ${response.status}`); if (response.status !== "Success") { console.error("Error:", response.error); } } ); console.log("Batch submitted:", responses.length, "transactions"); // Output: Transaction 3mK8...5pQw: Success // Output: Transaction 7xL2...9rTv: Success // Output: Batch submitted: 2 transactions ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.