mesh-transaction
2
总安装量
2
周安装量
#69067
全站排名
安装命令
npx skills add https://github.com/meshjs/skills --skill mesh-transaction
Agent 安装分布
opencode
2
gemini-cli
2
claude-code
2
github-copilot
2
codex
2
kimi-cli
2
Skill 文档
Mesh SDK Transaction Skill
AI-assisted Cardano transaction building using MeshTxBuilder from @meshsdk/transaction.
Package Info
npm install @meshsdk/transaction
# or
npm install @meshsdk/core # includes transaction + wallet + provider
Quick Reference
| Task | Method Chain |
|---|---|
| Send ADA | txIn() -> txOut() -> changeAddress() -> complete() |
| Mint tokens (Plutus) | mintPlutusScriptV2() -> mint() -> mintingScript() -> mintRedeemerValue() -> ... |
| Mint tokens (Native) | mint() -> mintingScript() -> ... |
| Script spending | spendingPlutusScriptV2() -> txIn() -> txInScript() -> txInDatumValue() -> txInRedeemerValue() -> ... |
| Stake delegation | delegateStakeCertificate(rewardAddress, poolId) |
| Withdraw rewards | withdrawal(rewardAddress, coin) -> withdrawalScript() -> withdrawalRedeemerValue() |
| Governance vote | vote(voter, govActionId, votingProcedure) |
| DRep registration | drepRegistrationCertificate(drepId, anchor?, deposit?) |
Constructor Options
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 |
|---|---|---|---|
complete() |
Yes | Yes | Production – auto coin selection, fee calculation |
completeSync() |
No | No | Testing – requires manual inputs/fee |
completeUnbalanced() |
No | No | Partial build for inspection |
completeSigning() |
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 this for chaining:
txBuilder
.txIn(hash, index)
.txOut(address, amount)
.changeAddress(addr)
.complete();
Script Versions
spendingPlutusScriptV1/V2/V3()– Set beforetxIn()for script inputsmintPlutusScriptV1/V2/V3()– Set beforemint()for Plutus mintingwithdrawalPlutusScriptV1/V2/V3()– Set beforewithdrawal()for script withdrawalsvotePlutusScriptV1/V2/V3()– Set beforevote()for script votes
Data Types
Datum and redeemer values accept three formats:
"Mesh"(default) – Mesh Data type"JSON"– Raw constructor format"CBOR"– Hex-encoded CBOR string
Reference Scripts
Use *TxInReference() methods to reference scripts stored on-chain instead of including them in the transaction (reduces tx size/fees).
Important Notes
- Change address required –
complete()fails withoutchangeAddress() - Collateral required – Script transactions need
txInCollateral() - Order matters – Call
spendingPlutusScriptV2()BEFOREtxIn()for script inputs - Coin selection – Provide UTxOs via
selectUtxosFrom()for auto-selection