@directcryptopay/sdk 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ExchangeController-CPMQq6Q-.js +217 -0
- package/dist/HelpersUtil-DfMFC7Bf.js +120 -0
- package/dist/NavigationUtil-kj9LEOOd.js +8 -0
- package/dist/PhArrowCircleDown-lsK25DCk.js +73 -0
- package/dist/PhArrowClockwise-NeKHZ1co.js +73 -0
- package/dist/PhArrowDown-C9AkNvLs.js +73 -0
- package/dist/PhArrowLeft-RNfIQP1X.js +73 -0
- package/dist/PhArrowRight-DM1tna0G.js +73 -0
- package/dist/PhArrowSquareOut-S5XYbAZj.js +73 -0
- package/dist/PhArrowUp-DmktzOWy.js +73 -0
- package/dist/PhArrowUpRight-BkNeW_5i.js +73 -0
- package/dist/PhArrowsClockwise-CQ4pG76b.js +73 -0
- package/dist/PhArrowsDownUp-H6gxaNM6.js +73 -0
- package/dist/PhArrowsLeftRight-DZSsfMR6.js +73 -0
- package/dist/PhBank-4_9QzqIB.js +73 -0
- package/dist/PhBrowser-B-JSznId.js +73 -0
- package/dist/PhCaretDown-vV5oHMNi.js +73 -0
- package/dist/PhCaretLeft-BLo6Y_f4.js +73 -0
- package/dist/PhCaretRight-CqQN4TT3.js +73 -0
- package/dist/PhCaretUp-Df7UCAHy.js +73 -0
- package/dist/PhCheck-gtpfK4ed.js +73 -0
- package/dist/PhCircleHalf-Uq7dwDYw.js +73 -0
- package/dist/PhClock-SDCW-NmF.js +73 -0
- package/dist/PhCompass-B7hgtdx-.js +73 -0
- package/dist/PhCopy-BcnhyXCy.js +73 -0
- package/dist/PhCreditCard-BJjByVgu.js +73 -0
- package/dist/PhCurrencyDollar-B7ZXqXBy.js +73 -0
- package/dist/PhDesktop-B3VKPuJx.js +73 -0
- package/dist/PhDeviceMobile-Bnd0TYEH.js +73 -0
- package/dist/PhDotsThree-yyMWyZ-R.js +73 -0
- package/dist/PhEnvelope-67uzHbI9.js +73 -0
- package/dist/PhFunnelSimple-B-DCsloI.js +73 -0
- package/dist/PhGlobe-TMm_6qGk.js +73 -0
- package/dist/PhIdentificationCard-CePPD2xc.js +73 -0
- package/dist/PhImage-gY96WtHR.js +73 -0
- package/dist/PhInfo-DRQM_ZDP.js +73 -0
- package/dist/PhLightbulb-B0TxPfZ1.js +73 -0
- package/dist/PhMagnifyingGlass-B8si5_6W.js +73 -0
- package/dist/PhPaperPlaneRight-DVu5PLYd.js +73 -0
- package/dist/PhPlus-BfTsQnUz.js +73 -0
- package/dist/PhPower-CxYUGOWn.js +73 -0
- package/dist/PhPuzzlePiece-CQ4wh0gV.js +73 -0
- package/dist/PhQrCode-BuJ97NYJ.js +73 -0
- package/dist/PhQuestion-kJoP8Mja.js +73 -0
- package/dist/PhQuestionMark-C46ZkFpu.js +73 -0
- package/dist/PhSealCheck-Eh8jVqSN.js +73 -0
- package/dist/PhSignOut-jk97OSVt.js +73 -0
- package/dist/PhSpinner-CiYOhwMg.js +73 -0
- package/dist/PhTrash-pxerMqzd.js +73 -0
- package/dist/PhUser-BMg0VV4A.js +73 -0
- package/dist/PhVault-DYQvx5A-.js +73 -0
- package/dist/PhWarning-NLC5Mj87.js +73 -0
- package/dist/PhWarningCircle-Ch2jU9fA.js +73 -0
- package/dist/PhX-Bx4wpwm3.js +73 -0
- package/dist/SwapController-Cti0Cyxa.js +457 -0
- package/dist/{ccip-BIGqktC1.js → ccip-CKZd2XJ7.js} +4 -4
- package/dist/data-capture-7D5CL385.js +490 -0
- package/dist/dcp-sdk.umd.js +7400 -6589
- package/dist/email-AmK0INbZ.js +344 -0
- package/dist/embedded-wallet-Pn0I_XLn.js +820 -0
- package/dist/features-x8XNprEe.js +274 -0
- package/dist/{hashTypedData-ZH9ZnWu3.js → hashTypedData-B50-z0AA.js} +6 -6
- package/dist/if-defined-CdZSZ6UL.js +10 -0
- package/dist/index-4ewUtPPp.js +7981 -0
- package/dist/{index-D6h-qfpt.js → index-51l86yqx.js} +5 -5
- package/dist/index-B6K56LF_.js +85 -0
- package/dist/index-BAmv9PxJ.js +257 -0
- package/dist/index-BEswjY9r.js +117 -0
- package/dist/index-BSKRq56S.js +355 -0
- package/dist/index-BaygXQxx.js +172 -0
- package/dist/index-BcPxaHr5.js +118 -0
- package/dist/index-Bjt7nGaJ.js +199 -0
- package/dist/{index-D5r0iSq4.js → index-BkTSyAJb.js} +1 -1
- package/dist/index-Bmnl7l2U.js +555 -0
- package/dist/index-BvPvouSq.js +56 -0
- package/dist/index-C-6iznUO.js +174 -0
- package/dist/index-C4M5s_AM.js +228 -0
- package/dist/index-CEqcN8QP.js +1175 -0
- package/dist/{index-CPTcEPbD.js → index-CM3YaYca.js} +296 -298
- package/dist/{index-f3LXSfM5.js → index-CclBLA5r.js} +56 -142
- package/dist/index-ChTxJOiF.js +46 -0
- package/dist/index-CmAv0Tzr.js +86 -0
- package/dist/index-CmvoKY4x.js +125 -0
- package/dist/{index-BdSIrl-R.js → index-D7PmdQ9B.js} +578 -570
- package/dist/{index-DobBVPe4.js → index-D7k2Pc4e.js} +481 -236
- package/dist/index-D7lmgqUR.js +153 -0
- package/dist/index-DG_-qYze.js +107 -0
- package/dist/{index-Dy4NyE6l.js → index-DHot9Fdb.js} +7 -7
- package/dist/index-DV2LrPtU.js +123 -0
- package/dist/index-DYBaJQ2W.js +65 -0
- package/dist/{index-BJ7cbG3N.js → index-D_8VUmn1.js} +36688 -40208
- package/dist/index-D_gLn3rT.js +100 -0
- package/dist/index-DqcVUSC9.js +62 -0
- package/dist/index-I7VDqINw.js +128 -0
- package/dist/index-Oz72I9VP.js +209 -0
- package/dist/index-UclsHkJ0.js +118 -0
- package/dist/index-X8zir_1j.js +110 -0
- package/dist/index-XvlWKGCu.js +1281 -0
- package/dist/index-dO97xPlt.js +171 -0
- package/dist/{index-5mp7WkhV.js → index-uBeF6OAB.js} +2 -2
- package/dist/index-zeA_RiCV.js +159 -0
- package/dist/index.js +1 -1
- package/dist/{localBatchGatewayRequest-CjGcn5nM.js → localBatchGatewayRequest-BUZHGdjw.js} +1 -1
- package/dist/onramp-CdnBuF0r.js +855 -0
- package/dist/{parseSignature-S8VEpRHC.js → parseSignature-CcyTNGr4.js} +2312 -2313
- package/dist/pay-with-exchange-CSM6WCOV.js +525 -0
- package/dist/property-Bd8U3_QP.js +618 -0
- package/dist/receive-DooMu4Dx.js +232 -0
- package/dist/ref-CpgjXAw7.js +107 -0
- package/dist/send-3T7CyYic.js +1166 -0
- package/dist/socials-Dt-iHL17.js +620 -0
- package/dist/swaps-CjA9Es42.js +1760 -0
- package/dist/{transactions-DujFkB-M.js → transactions-nRm9DVzn.js} +10 -10
- package/dist/w3m-modal-NV25AXhM.js +1706 -0
- package/package.json +3 -3
- package/dist/ConstantsUtil-B-_-u8aQ.js +0 -6
- package/dist/add-sji6scSD.js +0 -19
- package/dist/all-wallets-B4H-890E.js +0 -10
- package/dist/app-store-Z433s97G.js +0 -21
- package/dist/apple-b8Lxj7nb.js +0 -22
- package/dist/arrow-bottom-M9oWWo_9.js +0 -12
- package/dist/arrow-bottom-circle-N9c4CXY1.js +0 -15
- package/dist/arrow-left-Dw8AKfwf.js +0 -12
- package/dist/arrow-right-DwLQZSC_.js +0 -12
- package/dist/arrow-top-zhUjkBe1.js +0 -12
- package/dist/bank-CbQdnILK.js +0 -18
- package/dist/browser-xAqNwt7z.js +0 -18
- package/dist/card-Dr1QBmWp.js +0 -18
- package/dist/checkmark-BhT1dTgG.js +0 -15
- package/dist/checkmark-bold-CPB29wqQ.js +0 -12
- package/dist/chevron-bottom-BhNyx2II.js +0 -12
- package/dist/chevron-left-CGuEjQlY.js +0 -12
- package/dist/chevron-right-CvIRRsqZ.js +0 -12
- package/dist/chevron-top-RSzCqjBd.js +0 -12
- package/dist/chrome-store-Cs8dAgs0.js +0 -65
- package/dist/clock-fhZO5otC.js +0 -12
- package/dist/close-BPuztrdR.js +0 -12
- package/dist/coinPlaceholder-C8X2i7Kh.js +0 -12
- package/dist/compass-WMc5huk0.js +0 -12
- package/dist/copy-DVAeT17y.js +0 -19
- package/dist/cursor-BJ4YLXfy.js +0 -7
- package/dist/cursor-transparent-DN2fLQN4.js +0 -16
- package/dist/desktop-6avxisBw.js +0 -13
- package/dist/disconnect-AReVI8Gk.js +0 -12
- package/dist/discord-CxrI30BZ.js +0 -21
- package/dist/email-B8dIIaay.js +0 -696
- package/dist/embedded-wallet-C_5hF7rM.js +0 -468
- package/dist/etherscan-BnAy8cIF.js +0 -10
- package/dist/exclamation-triangle-Bu7nHwx9.js +0 -8
- package/dist/extension-F0LIhvcf.js +0 -12
- package/dist/external-link-CP6phyaM.js +0 -12
- package/dist/facebook-BtQ-Io2y.js +0 -30
- package/dist/farcaster-BmaN1ugd.js +0 -16
- package/dist/filters-DpEwoOmy.js +0 -12
- package/dist/github-q7qO9V-b.js +0 -22
- package/dist/google-DH_ZE8bW.js +0 -22
- package/dist/help-circle-BAQVmKas.js +0 -16
- package/dist/id-Cj68Zwgo.js +0 -16
- package/dist/if-defined-CNte9B3N.js +0 -744
- package/dist/image-BKJDw6N-.js +0 -8
- package/dist/index-7toZMdtG.js +0 -573
- package/dist/index-B1uKzdvN.js +0 -170
- package/dist/index-BHFZVF-b.js +0 -257
- package/dist/index-BKwa5JSA.js +0 -559
- package/dist/index-BP4B9VUt.js +0 -54
- package/dist/index-BVdzXHpO.js +0 -181
- package/dist/index-BYND0GJ9.js +0 -146
- package/dist/index-BaJ0zEbh.js +0 -97
- package/dist/index-Bh0MPFwP.js +0 -58
- package/dist/index-Bsh7_qTp.js +0 -511
- package/dist/index-BwnXTNNg.js +0 -199
- package/dist/index-C0kPDbg_.js +0 -77
- package/dist/index-CKikVKe2.js +0 -75
- package/dist/index-ChVh0Hkp.js +0 -243
- package/dist/index-Cle_NnnS.js +0 -305
- package/dist/index-CmWdvIFT.js +0 -51
- package/dist/index-D2AMA8Bu.js +0 -65
- package/dist/index-DAUM8CO4.js +0 -65
- package/dist/index-DGjZW6uR.js +0 -78
- package/dist/index-DQe94z7X.js +0 -265
- package/dist/index-DTo6w99t.js +0 -7864
- package/dist/index-DYdXjap2.js +0 -320
- package/dist/index-DceCxNV5.js +0 -181
- package/dist/index-Uw9cSw0q.js +0 -294
- package/dist/index-qiuyrukh.js +0 -45
- package/dist/index-zddvaohA.js +0 -78
- package/dist/info-RfPsmroW.js +0 -7
- package/dist/info-circle-DFKHB_ZN.js +0 -16
- package/dist/lightbulb-B-Bykj9X.js +0 -7
- package/dist/mail-mBAgGuw5.js +0 -12
- package/dist/mobile-Dhh3ndkf.js +0 -13
- package/dist/more-D1h7UTvg.js +0 -15
- package/dist/network-placeholder-Dqynvc-t.js +0 -18
- package/dist/nftPlaceholder-Df7MW4MM.js +0 -12
- package/dist/off-BmG3cHTX.js +0 -12
- package/dist/onramp-C401Aenb.js +0 -1279
- package/dist/play-store-4q1fzL_P.js +0 -36
- package/dist/plus-603Gs3yG.js +0 -17
- package/dist/qr-code-Dgwhf6M1.js +0 -10
- package/dist/receive-CYXbbEUR.js +0 -186
- package/dist/recycle-horizontal-Bu8zZ563.js +0 -13
- package/dist/ref-DpmKRWBK.js +0 -41
- package/dist/refresh-BMZFu0mu.js +0 -12
- package/dist/reown-logo-BXph7ThY.js +0 -16
- package/dist/search-Cm_V42Y_.js +0 -12
- package/dist/secp256k1-C0iX1TUr.js +0 -1510
- package/dist/secp256k1-DOQBqE4Z.js +0 -1302
- package/dist/send-BSMYxDuP.js +0 -19
- package/dist/send-C8EeIzRB.js +0 -1038
- package/dist/socials-DQrHQajs.js +0 -574
- package/dist/swapHorizontal-98rnJewS.js +0 -12
- package/dist/swapHorizontalBold-C299FjEt.js +0 -12
- package/dist/swapHorizontalMedium-Cqm6i4WJ.js +0 -20
- package/dist/swapHorizontalRoundedBold-De7hFfqZ.js +0 -12
- package/dist/swapVertical-DSL75l8L.js +0 -12
- package/dist/swaps-BuTNp65Y.js +0 -1637
- package/dist/telegram-cJP7hgUb.js +0 -20
- package/dist/three-dots-DHnEh28O.js +0 -9
- package/dist/twitch-CR2iGcBo.js +0 -22
- package/dist/twitterIcon-E5TAQjOn.js +0 -10
- package/dist/verify-DEukUJp0.js +0 -12
- package/dist/verify-filled-BXsx1i_p.js +0 -12
- package/dist/w3m-modal-Bm7BqVng.js +0 -1037
- package/dist/wallet-CzyyvdrT.js +0 -12
- package/dist/wallet-placeholder-BrcmyGEe.js +0 -18
- package/dist/walletconnect-BSYogWiE.js +0 -36
- package/dist/warning-circle-Cgp2BW3m.js +0 -16
- package/dist/x-BJinLpTw.js +0 -16
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { cE as g, fv as S, du as y, fw as A, d2 as w, dt as d, cP as N, dw as m } from "./index-D_8VUmn1.js";
|
|
2
|
+
class p {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
this.getNonce = e.getNonce;
|
|
5
|
+
}
|
|
6
|
+
async createMessage(e) {
|
|
7
|
+
const t = {
|
|
8
|
+
accountAddress: e.accountAddress,
|
|
9
|
+
chainId: e.chainId,
|
|
10
|
+
version: "1",
|
|
11
|
+
domain: typeof document > "u" ? "Unknown Domain" : document.location.host,
|
|
12
|
+
uri: typeof document > "u" ? "Unknown URI" : document.location.href,
|
|
13
|
+
resources: this.resources,
|
|
14
|
+
nonce: await this.getNonce(e),
|
|
15
|
+
issuedAt: this.stringifyDate(/* @__PURE__ */ new Date()),
|
|
16
|
+
statement: void 0,
|
|
17
|
+
expirationTime: void 0,
|
|
18
|
+
notBefore: void 0
|
|
19
|
+
};
|
|
20
|
+
return Object.assign(t, {
|
|
21
|
+
toString: () => this.stringify(t)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
stringify(e) {
|
|
25
|
+
var n;
|
|
26
|
+
const t = this.getNetworkName(e.chainId);
|
|
27
|
+
return [
|
|
28
|
+
`${e.domain} wants you to sign in with your ${t} account:`,
|
|
29
|
+
e.accountAddress,
|
|
30
|
+
e.statement ? `
|
|
31
|
+
${e.statement}
|
|
32
|
+
` : "",
|
|
33
|
+
`URI: ${e.uri}`,
|
|
34
|
+
`Version: ${e.version}`,
|
|
35
|
+
`Chain ID: ${e.chainId}`,
|
|
36
|
+
`Nonce: ${e.nonce}`,
|
|
37
|
+
e.issuedAt && `Issued At: ${e.issuedAt}`,
|
|
38
|
+
e.expirationTime && `Expiration Time: ${e.expirationTime}`,
|
|
39
|
+
e.notBefore && `Not Before: ${e.notBefore}`,
|
|
40
|
+
e.requestId && `Request ID: ${e.requestId}`,
|
|
41
|
+
((n = e.resources) == null ? void 0 : n.length) && e.resources.reduce((s, o) => `${s}
|
|
42
|
+
- ${o}`, "Resources:")
|
|
43
|
+
].filter((s) => typeof s == "string").join(`
|
|
44
|
+
`).trim();
|
|
45
|
+
}
|
|
46
|
+
getNetworkName(e) {
|
|
47
|
+
const t = g.getAllRequestedCaipNetworks();
|
|
48
|
+
return S.getNetworkNameByCaipNetworkId(t, e);
|
|
49
|
+
}
|
|
50
|
+
stringifyDate(e) {
|
|
51
|
+
return e.toISOString();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class E {
|
|
55
|
+
constructor(e = {}) {
|
|
56
|
+
this.otpUuid = null, this.listeners = {
|
|
57
|
+
sessionChanged: []
|
|
58
|
+
}, this.localAuthStorageKey = e.localAuthStorageKey || y.SIWX_AUTH_TOKEN, this.localNonceStorageKey = e.localNonceStorageKey || y.SIWX_NONCE_TOKEN, this.required = e.required ?? !0, this.messenger = new p({
|
|
59
|
+
getNonce: this.getNonce.bind(this)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async createMessage(e) {
|
|
63
|
+
return this.messenger.createMessage(e);
|
|
64
|
+
}
|
|
65
|
+
async addSession(e) {
|
|
66
|
+
const t = await this.request({
|
|
67
|
+
method: "POST",
|
|
68
|
+
key: "authenticate",
|
|
69
|
+
body: {
|
|
70
|
+
data: e.data,
|
|
71
|
+
message: e.message,
|
|
72
|
+
signature: e.signature,
|
|
73
|
+
clientId: this.getClientId(),
|
|
74
|
+
walletInfo: this.getWalletInfo()
|
|
75
|
+
},
|
|
76
|
+
headers: ["nonce", "otp"]
|
|
77
|
+
});
|
|
78
|
+
this.setStorageToken(t.token, this.localAuthStorageKey), this.emit("sessionChanged", e), this.setAppKitAccountUser(I(t.token)), this.otpUuid = null;
|
|
79
|
+
}
|
|
80
|
+
async getSessions(e, t) {
|
|
81
|
+
try {
|
|
82
|
+
if (!this.getStorageToken(this.localAuthStorageKey))
|
|
83
|
+
return [];
|
|
84
|
+
const n = await this.request({
|
|
85
|
+
method: "GET",
|
|
86
|
+
key: "me",
|
|
87
|
+
query: {},
|
|
88
|
+
headers: ["auth"]
|
|
89
|
+
});
|
|
90
|
+
if (!n)
|
|
91
|
+
return [];
|
|
92
|
+
const s = n.address.toLowerCase() === t.toLowerCase(), o = n.caip2Network === e;
|
|
93
|
+
if (!s || !o)
|
|
94
|
+
return [];
|
|
95
|
+
const r = {
|
|
96
|
+
data: {
|
|
97
|
+
accountAddress: n.address,
|
|
98
|
+
chainId: n.caip2Network
|
|
99
|
+
},
|
|
100
|
+
message: "",
|
|
101
|
+
signature: ""
|
|
102
|
+
};
|
|
103
|
+
return this.emit("sessionChanged", r), this.setAppKitAccountUser(n), [r];
|
|
104
|
+
} catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async revokeSession(e, t) {
|
|
109
|
+
return Promise.resolve(this.clearStorageTokens());
|
|
110
|
+
}
|
|
111
|
+
async setSessions(e) {
|
|
112
|
+
if (e.length === 0)
|
|
113
|
+
this.clearStorageTokens();
|
|
114
|
+
else {
|
|
115
|
+
const t = e.find((n) => {
|
|
116
|
+
var s;
|
|
117
|
+
return n.data.chainId === ((s = A()) == null ? void 0 : s.caipNetworkId);
|
|
118
|
+
}) || e[0];
|
|
119
|
+
await this.addSession(t);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
getRequired() {
|
|
123
|
+
return this.required;
|
|
124
|
+
}
|
|
125
|
+
async getSessionAccount() {
|
|
126
|
+
if (!this.getStorageToken(this.localAuthStorageKey))
|
|
127
|
+
throw new Error("Not authenticated");
|
|
128
|
+
return this.request({
|
|
129
|
+
method: "GET",
|
|
130
|
+
key: "me",
|
|
131
|
+
body: void 0,
|
|
132
|
+
query: {
|
|
133
|
+
includeAppKitAccount: !0
|
|
134
|
+
},
|
|
135
|
+
headers: ["auth"]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async setSessionAccountMetadata(e = null) {
|
|
139
|
+
if (!this.getStorageToken(this.localAuthStorageKey))
|
|
140
|
+
throw new Error("Not authenticated");
|
|
141
|
+
return this.request({
|
|
142
|
+
method: "PUT",
|
|
143
|
+
key: "account-metadata",
|
|
144
|
+
body: { metadata: e },
|
|
145
|
+
headers: ["auth"]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
on(e, t) {
|
|
149
|
+
return this.listeners[e].push(t), () => {
|
|
150
|
+
this.listeners[e] = this.listeners[e].filter((n) => n !== t);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
removeAllListeners() {
|
|
154
|
+
Object.keys(this.listeners).forEach((t) => {
|
|
155
|
+
this.listeners[t] = [];
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async requestEmailOtp({ email: e, account: t }) {
|
|
159
|
+
const n = await this.request({
|
|
160
|
+
method: "POST",
|
|
161
|
+
key: "otp",
|
|
162
|
+
body: { email: e, account: t }
|
|
163
|
+
});
|
|
164
|
+
return this.otpUuid = n.uuid, this.messenger.resources = [`email:${e}`], n;
|
|
165
|
+
}
|
|
166
|
+
confirmEmailOtp({ code: e }) {
|
|
167
|
+
return this.request({
|
|
168
|
+
method: "PUT",
|
|
169
|
+
key: "otp",
|
|
170
|
+
body: { code: e },
|
|
171
|
+
headers: ["otp"]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async request({ method: e, key: t, query: n, body: s, headers: o }) {
|
|
175
|
+
var f;
|
|
176
|
+
const { projectId: r, st: h, sv: k } = this.getSDKProperties(), a = new URL(`${w.W3M_API_URL}/auth/v1/${String(t)}`);
|
|
177
|
+
a.searchParams.set("projectId", r), a.searchParams.set("st", h), a.searchParams.set("sv", k), n && Object.entries(n).forEach(([i, l]) => a.searchParams.set(i, String(l)));
|
|
178
|
+
const c = await fetch(a, {
|
|
179
|
+
method: e,
|
|
180
|
+
body: s ? JSON.stringify(s) : void 0,
|
|
181
|
+
headers: Array.isArray(o) ? o.reduce((i, l) => {
|
|
182
|
+
switch (l) {
|
|
183
|
+
case "nonce":
|
|
184
|
+
i["x-nonce-jwt"] = `Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;
|
|
185
|
+
break;
|
|
186
|
+
case "auth":
|
|
187
|
+
i.Authorization = `Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;
|
|
188
|
+
break;
|
|
189
|
+
case "otp":
|
|
190
|
+
this.otpUuid && (i["x-otp"] = this.otpUuid);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
return i;
|
|
194
|
+
}, {}) : void 0
|
|
195
|
+
});
|
|
196
|
+
if (!c.ok)
|
|
197
|
+
throw new Error(await c.text());
|
|
198
|
+
return (f = c.headers.get("content-type")) != null && f.includes("application/json") ? c.json() : null;
|
|
199
|
+
}
|
|
200
|
+
getStorageToken(e) {
|
|
201
|
+
return d.getItem(e);
|
|
202
|
+
}
|
|
203
|
+
setStorageToken(e, t) {
|
|
204
|
+
d.setItem(t, e);
|
|
205
|
+
}
|
|
206
|
+
clearStorageTokens() {
|
|
207
|
+
this.otpUuid = null, d.removeItem(this.localAuthStorageKey), d.removeItem(this.localNonceStorageKey), this.emit("sessionChanged", void 0);
|
|
208
|
+
}
|
|
209
|
+
async getNonce() {
|
|
210
|
+
const { nonce: e, token: t } = await this.request({
|
|
211
|
+
method: "GET",
|
|
212
|
+
key: "nonce"
|
|
213
|
+
});
|
|
214
|
+
return this.setStorageToken(t, this.localNonceStorageKey), e;
|
|
215
|
+
}
|
|
216
|
+
getClientId() {
|
|
217
|
+
return N.state.clientId;
|
|
218
|
+
}
|
|
219
|
+
getWalletInfo() {
|
|
220
|
+
var o;
|
|
221
|
+
const e = (o = g.getAccountData()) == null ? void 0 : o.connectedWalletInfo;
|
|
222
|
+
if (!e)
|
|
223
|
+
return;
|
|
224
|
+
if ("social" in e && "identifier" in e) {
|
|
225
|
+
const r = e.social, h = e.identifier;
|
|
226
|
+
return { type: "social", social: r, identifier: h };
|
|
227
|
+
}
|
|
228
|
+
const { name: t, icon: n } = e;
|
|
229
|
+
let s = "unknown";
|
|
230
|
+
switch (e.type) {
|
|
231
|
+
case "EXTERNAL":
|
|
232
|
+
case "INJECTED":
|
|
233
|
+
case "ANNOUNCED":
|
|
234
|
+
s = "extension";
|
|
235
|
+
break;
|
|
236
|
+
case "WALLET_CONNECT":
|
|
237
|
+
s = "walletconnect";
|
|
238
|
+
break;
|
|
239
|
+
default:
|
|
240
|
+
s = "unknown";
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
type: s,
|
|
244
|
+
name: t,
|
|
245
|
+
icon: n
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
getSDKProperties() {
|
|
249
|
+
return m._getSdkProperties();
|
|
250
|
+
}
|
|
251
|
+
emit(e, t) {
|
|
252
|
+
this.listeners[e].forEach((n) => n(t));
|
|
253
|
+
}
|
|
254
|
+
setAppKitAccountUser(e) {
|
|
255
|
+
const { email: t } = e;
|
|
256
|
+
t && Object.values(w.CHAIN).forEach((n) => {
|
|
257
|
+
g.setAccountProp("user", { email: t }, n);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function I(u) {
|
|
262
|
+
const e = u.split(".");
|
|
263
|
+
if (e.length !== 3)
|
|
264
|
+
throw new Error("Invalid token");
|
|
265
|
+
const t = e[1];
|
|
266
|
+
if (typeof t != "string")
|
|
267
|
+
throw new Error("Invalid token");
|
|
268
|
+
const n = t.replace(/-/gu, "+").replace(/_/gu, "/"), s = n.padEnd(n.length + (4 - n.length % 4) % 4, "=");
|
|
269
|
+
return JSON.parse(atob(s));
|
|
270
|
+
}
|
|
271
|
+
export {
|
|
272
|
+
E as ReownAuthentication,
|
|
273
|
+
p as ReownAuthenticationMessenger
|
|
274
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c1 as l, b$ as $, bI as u, bB as m, cf as c, a1 as d, cq as z,
|
|
1
|
+
import { c1 as l, b$ as $, bI as u, bB as m, cf as c, a1 as d, cq as z, dr as k, c0 as H, bq as A, a0 as B, ds as N, T as O, bi as I, c2 as T } from "./index-D_8VUmn1.js";
|
|
2
2
|
const j = `Ethereum Signed Message:
|
|
3
3
|
`;
|
|
4
4
|
function C(e) {
|
|
@@ -44,17 +44,17 @@ function F(e) {
|
|
|
44
44
|
}
|
|
45
45
|
if (f === "address" && typeof o == "string" && !A(o))
|
|
46
46
|
throw new B({ address: o });
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const [S, y] =
|
|
47
|
+
const b = f.match(N);
|
|
48
|
+
if (b) {
|
|
49
|
+
const [S, y] = b;
|
|
50
50
|
if (y && u(o) !== Number.parseInt(y, 10))
|
|
51
51
|
throw new O({
|
|
52
52
|
expectedSize: Number.parseInt(y, 10),
|
|
53
53
|
givenSize: u(o)
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const g = n[f];
|
|
57
|
+
g && (J(f), a(g, o));
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
if (n.EIP712Domain && t) {
|