Smart Contract Execution
sendTransaction (SMART_CONTRACT_EXECUTION)
Smart Contract Execution 트랜잭션을 네트워크에 전송합니다.
Parameters
The parameters of sendTransaction are a transaction object and a callback function.
transactionObject
Object
The transaction object to send.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
SMART_CONTRACT_EXECUTION
트랜잭션 오브젝트 구조는 다음과 같습니다.
type
String
Transaction Type. "SMART_CONTRACT_EXECUTION"
from
String
Address of this transaction sender.
to
String
배포 된 스마트 컨트랙트의 address.
value
Number | String | BN | BigNumber
(선택 사항) 트랜잭션에 의해 전송된 peb 단위의 값. 전송된 KLAY를 받기 위해서는, 이 트랜잭션이 호출하는 컨트랙트 함수가 'payable'이어야 합니다. 생략하면 0으로 설정됩니다.
gas
Number
The maximum amount of gas willing to pay for the transaction (unused gas is refunded).
gasPrice
Number
(optional) Gas price provided by the sender in peb. The gasPrice must be the same as the unitPrice set in the Klaytn node.
nonce
Number
(optional) Integer of a nonce. If omitted, it will be set by caver-js via calling caver.klay.getTransactionCount
.
data
String
스마트 컨트랙트의 입력 데이터.
Return Value
The callback
will return the 32-byte transaction hash.
PromiEvent
: A promise combined event emitter. Will be resolved when the transaction receipt is available. Additionally the following events are available:
"transactionHash"
returnsString
: Is fired right after the transaction is sent and a transaction hash is available."receipt"
returnsObject
: Is fired when the transaction receipt is available."error"
returnsError
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
sendTransaction (FEE_DELEGATED_SMART_CONTRACT_EXECUTION)
Fee Delegated Smart Contract Execution 트랜잭션을 네트워크에 전송합니다.
Parameters
The parameters of sendTransaction are a transaction object and a callback function.
transactionObject
Object
The transaction object to send.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
FEE_DELEGATED_SMART_CONTRACT_EXECUTION
트랜잭션 오브젝트 구조는 다음과 같습니다.
type
String
Transaction Type. "FEE_DELEGATED_SMART_CONTRACT_EXECUTION"
from
String
Address of this transaction sender.
to
String
The address of the deployed smart contract.
value
Number | String | BN | BigNumber
(optional) The value transferred for the transaction in peb. To accept the value transfer, the contract function that will be executed by this transaction must be 'payable'. If omitted, it will be set to zero.
gas
Number
The maximum amount of gas willing to pay for the transaction (unused gas is refunded).
gasPrice
Number
(optional) Gas price provided by the sender in peb. The gasPrice must be the same as the unitPrice set in the Klaytn node.
nonce
Number
(optional) Integer of a nonce. If omitted, it will be set by caver-js via calling caver.klay.getTransactionCount
.
data
String
An input data of the smart contract.
위의 구조를 가진 FEE_DELEGATED_SMART_CONTRACT_EXECUTION
유형의 트랜잭션 오브젝트, 또는 FEE_DELEGATED_SMART_CONTRACT_EXECUTION
유형의 RLP 인코딩된 트랜잭션
은 트랜잭션 발신자의 경우 caver.klay.accounts.signTransaction의 매개 변수로, 수수료 납부자의 경우 caver.klay.accounts.feePayerSignTransaction의 매개 변수로 사용할 수 있습니다.
In order for the fee payer to sign an RLP encoded transaction signed by the sender and send it to the network, define an object with the following structure and call caver.klay.sendTransaction
.
feePayer
String
The fee payer address of the transaction.
senderRawTransaction
String
The RLP-encoded transaction signed by sender.
Return Value
The callback
will return the 32-byte transaction hash.
PromiEvent
: A promise combined event emitter. Will be resolved when the transaction receipt is available. Additionally the following events are available:
"transactionHash"
returnsString
: Is fired right after the transaction is sent and a transaction hash is available."receipt"
returnsObject
: Is fired when the transaction receipt is available."error"
returnsError
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
sendTransaction (FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO)
Fee Delegated Smart Contract Execution With Ratio 트랜잭션을 네트워크에 전송합니다.
Parameters
The parameters of sendTransaction are a transaction object and a callback function.
transactionObject
Object
The transaction object to send.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO
트랜잭션 오브젝트 구조는 다음과 같습니다.
type
String
Transaction Type. "FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO"
from
String
Address of this transaction sender.
to
String
The address of the deployed smart contract.
value
Number | String | BN | BigNumber
(optional) The value transferred for the transaction in peb. To accept the value transfer, the contract function that will be executed by this transaction must be 'payable'. If omitted, it will be set to zero.
gas
Number
The maximum amount of gas willing to pay for the transaction (unused gas is refunded).
gasPrice
Number
(optional) Gas price provided by the sender in peb. The gasPrice must be the same as the unitPrice set in the Klaytn node.
nonce
Number
(optional) Integer of a nonce. If omitted, it will be set by caver-js via calling caver.klay.getTransactionCount
.
data
String
An input data of the smart contract.
feeRatio
Number
Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender. The range of fee ratio is 1 ~ 99, if it is out of range, the transaction will not be accepted.
위의 구조를 가진 FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO
유형의 트랜잭션 오브젝트, 또는 FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO
유형의 RLP 인코딩된 트랜잭션
은 트랜잭션 발신자의 경우 caver.klay.accounts.signTransaction의 매개 변수로, 수수료 납부자의 경우 caver.klay.accounts.feePayerSignTransaction의 매개 변수로 사용할 수 있습니다.
In order for the fee payer to sign an RLP encoded transaction signed by the sender and send it to the network, define an object with the following structure and call caver.klay.sendTransaction
.
feePayer
String
The fee payer address of the transaction.
senderRawTransaction
String
The RLP-encoded transaction signed by sender.
Return Value
The callback
will return the 32-byte transaction hash.
PromiEvent
: A promise combined event emitter. Will be resolved when the transaction receipt is available. Additionally the following events are available:
"transactionHash"
returnsString
: Is fired right after the transaction is sent and a transaction hash is available."receipt"
returnsObject
: Is fired when the transaction receipt is available."error"
returnsError
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
Last updated