deployContract takes a single argument of type DeployContractArgs
exporttypeDeployContractArgs= {//the contract factory used to deploy the contract//if not provided defaults to the mintbase testnet contract factory: 'mintspace2.testnet' factoryContractId?:string;//name for the contract, this should be unique within the factory name:string;//wallet id of the intended owner ownerId:string; metadata: { symbol:string;//if nothing is provided will default to the mb default logo icon?:string;//will default to null baseUri?:string;//will default to null reference?:string;//will default to null referenceHash?:string; }; };
React example
Example usage of deployContract method in a hypothetical React component:
DeployContractComponent.ts
import { useState } from'react';import { useWallet } from'@mintbase-js/react';import { execute, deployContract , DeployContractArgs } from'@mintbase-js/sdk';exportconstDeployContractComponent= ({ name, owner, contractId, symbol }:DeployContractArgs):JSX.Element=> {const { selector } =useWallet();consthandleDeployContract=async ():Promise<void> => {constwallet=awaitselector.wallet();awaitexecute(//because no contract factory id is provided it defaults to 'mintspace2.testnet' {wallet},deployContract({ name: name, ownerId: owner, metadata: { symbol: symbol } }) ) }return ( <div><button onClick={() => handleDeployContract()}> DeployContract with name= {name} and owner= {owner}</button></div> );};