Added credentials and mint tokens

This commit is contained in:
2026-02-01 22:55:35 +05:30
parent de1f95563a
commit 11a632bf92
5 changed files with 39 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

14
readme.md Normal file
View File

@@ -0,0 +1,14 @@
# Solana Starter
Token Address: `6cEVBKWwj1haj1gafHypmgxEKu5iKnML5QWck75Tcswk`
![Solana Explorer1](docs/assets/Tokenexplorer.png)
---
### Transaction
View on [Solana Explorer](https://explorer.solana.com/tx/UxzAxb42GrzLnJH6CvnPgRAcY9ZtvdS8UGBo2rrAm7bnH2w8xNsFc1BRB7FKYBDxQLJw5DWKKSnXZ3m2cj224q3?cluster=devnet)
Blockhash: `D9VDkqnCdGHBwEAFk7Et23ZnD1yHWcyyHHDV7C25GeBG`<br>Signature: `UxzAxb42GrzLnJH6CvnPgRAcY9ZtvdS8UGBo2rrAm7bnH2w8xNsFc1BRB7FKYBDxQLJw5DWKKSnXZ3m2cj224q3`

View File

@@ -1,19 +1,28 @@
import { Keypair, Connection, Commitment } from "@solana/web3.js";
import { createMint } from '@solana/spl-token';
import wallet from "../turbin3-wallet.json"
import wallet from "/home/sortedcord/.config/solana/id.json";
// Import our keypair from the wallet file
const keypair = Keypair.fromSecretKey(new Uint8Array(wallet));
//Create a Solana devnet connection
const commitment: Commitment = "confirmed";
const connection = new Connection("https://api.devnet.solana.com", commitment);
const connection = new Connection("https://api.devnet.solana.com", commitment); // describes when a txn is to be done
// avoid processed
(async () => {
try {
// Start here
// const mint = ???
} catch(error) {
const mint = await createMint(
connection,
keypair,
keypair.publicKey,
null,
6
);
console.log(`successfully created a mint ${mint}`);
} catch (error) {
console.log(`Oops, something went wrong: ${error}`)
}
})()
})();

View File

@@ -1,6 +1,6 @@
import { Keypair, PublicKey, Connection, Commitment } from "@solana/web3.js";
import { getOrCreateAssociatedTokenAccount, mintTo } from '@solana/spl-token';
import wallet from "../turbin3-wallet.json"
import wallet from "/home/sortedcord/.config/solana/id.json";
// Import our keypair from the wallet file
const keypair = Keypair.fromSecretKey(new Uint8Array(wallet));
@@ -9,21 +9,21 @@ const keypair = Keypair.fromSecretKey(new Uint8Array(wallet));
const commitment: Commitment = "confirmed";
const connection = new Connection("https://api.devnet.solana.com", commitment);
const token_decimals = 1_000_000n;
const token_decimals = 500_000n;
// Mint address
const mint = new PublicKey("<mint address>");
const mint = new PublicKey("6cEVBKWwj1haj1gafHypmgxEKu5iKnML5QWck75Tcswk");
(async () => {
try {
// Create an ATA
// const ata = ???
// console.log(`Your ata is: ${ata.address.toBase58()}`);
const ata = await getOrCreateAssociatedTokenAccount(connection, keypair, mint, keypair.publicKey)
console.log(`Your ata is: ${ata.address.toBase58()}`);
// Mint to ATA
// const mintTx = ???
// console.log(`Your mint txid: ${mintTx}`);
} catch(error) {
const mintTx = await mintTo(connection, keypair, mint, ata.address, keypair.publicKey, 67)
console.log(`Your mint txid: ${mintTx}`);
} catch (error) {
console.log(`Oops, something went wrong: ${error}`)
}
})()

View File

@@ -42,5 +42,6 @@
},
"devDependencies": {
"ts-node": "^10.9.1"
}
},
"main": "index.js"
}