快速参考
| 方法 | 描述 |
|---|---|
LiteSVM::new() | 创建新的 LiteSVM 基础测试环境 |
LiteSVM::default() | 返回某个类型的"默认值" |
airdrop(&Address, lamports) | 向账户充值指定数量的 lamport |
get_account(&Address) | 返回与所提供地址账户相关的所有信息 |
set_account(Address, Account) | 设置与所提供地址账户相关的所有信息 |
get_balance(&Address) | 获取所提供账户地址的 lamport 余额 |
minimum_balance_for_rent_exemption(data_len) | 返回使指定数据长度的账户免除 rent 所需的最低余额 |
add_program(program_id, &bytes) | 向测试环境添加 SBF 程序 |
add_program_from_file(program_id, path) | 从指定文件向测试环境添加 SBF 程序 |
send_transaction(tx) | 提交已签名的交易 |
simulate_transaction(tx) | 模拟交易而不修改状态 |
get_transaction(&signature) | 从历史记录中获取交易 |
latest_blockhash() | 获取当前区块哈希 |
expire_blockhash() | 强制使当前区块哈希过期 |
warp_to_slot(slot) | 将时钟跳转至指定的 slot |
get_sysvar<T>() | 从测试环境获取系统变量 |
set_sysvar<T>(&value) | 将系统变量设置到测试环境 |
with_feature_accounts() | 在测试环境中包含功能门账户 |
set_invocation_inspect_callback(callback) | 注册调用前/后的回调函数(需要 invocation-inspect-callback 功能) |
Is this page helpful?