Generates signed data specific to the Klaytn network. Refer to Klaytn Platform API - klay_sign to know how the signature is generated.
constaccount=provider.selectedAddressconstmessage='Message to sign'constsignedMessage=awaitcaver.klay.sign(message, from)
caver.klay.sendTransaction
Create, sign, and send transaction to Klaytn blockchain network.
When executed, Kaikas asks the user for permission. If the user agrees, Kaikas signs the transaction with user's account key and send it to Klaytn blockchain network. There are 19 transaction types, including legacy type. Legacy type is transaction type that is compatible with Ethereum network, and the others are newly introduced types only available in Klaytn. When using the new types, you have to specify the type. To see the full list of types and their roles, please refer to send transaction.
Unlike caver.klay.sendTransaction, this does not send transaction to blockchain. Instead it returns RLP encoded signed transaction. This is useful for transactions that require multiple signatures(eg. fee delegated tx) where you have to get the signed raw transaction first then sign it with another key before sending it.
caver.klay.Contract is used to easily deploy and interact with contracts on blockchain. Before deployment, you need to prepare contract's bytecode and ABI. If you are not familiar with them, please refer to interacting with contracts.
Contract deployment example
constmyContract=newcaver.klay.Contract(contractABI)myContract.deploy({ data:'0x12345...',//compiled bytecode arguments: [123,'My String'] //arguments for constructor }).send({ from:klaytn.selectedAddress, gas:1500000, value:0, },function(error, transactionHash) { ... }).on('error',function(error) { ... }).on('transactionHash',function(transactionHash) { ... }).on('receipt',function(receipt) {console.log(receipt.contractAddress) // contains the new contract address }).then(function(newContractInstance) {console.log(newContractInstance.options.address) // instance with the new contract address });