[개발] 클레이튼 관련 지갑 연동-2
안녕하세요 @realmankwon입니다.
클레이튼 지갑 중 카이카스 연동시에는 일단 카이카스가 크롬에 설치되어 있는지 먼저 확인합니다.
window.klaytn
이 undefined 가 아니면 설치가 된 것이고 설치가 되어 있다면 klaytn.enable()로 계정을 연결할 수 있습니다.
if (typeof window.klaytn !== "undefined") {
try {
const accounts = await klaytn.enable();
const address = accounts[0]);
} catch (error) {
// Handle error. Likely the user rejected the login
console.error(error);
}
}
이후 아래와 같은 방법으로 이미 연결된 계정의 지갑 주소를 가지고 올 수 있습니다.
if (typeof window.klaytn !== "undefined") {
// Kaikas user detected. You can now use the provider.
const provider = window["klaytn"];
if (klaytn._kaikas.isEnabled()) {
const address = provider.selectedAddress;
}
}
앞으로 클레이트에서도 더 많은 것들을 개발할 수 있길!!!
Upvoted! Thank you for supporting witness @jswit.
@realmankwon transfered 20.000 KRWP to @krwp.burn. voting percent : 100.00%, voting power : 21.19%, steem power : 2044768.26, STU KRW : 1200.
@realmankwon staking status : 16811.268 KRWP
@realmankwon limit for KRWP voting service : 16.811 KRWP (rate : 0.001)
What you sent : 20.000 KRWP (Voting Percent over 100 %)
Refund balance : 17.062 KRWP [68209586 - ed97401a0fb657654944ae999b69d8208ac11567]