1import{b as o,j as e,C as r,L as n}from"./index-BAAzACLV.js";const c=`import { deployViaFactory, type DeployViaFactoryOptions } from '@hazbase/factory'; 2import { getAddress, type Signer } from 'ethers'; 3 4type CloneRequest = { 5 signer: Signer; 6 chainId: number; 7 factoryAddress: string; 8 implementationOwner: string; 9 contractType: string; 10 fnSignature: string; 11 fnArgs: readonly unknown[]; 12}; 13 14// Call only after the implementation and its initializer policy are registered. 15export async function createRegisteredClone(request: CloneRequest) { 16 if (!request.signer.provider) throw new Error('A connected signer is required.'); 17 const network = await request.signer.provider.getNetwork(); 18 if (network.chainId !== BigInt(request.chainId)) throw new Error('Chain mismatch.'); 19 20 const options = { 21 signer: request.signer, 22 chainId: request.chainId, 23 factoryAddress: getAddress(request.factoryAddress), 24 implementationOwner: getAddress(request.implementationOwner), 25 contractType: request.contractType, 26 fnSignature: request.fnSignature, 27 fnArgs: request.fnArgs, 28 } satisfies DeployViaFactoryOptions; 29 30 const result = await deployViaFactory(options); 31 return { address: result.proxy, transactionHash: result.txHash, receipt: result.receipt }; 32} 33`;function l(){const{i18n:a}=o(),t=(s,i)=>a.language.startsWith("en")?i:s;return e.jsxs("article",{className:"dev-page",children:[e.jsx("div",{className:"dev-eyebrow",children:"DEPLOYMENT / FACTORY"}),e.jsx("h1",{children:t("ç»é²æ¸ã¿ã®å®è£ ãããã³ã³ãã©ã¯ãã使ãã","Create a contract from a registered implementation")}),e.jsx("p",{className:"dev-lead",children:t("Factory SDKã¯ãç»é²æ¸ã¿ã®å®è£ ããæ°ããã³ã³ãã©ã¯ãã使ãã¾ããå®è£ ã®ç¨®é¡ã¨åæåæ¡ä»¶ãæå®ããã¢ããªã±ã¼ã·ã§ã³ãããããã¤ãå®è¡ã§ãã¾ãã","The Factory SDK creates a contract from a registered implementation. Specify the implementation type and initialization settings to deploy from your application.")}),e.jsxs("div",{className:"dev-meta",children:[e.jsx("span",{children:"@hazbase/factory 0.2.1"}),e.jsx("span",{children:"ethers 6.16.0"}),e.jsx("span",{children:"TypeScript"})]}),e.jsxs("section",{children:[e.jsx("h2",{children:t("å®è¡åã®æºå","Prerequisites")}),e.jsx("p",{children:t("対象ãã§ã¼ã³ä¸ã®Factoryãç»é²æ¸ã¿å®è£ ã®ææè ã¨ç¨®é¡ãåæå颿°ã®ã·ã°ããã£ã¨å¼æ°ãå®è¡æ¨©éãæã¤Signerãç¨æãã¾ããååã¨åæåæ¡ä»¶ã¯ããã®Factoryã«ç»é²ããããã®ãæå®ãã¾ãã","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.")}),e.jsx(r,{language:"bash",code:"npm install --save-exact @hazbase/[email protected] [email protected]"}),e.jsx(n,{className:"dev-link",to:"/start/day0",children:t("ãµã³ãã«ã¢ããªããå§ãã","Start with the sample application")})]}),e.jsxs("section",{children:[e.jsx("h2",{children:t("ã¢ããªã±ã¼ã·ã§ã³ããå¼ã³åºã","Call from your application")}),e.jsx("p",{children:t("æ¥ç¶æ¸ã¿ã®Signerã¨ç»é²æ å ±ããã®é¢æ°ã«æ¸¡ãã¨ãåæåã®å¼ã³åºããã¼ã¿ãçæããFactoryçµç±ã§ã³ã³ãã©ã¯ãã使ã§ãã¾ãããµã³ãã«ã®æ¥ç¶å ã¨å¼æ°ã¯ããå©ç¨ã®ç°å¢ã«åããã¦æå®ãã¦ãã ããã","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.")}),e.jsx(r,{language:"typescript",code:c,filename:"factory-clone.ts"}),e.jsx("a",{className:"dev-link",href:"/examples/factory-clone.ts",download:!0,children:t("ã³ã¼ãããã¦ã³ãã¼ã","Download the code")})]}),e.jsxs("section",{children:[e.jsx("h2",{children:t("çµæã確èªãã","Verify the result")}),e.jsx("p",{children:t("addressã¯ä½æãããããã·ãtransactionHashã¯ä½æãã©ã³ã¶ã¯ã·ã§ã³ãreceiptã¯ç¢ºå®ããå®è¡çµæã§ããåæåå¾ã®åç§°ã»ç®¡çè ã»ä¸éãªã©ãèªã¿åããæ¸¡ããæ¡ä»¶ã¨ã®ä¸è´ã確èªã§ãã¾ãã","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.")}),e.jsx(n,{className:"dev-link",to:"/reference/sdk/factory?symbol=DeployViaFactoryOptions",children:"DeployViaFactoryOptions"}),e.jsx("br",{}),e.jsx(n,{className:"dev-link",to:"/reference/sdk/factory?symbol=deployViaFactory",children:t("弿°ã»æ»ãå¤ã®æ£å¼ãªä»æ§","Parameters and return types")})]})]})}export{l as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.