KTHULU DOCS
Search
K
Comment on page

토큰 승인

개요

토큰으로 스왑 이용 시 parameter로 받은 amount의 양만큼 유니스왑에게 토큰 스왑 권한을 승인합니다.
해당 기능은 실행 전 스왑 pool을 확인하여 스왑이 가능한 상황인지를 먼저 확인합니다.
Android
iOS
Web

Parameters

이름
타입
설명
참조
network
String
네트워크
required
from
String
보낸 계정
required
form_token_id
String
보낸 토큰 아이디 (컨트랙트 주소)
required
to_token_id
String
받는 토큰 아이디 (컨트랙트 주소)
required
amount
String
전송량
required

Response

이름
타입
설명
result
String
호출 결과 성공여부 (성공: OK, 실패: FAIL)
value (array of object)
이름
타입
설명
transactionHash
String
트랜잭션 Hash 값

Example

// parameters
val network = "polygon"
val from = "0x..."
val from_token_id = "0x..."
val to_token_id = "0x..."
val amount = "1000000"
val tokenSwapAppove = tokenSwapAppoveAsync(network,
from,
from_token_id,
to_token_id,
amount)
println(tokenSwapAppove)
// tokenSwapAppove result log
/*
{
"result": "OK",
"value": [
{
"transactionHash" : "0x..."
}
]
}
*/

Parameters

이름
타입
설명
참조
network
String
네트워크
required
from
String
보낸 계정
required
form_token_id
String
보낸 토큰 아이디 (컨트랙트 주소)
required
to_token_id
String
받는 토큰 아이디 (컨트랙트 주소)
required
amount
String
전송량
required

Response

이름
타입
설명
result
String
호출 결과 성공여부 (성공: OK, 실패: FAIL)
value (array of object)
이름
타입
설명
transaction_hash
String
트랜잭션 Hash 값

Example

// parameters
let network = "ethereum"
let from = "0x..."
let from_token_id = "0x..."
let to_token_id
let amount = "1000000"
let tokenSwapAppove = try await tokenSwapAppoveAsync(network: network,
from: from,
from_token_id: from_token_id,
to_token_id: to_token_id,
amount: amount)
print(tokenSwapAppove)
// tokenSwapAppove result log
/*
{
"result": "OK",
"value": [
{
"transactionHash" : "0x..."
}
]
}
*/