Smart Contract Deploy
TxTypeSmartContractDeploy deploys a smart contract to the given address. 이 트랜잭션 유형에 따라 다음과 같은 변경 사항이 적용됩니다.
Import the ethers and @kaiachain/ethers-ext modules to add kaia features on ethers.js.
Define sender's and fee payer's addresses and private keys
Set up the provider with the specified kairos testnet URL. A provider in ethers is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from kairos to quicknode
Create wallets for the sender and fee payer using their private keys
Define the transaction object for a fee-delegated smart contract deployment
Specify the transaction type as FeeDelegatedSmartContractDeploy
Specify the contract bytecode, you can retreive it from block explorer
Populate the transaction with additional details (e.g., gas limit)
Sign the transaction with the sender's private key
Send the transaction to blockchain using fee payer's wallet. Function sendTransactionAsFeePayer
adds a signature with FeePayer’s private key to the sender’s signature and transmits it to the blockchain network.
The wait function returns the tx receipt if the tx was sent to the blockchain successfully.