MarketplaceStorage
The MarketplaceStorage
class provides a way to interact with the MarketplaceStorage smart contract.
Constructor
The constructor initializes an instance of the MarketplaceStorage
class.
Parameters
sdkInstance
:Sdk
An instance of the SDK containing configuration details for interacting with the blockchain.
Throws
- An error if the MarketplaceStorage address is not found for the current network ID.
Usage
const marketplaceStorage = new MarketplaceStorage(sdkInstance);
Attributes
config
: SdkConfig
Contains the configuration for the SDK, including walletClient
and publicClient
.
Methods
view
Calls a read-only function on the MarketplaceStorage contract.
-
Parameters:
-
functionName
:string
The name of the contract function to call. -
args
:any[]
The arguments to pass to the contract function. -
Returns:
Promise<any>
The result of the contract function. -
Throws: Will throw an error if the contract read operation fails.
execute
Executes a state-changing function on the MarketplaceStorage contract.
-
Parameters:
-
functionName
:string
The name of the contract function to execute. -
args
:any[]
The arguments to pass to the contract function. -
Returns:
Promise<any>
The transaction receipt. -
Throws: Will throw an error if the contract execution fails.
initializeMarketplace
Initializes the marketplace with the required parameters.
-
Parameters:
-
params
:InitializeMarketplaceParams
The parameters required to initialize the marketplace. -
Returns:
Promise<any>
The transaction receipt.