Create a contract from a registered implementation https://docs.hazbase.com/en/hazbase-factory/ DEPLOYMENT / FACTORY Create a contract from a registered implementation The Factory SDK creates a contract from a registered implementation. Specify the implementation type and initialization settings to deploy from your application. @hazbase/factory 0.2.1 ethers 6.16.0 TypeScript Prerequisites Provide the target Factory, registered implementation owner and type, initializer signature and arguments, and an authorized signer. The type and initializer must match that Factory registration. bash npm install --save-exact @hazbase/factory@0.2.1 ethers@6.16.0 Start with the sample application Call from your application Pass a connected signer and registration details to this function to encode initialization data and create a contract through Factory. Set the connection and arguments for your environment. factory-clone.ts 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import { deployViaFactory , type DeployViaFactoryOptions } from '@hazbase/factory' ; import { getAddress , type Signer } from 'ethers' ; type CloneRequest = { signer : Signer ; chainId : number ; factoryAddress : string ; implementationOwner : string ; contractType : string ; fnSignature : string ; fnArgs : readonly unknown [ ] ; } ; // Call only after the implementation and its initializer policy are registered. export async function createRegisteredClone ( request : CloneRequest ) { if ( ! request . signer . provider ) throw new Error ( 'A connected signer is required.' ) ; const network = await request . signer . provider . getNetwork ( ) ; if ( network . chainId !== BigInt ( request . chainId ) ) throw new Error ( 'Chain mismatch.' ) ; const options = { signer : request . signer , chainId : request . chainId , factoryAddress : getAddress ( request . factoryAddress ) , implementationOwner : getAddress ( request . implementationOwner ) , contractType : request . contractType , fnSignature : request . fnSignature , fnArgs : request . fnArgs , } satisfies DeployViaFactoryOptions ; const result = await deployViaFactory ( options ) ; return { address : result . proxy , transactionHash : result . txHash , receipt : result . receipt } ; } Download the code Verify the result address identifies the new proxy, transactionHash identifies its creation transaction, and receipt records the mined result. Read the initialized name, administrator and cap to verify they match the request. DeployViaFactoryOptions Parameters and return types