44 lines
1007 B
TypeScript
44 lines
1007 B
TypeScript
import { UIBase } from "../UI/UIBase";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class ChainErrTip extends UIBase {
|
|
public static prefabPath = "prefabs/tips/pb_chainerr";
|
|
|
|
|
|
init(data: any) {
|
|
//
|
|
}
|
|
|
|
onClickOK() {
|
|
var chainInfo = {
|
|
chainId: "0x141",
|
|
chainName: "KCC Mainnet",
|
|
nativeCurrency: {
|
|
name: "kccToken",
|
|
symbol: "KCS",
|
|
decimals: 18,
|
|
},
|
|
blockExplorerUrls: ["https://explorer.kcc.io/en"],
|
|
rpcUrls: ["https://rpc-mainnet.kcc.network"],
|
|
};
|
|
|
|
if (cc.sys.os == cc.sys.OS_ANDROID) {
|
|
jsb.reflection.callStaticMethod(
|
|
"org/cocos2dx/javascript/AppActivity",
|
|
"addChain",
|
|
"(Ljava/lang/String;)V",
|
|
JSON.stringify(chainInfo)
|
|
);
|
|
}
|
|
|
|
this.node.destroy()
|
|
|
|
}
|
|
|
|
onClose() {
|
|
this.node.destroy();
|
|
}
|
|
}
|