@directcryptopay/sdk 0.2.4 → 0.3.0
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/README.md +51 -87
- package/dist/core/config.d.ts +9 -46
- package/dist/core/iframe.d.ts +16 -0
- package/dist/dcp-sdk.umd.js +1 -12811
- package/dist/dcp.d.ts +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -2
- package/dist/types.d.ts +26 -164
- package/package.json +3 -13
- package/dist/ExchangeController-CbO41bcH.js +0 -217
- package/dist/HelpersUtil-DHm6EVSE.js +0 -120
- package/dist/NavigationUtil-kj9LEOOd.js +0 -8
- package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
- package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
- package/dist/PhArrowDown-C9AkNvLs.js +0 -73
- package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
- package/dist/PhArrowRight-DM1tna0G.js +0 -73
- package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
- package/dist/PhArrowUp-DmktzOWy.js +0 -73
- package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
- package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
- package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
- package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
- package/dist/PhBank-4_9QzqIB.js +0 -73
- package/dist/PhBrowser-B-JSznId.js +0 -73
- package/dist/PhCaretDown-vV5oHMNi.js +0 -73
- package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
- package/dist/PhCaretRight-CqQN4TT3.js +0 -73
- package/dist/PhCaretUp-Df7UCAHy.js +0 -73
- package/dist/PhCheck-gtpfK4ed.js +0 -73
- package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
- package/dist/PhClock-SDCW-NmF.js +0 -73
- package/dist/PhCompass-B7hgtdx-.js +0 -73
- package/dist/PhCopy-BcnhyXCy.js +0 -73
- package/dist/PhCreditCard-BJjByVgu.js +0 -73
- package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
- package/dist/PhDesktop-B3VKPuJx.js +0 -73
- package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
- package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
- package/dist/PhEnvelope-67uzHbI9.js +0 -73
- package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
- package/dist/PhGlobe-TMm_6qGk.js +0 -73
- package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
- package/dist/PhImage-gY96WtHR.js +0 -73
- package/dist/PhInfo-DRQM_ZDP.js +0 -73
- package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
- package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
- package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
- package/dist/PhPlus-BfTsQnUz.js +0 -73
- package/dist/PhPower-CxYUGOWn.js +0 -73
- package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
- package/dist/PhQrCode-BuJ97NYJ.js +0 -73
- package/dist/PhQuestion-kJoP8Mja.js +0 -73
- package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
- package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
- package/dist/PhSignOut-jk97OSVt.js +0 -73
- package/dist/PhSpinner-CiYOhwMg.js +0 -73
- package/dist/PhTrash-pxerMqzd.js +0 -73
- package/dist/PhUser-BMg0VV4A.js +0 -73
- package/dist/PhVault-DYQvx5A-.js +0 -73
- package/dist/PhWarning-NLC5Mj87.js +0 -73
- package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
- package/dist/PhX-Bx4wpwm3.js +0 -73
- package/dist/SwapController-Ch0FFTEt.js +0 -457
- package/dist/ccip-BrGhNXIM.js +0 -150
- package/dist/core/api.d.ts +0 -39
- package/dist/core/logic.d.ts +0 -2
- package/dist/core/wallet.d.ts +0 -55
- package/dist/data-capture-CpafmuCb.js +0 -490
- package/dist/email-Dcg4jlai.js +0 -344
- package/dist/embedded-wallet-DeoRdAPw.js +0 -820
- package/dist/features-B9Nde43h.js +0 -274
- package/dist/hashTypedData-a7b8tdkO.js +0 -197
- package/dist/if-defined-k21LutCn.js +0 -10
- package/dist/index-9vLw53Xl.js +0 -228
- package/dist/index-B5wUyynz.js +0 -107
- package/dist/index-B8LkUrww.js +0 -86
- package/dist/index-BA0VwKg0.js +0 -8189
- package/dist/index-BB9JJ24N.js +0 -125
- package/dist/index-BCkEvPQ6.js +0 -172
- package/dist/index-BDeO_csr.js +0 -171
- package/dist/index-Bb7babLF.js +0 -1281
- package/dist/index-BjOhprVS.js +0 -199
- package/dist/index-BjyMgZsf.js +0 -218
- package/dist/index-BkThIDLX.js +0 -159
- package/dist/index-BmFs6nb7.js +0 -209
- package/dist/index-C1QEJL-2.js +0 -572
- package/dist/index-C4qc4PdD.js +0 -387
- package/dist/index-CAPvUh14.js +0 -1750
- package/dist/index-CBMU3PTE.js +0 -65
- package/dist/index-CGwPkJLF.js +0 -355
- package/dist/index-CNGEqX3D.js +0 -153
- package/dist/index-CRlCq6IB.js +0 -7981
- package/dist/index-Cg_o-i9X.js +0 -118
- package/dist/index-D1BvhCbI.js +0 -62
- package/dist/index-DFi8TiHc.js +0 -128
- package/dist/index-DLwuveL9.js +0 -555
- package/dist/index-DMn7ktUQ.js +0 -56
- package/dist/index-DOXwtuwa.js +0 -117
- package/dist/index-DPPOW_Tp.js +0 -118
- package/dist/index-DQpzHpW-.js +0 -517
- package/dist/index-DXHg5C-W.js +0 -276
- package/dist/index-DcYjZV4H.js +0 -110
- package/dist/index-DeL88Lwc.js +0 -41655
- package/dist/index-DrWVlf8b.js +0 -46
- package/dist/index-Dsfuc4rB.js +0 -123
- package/dist/index-DuTny38n.js +0 -1175
- package/dist/index-Nfjb6bV0.js +0 -21991
- package/dist/index-WwwdQSN2.js +0 -85
- package/dist/index-Yha9Afch.js +0 -174
- package/dist/index-cbQHN7GC.js +0 -100
- package/dist/index-hyG3cYsv.js +0 -1083
- package/dist/index-qLxmmPaL.js +0 -257
- package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
- package/dist/onramp-BSiyOX4L.js +0 -855
- package/dist/parseSignature-CdCMAPZN.js +0 -3304
- package/dist/pay-with-exchange-CduNoMEz.js +0 -525
- package/dist/property-Bd8U3_QP.js +0 -618
- package/dist/receive-CrmptJlq.js +0 -232
- package/dist/ref-SOwYtCZb.js +0 -107
- package/dist/send-oMcHMEr6.js +0 -1166
- package/dist/socials-C0A4-FbY.js +0 -620
- package/dist/swaps-CbJJ9Ciu.js +0 -1760
- package/dist/transactions-BDfCoBS5.js +0 -37
- package/dist/ui/Modal.d.ts +0 -9
- package/dist/ui/index.d.ts +0 -6
- package/dist/w3m-modal-BjsTkny7.js +0 -1706
|
@@ -1,274 +0,0 @@
|
|
|
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-DeL88Lwc.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,197 +0,0 @@
|
|
|
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-DeL88Lwc.js";
|
|
2
|
-
const j = `Ethereum Signed Message:
|
|
3
|
-
`;
|
|
4
|
-
function C(e) {
|
|
5
|
-
const t = typeof e == "string" ? l(e) : typeof e.raw == "string" ? e.raw : $(e.raw), s = l(`${j}${u(t)}`);
|
|
6
|
-
return m([s, t]);
|
|
7
|
-
}
|
|
8
|
-
function U(e, t) {
|
|
9
|
-
return c(C(e), t);
|
|
10
|
-
}
|
|
11
|
-
class R extends d {
|
|
12
|
-
constructor({ domain: t }) {
|
|
13
|
-
super(`Invalid domain "${z(t)}".`, {
|
|
14
|
-
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
class W extends d {
|
|
19
|
-
constructor({ primaryType: t, types: s }) {
|
|
20
|
-
super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`, {
|
|
21
|
-
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
22
|
-
metaMessages: ["Check that the primary type is a key in `types`."]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class q extends d {
|
|
27
|
-
constructor({ type: t }) {
|
|
28
|
-
super(`Struct type "${t}" is invalid.`, {
|
|
29
|
-
metaMessages: ["Struct type must not be a Solidity type."],
|
|
30
|
-
name: "InvalidStructTypeError"
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function F(e) {
|
|
35
|
-
const { domain: t, message: s, primaryType: r, types: n } = e, a = (i, p) => {
|
|
36
|
-
for (const D of i) {
|
|
37
|
-
const { name: P, type: f } = D, o = p[P], h = f.match(k);
|
|
38
|
-
if (h && (typeof o == "number" || typeof o == "bigint")) {
|
|
39
|
-
const [S, y, M] = h;
|
|
40
|
-
H(o, {
|
|
41
|
-
signed: y === "int",
|
|
42
|
-
size: Number.parseInt(M, 10) / 8
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
if (f === "address" && typeof o == "string" && !A(o))
|
|
46
|
-
throw new B({ address: o });
|
|
47
|
-
const b = f.match(N);
|
|
48
|
-
if (b) {
|
|
49
|
-
const [S, y] = b;
|
|
50
|
-
if (y && u(o) !== Number.parseInt(y, 10))
|
|
51
|
-
throw new O({
|
|
52
|
-
expectedSize: Number.parseInt(y, 10),
|
|
53
|
-
givenSize: u(o)
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const g = n[f];
|
|
57
|
-
g && (J(f), a(g, o));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
if (n.EIP712Domain && t) {
|
|
61
|
-
if (typeof t != "object")
|
|
62
|
-
throw new R({ domain: t });
|
|
63
|
-
a(n.EIP712Domain, t);
|
|
64
|
-
}
|
|
65
|
-
if (r !== "EIP712Domain")
|
|
66
|
-
if (n[r])
|
|
67
|
-
a(n[r], s);
|
|
68
|
-
else
|
|
69
|
-
throw new W({ primaryType: r, types: n });
|
|
70
|
-
}
|
|
71
|
-
function V({ domain: e }) {
|
|
72
|
-
return [
|
|
73
|
-
typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
|
|
74
|
-
(e == null ? void 0 : e.version) && { name: "version", type: "string" },
|
|
75
|
-
(typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
|
|
76
|
-
name: "chainId",
|
|
77
|
-
type: "uint256"
|
|
78
|
-
},
|
|
79
|
-
(e == null ? void 0 : e.verifyingContract) && {
|
|
80
|
-
name: "verifyingContract",
|
|
81
|
-
type: "address"
|
|
82
|
-
},
|
|
83
|
-
(e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
|
|
84
|
-
].filter(Boolean);
|
|
85
|
-
}
|
|
86
|
-
function J(e) {
|
|
87
|
-
if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
|
|
88
|
-
throw new q({ type: e });
|
|
89
|
-
}
|
|
90
|
-
function X(e) {
|
|
91
|
-
const { domain: t = {}, message: s, primaryType: r } = e, n = {
|
|
92
|
-
EIP712Domain: V({ domain: t }),
|
|
93
|
-
...e.types
|
|
94
|
-
};
|
|
95
|
-
F({
|
|
96
|
-
domain: t,
|
|
97
|
-
message: s,
|
|
98
|
-
primaryType: r,
|
|
99
|
-
types: n
|
|
100
|
-
});
|
|
101
|
-
const a = ["0x1901"];
|
|
102
|
-
return t && a.push(G({
|
|
103
|
-
domain: t,
|
|
104
|
-
types: n
|
|
105
|
-
})), r !== "EIP712Domain" && a.push(v({
|
|
106
|
-
data: s,
|
|
107
|
-
primaryType: r,
|
|
108
|
-
types: n
|
|
109
|
-
})), c(m(a));
|
|
110
|
-
}
|
|
111
|
-
function G({ domain: e, types: t }) {
|
|
112
|
-
return v({
|
|
113
|
-
data: e,
|
|
114
|
-
primaryType: "EIP712Domain",
|
|
115
|
-
types: t
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function v({ data: e, primaryType: t, types: s }) {
|
|
119
|
-
const r = x({
|
|
120
|
-
data: e,
|
|
121
|
-
primaryType: t,
|
|
122
|
-
types: s
|
|
123
|
-
});
|
|
124
|
-
return c(r);
|
|
125
|
-
}
|
|
126
|
-
function x({ data: e, primaryType: t, types: s }) {
|
|
127
|
-
const r = [{ type: "bytes32" }], n = [K({ primaryType: t, types: s })];
|
|
128
|
-
for (const a of s[t]) {
|
|
129
|
-
const [i, p] = w({
|
|
130
|
-
types: s,
|
|
131
|
-
name: a.name,
|
|
132
|
-
type: a.type,
|
|
133
|
-
value: e[a.name]
|
|
134
|
-
});
|
|
135
|
-
r.push(i), n.push(p);
|
|
136
|
-
}
|
|
137
|
-
return I(r, n);
|
|
138
|
-
}
|
|
139
|
-
function K({ primaryType: e, types: t }) {
|
|
140
|
-
const s = T(L({ primaryType: e, types: t }));
|
|
141
|
-
return c(s);
|
|
142
|
-
}
|
|
143
|
-
function L({ primaryType: e, types: t }) {
|
|
144
|
-
let s = "";
|
|
145
|
-
const r = E({ primaryType: e, types: t });
|
|
146
|
-
r.delete(e);
|
|
147
|
-
const n = [e, ...Array.from(r).sort()];
|
|
148
|
-
for (const a of n)
|
|
149
|
-
s += `${a}(${t[a].map(({ name: i, type: p }) => `${p} ${i}`).join(",")})`;
|
|
150
|
-
return s;
|
|
151
|
-
}
|
|
152
|
-
function E({ primaryType: e, types: t }, s = /* @__PURE__ */ new Set()) {
|
|
153
|
-
const r = e.match(/^\w*/u), n = r == null ? void 0 : r[0];
|
|
154
|
-
if (s.has(n) || t[n] === void 0)
|
|
155
|
-
return s;
|
|
156
|
-
s.add(n);
|
|
157
|
-
for (const a of t[n])
|
|
158
|
-
E({ primaryType: a.type, types: t }, s);
|
|
159
|
-
return s;
|
|
160
|
-
}
|
|
161
|
-
function w({ types: e, name: t, type: s, value: r }) {
|
|
162
|
-
if (e[s] !== void 0)
|
|
163
|
-
return [
|
|
164
|
-
{ type: "bytes32" },
|
|
165
|
-
c(x({ data: r, primaryType: s, types: e }))
|
|
166
|
-
];
|
|
167
|
-
if (s === "bytes")
|
|
168
|
-
return [{ type: "bytes32" }, c(r)];
|
|
169
|
-
if (s === "string")
|
|
170
|
-
return [{ type: "bytes32" }, c(T(r))];
|
|
171
|
-
if (s.lastIndexOf("]") === s.length - 1) {
|
|
172
|
-
const n = s.slice(0, s.lastIndexOf("[")), a = r.map((i) => w({
|
|
173
|
-
name: t,
|
|
174
|
-
type: n,
|
|
175
|
-
types: e,
|
|
176
|
-
value: i
|
|
177
|
-
}));
|
|
178
|
-
return [
|
|
179
|
-
{ type: "bytes32" },
|
|
180
|
-
c(I(a.map(([i]) => i), a.map(([, i]) => i)))
|
|
181
|
-
];
|
|
182
|
-
}
|
|
183
|
-
return [{ type: s }, r];
|
|
184
|
-
}
|
|
185
|
-
export {
|
|
186
|
-
R as I,
|
|
187
|
-
W as a,
|
|
188
|
-
q as b,
|
|
189
|
-
G as c,
|
|
190
|
-
v as d,
|
|
191
|
-
X as e,
|
|
192
|
-
V as g,
|
|
193
|
-
U as h,
|
|
194
|
-
j as p,
|
|
195
|
-
C as t,
|
|
196
|
-
F as v
|
|
197
|
-
};
|
package/dist/index-9vLw53Xl.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { cU as c, cV as h, cW as m, cX as b, cY as a } from "./index-DeL88Lwc.js";
|
|
2
|
-
import { n as o, c as x } from "./index-DuTny38n.js";
|
|
3
|
-
import { o as f } from "./if-defined-k21LutCn.js";
|
|
4
|
-
import { e as $, n as g } from "./ref-SOwYtCZb.js";
|
|
5
|
-
const w = c`
|
|
6
|
-
:host {
|
|
7
|
-
position: relative;
|
|
8
|
-
width: 100%;
|
|
9
|
-
display: inline-flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
gap: ${({ spacing: t }) => t[3]};
|
|
12
|
-
color: ${({ tokens: t }) => t.theme.textPrimary};
|
|
13
|
-
caret-color: ${({ tokens: t }) => t.core.textAccentPrimary};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.wui-input-text-container {
|
|
17
|
-
position: relative;
|
|
18
|
-
display: flex;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
input {
|
|
22
|
-
width: 100%;
|
|
23
|
-
border-radius: ${({ borderRadius: t }) => t[4]};
|
|
24
|
-
color: inherit;
|
|
25
|
-
background: transparent;
|
|
26
|
-
border: 1px solid ${({ tokens: t }) => t.theme.borderPrimary};
|
|
27
|
-
caret-color: ${({ tokens: t }) => t.core.textAccentPrimary};
|
|
28
|
-
padding: ${({ spacing: t }) => t[3]} ${({ spacing: t }) => t[3]}
|
|
29
|
-
${({ spacing: t }) => t[3]} ${({ spacing: t }) => t[10]};
|
|
30
|
-
font-size: ${({ textSize: t }) => t.large};
|
|
31
|
-
line-height: ${({ typography: t }) => t["lg-regular"].lineHeight};
|
|
32
|
-
letter-spacing: ${({ typography: t }) => t["lg-regular"].letterSpacing};
|
|
33
|
-
font-weight: ${({ fontWeight: t }) => t.regular};
|
|
34
|
-
font-family: ${({ fontFamily: t }) => t.regular};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
input[data-size='lg'] {
|
|
38
|
-
padding: ${({ spacing: t }) => t[4]} ${({ spacing: t }) => t[3]}
|
|
39
|
-
${({ spacing: t }) => t[4]} ${({ spacing: t }) => t[10]};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@media (hover: hover) and (pointer: fine) {
|
|
43
|
-
input:hover:enabled {
|
|
44
|
-
border: 1px solid ${({ tokens: t }) => t.theme.borderSecondary};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
input:disabled {
|
|
49
|
-
cursor: unset;
|
|
50
|
-
border: 1px solid ${({ tokens: t }) => t.theme.borderPrimary};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
input::placeholder {
|
|
54
|
-
color: ${({ tokens: t }) => t.theme.textSecondary};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
input:focus:enabled {
|
|
58
|
-
border: 1px solid ${({ tokens: t }) => t.theme.borderSecondary};
|
|
59
|
-
background-color: ${({ tokens: t }) => t.theme.foregroundPrimary};
|
|
60
|
-
-webkit-box-shadow: 0px 0px 0px 4px ${({ tokens: t }) => t.core.foregroundAccent040};
|
|
61
|
-
-moz-box-shadow: 0px 0px 0px 4px ${({ tokens: t }) => t.core.foregroundAccent040};
|
|
62
|
-
box-shadow: 0px 0px 0px 4px ${({ tokens: t }) => t.core.foregroundAccent040};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
div.wui-input-text-container:has(input:disabled) {
|
|
66
|
-
opacity: 0.5;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
wui-icon.wui-input-text-left-icon {
|
|
70
|
-
position: absolute;
|
|
71
|
-
top: 50%;
|
|
72
|
-
transform: translateY(-50%);
|
|
73
|
-
pointer-events: none;
|
|
74
|
-
left: ${({ spacing: t }) => t[4]};
|
|
75
|
-
color: ${({ tokens: t }) => t.theme.iconDefault};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
button.wui-input-text-submit-button {
|
|
79
|
-
position: absolute;
|
|
80
|
-
top: 50%;
|
|
81
|
-
transform: translateY(-50%);
|
|
82
|
-
right: ${({ spacing: t }) => t[3]};
|
|
83
|
-
width: 24px;
|
|
84
|
-
height: 24px;
|
|
85
|
-
border: none;
|
|
86
|
-
background: transparent;
|
|
87
|
-
border-radius: ${({ borderRadius: t }) => t[2]};
|
|
88
|
-
color: ${({ tokens: t }) => t.core.textAccentPrimary};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
button.wui-input-text-submit-button:disabled {
|
|
92
|
-
opacity: 1;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
button.wui-input-text-submit-button.loading wui-icon {
|
|
96
|
-
animation: spin 1s linear infinite;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
button.wui-input-text-submit-button:hover {
|
|
100
|
-
background: ${({ tokens: t }) => t.core.foregroundAccent010};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
input:has(+ .wui-input-text-submit-button) {
|
|
104
|
-
padding-right: ${({ spacing: t }) => t[12]};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
input[type='number'] {
|
|
108
|
-
-moz-appearance: textfield;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
input[type='search']::-webkit-search-decoration,
|
|
112
|
-
input[type='search']::-webkit-search-cancel-button,
|
|
113
|
-
input[type='search']::-webkit-search-results-button,
|
|
114
|
-
input[type='search']::-webkit-search-results-decoration {
|
|
115
|
-
-webkit-appearance: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* -- Keyframes --------------------------------------------------- */
|
|
119
|
-
@keyframes spin {
|
|
120
|
-
from {
|
|
121
|
-
transform: rotate(0deg);
|
|
122
|
-
}
|
|
123
|
-
to {
|
|
124
|
-
transform: rotate(360deg);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
`;
|
|
128
|
-
var n = function(t, i, s, u) {
|
|
129
|
-
var p = arguments.length, r = p < 3 ? i : u === null ? u = Object.getOwnPropertyDescriptor(i, s) : u, l;
|
|
130
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, i, s, u);
|
|
131
|
-
else for (var d = t.length - 1; d >= 0; d--) (l = t[d]) && (r = (p < 3 ? l(r) : p > 3 ? l(i, s, r) : l(i, s)) || r);
|
|
132
|
-
return p > 3 && r && Object.defineProperty(i, s, r), r;
|
|
133
|
-
};
|
|
134
|
-
let e = class extends b {
|
|
135
|
-
constructor() {
|
|
136
|
-
super(...arguments), this.inputElementRef = $(), this.disabled = !1, this.loading = !1, this.placeholder = "", this.type = "text", this.value = "", this.size = "md";
|
|
137
|
-
}
|
|
138
|
-
render() {
|
|
139
|
-
return a` <div class="wui-input-text-container">
|
|
140
|
-
${this.templateLeftIcon()}
|
|
141
|
-
<input
|
|
142
|
-
data-size=${this.size}
|
|
143
|
-
${g(this.inputElementRef)}
|
|
144
|
-
data-testid="wui-input-text"
|
|
145
|
-
type=${this.type}
|
|
146
|
-
enterkeyhint=${f(this.enterKeyHint)}
|
|
147
|
-
?disabled=${this.disabled}
|
|
148
|
-
placeholder=${this.placeholder}
|
|
149
|
-
@input=${this.dispatchInputChangeEvent.bind(this)}
|
|
150
|
-
@keydown=${this.onKeyDown}
|
|
151
|
-
.value=${this.value || ""}
|
|
152
|
-
/>
|
|
153
|
-
${this.templateSubmitButton()}
|
|
154
|
-
<slot class="wui-input-text-slot"></slot>
|
|
155
|
-
</div>
|
|
156
|
-
${this.templateError()} ${this.templateWarning()}`;
|
|
157
|
-
}
|
|
158
|
-
templateLeftIcon() {
|
|
159
|
-
return this.icon ? a`<wui-icon
|
|
160
|
-
class="wui-input-text-left-icon"
|
|
161
|
-
size="md"
|
|
162
|
-
data-size=${this.size}
|
|
163
|
-
color="inherit"
|
|
164
|
-
name=${this.icon}
|
|
165
|
-
></wui-icon>` : null;
|
|
166
|
-
}
|
|
167
|
-
templateSubmitButton() {
|
|
168
|
-
var i;
|
|
169
|
-
return this.onSubmit ? a`<button
|
|
170
|
-
class="wui-input-text-submit-button ${this.loading ? "loading" : ""}"
|
|
171
|
-
@click=${(i = this.onSubmit) == null ? void 0 : i.bind(this)}
|
|
172
|
-
?disabled=${this.disabled || this.loading}
|
|
173
|
-
>
|
|
174
|
-
${this.loading ? a`<wui-icon name="spinner" size="md"></wui-icon>` : a`<wui-icon name="chevronRight" size="md"></wui-icon>`}
|
|
175
|
-
</button>` : null;
|
|
176
|
-
}
|
|
177
|
-
templateError() {
|
|
178
|
-
return this.errorText ? a`<wui-text variant="sm-regular" color="error">${this.errorText}</wui-text>` : null;
|
|
179
|
-
}
|
|
180
|
-
templateWarning() {
|
|
181
|
-
return this.warningText ? a`<wui-text variant="sm-regular" color="warning">${this.warningText}</wui-text>` : null;
|
|
182
|
-
}
|
|
183
|
-
dispatchInputChangeEvent() {
|
|
184
|
-
var i;
|
|
185
|
-
this.dispatchEvent(new CustomEvent("inputChange", {
|
|
186
|
-
detail: (i = this.inputElementRef.value) == null ? void 0 : i.value,
|
|
187
|
-
bubbles: !0,
|
|
188
|
-
composed: !0
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
e.styles = [h, m, w];
|
|
193
|
-
n([
|
|
194
|
-
o()
|
|
195
|
-
], e.prototype, "icon", void 0);
|
|
196
|
-
n([
|
|
197
|
-
o({ type: Boolean })
|
|
198
|
-
], e.prototype, "disabled", void 0);
|
|
199
|
-
n([
|
|
200
|
-
o({ type: Boolean })
|
|
201
|
-
], e.prototype, "loading", void 0);
|
|
202
|
-
n([
|
|
203
|
-
o()
|
|
204
|
-
], e.prototype, "placeholder", void 0);
|
|
205
|
-
n([
|
|
206
|
-
o()
|
|
207
|
-
], e.prototype, "type", void 0);
|
|
208
|
-
n([
|
|
209
|
-
o()
|
|
210
|
-
], e.prototype, "value", void 0);
|
|
211
|
-
n([
|
|
212
|
-
o()
|
|
213
|
-
], e.prototype, "errorText", void 0);
|
|
214
|
-
n([
|
|
215
|
-
o()
|
|
216
|
-
], e.prototype, "warningText", void 0);
|
|
217
|
-
n([
|
|
218
|
-
o()
|
|
219
|
-
], e.prototype, "onSubmit", void 0);
|
|
220
|
-
n([
|
|
221
|
-
o()
|
|
222
|
-
], e.prototype, "size", void 0);
|
|
223
|
-
n([
|
|
224
|
-
o({ attribute: !1 })
|
|
225
|
-
], e.prototype, "onKeyDown", void 0);
|
|
226
|
-
e = n([
|
|
227
|
-
x("wui-input-text")
|
|
228
|
-
], e);
|