algoflow-sdk
v1.3.3
Published
<div align="center"> <img src="algorand-logo-white-CMYK.png" width="300" />
Readme
🚀 Algoflow SDK
Official Documentation Links is Here
🌟 Overview
Algoflow SDK is an innovative development toolkit that simplifies data storage and access processes for developers using the Algorand blockchain infrastructure. By automating the complexity of traditional blockchain operations (wallet connections, gas fees, private key management) in the background, it enables data to be written to and read from the blockchain with just a few function calls.
💡 Perfect for developers who want to integrate blockchain functionality without the complexity!
📦 Installation
🛠️ Local Development
# Install via yarn
yarn add algoflow-sdk📄 Package.json Reference
{
"dependencies": {
"algoflow-sdk": "2.0.0"
}
}✨ Features
- = Account creation and management
- =� Token transfers on Algorand TestNet
- <� NFT creation with metadata support
- =� Data storage and retrieval via smart contracts
- =� Intereact with blochain instructure via algorand.
🚀 Quick Start
📚 Table of Contents
📦 Import Functions
import {
createAccount,
sendToken,
createNft,
writeVault,
getVault,
getNft,
optIn
} from 'algoflow-sdk'📖 API Reference
🔐 Account Management
🔑 createAccount()
Description: Creates a new Algorand account with secure mnemonic and address generation.
Signature:
function createAccount(): Promise<{
mnemonic: string;
address: string;
}>Usage:
const newAccount = await createAccount()
console.log('New Account:', newAccount.address)
console.log('Mnemonic:', newAccount.mnemonic)Returns:
mnemonic(string): 25-word mnemonic phraseaddress(string): Algorand wallet address
💰 Token Operations
💸 sendToken(mnemonic, recipient, amount)
Transfers ALGO tokens between accounts on TestNet.
Parameters:
mnemonic(string): Sender's 25-word mnemonic phraserecipient(string): Recipient's Algorand addressamount(number): Amount in microALGOs (1 ALGO = 1,000,000 microALGOs)
const result = await sendToken(
"your 25-word mnemonic phrase here",
"RECIPIENT_ADDRESS_HERE",
100_000 // 0.1 ALGO
)🎨 NFT Operations
🖼️ createNft(mnemonic, options)
Creates an NFT with metadata stored on Supabase.
Parameters:
mnemonic(string): Creator's 25-word mnemonic phraseoptions(object): NFT configuration
const newNft = await createNft("your-mnemonic", {
metadata: {
"name": "Your NFT Name",
"description": "NFT Description",
"image": "https://your-image-url.com/image.png",
"image_mimetype": "image/png",
"unitname": "SYMBOL"
},
metadataURL: "https://your-metadata-url.json"
})
// Returns: { assetId: number, txIds: string[] }🖼️ getNft(assetId: number)
Creates an NFT with metadata stored on Supabase.
Parameters:
assetId(number): Number of the asset
const res = await getNft(746497619)
return res.asset.params.url📦 Data Storage (Smart Contract)
📝 writeVault(mnemonic, data)
Stores data in Algorand smart contract (AlgoflowVault).
Parameters:
mnemonic(string): Account's 25-word mnemonic phrasedata(string): Data to store in the vault
const result = await writeVault(
"your-mnemonic",
"Your data to store"
)📥 getVault()
Retrieves stored data from the smart contract.
const storedData = await getVault()
// Returns: string📥 optIn()
You need to authorize wallet before send an asset.
Parameters:
mnemonic(string): Account's 25-word mnemonic phraseassetId(number): NFT or Token assetId
await optIn("25 KEY MNEMONIC", 746497619)
// Returns: stringExample Usage:
export async function GET(req: Request, context: any) {
const res = await getVault()
return Response.json({res: res});
}⚙️ Network Configuration
| 🌐 Network | 🔗 Endpoint | 📊 Chain ID |
|:---:|:---:|:---:|
| Algorand TestNet | https://testnet-api.algonode.cloud | TestNet |
| Smart Contract | AlgoflowVault | App ID: 746498651 |
🔧 Configuration Details
- Environment: Algorand TestNet (Development & Testing)
- Node Provider: AlgoNode (Free tier)
- Smart Contract: AlgoflowVault for data storage
- Gas Fees: Automatically handled by the SDK
🐛 Error Handling
⚠️ Best Practices
All SDK functions return promises and should be wrapped in try-catch blocks for proper error handling:
try {
const account = await createAccount()
console.log('✅ Account created:', account.address)
} catch (error) {
console.error('❌ Error creating account:', error.message)
}🔍 Common Error Types
| Error Type | Description | Solution |
|:---:|:---:|:---:|
| NetworkError | Connection issues with Algorand node | Check internet connection |
| InsufficientFunds | Not enough ALGO for transaction | Add funds to account |
| InvalidMnemonic | Malformed mnemonic phrase | Verify 25-word mnemonic |
| TransactionFailed | Blockchain transaction error | Check transaction parameters |
🛠️ Development & Build
📦 Build Process
The SDK includes TypeScript definitions and is pre-compiled for immediate use. No additional build steps required!
# SDK Structure
lib/
├── dist/ # Compiled JavaScript + Type definitions
├── fn/ # Individual function modules
├── api/ # API integration utilities
└── package.json # Package configuration📚 Dependencies
🔧 Core Dependencies
| Package | Version | Purpose |
|:---:|:---:|:---:|
| |
^3.5.2 | Algorand JavaScript SDK |
| |
^9.1.2 | Algorand development utilities |
| |
^2.58.0 | Metadata storage client |
🤝 Support & Community
📞 Getting Help
| Resource | Description | |:---:|:---:| | 📖 Documentation | Complete API reference and examples | | 🐛 Issues | Report bugs and request features | | 💬 Community | Join our developer community | | 📧 Contact | Direct support from development team |
🔗 Useful Links
⭐ Star this project if you find it useful!
Made with ❤️ by the Algoflow team
