Legacy
sendTransaction (Legacy)
트랜잭션을 네트워크로 보냅니다.
참고: AccountKeyLegacy
가 있는 계정 만, sendTransaction 이 가능합니다.
Parameters
The parameters of sendTransaction are a transaction object and a callback function.
Name | Type | Description |
---|---|---|
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. |
LEGACY
유형의 트랜잭션 오브젝트의 구조는 다음과 같습니다.
Name | Type | Description |
---|---|---|
from | String | Address of this transaction sender. |
to | String | (선택 사항) 메시지 수신자 주소이며, 트랜잭션이 컨트랙트 생성 트랜잭션일 경우 수신자 주소가 입력되지 않습니다. |
value | Number | String | BN | BigNumber | (선택 사항) 트랜잭션으로 전송할 peb 단위로 환산된 KLAY입니다. 컨트랙트 생성 트랜잭션일 경우 (생성 함수가 KLAY를 받을 수 있게 설정되었다면) 컨트랙트가 생성 시 보유하는 KLAY입니다. |
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. |
data | String | (선택 사항) 컨트랙트의 함수를 호출할 수 있는 데이터가 담긴 ABI byte string 또는, 컨트랙트 생성 트랜잭션일 경우 컨트랙트를 초기화(initialize)하는 코드입니다. |
nonce | Number | (optional) Integer of a nonce. If omitted, it will be set by caver-js via calling |
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