Klaytn
getKlaytnSignedTransaction
The DCENT Android SDK provides functions for signing transaction of coins.
This function is for:
KLAYTN(KLAY)KLAYTN_ERC20- klaytn tokenKLAY_BAOBAB(KLAYt)KRC20_BAOBAB
Parameters
| Parameter | Type | Description |
|---|---|---|
| coinType | CoinType | klaytn coin type. |
| transaction | KlaytnTransaction | klaytn transaction parameters. |
class KlaytnTransaction
| Name | Type | Description |
|---|---|---|
| hdKeyPath | Bip44KeyPath | sign key path for klaytn transaction |
| nonce | String | account nonce for klaytn transaction |
| toAddr | String | address to send |
| amount | String | amount of KLAY to send |
| gasLimit | String | gas limit value |
| gasPrice | String | gas price for klaytn transaction |
| data | String | transaction data of klaytn transaction |
| chainId | String | chain id |
| txType | KlaytnTxType | (optional)Type of klaytn transaction This can be set using the setOptionAttribute() method. The default is TX_TYPE_LEGACY |
| fromAddr | String | (optional)Signer's Address of klaytn transaction This can be set using the setOptionAttribute() method. |
| feeRatio | int | (optional)Fee Ratio of klaytn transaction This can be set using the setOptionAttribute() method. |
| tokenName | String | (optional)token name of contract for KLAYTN_ERC20 transactionThis can be set using the setTokenAttribute()method. |
| decimals | String | (optional)decimals of contract for KLAYTN_ERC20 transactionThis can be set using the setTokenAttribute()method. |
| symbol | String | (optional)symbol of contract for KLAYTN_ERC20 transactionThis can be set using the setTokenAttribute()method. |
Returns
String - signed transaction.
Example
KlaytnTransaction klaytnTransanction;
klaytnTransanction = new KlaytnTransaction.Builder()
.keyPath(Bip44KeyPath.valueOf("m/44'/8217'/0'/0/0"))
.nonce("0")
.toAddr("0x732E035fBdb9E5AB5Ef80c08f6aA081d029984dc")
.amount("1000000000000000000")
.gasLimit("25000")
.gasPrice("25000000000")
.data("")
.chainId(1001)
.build();
String response = mDcentmanager.getKlaytnSignedTransaction(CoinType.KLAYTN, klaytnTransanction);