
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
dotcv-solana
Advanced tools
A TypeScript client library for DotCv's Solana program that enables domain registration, record management, and payment routing.
npm install dotcv-solana --save
OR
yarn add dotcv-solana
import { DotCvWeb3 } from 'dotcv-solana';
const web3 = new DotCvWeb3(
process.env.DOTCV_SIGNER_KEY, // Private key for admin operations
'devnet', // Network: "devnet" or "mainnet-beta"
{
mainnet: 'https://api.mainnet-beta.solana.com',
devnet: 'https://api.devnet.solana.com',
},
'dotcv.sol' // Your parent domain
);
// Create a domain registrar
const registrar = await web3.createRegistrar();
// Register a subdomain (admin)
const txHash = await web3.adminRegisterSubDomain('subdomain');
// Register a subdomain (user)
const serializedTx = await web3.registerSubDomain(
'subdomain',
'buyerPublicKey'
);
// Transfer subdomain ownership
const transferTx = await web3.transferSubDomain(
'subdomain',
'newOwnerPublicKey'
);
// Resolve domain information
const domainInfo = await web3.resolveDomain('subdomain');
// Create a record
const recordTx = await web3.createRecord(
'subdomain',
'@twitterhandle',
'domainOwnerPublicKey',
Record.Twitter
);
// Edit a record
const editTx = await web3.editRecord(
'subdomain',
'@newhandle',
'domainOwnerPublicKey',
Record.Twitter
);
// Initialize payment router
const routerInit = await web3.initializePaymentRouter('subdomain', [
{ wallet: 'wallet1PublicKey', percentage: 60 },
{ wallet: 'wallet2PublicKey', percentage: 40 },
]);
// Distribute funds
const distribution = await web3.distribute(
'subdomain',
1000000000, // Amount in lamports
true, // isSol
'mintAddress' // Optional: for SPL tokens
);
// Setup webhook for payment monitoring
const webhook = await setupPaymentRouterWebhook(
'heliusApiKey',
routerInit.paymentRouterPDA,
'devnet',
'https://your-webhook.url'
);
interface DistributionRuleInput {
wallet: string; // Wallet address as base58 string
percentage: number; // Percentage of distribution (0-100)
}
interface ApiEndpoints {
mainnet: string; // Mainnet RPC URL
devnet: string; // Devnet RPC URL
}
interface WebhookConfig {
webhookUrl: string;
accountAddresses: string[];
transactionTypes: string[];
webhookType: string;
}
The SDK includes comprehensive error handling. Most methods will throw detailed errors that should be caught and handled appropriately:
try {
const distribution = await web3.distribute(...);
} catch (error) {
if (error.message.includes('unauthorized')) {
// Handle authentication errors
}
// Handle other errors
}
The SDK supports both Solana mainnet and devnet environments. Specify the network when initializing the SDK:
"devnet"
"mainnet-beta"
[Add your license information here]
FAQs
Smart Contract Library
The npm package dotcv-solana receives a total of 12 weekly downloads. As such, dotcv-solana popularity was classified as not popular.
We found that dotcv-solana demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.