0.3.2 |
|
---|---|
0.3.1 |
|
0.2.1 |
|
0.1.6 |
|
0.1.4 |
|
在 #large-scale 中排名 第4
每月下载量 33 次
在 116 个crate(5个直接)中使用 116 个crate (5 直接)
24KB
452 行
此crate包含一个对Move语言的扩展,该扩展具有大规模存储表。
为了使用此扩展与Move CLI和包系统一起使用,您需要使用带有feature = ["table-extension"]
编译。
要在您的适配器中使用此扩展,请按以下步骤操作
use move_core_types::account_address::AccountAddress;
use move_stdlib::natives;
use move_table_extension::NativeTableContext;
use move_vm_runtime::move_vm::MoveVM;
use move_vm_runtime::native_functions::NativeContextExtensions;
fn run() {
let resource_resolver = unimplemented!(); // a resource resolver the adapter provides
let txn_hash = unimplemented!(); // a unique hash for table creation for this transaction
let table_resolver = unimplemented!(); // a remote table resolver the adapter provides
let std_addr = unimplemented!(); // address where to deploy the std lib
let extension_addr = unimplemented!(); // address where to deploy the table extension
let mut extensions = NativeContextExtensions::default();
extensions.add(NativeTableContext::new(txn_hash, table_resolver));
let mut natives = move_stdlib::natives::all_natives(std_addr);
natives.append(&mut move_table_extension::table_natives(extension_addr));
let vm = MoveVM::new(natives);
let session = vm.new_session_with_extensions(resource_resolver, extensions);
let result = session.execute_function(..)?;
let (change_set, events, extensions) = session.finish_with_extensions()?;
let table_change_set = extensions.get::<NativeTableContext>().into_change_set();
// Do something with the table change set
// ...
}
依赖项
~8MB
~126K SLoC