未验证 提交 850753a7 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge branch 'slim' into system-contract-tests-fix

/**
* @file account.h
* @copyright defined in eos/LICENSE.txt
*/
#pragma once
#include <eosiolib/types.h>
/**
* @defgroup accountapi Account API
* @brief Define API for querying account data
* @ingroup contractdev
*/
/**
* @defgroup accountcapi Account C API
* @brief C API for querying account data
* @ingroup accountapi
* @{
*/
extern "C" {
/**
* @brief Retrieve the balance for the provided account
* @details Retrieve the balance for the provided account
*
* @param balance - a pointer to a range of memory to store balance data
* @param len - length of the range of memory to store balance data
* @return true if account information is retrieved
*
* @pre data is a valid pointer to a range of memory at least datalen bytes long
* @pre data is a pointer to a balance object
* @pre *((uint64_t*)data) stores the primary key
*
* Example:
* @code
* balance b;
* b.account = N(myaccount);
* balance(b, sizeof(balance));
* @endcode
*
*/
bool account_balance_get( void* balance, uint32_t len );
///@ } accountcapi
}
/**
* @file account.hpp
* @copyright defined in eos/LICENSE.txt
* @brief Defines types and ABI for account API interactions
*
*/
#pragma once
#include <eosiolib/account.h>
#include <eosiolib/print.hpp>
#include <eosiolib/asset.hpp>
namespace eosio { namespace account {
/**
* @defgroup accountcppapi Account C++ API
* @brief C++ API for querying account data, e.g. account balance
* @ingroup accountapi
*
* @{
*/
/**
* @brief The binary structure expected and populated by native balance function.
* @details
* Example:
* @code
* account_balance test1_balance;
* test1_balance.account = N(test1);
* if (account_api::get(test1_balance))
* {
* eosio::print("test1 balance=", test1_balance.eos_balance, "\n");
* }
* @endcode
* @{
*/
struct PACKED(account_balance) {
/**
* @brief Name of the account who's balance this is
* @details Name of the account who's balance this is
*/
account_name account;
/**
* @brief Balance for this account
* @details Balance for this account
*/
asset eos_balance;
/**
* @brief Staked balance for this account
* @details Staked balance for this account
*/
asset staked_balance;
/**
* @brief Unstaking balance for this account
* @details Unstaking balance for this account
*/
asset unstaking_balance;
/**
* @brief Time at which last unstaking occurred for this account
* @details Time at which last unstaking occurred for this account
*/
time last_unstaking_time;
};
/// @} account_balance
/**
* @brief Retrieve a populated balance structure
* @details Retrieve a populated balance structure
* @param acnt - account
* @return true if account's balance is found
*/
bool get(account_balance& acnt)
{
return account_balance_get(&acnt, sizeof(account_balance));
}
/// @} eosio
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册