sui_adapter_latest/data_store/
mod.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4pub mod cached_package_store;
5pub mod transaction_package_store;
6
7use move_core_types::identifier::IdentStr;
8use move_vm_runtime::validation::verification::ast::Package as VerifiedPackage;
9use std::sync::Arc;
10use sui_types::{base_types::ObjectID, error::SuiResult};
11
12// A unifying trait that allows us to resolve a type to its defining ID as well as load packages.
13// Some move packages that can be "loaded" via this may not be objects just yet (e.g., if
14// they were published in the current transaction). Note that this needs to load `MovePackage`s and
15// not `MovePackageObject`s because of this.
16pub trait PackageStore {
17    fn get_package(&self, id: &ObjectID) -> SuiResult<Option<Arc<VerifiedPackage>>>;
18
19    fn resolve_type_to_defining_id(
20        &self,
21        module_address: ObjectID,
22        module_name: &IdentStr,
23        type_name: &IdentStr,
24    ) -> SuiResult<Option<ObjectID>>;
25}