Questions tagged [solana-program-library]

90 questions
6
votes
1 answer

How to transfer (using Program instructions) custom SPL token from my own account to another user's wallet?

This is my situation: I have created a wallet solana-keygen new I have created my own custom SPL Token spl-token create-token Then I created an Account for this SPL Token spl-token create-account The SPL token is now in my wallet A In the…
4
votes
1 answer

Conceptual difference between Token, Account and Associated account in Solana

I'm coming from an Ethereum environment and the Solana concepts are a bit confusing. I found various tutorials that guide thru the code steps, but don't really explain the concept behind the logic. I understand that in Solana we've got Programs,…
Milkncookiez
  • 6,817
  • 10
  • 57
  • 96
3
votes
0 answers

Having a Solana program mint tokens while a user pays the fee

I'm trying to have a Solana Anchor program mint tokens to a user's token account (so the program or its PDA should be the authority for the mint), while the owner of the token account that's receiving the tokens should pay the fee. This is what I…
3
votes
2 answers

Estimate gas cost for transaction to custom Solana Program written with Anchor

How can I get a gasFee estimate for a transaction of my custom contract? For a normal transaction execution from the SPL library I can do so like this: import { Transaction } from '@solana/web3.js'; const transaction = new Transaction({ …
Milkncookiez
  • 6,817
  • 10
  • 57
  • 96
3
votes
2 answers

What is an epoch in solana?

I am new to the solana and exploring the web3js part for solana. I came across the term "epoch". I know what the epoch is which we normally use for timestamp. But in solana, the definition of epoch is quite different. I read the official…
3
votes
1 answer

How can I confirm if a transaction has happened on Solana using the transaction hash (signature)

The confirmTransaction method is being deprecated. Instead there's a sendandconfirmtransaction method but that is not available on the connection object, so I can't use for transactions that are to be signed using phantom. I have a transaction…
3
votes
3 answers

Weird Typescript Bug: Imports dependency not top level module

Trying to transfer a custom token from one account to the other using this guide. For some reason I'm getting four errors on all the imports from the @solana/spl-token package. I've tried deleting the node-modules folder and rerunning npm install…
JoeVictor
  • 1,806
  • 1
  • 17
  • 38
3
votes
2 answers

How do i execute solana-test-validator command properly?

When i try to execute "solana-test-validator" command in my terminal, i get error and it says: "libcrypto1_1-x64.dll not found" "libssl-1_1-x64.dll not found" I searched everywhere and i looked every solana-test-validator related error things but i…
2
votes
0 answers

How to make non-transferable token on solana

I'm trying to deploy non-transferable token on solana. As explained in the document, I used token-program-2022 example with non-transferable extension. import { clusterApiUrl, sendAndConfirmTransaction, Connection, Keypair, …
user2108
  • 21
  • 1
2
votes
0 answers

How to find the Pubkey of the user who made a transaction using Solana web3.js websocket

I have tried the following WS methods to get live updates for certain Solana account: connection.onLogs() connection.onAccountChange() But none of them displays the Publickey of the wallet that is performing/signing the transaction. Is there a way…
Ander
  • 5,093
  • 7
  • 41
  • 70
2
votes
0 answers

Could not find a declaration file for module 'buffer-layout': @solana/spl-token

I'm trying to work with @solana/spl-token lib for transferring tokens but when I tried to install and run ng serve (using Angular 11). I'm getting the following error: Could not find a declaration file for module 'buffer-layout'.…
2
votes
1 answer

How can I retrieve market ids for Solana token swap program?

Having mint addresses of two spl tokens on Solana mainnet, I need to find public key of all possible markets (i.e. marketId in the following code snippet) available on Solana to get token swap info from: const tokenSwap = await…
1
vote
1 answer

How can I create a associated token address in solana from connected wallet address?

I want to create an associated token address in Solana from a connected wallet address. This is my code currently: import { useWallet, useConnection } from "@solana/wallet-adapter-react"; ... const wallet = useWallet(); const { publicKey,…
Tahlil
  • 1,031
  • 1
  • 14
  • 26
1
vote
0 answers

How to close and transfer all SOL balance programatically without reserving the rent?

I have a Solana account A which is a fee payer, and another Solana account B with some SOL balance, I want to close and transfer all account B's SOL balance to another account C. How do I do that? I saw the following error: SendTransactionError:…
1
vote
1 answer

SendTransactionError: failed to send transaction: Node is unhealthy

I'm trying to send a transaction with a memo program inside it. The problem appears on solana cli and web3 too. This is the command: solana transfer --from ./.cache/solana.json RECIVER_PUBLIC_KEY 0.00001 --allow-unfunded-recipient --url…
1
2 3 4 5 6