POST
https://api.kaikas.io/api/v1/k/prepare
Request Body
Name | Type | Description |
---|
| | |
| | |
| | auth
sign
send_klay
__ execute_contract
|
| | |
| | |
| | |
| | |
{
"chain_id": "chain id", // defualt "8217"
"request_key": "string",
"status": "prepared",
"expiration_time": 12345 // unix timestamp
}
Bapp 객체는 아래와 같으며, callback 은 생략할 수 있다.
callback 이 있을 경우 요청이 성공/실패할 경우 해당 페이지의 웹뷰가 뜬다.
{
"bapp": {
"name": "SERVICE NAME",
"callback": {
"success": "https://MY_SERVICE.com/success",
"fail": "https://MY_SERVICE.com/failure"
}
}
각 요청에 해당하는 객체는 아래와 같다.
{ // type == sign
"sign": {
"message": "hello world"
}
}
{ // type == send_klay
"transaction": {
"to": "0x0000000000000000000000000000000000000000",
"amount": "0.1"
}
}
{ // type == execute_contract
"transaction": {
"abi": "{\\n \\"constant\\": false,\\n \\"inputs\\": [\\n {\\n \\"name\\": \\"_to\\",\\n \\"type\\": \\"address\\"\\n },\\n {\\n \\"name\\": \\"_value\\",\\n \\"type\\": \\"uint256\\"\\n }\\n ],\\n \\"name\\": \\"transfer\\",\\n \\"outputs\\": [\\n {\\n \\"name\\": \\"\\",\\n \\"type\\": \\"bool\\"\\n }\\n ],\\n \\"payable\\": false,\\n \\"stateMutability\\": \\"nonpayable\\",\\n \\"type\\": \\"function\\"\\n}",
"value": "0",
"to": "0x5c74070fdea071359b86082bd9f9b3deaafbe32b", // smart contract address
"params": "[\\"0x0000000000000000000000000000000000000000\\", \\"0\\"]"
}
}
{ // type == watch_asset
"watch_asset":{
"address":"0x4fa62f1f404188ce860c8f0041d6ac3765a72e67",
"symbol":"KSD",
"decimals":18,
"name":"Kokoa Stable Dollar"
}
}
{ // type == add_network
"add_network":{
"chain_id":"8217"
}
}
대납 (Fee Delegation) - klaytn only
execute_contract
와 send_klay
는 대납 기능을 제공한다.
Transaction 객체에 fee_delegated
를 true로 설정할 경우 FeeDelegatedValueTransfer 혹은 FeeDelegatedSmartContractExecution 타입이 생성된다.
대납이 설정된 경우 네트워크로 트렌젝션을 전송하지 않으며, 대납 서명을 위한 senderTxHashRLP 가 리턴된다.
{ // type == execute_contract
"transaction": {
"abi": "{\\n \\"constant\\": false,\\n \\"inputs\\": [\\n {\\n \\"name\\": \\"_to\\",\\n \\"type\\": \\"address\\"\\n },\\n {\\n \\"name\\": \\"_value\\",\\n \\"type\\": \\"uint256\\"\\n }\\n ],\\n \\"name\\": \\"transfer\\",\\n \\"outputs\\": [\\n {\\n \\"name\\": \\"\\",\\n \\"type\\": \\"bool\\"\\n }\\n ],\\n \\"payable\\": false,\\n \\"stateMutability\\": \\"nonpayable\\",\\n \\"type\\": \\"function\\"\\n}",
"value": "0",
"to": "0x5c74070fdea071359b86082bd9f9b3deaafbe32b", // smart contract address
"params": "[\\"0x0000000000000000000000000000000000000000\\", \\"0\\"]",
"fee_delegated": true
}
}
Last updated