1
Technical Support / how to use wallet_get_pretty_transaction in json rpc call?
« on: July 10, 2014, 08:39:59 am »
i have called wallet_transfer successfully in php
and the result is
Array [4]
expiration (string:15) 20140710T102525
delegate_slate_id null
operations Array [2]
0 Array [2]
type (string:16) withdraw_op_type
data Array [3]
balance_id (string:36) XTSNWJpomfWVhvd7PM8QMMxnbmc8rNNg6C86
amount (int) 1210000
claim_input_data (string:0)
1 Array [2]
type (string:15) deposit_op_type
data Array [2]
amount (int) 1200000
condition Array [4]
asset_id (int) 0
delegate_slate_id (int) 0
type (string:23) withdraw_signature_type
data Array [2]
owner (string:36) XTSJL1fTtNg8LQbLPw33LKrHJKRpEsayNCG4
memo Array [2]
one_time_key (string:53) XTS7sxksh6uXuELNAaawFsC7V2Qu5Kt7dWj51KnCrLmzcJi4gbvu7
encrypted_memo_data (string:128) 6279c02e653b21d7c25d7a818a1f2badfe36861ff73fa53e9d3396416e9493a3ca539c0528d2353ef62692cd33a9043694adc57429f8e5081152b5ad94d6ab4f
signatures Array [1]
0 (string:130) 207343a0001159d526f358caca89cc32a935ec84c5ee2c3a873a2cffa1b94998f15b7fadd940e84dc2902f7c774682bd5f6c4accaed87934da9de2292504e9e894
i don't find the tx id, so i think i could use wallet_get_pretty_transaction to parse the result to get tx id
this is the wallet_transfer introduction
and wallet_get_pretty_transaction introduction
so, i tried
$r = $rpc->wallet_get_pretty_transaction($tx);
and
$r = $rpc->wallet_get_pretty_transaction(json_encode($tx));
both failed
i find signed_transaction structure in transaction.hpp
can any one help me with this problem please?how to get tx id from the result of wallet_transfer?
Code: [Select]
try{
$tx = $rpc->wallet_transfer(12, "XTS", "acc-51btc", "lihao-test1");
}catch(Exception $e){
echo sprintf("error %s\n", $e->getMessage());
};
and the result is
Array [4]
expiration (string:15) 20140710T102525
delegate_slate_id null
operations Array [2]
0 Array [2]
type (string:16) withdraw_op_type
data Array [3]
balance_id (string:36) XTSNWJpomfWVhvd7PM8QMMxnbmc8rNNg6C86
amount (int) 1210000
claim_input_data (string:0)
1 Array [2]
type (string:15) deposit_op_type
data Array [2]
amount (int) 1200000
condition Array [4]
asset_id (int) 0
delegate_slate_id (int) 0
type (string:23) withdraw_signature_type
data Array [2]
owner (string:36) XTSJL1fTtNg8LQbLPw33LKrHJKRpEsayNCG4
memo Array [2]
one_time_key (string:53) XTS7sxksh6uXuELNAaawFsC7V2Qu5Kt7dWj51KnCrLmzcJi4gbvu7
encrypted_memo_data (string:128) 6279c02e653b21d7c25d7a818a1f2badfe36861ff73fa53e9d3396416e9493a3ca539c0528d2353ef62692cd33a9043694adc57429f8e5081152b5ad94d6ab4f
signatures Array [1]
0 (string:130) 207343a0001159d526f358caca89cc32a935ec84c5ee2c3a873a2cffa1b94998f15b7fadd940e84dc2902f7c774682bd5f6c4accaed87934da9de2292504e9e894
i don't find the tx id, so i think i could use wallet_get_pretty_transaction to parse the result to get tx id
this is the wallet_transfer introduction
Code: [Select]
{
"method_name": "wallet_transfer",
"description": "Sends given amount to the given address, assumes shares in DAC. This transfer will occur in a single transaction and will be cheaper, but may reduce your privacy.",
"return_type": "signed_transaction",
"parameters" :
[
{
"name" : "amount_to_transfer",
"type" : "real_amount",
"description" : "the amount of shares to transfer"
},
{
"name" : "asset_symbol",
"type" : "asset_symbol",
"description" : "the asset to transfer"
},
{
"name" : "from_account_name",
"type" : "sending_account_name",
"description" : "the source account(s) to draw the shares from"
},
{
"name" : "to_account_name",
"type" : "receive_account_name",
"description" : "the account to transfer the shares to"
},
{
"name" : "memo_message",
"type" : "string",
"description" : "a memo to store with the transaction",
"default_value" : ""
}
],
"prerequisites" : ["wallet_unlocked"],
"aliases" : ["transfer"]
},
and wallet_get_pretty_transaction introduction
Code: [Select]
{
"method_name": "wallet_get_pretty_transaction",
"description": "Return a pretty JSON representation of a transaction",
"return_type": "pretty_transaction",
"parameters" :
[
{
"name" : "transaction",
"type" : "signed_transaction",
"description" : "the transaction to pretty-print"
}
],
"is_const" : true,
"prerequisites" : ["json_authenticated"]
}
so, i tried
$r = $rpc->wallet_get_pretty_transaction($tx);
and
$r = $rpc->wallet_get_pretty_transaction(json_encode($tx));
both failed
i find signed_transaction structure in transaction.hpp
Code: [Select]
struct signed_transaction : public transaction
{
transaction_id_type id()const;
size_t data_size()const;
void sign( const fc::ecc::private_key& signer, const digest_type& chain_id );
vector<fc::ecc::compact_signature> signatures;
};
and i am coufused, beacuse i counldn't find transaction_id_type in the result of wallet_transfercan any one help me with this problem please?how to get tx id from the result of wallet_transfer?