Comment on page
플랫폼 코인 전송
Parameters
이름 | 타입 | 설명 |
---|---|---|
chainId | number | 해당 네트워크의 체인 아이디 |
appName | string | 플랫폼 코인 전송 시 FAVORLET 앱에 노출될 이름 |
transactions | object array | 플랫폼 코인을 전송하기 위해 필요한 정보 (자세한 내용은 아래를 참고) |
transactions 객체는 다음을 포함합니다.
이름 | 타입 | 설명 |
---|---|---|
from | string | 플랫폼 코인을 전송할 주소 |
to | string | 플랫폼 코인을 받을 주소 |
value | string | 전송할 코인의 양 |
gasLimit | string | 사용할 gasLimit (optional) 없을 시,
앱 내 estimate 함수 실행 |
Response
이름 | 타입 | 설명 |
---|---|---|
requestId | string | 작업 또는 트랜잭션 요청을 추적하기 위한 id |
expiredAt | number | 작업 또는 트랜잭션 요청이 만료 되는 시간(단위: 초) |
Example
import { Request } from "favorlet.js";
const response = await Request.sendCoin({
chainId: 8217, // 해당 체인 id
appName: "BlockChainApp", // FAVORLET 앱에 노출
transactions: [
{
from: "0x{address in hex}", // 코인을 전송할 주소
to: "0x{address in hex}", // 코인을 받을 주소
value: "1000000000000000000", // 전송할 코인의 양
gasLimit: "100000"
},
],
});
console.log(response);
/*
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675
}
*/
Parameters
타입 | 설명 |
---|---|
string | Request 요청시 전달받은 requestId |
Response
타입 | 설명 |
---|---|
string | FAVORLET 앱 내 해당 요청 페이지 DeepLink |
Example
import { createDeepLink } from "favorlet.js";
const deepLink = createDeepLink(response.requestId); // Request를 통해 받은 requestId
/*
- PC: 생성된 deepLink를 qrcode 라이브러리를 이용하여 QR 생성 후 스마트폰으로 스캔
- Mobile: window.location.href 등을 사용하여 생성된 deepLink로 직접 이동
*/
console.log(deepLink);
// https://app.favorlet.link/?requestId=56ba790c-aceb-465b-a6f2-33d103b25596
import { receipt } from "favorlet.js";
const result = await receipt(response.requestId); // Request를 통해 받은 requestId
console.log(result);
/*
- status에 따라 이후 분기 처리
### requested
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675,
action: "sendCoin",
transactions: [
{ status: "requested" }
]
}
### executed
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675,
action: "sendCoin",
transactions: [
{ status: "executed" }
]
}
### canceled
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675,
action: "sendCoin",
transactions: [
{
status: "canceled",
txHash: null,
errorMessage: null
}
]
}
### failed
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675,
action: "sendCoin",
transactions: [
{
status: "failed",
txHash: "0x5a4e16cfe0c21c3cd20456340b8614f585d951d9b931b515b11575d08142a6e2",
errorMessage: "execution reverted : invalid id"
}
]
}
### succeed
{
requestId: "56ba790c-aceb-465b-a6f2-33d103b25596",
expiredAt: 1667891675,
action: "sendCoin",
transactions: [
{
status: "succeed",
txHash: "0x5a4e16cfe0c21c3cd20456340b8614f585d951d9b931b515b11575d08142a6e2",
errorMessage: null
}
]
}
*/
Last modified 10mo ago