pub struct Contracts;Expand description
Contracts namespace containing related APIs about contracts
Implementations§
Source§impl Contracts
impl Contracts
Sourcepub fn get_abi(
self,
ctx: &Context,
address: &str,
is_pretty_print: bool,
) -> Result<String, BscError>
pub fn get_abi( self, ctx: &Context, address: &str, is_pretty_print: bool, ) -> Result<String, BscError>
Get contract ABI.
§Arguments
ctx- Contextaddress- contract address to get ABIis_pretty_print- whether or not to pretty print
Sourcepub fn get_verified_source_code(
self,
ctx: &Context,
address: &str,
) -> Result<(Vec<BSCContractSourceCode>, bool), BscError>
pub fn get_verified_source_code( self, ctx: &Context, address: &str, ) -> Result<(Vec<BSCContractSourceCode>, bool), BscError>
Get verified contract’s source code from the specified address.
§Arguments
ctx- Contextaddress- contract address to get verified source code
§Result
Return a tuple of (Vec<BSCContractSourceCode>, bool) for success case.
-
If second part is
true, then it means vector might have more than 1 items to represent the number of files. But it will have 1 + N ; wheres N is the number of files. The first item of vector will always be the raw combined altogether of all files the same asfalsecase of second part. -
If second part is
false, then user just need to focus on the first item of the vector as the source code is combined altogether in there. This is due to the way API returned back. Even with mutiple source files uploaded and verified but it will altogether combined into one long string of code.