RGB-Tools / rgb-lib

MIT License
44 stars 25 forks source link

Questioins in the wallet/utils.rs #43

Closed cymqqqq closed 8 months ago

cymqqqq commented 8 months ago

Hi there, I found some interfaces(rgb runtime) about the rgb-std library in the wallet/utils.ts, such as: pub(crate) fn contracts_by_outpoints( &mut self, outpoints: impl IntoIterator<Item = impl Into>, ) -> Result<BTreeSet, InternalError> { self.runtime .contracts_by_outpoints(outpoints) .map_err(InternalError::from) } But, there are many interfaces(in the rgb-std/inventory.rs) not implemented in the wallet/utils.rs, such as: fn public_opouts( &mut self, contract_id: ContractId, ) -> Result<BTreeSet, InventoryError>;

fn opouts_by_outpoints(
    &mut self,
    contract_id: ContractId,
    outpoints: impl IntoIterator<Item = impl Into<Outpoint>>,
) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>;

and so on. So, do you need to implement all of them? My question is: why just implement part of these interfaces? (Any bugs you found in rgb-std, or other reasons)

zoedberg commented 8 months ago

So, do you need to implement all of them? My question is: why just implement part of these interfaces? (Any bugs you found in rgb-std, or other reasons)

We implemented only the Runtime methods that rgb-lib uses. The reason we have these "wrapper methods" is to be able to call RgbRuntime.<method> instead of RgbRuntime.runtime.<method> (mainly because we didn't want to change too much code when we switched from using the Runtime to using the RgbRuntime wrapper struct).