prodv1
This commit is contained in:
45
sol.js
Normal file
45
sol.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import {Keypair, Connection, PublicKey, clusterApiUrl} from '@solana/web3.js';
|
||||
import {createAssociatedTokenAccount} from '@solana/spl-token';
|
||||
// import { GetPrivateKey } from './database.js';
|
||||
// import {AnchorProvider, Wallet, setProvider} from '@project-serum/anchor';
|
||||
|
||||
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
|
||||
// const ticketStoreIdl = require('./ticket_store_idl.json');
|
||||
// const ticketStoreProgramId = new PublicKey("5kgwVNdKDndFYNkUhZ5TvkNXxEJngMSczfS61qNALhzJ");
|
||||
// const ticketStoreProgram = new Program(ticketStoreIdl, ticketStoreProgramId);
|
||||
|
||||
const tokenMint = new PublicKey("vcHyeKhk67CVumjzYV3m8cf6V8xcE85N9ay48pcyUpB");
|
||||
const ticketsMint = new PublicKey("tktUDLZhFGb9VW9zDxZ7HYDFuBooEf8daZEvPbBY7at");
|
||||
|
||||
|
||||
export async function GenerateATAs(wallet){
|
||||
let tokenAta = await createAssociatedTokenAccount(
|
||||
connection,
|
||||
wallet,
|
||||
tokenMint,
|
||||
wallet.publicKey,
|
||||
);
|
||||
console.log(`Tokens ATA: ${tokenAta.toBase58()}`);
|
||||
|
||||
let ticketsAta = await createAssociatedTokenAccount(
|
||||
connection,
|
||||
wallet,
|
||||
ticketsMint,
|
||||
wallet.publicKey,
|
||||
);
|
||||
console.log(`Tickets ATA: ${ticketsAta.toBase58()}`);
|
||||
}
|
||||
|
||||
|
||||
// export async function PurchaseTickets(pubkey, amount){
|
||||
// const privateKey = GetPrivateKey(pubkey); //string
|
||||
|
||||
// const keypair = Keypair.fromSecretKey(privateKey);
|
||||
// const provider = new AnchorProvider(connection, new Wallet(keypair));
|
||||
|
||||
// setProvider(provider);
|
||||
|
||||
// await ticketStoreProgram.methods.purchaseTickets(new BN(amount)).accounts({
|
||||
// mint: ticketsMint
|
||||
// }).rpc();
|
||||
// }
|
||||
Reference in New Issue
Block a user