Agent skill
sui-transaction-building
Helps Claude Code understand Sui blockchain transaction building, providing guidelines and examples for Transaction class, commands, input types, gas configuration, and serialization. Use when building blockchain transactions on Sui or when the user mentions transaction building, Transaction class, or Move calls.
Install this agent skill to your Project
npx add-skill https://github.com/RandyPen/sui-eco-skills/tree/main/sui-transaction-building
SKILL.md
Sui Transaction Building Skill
Overview
Transaction building is a core functionality of Sui blockchain development. The Sui TypeScript SDK provides the Transaction class, allowing developers to create, serialize, sign, and execute blockchain transactions using a fluent builder pattern. This skill helps Claude Code understand how to assist users in building various types of transactions on Sui.
Quick Start
Installation and Import
// Import Transaction class
import { Transaction } from '@mysten/sui/transactions';
// Create new transaction
const tx = new Transaction();
Basic Example: Sending SUI
import { Transaction } from '@mysten/sui/transactions';
const tx = new Transaction();
// Split 100 units of SUI from gas coin
const [coin] = tx.splitCoins(tx.gas, [100]);
// Transfer the split coin to specified address
tx.transferObjects([coin], '0xSomeSuiAddress');
// Execute transaction using signAndExecuteTransaction
const result = await client.signAndExecuteTransaction({
signer: keypair,
transaction: tx
});
Core Components
Transaction Class
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/Transaction.ts
The Transaction class is the core of transaction building, providing the following key features:
- Builder Pattern: Fluent interface supporting method chaining
- Command Support: Supports all Sui transaction commands (Move calls, transfers, merges, etc.)
- Plugin System: Supports transaction parsing plugins
- Serialization Capability: Built-in BCS serialization support
- Async Support: Supports automatic resolution of async transaction thunks
TransactionDataBuilder Class
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/TransactionData.ts
Handles transaction data structure and serialization:
- Transaction data validation and serialization
- BCS serialization for blockchain compatibility
- Gas configuration and budget management
- Input and command management
Commands Module
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/Commands.ts
Defines all available transaction operations:
- MoveCall: Execute Move smart contract functions
- TransferObjects: Transfer objects between addresses
- SplitCoins: Split a coin into multiple amounts
- MergeCoins: Merge multiple coins
- Publish: Deploy new Move modules
- Upgrade: Upgrade existing Move modules
- MakeMoveVec: Create Move vectors
Detailed Documentation
This skill follows a progressive disclosure pattern. The main file provides an overview and quick start, while detailed information is available in the reference directory.
Transaction Commands
For detailed information about transaction commands including SplitCoins, MergeCoins, TransferObjects, MoveCall, MakeMoveVec, and Publish, see Transaction Commands.
Input Types
Learn about different input types including pure values, object references, and transaction results in Input Types.
Gas Configuration
Understand gas coin usage, price setting, budget configuration, and optimization in Gas Configuration.
Transaction Serialization
Details about building transaction bytes, deserialization, and offline building in Transaction Serialization.
Advanced Features
Explore transaction intents, sponsored transactions, plugin system, and async support in Advanced Features.
Usage Patterns
Common patterns for transaction building, signing, execution, testing, and error handling in Usage Patterns.
Integration Points
Integration with SuiClient, BCS, keypairs, wallets, and external systems in Integration Points.
Workflows
Complete end-to-end workflows for common scenarios including SUI transfers, NFT minting, and offline building in Workflows.
Best Practices
Performance optimization, error handling, security considerations, and code quality guidelines in Best Practices.
Related Skills
- sui-bcs: Understand BCS serialization usage in transactions
- sui-transaction-executors: Understand advanced usage of transaction executors
- sui-keypair-cryptography: Understand transaction signing and key management
- sui-client: Understand complete SuiClient API
References
- Official Documentation: https://sdk.mystenlabs.com/typescript/transaction-building
- Source Code:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/ - Test Cases:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/__tests__/ - TypeScript Type Definitions:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/transactions/types.ts
This skill helps Claude Code understand Sui transaction building, providing practical code examples and usage guidelines. When users need to build Sui blockchain transactions, referencing this skill can provide accurate TypeScript code and best practices.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
sui-keypair-cryptography
Helps Claude Code understand Sui blockchain keypair and cryptography operations, providing guidelines and examples for key generation, signing, verification, address derivation, and multi-signature scheme support. Use when working with cryptography in Sui development or when the user mentions keypairs, cryptography, signing, or verification.
deepbook-trading
Helps Claude Code understand DeepBook V3 SDK usage for order book trading, flash loans, fund management, and market data queries on Sui blockchain. Use when operating DeepBook DEX, executing trading strategies, or querying market data.
working-with-ferra-dlmm
Helps developers work with the Ferra DLMM SDK for Discrete Liquidity Market Maker operations on Sui blockchain. Provides guidance on SDK initialization, pair creation, liquidity management, token swaps, and position handling. Use when working with DLMM pairs, adding/removing liquidity, creating trading pairs, or performing token swaps in the ferra-sdks monorepo.
deepbook-margin-trading-skill
Guides developers through using DeepBook V3 Margin Trading SDK for leverage trading, borrowing, lending, liquidation operations, and risk management on Sui blockchain. Use when working with DeepBook margin trading, margin pools, margin managers, take profit/stop loss orders, or liquidation functionality.
sui-client
Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.
cetus-dlmm-interface
Enables Claude to effectively work with the Cetus Dynamic Liquidity Market Maker (DLMM) protocol on Sui blockchain. This skill provides comprehensive knowledge of the DLMM architecture, Move smart contracts, Rust SDK, and development workflows. Claude can assist with building, testing, and modifying DLMM contracts, creating swap simulations, implementing new features, and debugging protocol issues. The skill covers all 15 Move modules, multi-bin architecture, reward distribution, ACL system, and flash swap functionality. Trigger contexts include: working with Sui Move smart contracts for decentralized exchanges, implementing dynamic liquidity management, creating multi-bin AMM protocols, building swap simulations with Rust SDK, modifying DLMM protocol parameters, debugging pool operations, implementing reward systems, and working with Cetus DLMM interface codebase.
Didn't find tool you were looking for?