diff --git a/docs/assets/Tokenexplorer.png b/docs/assets/Tokenexplorer.png new file mode 100644 index 0000000..462d560 Binary files /dev/null and b/docs/assets/Tokenexplorer.png differ diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..824bd12 --- /dev/null +++ b/readme.md @@ -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`
Signature: `UxzAxb42GrzLnJH6CvnPgRAcY9ZtvdS8UGBo2rrAm7bnH2w8xNsFc1BRB7FKYBDxQLJw5DWKKSnXZ3m2cj224q3` \ No newline at end of file diff --git a/ts/cluster1/spl_init.ts b/ts/cluster1/spl_init.ts index a1eaf84..0f77785 100644 --- a/ts/cluster1/spl_init.ts +++ b/ts/cluster1/spl_init.ts @@ -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}`) } -})() +})(); diff --git a/ts/cluster1/spl_mint.ts b/ts/cluster1/spl_mint.ts index f6f1e16..210649c 100644 --- a/ts/cluster1/spl_mint.ts +++ b/ts/cluster1/spl_mint.ts @@ -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(""); +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}`) } })() diff --git a/ts/package.json b/ts/package.json index 25cbb50..676e02e 100644 --- a/ts/package.json +++ b/ts/package.json @@ -42,5 +42,6 @@ }, "devDependencies": { "ts-node": "^10.9.1" - } + }, + "main": "index.js" }