Troubleshooting: Get Account key from “GettranSection” in Solana

As a developer at Solana Blockchain, it is not unusual for you to deal with problems when trying to interact with the Solana network. In this article we enter into a general problem that can occur when using the “GettranSection” method in the Solana website connection: Find the contact key in the message.
The problem
If you call up “Testransection” in a Solana website connection, a transaction object with different functions, including “Accodys”, will be returned. Sometimes this information is not visible in your code. If the application “Static Countkeys” is not properly determined, you will not see the account keys in the message.
The solution
To solve this problem, let’s say that the following code lines are part of the Solana website connection:
`JavaScript
Const ws_url = process.env.solan_ws_url || '
Connection = new Connection (WS_URL, 'confirmed');
Const raydium_amm_Program_id = New Publickey (...); // Initialize the public key of the AMM program
In this case, find that the “Staticccountkeys” are set to an empty array. This means that every account key transmitted by the client is not taken into account for the connection of Solana website.
To solve the problem, you can correctly adjust the “Static Counters” into the code or update the API endpoint to include account keys in the response data.
Option 1: Set the “Static Countkeys” correctly
If you do not want to examine AMM’s account keys, you can change the API endpoint to skip it. For example:
`JavaScript
Const ws_url = process.env.solan_ws_url || '
Connection = new Connection (WS_URL, 'confirmed');
Const raydium_amm_Program_id = New Publickey (...); // Initialize the public key of the AMM program
// api endpoint -s answer
Const Answeredata = {
Transactions: [
{Account_keys: [New Publickey ('Account Key-1')], give: 'Gettransaction'}, one, one,},
{Account_keys: [New Publickey ('New Accounting-2')], Type: 'Gettransaction'}
]
};
Option 2: update API endpoint to cover the account key **
If you want to insert the account keys into the API endpoint -response data, you can change it as follows:
`JavaScript
Const ws_url = process.env.solan_ws_url || '
Connection = new Connection (WS_URL, 'confirmed');
Const raydium_amm_Program_id = New Publickey (...); // Initialize the public key of the AMM program
// api endpoint -s answer
Const Answeredata = {
Transactions: [
{Account_keys: [New PuBlickey ('Account Key-1'), New Publickey ('New Accounting-2')], Type: 'Gettransaction'}
]
};
If you correctly set the StaticCountkeys or update the API endpoint, you must now be displayed in the message if you use the “GettranSection” method in the Solana website connection.
Yazar hakkında