Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
const axios = require('axios');
const algosdk = require('algosdk');
const MNEMONIC = 'seed phrase here'; // Never commit this in production!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use dotenv ; )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to update .gitignore ; )

const senderAccount = algosdk.mnemonicToSecretKey(MNEMONIC);
// Voi Mainnet Algorand API (using AlgoNode as an example)
const algodClient = new algosdk.Algodv2('', 'https://mainnet-api.voi.nodely.dev', '');

// CLI usage: node script.js 100000 --nodryrun
const totalValue = parseFloat(process.argv[2]);
Expand All @@ -18,10 +23,27 @@ const ELEMENT_WEIGHTS = {
Gold: 5,
};

// 🔁 Placeholder transfer function
async function sendPayment(to, amount) {
// TODO: Implement real transfer logic here using algosdk, Nautilus SDK, etc.
console.log(`[TRANSFER] Sent ${amount.toFixed(6)} VOI to ${to}`);
async function sendPayment(toAddress, amount) {
try {
const params = await algodClient.getTransactionParams().do();

const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: senderAccount.addr,
to: toAddress,
amount: algosdk.algosToMicroalgos(amount), // convert VOI to microVOI
suggestedParams: params,
note: new TextEncoder().encode(
`Drop ${amount} VOI for vGully holder rewards`
),
});

const signedTxn = txn.signTxn(senderAccount.sk);
const { txId } = await algodClient.sendRawTransaction(signedTxn).do();

console.log(`[TRANSFER] Sent ${amount.toFixed(6)} VOI to ${toAddress} | TXID: ${txId}`);
} catch (error) {
console.error(`[ERROR] Failed to send ${amount} VOI to ${toAddress}:`, error.message);
}
}

async function fetchNFTData() {
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vgully",
"version": "1.0.0",
"version": "1.0.1",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -10,6 +10,7 @@
"license": "ISC",
"description": "",
"dependencies": {
"algosdk": "^2.9.0",
"axios": "^1.8.4"
}
}