mesh-transaction
Original:🇺🇸 English
Translated
Use when building Cardano transactions with MeshJS SDK. Covers MeshTxBuilder API for sending ADA, minting NFTs and tokens, spending from Plutus scripts, staking, governance voting, DRep registration, and multi-sig patterns. Includes correct method ordering, coin selection, fee calculation, and troubleshooting common Cardano transaction errors.
2installs
Sourcemeshjs/skills
Added on
NPX Install
npx skill4agent add meshjs/skills mesh-transactionTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Mesh SDK Transaction Skill
AI-assisted Cardano transaction building using from .
MeshTxBuilder@meshsdk/transactionPackage Info
bash
npm install @meshsdk/transaction
# or
npm install @meshsdk/core # includes transaction + wallet + providerQuick Reference
| Task | Method Chain |
|---|---|
| Send ADA | |
| Mint tokens (Plutus) | |
| Mint tokens (Native) | |
| Script spending | |
| Stake delegation | |
| Withdraw rewards | |
| Governance vote | |
| DRep registration | |
Constructor Options
typescript
import { MeshTxBuilder } from '@meshsdk/transaction';
const txBuilder = new MeshTxBuilder({
fetcher?: IFetcher, // For querying UTxOs (e.g., BlockfrostProvider)
submitter?: ISubmitter, // For submitting transactions
evaluator?: IEvaluator, // For script execution cost estimation
serializer?: IMeshTxSerializer, // Custom serializer
selector?: IInputSelector, // Custom coin selection
isHydra?: boolean, // Hydra L2 mode (zero fees)
params?: Partial<Protocol>, // Custom protocol parameters
verbose?: boolean, // Enable logging
});Completion Methods
| Method | Async | Balanced | Use Case |
|---|---|---|---|
| Yes | Yes | Production - auto coin selection, fee calculation |
| No | No | Testing - requires manual inputs/fee |
| No | No | Partial build for inspection |
| No | N/A | Add signatures after complete() |
Files
- TRANSACTION.md - Complete API reference
- PATTERNS.md - Common transaction recipes
- TROUBLESHOOTING.md - Error solutions
Key Concepts
Fluent API
All methods return for chaining:
thistypescript
txBuilder
.txIn(hash, index)
.txOut(address, amount)
.changeAddress(addr)
.complete();Script Versions
- - Set before
spendingPlutusScriptV1/V2/V3()for script inputstxIn() - - Set before
mintPlutusScriptV1/V2/V3()for Plutus mintingmint() - - Set before
withdrawalPlutusScriptV1/V2/V3()for script withdrawalswithdrawal() - - Set before
votePlutusScriptV1/V2/V3()for script votesvote()
Data Types
Datum and redeemer values accept three formats:
- (default) - Mesh Data type
"Mesh" - - Raw constructor format
"JSON" - - Hex-encoded CBOR string
"CBOR"
Reference Scripts
Use methods to reference scripts stored on-chain instead of including them in the transaction (reduces tx size/fees).
*TxInReference()Important Notes
- Change address required - fails without
complete()changeAddress() - Collateral required - Script transactions need
txInCollateral() - Order matters - Call BEFORE
spendingPlutusScriptV2()for script inputstxIn() - Coin selection - Provide UTxOs via for auto-selection
selectUtxosFrom()