@tari-project/tarijs
v0.14.6
Published
> **๐ The complete TypeScript toolkit for building on Tari** โ Connect any wallet, query the blockchain, and create powerful dApps with confidence.
Keywords
Readme
tari.js
๐ The complete TypeScript toolkit for building on Tari โ Connect any wallet, query the blockchain, and create powerful dApps with confidence.
โจ What makes tari.js special?
- ๐ Universal Wallet Support โ MetaMask, Wallet Daemon, Universe, WalletConnect โ all with one API
- ๐ก๏ธ Privacy-First โ Built-in confidential transactions and zero-knowledge proofs
- ๐ฑ Developer Friendly โ Full TypeScript support, intuitive APIs, comprehensive docs
- โก Production Ready โ Battle-tested, optimized, and actively maintained
Installing Tari.js
Tari.js provides the following packages:
| Package Name | Description | |----------------------------------------|------------------------------------------------------------| | @tari-project/tarijs-all | Everything: core, signers, providers, builders, permissions| | @tari-project/tarijs | Core Tari.js types and helpers | | @tari-project/tarijs-builders | Transaction builder (fluent API) | | @tari-project/indexer-provider | Read-only blockchain provider | | @tari-project/wallet-daemon-signer | Wallet Daemon signer & provider | | @tari-project/metamask-signer | MetaMask signer | | @tari-project/tari-universe-signer | Tari Universe wallet signer | | @tari-project/wallet-connect-signer | WalletConnect signer | | @tari-project/tari-permissions | Permissions utility | | @tari-project/typescript-bindings | TypeScript type definitions and low-level structures | | @tari-project/tarijs-types | Re-exports typescript-bindings while adding tari.js specific types |
Recommended: Use the Main Package
This installs everything (providers, signers, core modules, builders, types and permissions) with one package:
npm install @tari-project/tarijsYou can then import any of the required packages in your application:
import {
IndexerProvider,
WalletDaemonTariSigner,
TariUniverseSigner,
WalletConnectTariSigner,
TransactionBuilder,
TariPermissions,
} from "@tari-project/tarijs";If you are interested in development on the bleeding edge, you can install the following:
npm install @tari-project/tarijs-allThis will install ALL tari.js modules. Some of these may be under active development, experimental or not properly documented.
Optional: Install only the modules you require
If you require a minimal or custom setup, you can install the packages individually. This is not recommended unless you have a firm understanding of the purpose and function of the different packages.
Example of dependencies if you just wish to query Ootle states on the chain:
npm install @tari-project/indexer-provider
npm install @tari-project/wallet-daemon-signer # Only if you need wallet data models/typesCore Packages
- @tari-project/tarijs-builders
npm install @tari-project/tarijs-builders
Providers
@tari-project/indexer-provider
npm install @tari-project/indexer-provider@tari-project/wallet-daemon-signer
npm install @tari-project/wallet-daemon-signer
Signers
@tari-project/metamask-signer
npm install @tari-project/metamask-signer@tari-project/tari-universe-signer
npm install @tari-project/tari-universe-signer@tari-project/wallet-connect-signer
npm install @tari-project/wallet-connect-signer
Helpers
- @tari-project/tari-permissions
npm install @tari-project/tari-permissions
๐ฏ Quick Start (5 minutes)
Get your first Tari app running in minutes:
# Install tari.js
npm install @tari-project/tarijs-all
# Run your first connection test
node -e "
import { WalletDaemonTariSigner, TariPermissions } from '@tari-project/tarijs-all';
const wallet = await WalletDaemonTariSigner.buildFetchSigner({
serverUrl: 'http://localhost:18103',
permissions: new TariPermissions()
});
console.log('Connected to Tari!');
"๐ Complete Installation Guide | 5-Minute Tutorial
๐๏ธ What You Can Build
๐ช DeFi Applications
// Transfer tokens
const transaction = new TransactionBuilder()
.feeTransactionPayFromComponent(account.address, "100")
.callMethod({
componentAddress: account.address,
methodName: 'withdraw'
}, [{ type: 'Amount', value: '1000' }])
.build();๐ฎ Gaming & NFTs
// Call a smart contract function
const transaction = new TransactionBuilder()
.feeTransactionPayFromComponent(account.address, "100")
.callFunction({
templateAddress: nftTemplate.address,
functionName: 'mint_nft'
}, [{ name: 'metadata', value: { name: "Epic Sword", rarity: "legendary" } }])
.build();๐ผ Enterprise Solutions
// Multiple operations in one transaction
const transaction = new TransactionBuilder()
.feeTransactionPayFromComponent(account.address, "100")
.callMethod({ componentAddress: account1, methodName: 'withdraw' }, [amount1])
.callMethod({ componentAddress: account2, methodName: 'withdraw' }, [amount2])
.build();๐ Supported Wallets
| Wallet | Best For | Status | |--------|----------|--------| | ๐ฅ๏ธ Tari Wallet Daemon | Servers, advanced features | โ Production | | ๐ฆ MetaMask | Browser apps, familiar UX | โ Production | | ๐ Tari Universe | Mobile, native experience | โ Production | | ๐ฑ WalletConnect | Cross-platform, mobile-first | โ Production |
๐ Documentation Hub
๐ Get Started
- Installation Guide โ Set up your development environment
- First App Tutorial โ Build a working wallet app
- Provider vs Signer โ Understand the core concepts
๐ Guides & Examples
- Wallet Integration โ Connect different wallet types
- Transaction Building โ Create complex transactions
- Production Deployment โ Go live with confidence
๐ง Reference
- Complete API Reference โ Every method documented
- Troubleshooting โ Common issues & solutions
- Templates & Examples โ Copy-paste code snippets
๐ ๏ธ Contributing & Development
Want to contribute? We'd love your help! Here's how to get started:
๐ Quick Development Setup
# 1. Clone with required dependencies
git clone https://github.com/tari-project/tari.js
git clone https://github.com/tari-project/tari-ootle ../tari-ootle
# 2. Install toolchain
curl -fsSL https://moonrepo.dev/install/proto.sh | bash
proto use
# 3. Build everything
pnpm install
moon :build
# or target individual packages with
moon <package>:build๐งช Run the Example App
cd packages/tarijs/example
cp .env.example .env # Configure your wallet endpoints
pnpm run dev # Start development server๐ฆ Docker Development
docker build -t tarijs .
docker create --name tarijs-build tarijs
docker cp tarijs-build:/app/combined_dist/ ./dist๐ Documentation Development
moon tari-docs:start # http://localhost:3000/tari.js/Need help getting started? Check our Contributing Guide or ask in GitHub Discussions.
๐ค Community & Support
- ๐ Complete Documentation โ Everything you need to know
- ๐ฌ GitHub Discussions โ Ask questions, share ideas
- ๐ Issue Tracker โ Report bugs, request features
- ๐ง Troubleshooting Guide โ Common issues & solutions
- ๐ฎ Example Apps โ See tari.js in action
๐ License
This project is licensed under the BSD 3-Clause License โ see the LICENSE file for details.
Built with โค๏ธ by the Tari Project
