### Install @fleet-sdk/core Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Install the core library using npm. ```bash npm install @fleet-sdk/core ``` -------------------------------- ### Install @fleet-sdk/compiler Source: https://github.com/fleet-sdk/fleet/blob/master/packages/compiler/README.md Install the @fleet-sdk/compiler package using npm. ```bash npm install @fleet-sdk/compiler ``` -------------------------------- ### Install @fleet-sdk/babel-fees-plugin Source: https://github.com/fleet-sdk/fleet/blob/master/plugins/babel-fees/README.md Install the plugin using npm. This command adds the necessary package to your project dependencies. ```bash npm install @fleet-sdk/babel-fees-plugin ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/fleet-sdk/fleet/blob/master/CONTRIBUTING.md Use this command to install all project dependencies in the monorepo. ```bash pnpm install ``` -------------------------------- ### Build All Packages with pnpm Source: https://github.com/fleet-sdk/fleet/blob/master/CONTRIBUTING.md Builds all packages within the monorepo. This is a necessary step after installing dependencies. ```bash pnpm -r build ``` -------------------------------- ### Build Blockchain Providers Package Source: https://github.com/fleet-sdk/fleet/blob/master/packages/blockchain-providers/README.md Builds the blockchain-providers package using pnpm. Ensure you have pnpm installed and are in the project root. ```sh pnpm --filter blockchain-providers build ``` -------------------------------- ### Install AgeUSD Plugin Source: https://github.com/fleet-sdk/fleet/blob/master/plugins/ageusd/README.md Install the AgeUSD plugin using npm. This command adds the necessary package to your project dependencies. ```bash npm install @fleet-sdk/ageusd-plugin ``` -------------------------------- ### Run Unit Tests in Watch Mode Source: https://github.com/fleet-sdk/fleet/blob/master/CONTRIBUTING.md Starts unit tests for the 'core' package in watch mode, automatically re-running tests when code changes. ```bash pnpm watch:unit core ``` -------------------------------- ### Format Files with pnpm fix Source: https://github.com/fleet-sdk/fleet/blob/master/CONTRIBUTING.md Formats all files according to the project's coding style guidelines. This should be run before committing. ```bash pnpm fix ``` -------------------------------- ### Test Blockchain Providers Package Source: https://github.com/fleet-sdk/fleet/blob/master/packages/blockchain-providers/README.md Runs unit tests for the blockchain-providers package using pnpm. This command is used to verify the functionality of the providers. ```sh pnpm test:unit blockchain-providers ``` -------------------------------- ### Build a Simple Ergo Transaction Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Construct an unsigned Ergo transaction with a single output and minimum fee. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .to(new OutputBuilder(1000000n, "9gNvAv97W71Wm33GoXgSQBFJxinFubKvE6wh2dEhFTSgYEe783j")) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .payMinFee() .build(); ``` -------------------------------- ### Build Ergo Transaction with Multiple Outputs Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Create an unsigned Ergo transaction with multiple outputs by passing an array of OutputBuilder instances. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .to([ new OutputBuilder(1000000n, "9gNvAv97W71Wm33GoXgSQBFJxinFubKvE6wh2dEhFTSgYEe783j"), new OutputBuilder(2000000n, "9fhJkRaSoPfzE9rA3e4ptK51xvyNsLKonYN1xje5LWaLukx7iX2") ]) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .payMinFee() .build(); ``` -------------------------------- ### Use BabelSwapPlugin in TransactionBuilder Source: https://github.com/fleet-sdk/fleet/blob/master/plugins/babel-fees/README.md Extend the TransactionBuilder with BabelSwapPlugin to swap tokens for ERG. The swapped ERG can then be used for transaction fees or other purposes. ```typescript const tx = new TransactionBuilder(height) .from(inputs) // Use extend method to extend the transaction builder with plugins. .extend( // In this case, BabelSwapPlugin will swap the specified token // amount for ERG, based on token price, and make it available. // for use in the transaction. BabelSwapPlugin(babelBox, { tokenId: "03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04", amount: "2" // amount of token units you want to swap for ERG }) ) // BabelSwapPlugin will make swapped ERG available for use in any // point of the transaction, in this example, we are using it to // pay the mining fee and sending the excess to the change address. .payMinFee() .sendChangeTo(changeAddress) .build(); ``` -------------------------------- ### Mint Tokens in Ergo Transaction Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Mint new tokens as part of an Ergo transaction output using the mintToken method. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .to( new OutputBuilder(1000000n, "9gNvAv97W71Wm33GoXgSQBFJxinFubKvE6wh2dEhFTSgYEe783j").mintToken({ name: "TestToken", amount: 21000000n, decimals: 4, description: "Just a test token" }) ) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .payMinFee() .build(); ``` -------------------------------- ### Burn Tokens in Ergo Transaction Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Burn existing tokens as part of an Ergo transaction using the burnTokens method. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .burnTokens([ { tokenId: "0cd8c9f416e5b1ca9f986a7f10a84191dfb85941619e49e53c0dc30ebf83324b", amount: 100n }, { tokenId: "36aba4b4a97b65be491cf9f5ca57b5408b0da8d0194f30ec8330d1e8946161c1", amount: 429n } ]) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .payMinFee() .build(); ``` -------------------------------- ### Ensure Input Inclusion in Ergo Transaction Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Use configureSelector to guarantee specific inputs are included in the transaction, useful for contract interactions. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const boxId = "e56847ed19b3dc6b72828fcfb992fdf7310828cf291221269b7ffc72fd66706e"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .to(new OutputBuilder(1000000n, "9gNvAv97W71Wm33GoXgSQBFJxinFubKvE6wh2dEhFTSgYEe783j")) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .configureSelector((selector) => selector.ensureInclusion((input) => input.boxId === boxId)) .payMinFee() .build(); ``` -------------------------------- ### Send Tokens in Ergo Transaction Source: https://github.com/fleet-sdk/fleet/blob/master/packages/core/README.md Include custom tokens in an Ergo transaction output by using the addTokens method. ```typescript import { OutputBuilder, TransactionBuilder } from "@fleet-sdk/core"; const unsignedTransaction = new TransactionBuilder(creationHeight) .from(inputs) .to( new OutputBuilder(1000000n, "9gNvAv97W71Wm33GoXgSQBFJxinFubKvE6wh2dEhFTSgYEe783j").addTokens([ { tokenId: "0cd8c9f416e5b1ca9f986a7f10a84191dfb85941619e49e53c0dc30ebf83324b", amount: 100n }, { tokenId: "36aba4b4a97b65be491cf9f5ca57b5408b0da8d0194f30ec8330d1e8946161c1", amount: 429n } ]) ) .sendChangeTo("9i2bQmRpCPLmDdVgBNyeAy7dDXqBQfjvcxVVt5YMzbDud6AvJS8") .payMinFee() .build(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.