1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- const axios = require('axios');
- const web3 = require('@solana/web3.js');
- const fs = require("fs-extra");
- const { ReturnData } = require('@triton-one/yellowstone-grpc/dist/grpc/solana-storage');
- let swap_url = "https://solana-mainnet.g.alchemy.com/v2/WLI0ohbUlvbsJVmoIvB1wTSwUA8qP5qS";
- let swap_connection = new web3.Connection("https://solana-mainnet.g.alchemy.com/v2/WLI0ohbUlvbsJVmoIvB1wTSwUA8qP5qS", {
- commitment: "confirmed",
- });
- let sign = "3p2nQh1AfYsXFqBE59z2LsKB1Sv9JM7kjCS3GnD3bFw8VDN6z7Va7Kvjosdkt9tvesR68n52Q1y4sTLvhFFJsmyB"
- function guid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- }
- const listen_axios_config = {
- headers: { 'accept': 'application/json', 'content-type': 'application/json' },
- timeout: 3000,
- }
- async function main() {
- // let str_dalao_address = '7T1kJcKi5tYA2Vpza1BQnfShSsFCmyVBnxbncqHoEUqAa'
- // let listen_body_data = `{"id":"${guid()}","jsonrpc":"2.0","method":"getSignaturesForAddress","params":["${str_dalao_address}",{"limit":5, "commitment": "confirmed"}]}`;
- // let requestSignatures = await axios.post(swap_url, listen_body_data, listen_axios_config);
- // if (requestSignatures.status != 200) {
- // console.log(``)
- // return;
- // }
- // else if (requestSignatures.status == 200 && requestSignatures.error) {
- // throw new Error(requestSignatures.error.message);
- // }
- // console.log("yes")
- // requestSignatures = requestSignatures.data.result;
- // requestSignatures = requestSignatures.data;
- // console.log(requestSignatures);
- // let sign = '3pmidzXXVgtVPkLABbfurd3hqShFdib4d2epAz3zToeDi9uFbc6pkF79JH9axuGTtaDqwjDy8U9wLmXRy9b278pf'
- // obj_transaction = await swap_connection.getTransaction(sign, { commitment: "confirmed", maxSupportedTransactionVersion: 0 });
- // fs.writeJSONSync(`${sign}_obj_transaction.json`, obj_transaction, { spaces: 4 });
- // console.log(obj_transaction)
- let walletTokenAccount;
- walletTokenAccount = await swap_connection.getTokenAccountsByOwner(new web3.PublicKey("EuCYZeczx4L2y8HozZRgNsp17UtmeuN1gzBDn2ubW71k"), {
- programId: new web3.PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'),
- mint: new web3.PublicKey("9UvushzXmQ7Xz6bEBReQtbHdgUXru3jBTe9SfaPts1Qe")
- });
- console.log(walletTokenAccount.value)
- // let str_ammid = "AiyRewCvnCWaJuCE851bQZP5LQeT11uVgKCASYZAfEHp"
- // const account = await swap_connection.getAccountInfo(new web3.PublicKey(str_ammid));
- // console.log(account)
- // let web3pub_dalaoaddd = new web3.PublicKey('GFUS44ebiF6YQ5FZQ9dXZVFba69rEuTqLwXcUFvVxVTD')
- // let requestSignatures = await swap_connection.getSignaturesForAddress(web3pub_dalaoaddd, {
- // limit: 5,
- // }, 'confirmed');
- // console.log(requestSignatures);
- }
- main()
|