ryt-sdk
v1.0.12
Published
RYT blockchain SDK for provider, wallet, and smart contract interactions
Maintainers
Readme
RYT is a blockchain infrastructure platform that simplifies building, deploying, and interacting with smart contracts, wallets, and dApps. It provides a streamlined developer experience with tools for scalable and modular Web3 development.
This is our RYT blockchain sdk for provider, wallet, and smart contract interactions.
- ⚡ This is only a quick start guide.
- 📚 For detail developer documentation and guide that how to interact with ryt chain visit 👉 Homepage
⚙️ Install
npm install ryt-sdkor
yarn add ryt-sdk🌐 Frontend Dapp Setup (Browser Mode)
RYT SDK supports browser-based dApps using injected wallets such as:
- MetaMask
- Rabby
- Coinbase Wallet
No private keys are required in frontend mode.
💻 Frontend Example Dapp
import { useState } from "react";
import {
RYTContract,
RYTWallet,
hasRYT,
requestAccounts,
RYTProvider,
parseTokenUnits,
} from "ryt-sdk";
const CONTRACT_ADDRESS = process.env.ERC20_ADDRESS; /* deploy erc20 token */
const CHAIN_ID= process.env.CHAIN_ID; /* provide chain id */
const ABI = [
"function approve(address spender, uint256 value) returns (bool)",
"function transfer(address to, uint256 value) returns (bool)",
"function decimals() view returns (uint8)",
];
function App() {
const [account, setAccount] = useState<string | null>(null);
const [contract, setContract] = useState<RYTContract | null>(null);
const [recipient, setRecipient] = useState("");
const [amount, setAmount] = useState("");
const [spender, setSpender] = useState("");
const [loading, setLoading] = useState(false);
const [txHash, setTxHash] = useState<string | null>(null);
/**
* Connect wallet using RTY SDK
*/
const connectWallet = async () => {
try {
if (!hasRYT()) {
alert("Install MetaMask or compatible wallet");
return;
}
setLoading(true);
// 1. request accounts via SDK
const accounts = await requestAccounts();
const address = accounts[0];
// 2. create provider via SDK
const provider = new RYTProvider({
chainId: CHAIN_ID,
rpcUrls: [process.env.RPC_URL] /* provide rpc url */
});
// 3. create wallet
const signer = await provider.getSigner();
const wallet = new RYTWallet(signer);
// 4. create contract instance via SDK
const rytContract = new RYTContract(
CONTRACT_ADDRESS,
ABI,
wallet
);
setAccount(address);
setContract(rytContract);
} catch (err) {
console.error(err);
} finally {
setLoading(false);
}
};
/**
* Approve tokens
*/
const handleApprove = async () => {
if (!contract) return alert("Connect wallet");
try {
setLoading(true);
const decimals = await contract.read("decimals");
const parsed = parseTokenUnits(amount, decimals);
const tx = await contract.write("approve", spender, parsed);
setTxHash(tx.hash);
await tx.wait();
} finally {
setLoading(false);
}
};
/**
* Transfer tokens
*/
const handleTransfer = async () => {
if (!contract) return alert("Connect wallet");
try {
setLoading(true);
const decimals = await contract.read("decimals");
const parsed = parseTokenUnits(amount, decimals);
const tx = await contract.write("transfer", recipient, parsed);
setTxHash(tx.hash);
await tx.wait();
} finally {
setLoading(false);
}
};
return (/* Build your stunning UI here*/);
}
export default App;
⚡ Backend Quickstart Guide
🔐 Environment Setup
Create a .env file
PRIVATE_KEY=your_private_key
RPC_URL=https://your-rpc-url
CHAIN_ID=1234
TOKEN_URI=https://metadata.example.com
CREATE2_FACTORY=0xFactoryAddress
SALT=random_salt
MATH_LIB_ADDRESS=0xLibraryAddress💻 Code Example
import {
RYTContract,
RYTWallet,
RYTProvider
} from "ryt-sdk";
const provider = new RYTProvider({
chainId: process.env.CHAIN_ID,
rpcUrls: [process.env.RPC_URL]
});
const wallet = new RYTWallet(process.env.PRIVATE_KEY, provider);
const contract = new RYTContract(address, abi, wallet);
const tx = await contract.write("transfer", to, 100n);
await tx.wait();📌 Overview
RYT SDK is a modular blockchain development toolkit designed to simplify
- Smart contract interaction
- Wallet management
- Contract deployment (CREATE / CREATE2)
- ERC20 / ERC721 / ERC1155 support
- Proxy patterns (UUPS)
- Cloning (EIP-1167)
- Library-linked contracts
🧪 Testing
To run tests, run the following commands:
npm test
npm run contractsTest📜 License
MIT© 2026 RYT Core Team
