+2
-2
| { | ||
| "name": "torosdk", | ||
| "version": "0.1.2", | ||
| "version": "0.1.3", | ||
| "description": "A comprehensive Node.js library for interacting with the Toronet blockchain. This package simplifies wallet management, TNS setup, balance queries, fiat deposits, inter-wallet transfers, KYC verification, and smart contract deployment on Toronet's EVM-compatible network. Perfect for developers building blockchain-based applications with Toronet.", | ||
@@ -11,3 +11,3 @@ "main": "./dist/index.js", | ||
| "type": "git", | ||
| "url": "https://github.com/ToroForge-Collective/ToroSDK.git" | ||
| "url": "git+https://github.com/ToroForge-Collective/ToroSDK.git" | ||
| }, | ||
@@ -14,0 +14,0 @@ "scripts": { |
+87
-2
@@ -745,4 +745,12 @@ # Toronet SDK | ||
| import { | ||
| createSolanaAddress, | ||
| isValidSolanaAddress, | ||
| createToronetSolanaAddress, | ||
| verifySolanaVirtualAddressEnc, | ||
| verifySolanaVirtualAddress, | ||
| getSolBalance, | ||
| getSolTokenBalance, | ||
| getSolLatestBlock, | ||
| getSolTransactions, | ||
| getSolTokenTransactions, | ||
| transferSolana, | ||
@@ -752,9 +760,37 @@ transferSolToken, | ||
| getBridgeTokenFeeSol, | ||
| isValidSolanaAddress, | ||
| BridgeNetwork | ||
| } from "torosdk"; | ||
| // Create a new Solana address (prefer generatevirtualwallet for linking to Toronet) | ||
| const solAddress = await createSolanaAddress({ | ||
| admin: "0xAdminAddress", | ||
| adminpwd: "adminPassword" | ||
| }); | ||
| console.log("Created Solana address:", solAddress); | ||
| // Validate Solana address | ||
| const isValid = await isValidSolanaAddress("3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w"); | ||
| console.log("Is valid Solana address:", isValid); | ||
| // Create a custodial Solana address linked to Toronet address | ||
| const toronetSolAddress = await createToronetSolanaAddress({ | ||
| addr: "0xYourToronetAddress", | ||
| pwd: "YourPassword" | ||
| }); | ||
| console.log("Created Toronet-linked Solana address:", toronetSolAddress); | ||
| // Verify Solana virtual address encryption | ||
| const encVerified = await verifySolanaVirtualAddressEnc( | ||
| "0xYourToronetAddress", | ||
| "YourPassword" | ||
| ); | ||
| console.log("Encryption verified:", encVerified); | ||
| // Verify Solana virtual address (Toronet address) | ||
| const addrVerified = await verifySolanaVirtualAddress( | ||
| "0xYourToronetAddress", | ||
| "YourPassword" | ||
| ); | ||
| console.log("Address verified:", addrVerified); | ||
| // Get SOL balance | ||
@@ -764,9 +800,57 @@ const solBalance = await getSolBalance({ | ||
| }); | ||
| console.log("SOL balance:", solBalance); | ||
| // Get USDC balance on Solana | ||
| // Get SPL token balance (e.g., USDC on Solana) | ||
| const usdcBalance = await getSolTokenBalance({ | ||
| address: "3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w", | ||
| contractaddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" // USDC contract | ||
| }); | ||
| console.log("USDC balance on Solana:", usdcBalance); | ||
| // Get latest Solana block | ||
| const latestBlock = await getSolLatestBlock(); | ||
| console.log("Latest Solana block:", latestBlock); | ||
| // Get SOL transactions for an address | ||
| const solTransactions = await getSolTransactions({ | ||
| address: "3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w" | ||
| }); | ||
| console.log("SOL transactions:", solTransactions); | ||
| // Get SPL token transactions for an address | ||
| const tokenTransactions = await getSolTokenTransactions({ | ||
| address: "3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w", | ||
| contractaddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | ||
| }); | ||
| console.log("USDC transactions on Solana:", tokenTransactions); | ||
| // Transfer SOL | ||
| await transferSolana({ | ||
| from: "3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w", | ||
| to: "2Ha5ETJGGahgeLpqhTiAYWhAtre1bAGaG47zTDPzJcP4", | ||
| amount: "0.1", | ||
| pwd: "YourPassword" | ||
| }); | ||
| console.log("✓ SOL transferred"); | ||
| // Transfer SPL token (e.g., USDC) | ||
| await transferSolToken({ | ||
| from: "3uwR7HMDuK6dXwZAfx8jHwPcyXsYmFuHWJv3zvJxRE9w", | ||
| to: "2Ha5ETJGGahgeLpqhTiAYWhAtre1bAGaG47zTDPzJcP4", | ||
| amount: "10", | ||
| pwd: "YourPassword", | ||
| contractaddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", | ||
| tokenname: "USDC", | ||
| usetokenasfees: "true" // Use token for fees if not enough SOL | ||
| }); | ||
| console.log("✓ USDC transferred on Solana"); | ||
| // Get bridge fee estimate | ||
| const fee = await getBridgeTokenFeeSol({ | ||
| network: BridgeNetwork.Solana, | ||
| contractaddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", | ||
| amount: "100" | ||
| }); | ||
| console.log("Bridge fee:", fee); | ||
| // Bridge USDC from Solana to Toronet | ||
@@ -781,2 +865,3 @@ await bridgeTokenSol({ | ||
| }); | ||
| console.log("✓ USDC bridged from Solana to Toronet"); | ||
| ``` | ||
@@ -783,0 +868,0 @@ |
475901
0.6%1073
8.6%