Update simulateTransaction rpc handling of return_data, and update docs (#24355)
* Stringify return_data program_id; also camel-case all fields * Update simulateTransaction json-rpc docs * Base64-encode return data in simulation RPC responses
This commit is contained in:
@ -348,7 +348,29 @@ pub struct RpcSimulateTransactionResult {
|
||||
pub logs: Option<Vec<String>>,
|
||||
pub accounts: Option<Vec<Option<UiAccount>>>,
|
||||
pub units_consumed: Option<u64>,
|
||||
pub return_data: Option<TransactionReturnData>,
|
||||
pub return_data: Option<RpcTransactionReturnData>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RpcTransactionReturnData {
|
||||
pub program_id: String,
|
||||
pub data: (String, ReturnDataEncoding),
|
||||
}
|
||||
|
||||
impl From<TransactionReturnData> for RpcTransactionReturnData {
|
||||
fn from(return_data: TransactionReturnData) -> Self {
|
||||
Self {
|
||||
program_id: return_data.program_id.to_string(),
|
||||
data: (base64::encode(return_data.data), ReturnDataEncoding::Base64),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum ReturnDataEncoding {
|
||||
Base64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
|
Reference in New Issue
Block a user