Submits a Solana transaction composed of one or more program call instructions. Each instruction must specify the target program address, a list of accounts, and the data payload (as a list of (type, value) tuples) to be serialized for the Solana smart contract call. This function expects the instruction structure to match the one used in evaluateSolanaSmartContractTransaction.
Account Types for Instructions:
Each account in the "Accounts" array must specify:
- Address (str): The base58-encoded Solana account address
- Type (int): Account permission type:
- 0 = WRITABLE: Account can be written to but doesn't sign
- 1 = SIGNER: Account must sign but is read-only
- 2 = WRITABLE_SIGNER: Account must sign and can be written to
- 3 = READONLY: Account is read-only and doesn't sign
NOTE: Success or failure in this API call does not necessarily mean success or failure in the transaction itself. For example, the transaction may succeed, but the "success" response to the client can be lost if the client's internet connection is down.
To verify the status of the transaction:
- Call
getCurrentToken and store it.
- Send your transaction. The transaction will use the token from step 1.
- Call
getTransactionByToken using the stored token to track the status of the transaction.
This function is part of the transaction flow detailed at https://docs.gk8.io/api-v19/sending-transactions-from-the-api.
return: JSON object containing the transaction result, including approval status and contract interaction details.
-------------------- Request --------------------
from apiclient.Solana.Instruction import Instruction, InstructionAccount, InstructionAccountType, InstructionDiscriminator, InstructionDiscriminatorType
instructions = [
Instruction(
program_address="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
accounts=[
InstructionAccount("address1", InstructionAccountType.WRITABLE_SIGNER),
InstructionAccount("address2", InstructionAccountType.READONLY)
],
data=[("u64", 1000), ("address", "So11111111111111111111111111111111111111112")],
discriminator=InstructionDiscriminator(InstructionDiscriminatorType.U8, 42)
)
]
sendSolanaProgramCallsTransaction(
account_id=1,
instructions=instructions,
specific_from_address=None,
validate_transaction=True,
description="Test Solana program call"
)
-------------------- Response --------------------
{
"FunctionData": {
"ApprovalRequestStatus": 3,
"CoinType": "SOL",
"Transactions": [
{
"AmountToTransfer": "1000000",
"DestinationAddress": "5CBy...Jtf"
}
]
},
"Meta": {
"AccessToken": "f192762c...",
"Destination": "045bd19d...",
"Source": "6f8fd2e8...",
"Time": "2024-09-29 20:48
.158"
}
}
account_idintegerThe account ID to use in this operation.
instructionsobject<p>List of Instruction objects representing the Solana instructions to execute.
Each Instruction object contains:</p>
<ul>
<li>program_address (str): The program ID to invoke (base58 string)</li>
<li>accounts (List[InstructionAccount]): List of InstructionAccount objects with address and type</li>
<li>data (List[Tuple[str, Any]]): The instruction data as list of (type, value) tuples for parameter serialization</li>
<li>discriminator (Optional[InstructionDiscriminator]): Optional discriminator for instruction identification</li>
</ul>
descriptionstringText for describing the transaction in your records. This is not sent to the blockchain.
specificFromAddressstringDeposit address to send from. Cannot be used if the account is defined as an Omnibus account.
validate_transactionboolean<p>When true, the MPC wallet will access the node (using eth_call) to check if the transaction is likely to fail and will block the transaction if it is.</p>