@directcryptopay/sdk 0.1.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 +357 -0
- package/dist/ConstantsUtil-B-_-u8aQ.js +6 -0
- package/dist/add-KF4m4jFK.js +19 -0
- package/dist/all-wallets-D6NAjQgX.js +10 -0
- package/dist/app-store-D7TTn-EO.js +21 -0
- package/dist/apple-DjX2E2hE.js +22 -0
- package/dist/arrow-bottom-C0YrNJYB.js +12 -0
- package/dist/arrow-bottom-circle-Dlxvx_XG.js +15 -0
- package/dist/arrow-left-x8_-lUyK.js +12 -0
- package/dist/arrow-right-BTZybj80.js +12 -0
- package/dist/arrow-top-LzH7iLCp.js +12 -0
- package/dist/bank-23jp-IV_.js +18 -0
- package/dist/browser-EjoorDid.js +18 -0
- package/dist/card-DGgWwtwC.js +18 -0
- package/dist/ccip-BMANewTU.js +150 -0
- package/dist/checkmark-B1qcQhBo.js +15 -0
- package/dist/checkmark-bold-Cyc4IEEJ.js +12 -0
- package/dist/chevron-bottom-ClHs08rB.js +12 -0
- package/dist/chevron-left-O8h_551_.js +12 -0
- package/dist/chevron-right-DP3xpyIA.js +12 -0
- package/dist/chevron-top-CuwkBUs9.js +12 -0
- package/dist/chrome-store-zfT_aJ3R.js +65 -0
- package/dist/clock-DHZqivIS.js +12 -0
- package/dist/close-Cp9rNAw4.js +12 -0
- package/dist/coinPlaceholder-U7-T1KKQ.js +12 -0
- package/dist/compass-Ds5-PRSR.js +12 -0
- package/dist/copy-Jg4HdIMf.js +19 -0
- package/dist/core/api.d.ts +30 -0
- package/dist/core/config.d.ts +59 -0
- package/dist/core/logic.d.ts +2 -0
- package/dist/core/wallet.d.ts +34 -0
- package/dist/cursor-DmMevduB.js +7 -0
- package/dist/cursor-transparent-Dn9-1SV8.js +16 -0
- package/dist/dcp-sdk.umd.js +12000 -0
- package/dist/dcp.d.ts +10 -0
- package/dist/desktop-C4udXXlZ.js +13 -0
- package/dist/disconnect-wd1BYLxt.js +12 -0
- package/dist/discord-DthxuCAP.js +21 -0
- package/dist/email-B3jSnUFE.js +696 -0
- package/dist/embedded-wallet-CJHmoBI2.js +468 -0
- package/dist/etherscan-Cjp4xfMW.js +10 -0
- package/dist/exclamation-triangle-CRNR5WOy.js +8 -0
- package/dist/extension-Cydk0mZt.js +12 -0
- package/dist/external-link-CuPTAoq9.js +12 -0
- package/dist/facebook-CghqXmdf.js +30 -0
- package/dist/farcaster-BREqMX4y.js +16 -0
- package/dist/filters-Dn_Ys7ew.js +12 -0
- package/dist/github-C-A7JmIY.js +22 -0
- package/dist/google-CCdM_naE.js +22 -0
- package/dist/hashTypedData-D2Qmzscs.js +197 -0
- package/dist/help-circle-DIH4vyj3.js +16 -0
- package/dist/id-DkJ0gBuy.js +16 -0
- package/dist/if-defined-BciplFKz.js +744 -0
- package/dist/image-qMjyiXM0.js +8 -0
- package/dist/index--3Zp0jAb.js +45 -0
- package/dist/index-1adX-Fit.js +65 -0
- package/dist/index-AvC0IGDl.js +7864 -0
- package/dist/index-B2-vKLd8.js +276 -0
- package/dist/index-B2iDt0TJ.js +146 -0
- package/dist/index-B5zkXsLJ.js +320 -0
- package/dist/index-B7K86vWu.js +1742 -0
- package/dist/index-BBkcvSiY.js +511 -0
- package/dist/index-BdjxQs66.js +181 -0
- package/dist/index-Bijd4_Ns.js +294 -0
- package/dist/index-BpXOsxzU.js +387 -0
- package/dist/index-C1QEJL-2.js +572 -0
- package/dist/index-C27dwOyE.js +243 -0
- package/dist/index-C4BX3QW8.js +58 -0
- package/dist/index-CMPIqsB1.js +170 -0
- package/dist/index-CTYngdl0.js +21991 -0
- package/dist/index-CUdQyyFn.js +51 -0
- package/dist/index-CX60z_g2.js +573 -0
- package/dist/index-CppCc1n8.js +65 -0
- package/dist/index-CqVegmN4.js +559 -0
- package/dist/index-CuiyMA8F.js +78 -0
- package/dist/index-CwB_qRfM.js +305 -0
- package/dist/index-CxOF7GqE.js +265 -0
- package/dist/index-D-IzHD_8.js +54 -0
- package/dist/index-DRNiFv9I.js +218 -0
- package/dist/index-Da8oZh8H.js +838 -0
- package/dist/index-DiHImG4L.js +44236 -0
- package/dist/index-DmOMXRG1.js +181 -0
- package/dist/index-DoSYqTQg.js +199 -0
- package/dist/index-DpHXq5_E.js +603 -0
- package/dist/index-DtCsAVBg.js +78 -0
- package/dist/index-Ij6XA6_4.js +77 -0
- package/dist/index-SzyBYfzA.js +8490 -0
- package/dist/index-eW8y-mXH.js +257 -0
- package/dist/index-fxzIDZsb.js +75 -0
- package/dist/index-lbhz9evJ.js +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/info-DMIGgjkL.js +7 -0
- package/dist/info-circle-CJuIKZSx.js +16 -0
- package/dist/lightbulb-qFT6WEWV.js +7 -0
- package/dist/localBatchGatewayRequest-CsMVMFBc.js +91 -0
- package/dist/mail-DoYgQvOt.js +12 -0
- package/dist/mobile-URtsh7o-.js +13 -0
- package/dist/more-DoQd10TF.js +15 -0
- package/dist/network-placeholder-BBA2Ue6C.js +18 -0
- package/dist/nftPlaceholder-C9RXWz9k.js +12 -0
- package/dist/off-YcuDQczT.js +12 -0
- package/dist/onramp-BfqDIx4o.js +1279 -0
- package/dist/parseSignature-280HB24T.js +3560 -0
- package/dist/play-store-sFaloG_r.js +36 -0
- package/dist/plus-l0wekSht.js +17 -0
- package/dist/qr-code-CihrUU4G.js +10 -0
- package/dist/receive-dfY1Cu-g.js +186 -0
- package/dist/recycle-horizontal-nXu6YaPw.js +13 -0
- package/dist/ref-huAzXCX0.js +41 -0
- package/dist/refresh-D2ZbVeNC.js +12 -0
- package/dist/reown-logo-BMaTMJmc.js +16 -0
- package/dist/search-YVM9q3J-.js +12 -0
- package/dist/secp256k1-BrysY3Sv.js +1302 -0
- package/dist/secp256k1-DPQgTBwQ.js +1510 -0
- package/dist/send-BwQZPKxI.js +19 -0
- package/dist/send-GyetMVu1.js +1038 -0
- package/dist/socials-B0W91J9k.js +574 -0
- package/dist/swapHorizontal-Dy_oQEkp.js +12 -0
- package/dist/swapHorizontalBold-C4JpaMpc.js +12 -0
- package/dist/swapHorizontalMedium-D5NuVZFh.js +20 -0
- package/dist/swapHorizontalRoundedBold-Bq4P2MCj.js +12 -0
- package/dist/swapVertical-CVQ8Mg03.js +12 -0
- package/dist/swaps-CA04SSdK.js +1637 -0
- package/dist/telegram-BP4SgW_L.js +20 -0
- package/dist/three-dots-BJYGJ-dQ.js +9 -0
- package/dist/transactions-Bq-98Tsg.js +37 -0
- package/dist/twitch-DTATWo9M.js +22 -0
- package/dist/twitterIcon-D5UWPInb.js +10 -0
- package/dist/types.d.ts +128 -0
- package/dist/ui/Modal.d.ts +9 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/verify-Byvj8Wi1.js +12 -0
- package/dist/verify-filled-B40taNm0.js +12 -0
- package/dist/w3m-modal-HV6SE74G.js +1037 -0
- package/dist/wallet-Cp-6Kk88.js +12 -0
- package/dist/wallet-placeholder-C3juwA9o.js +18 -0
- package/dist/walletconnect-CRkIiLCx.js +36 -0
- package/dist/warning-circle-DtvCLwG4.js +16 -0
- package/dist/x-Cqyx5eCt.js +16 -0
- package/package.json +70 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { cz as g, cC as b, cD as p, cA as h, cB as d } from "./index-DiHImG4L.js";
|
|
2
|
+
import { n as r, c as w } from "./if-defined-BciplFKz.js";
|
|
3
|
+
import "./index-lbhz9evJ.js";
|
|
4
|
+
const f = g`
|
|
5
|
+
:host {
|
|
6
|
+
width: var(--local-width);
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
button {
|
|
11
|
+
border: none;
|
|
12
|
+
border-radius: var(--local-border-radius);
|
|
13
|
+
width: var(--local-width);
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* -- Sizes --------------------------------------------------- */
|
|
18
|
+
button[data-size='md'] {
|
|
19
|
+
padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-l);
|
|
20
|
+
height: 36px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
button[data-size='md'][data-icon-left='true'][data-icon-right='false'] {
|
|
24
|
+
padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-s);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
button[data-size='md'][data-icon-right='true'][data-icon-left='false'] {
|
|
28
|
+
padding: 8.2px var(--wui-spacing-s) 9px var(--wui-spacing-l);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
button[data-size='lg'] {
|
|
32
|
+
padding: var(--wui-spacing-m) var(--wui-spacing-2l);
|
|
33
|
+
height: 48px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* -- Variants --------------------------------------------------------- */
|
|
37
|
+
button[data-variant='main'] {
|
|
38
|
+
background-color: var(--wui-color-accent-100);
|
|
39
|
+
color: var(--wui-color-inverse-100);
|
|
40
|
+
border: none;
|
|
41
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
button[data-variant='inverse'] {
|
|
45
|
+
background-color: var(--wui-color-inverse-100);
|
|
46
|
+
color: var(--wui-color-inverse-000);
|
|
47
|
+
border: none;
|
|
48
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
button[data-variant='accent'] {
|
|
52
|
+
background-color: var(--wui-color-accent-glass-010);
|
|
53
|
+
color: var(--wui-color-accent-100);
|
|
54
|
+
border: none;
|
|
55
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
button[data-variant='accent-error'] {
|
|
59
|
+
background: var(--wui-color-error-glass-015);
|
|
60
|
+
color: var(--wui-color-error-100);
|
|
61
|
+
border: none;
|
|
62
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-error-glass-010);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
button[data-variant='accent-success'] {
|
|
66
|
+
background: var(--wui-color-success-glass-015);
|
|
67
|
+
color: var(--wui-color-success-100);
|
|
68
|
+
border: none;
|
|
69
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-success-glass-010);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
button[data-variant='neutral'] {
|
|
73
|
+
background: transparent;
|
|
74
|
+
color: var(--wui-color-fg-100);
|
|
75
|
+
border: none;
|
|
76
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* -- Focus states --------------------------------------------------- */
|
|
80
|
+
button[data-variant='main']:focus-visible:enabled {
|
|
81
|
+
background-color: var(--wui-color-accent-090);
|
|
82
|
+
box-shadow:
|
|
83
|
+
inset 0 0 0 1px var(--wui-color-accent-100),
|
|
84
|
+
0 0 0 4px var(--wui-color-accent-glass-020);
|
|
85
|
+
}
|
|
86
|
+
button[data-variant='inverse']:focus-visible:enabled {
|
|
87
|
+
background-color: var(--wui-color-inverse-100);
|
|
88
|
+
box-shadow:
|
|
89
|
+
inset 0 0 0 1px var(--wui-color-gray-glass-010),
|
|
90
|
+
0 0 0 4px var(--wui-color-accent-glass-020);
|
|
91
|
+
}
|
|
92
|
+
button[data-variant='accent']:focus-visible:enabled {
|
|
93
|
+
background-color: var(--wui-color-accent-glass-010);
|
|
94
|
+
box-shadow:
|
|
95
|
+
inset 0 0 0 1px var(--wui-color-accent-100),
|
|
96
|
+
0 0 0 4px var(--wui-color-accent-glass-020);
|
|
97
|
+
}
|
|
98
|
+
button[data-variant='accent-error']:focus-visible:enabled {
|
|
99
|
+
background: var(--wui-color-error-glass-015);
|
|
100
|
+
box-shadow:
|
|
101
|
+
inset 0 0 0 1px var(--wui-color-error-100),
|
|
102
|
+
0 0 0 4px var(--wui-color-error-glass-020);
|
|
103
|
+
}
|
|
104
|
+
button[data-variant='accent-success']:focus-visible:enabled {
|
|
105
|
+
background: var(--wui-color-success-glass-015);
|
|
106
|
+
box-shadow:
|
|
107
|
+
inset 0 0 0 1px var(--wui-color-success-100),
|
|
108
|
+
0 0 0 4px var(--wui-color-success-glass-020);
|
|
109
|
+
}
|
|
110
|
+
button[data-variant='neutral']:focus-visible:enabled {
|
|
111
|
+
background: var(--wui-color-gray-glass-005);
|
|
112
|
+
box-shadow:
|
|
113
|
+
inset 0 0 0 1px var(--wui-color-gray-glass-010),
|
|
114
|
+
0 0 0 4px var(--wui-color-gray-glass-002);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* -- Hover & Active states ----------------------------------------------------------- */
|
|
118
|
+
@media (hover: hover) and (pointer: fine) {
|
|
119
|
+
button[data-variant='main']:hover:enabled {
|
|
120
|
+
background-color: var(--wui-color-accent-090);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
button[data-variant='main']:active:enabled {
|
|
124
|
+
background-color: var(--wui-color-accent-080);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
button[data-variant='accent']:hover:enabled {
|
|
128
|
+
background-color: var(--wui-color-accent-glass-015);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
button[data-variant='accent']:active:enabled {
|
|
132
|
+
background-color: var(--wui-color-accent-glass-020);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
button[data-variant='accent-error']:hover:enabled {
|
|
136
|
+
background: var(--wui-color-error-glass-020);
|
|
137
|
+
color: var(--wui-color-error-100);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
button[data-variant='accent-error']:active:enabled {
|
|
141
|
+
background: var(--wui-color-error-glass-030);
|
|
142
|
+
color: var(--wui-color-error-100);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
button[data-variant='accent-success']:hover:enabled {
|
|
146
|
+
background: var(--wui-color-success-glass-020);
|
|
147
|
+
color: var(--wui-color-success-100);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
button[data-variant='accent-success']:active:enabled {
|
|
151
|
+
background: var(--wui-color-success-glass-030);
|
|
152
|
+
color: var(--wui-color-success-100);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
button[data-variant='neutral']:hover:enabled {
|
|
156
|
+
background: var(--wui-color-gray-glass-002);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
button[data-variant='neutral']:active:enabled {
|
|
160
|
+
background: var(--wui-color-gray-glass-005);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
button[data-size='lg'][data-icon-left='true'][data-icon-right='false'] {
|
|
164
|
+
padding-left: var(--wui-spacing-m);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
button[data-size='lg'][data-icon-right='true'][data-icon-left='false'] {
|
|
168
|
+
padding-right: var(--wui-spacing-m);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* -- Disabled state --------------------------------------------------- */
|
|
173
|
+
button:disabled {
|
|
174
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
175
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002);
|
|
176
|
+
color: var(--wui-color-gray-glass-020);
|
|
177
|
+
cursor: not-allowed;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
button > wui-text {
|
|
181
|
+
transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
182
|
+
will-change: opacity;
|
|
183
|
+
opacity: var(--local-opacity-100);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
::slotted(*) {
|
|
187
|
+
transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
188
|
+
will-change: opacity;
|
|
189
|
+
opacity: var(--local-opacity-100);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
wui-loading-spinner {
|
|
193
|
+
position: absolute;
|
|
194
|
+
left: 50%;
|
|
195
|
+
top: 50%;
|
|
196
|
+
transform: translate(-50%, -50%);
|
|
197
|
+
opacity: var(--local-opacity-000);
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
var t = function(s, o, i, n) {
|
|
201
|
+
var c = arguments.length, e = c < 3 ? o : n === null ? n = Object.getOwnPropertyDescriptor(o, i) : n, l;
|
|
202
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") e = Reflect.decorate(s, o, i, n);
|
|
203
|
+
else for (var u = s.length - 1; u >= 0; u--) (l = s[u]) && (e = (c < 3 ? l(e) : c > 3 ? l(o, i, e) : l(o, i)) || e);
|
|
204
|
+
return c > 3 && e && Object.defineProperty(o, i, e), e;
|
|
205
|
+
};
|
|
206
|
+
const v = {
|
|
207
|
+
main: "inverse-100",
|
|
208
|
+
inverse: "inverse-000",
|
|
209
|
+
accent: "accent-100",
|
|
210
|
+
"accent-error": "error-100",
|
|
211
|
+
"accent-success": "success-100",
|
|
212
|
+
neutral: "fg-100",
|
|
213
|
+
disabled: "gray-glass-020"
|
|
214
|
+
}, x = {
|
|
215
|
+
lg: "paragraph-600",
|
|
216
|
+
md: "small-600"
|
|
217
|
+
}, y = {
|
|
218
|
+
lg: "md",
|
|
219
|
+
md: "md"
|
|
220
|
+
};
|
|
221
|
+
let a = class extends h {
|
|
222
|
+
constructor() {
|
|
223
|
+
super(...arguments), this.size = "lg", this.disabled = !1, this.fullWidth = !1, this.loading = !1, this.variant = "main", this.hasIconLeft = !1, this.hasIconRight = !1, this.borderRadius = "m";
|
|
224
|
+
}
|
|
225
|
+
render() {
|
|
226
|
+
this.style.cssText = `
|
|
227
|
+
--local-width: ${this.fullWidth ? "100%" : "auto"};
|
|
228
|
+
--local-opacity-100: ${this.loading ? 0 : 1};
|
|
229
|
+
--local-opacity-000: ${this.loading ? 1 : 0};
|
|
230
|
+
--local-border-radius: var(--wui-border-radius-${this.borderRadius});
|
|
231
|
+
`;
|
|
232
|
+
const o = this.textVariant ?? x[this.size];
|
|
233
|
+
return d`
|
|
234
|
+
<button
|
|
235
|
+
data-variant=${this.variant}
|
|
236
|
+
data-icon-left=${this.hasIconLeft}
|
|
237
|
+
data-icon-right=${this.hasIconRight}
|
|
238
|
+
data-size=${this.size}
|
|
239
|
+
?disabled=${this.disabled}
|
|
240
|
+
>
|
|
241
|
+
${this.loadingTemplate()}
|
|
242
|
+
<slot name="iconLeft" @slotchange=${() => this.handleSlotLeftChange()}></slot>
|
|
243
|
+
<wui-text variant=${o} color="inherit">
|
|
244
|
+
<slot></slot>
|
|
245
|
+
</wui-text>
|
|
246
|
+
<slot name="iconRight" @slotchange=${() => this.handleSlotRightChange()}></slot>
|
|
247
|
+
</button>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
handleSlotLeftChange() {
|
|
251
|
+
this.hasIconLeft = !0;
|
|
252
|
+
}
|
|
253
|
+
handleSlotRightChange() {
|
|
254
|
+
this.hasIconRight = !0;
|
|
255
|
+
}
|
|
256
|
+
loadingTemplate() {
|
|
257
|
+
if (this.loading) {
|
|
258
|
+
const o = y[this.size], i = this.disabled ? v.disabled : v[this.variant];
|
|
259
|
+
return d`<wui-loading-spinner color=${i} size=${o}></wui-loading-spinner>`;
|
|
260
|
+
}
|
|
261
|
+
return d``;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
a.styles = [b, p, f];
|
|
265
|
+
t([
|
|
266
|
+
r()
|
|
267
|
+
], a.prototype, "size", void 0);
|
|
268
|
+
t([
|
|
269
|
+
r({ type: Boolean })
|
|
270
|
+
], a.prototype, "disabled", void 0);
|
|
271
|
+
t([
|
|
272
|
+
r({ type: Boolean })
|
|
273
|
+
], a.prototype, "fullWidth", void 0);
|
|
274
|
+
t([
|
|
275
|
+
r({ type: Boolean })
|
|
276
|
+
], a.prototype, "loading", void 0);
|
|
277
|
+
t([
|
|
278
|
+
r()
|
|
279
|
+
], a.prototype, "variant", void 0);
|
|
280
|
+
t([
|
|
281
|
+
r({ type: Boolean })
|
|
282
|
+
], a.prototype, "hasIconLeft", void 0);
|
|
283
|
+
t([
|
|
284
|
+
r({ type: Boolean })
|
|
285
|
+
], a.prototype, "hasIconRight", void 0);
|
|
286
|
+
t([
|
|
287
|
+
r()
|
|
288
|
+
], a.prototype, "borderRadius", void 0);
|
|
289
|
+
t([
|
|
290
|
+
r()
|
|
291
|
+
], a.prototype, "textVariant", void 0);
|
|
292
|
+
a = t([
|
|
293
|
+
w("wui-button")
|
|
294
|
+
], a);
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { r as T } from "./index-C1QEJL-2.js";
|
|
2
|
+
import { bk as y } from "./index-DiHImG4L.js";
|
|
3
|
+
import { h as k, e as I } from "./hashTypedData-D2Qmzscs.js";
|
|
4
|
+
const q = () => "9.1.0", v = (t) => t.toString(16).padStart(2, "0"), C = (t) => {
|
|
5
|
+
const e = new Uint8Array(t / 2);
|
|
6
|
+
return window.crypto.getRandomValues(e), Array.from(e, v).join("");
|
|
7
|
+
}, R = () => typeof window < "u" ? C(10) : (/* @__PURE__ */ new Date()).getTime().toString(36);
|
|
8
|
+
class g {
|
|
9
|
+
}
|
|
10
|
+
g.makeRequest = (t, e) => ({
|
|
11
|
+
id: R(),
|
|
12
|
+
method: t,
|
|
13
|
+
params: e,
|
|
14
|
+
env: {
|
|
15
|
+
sdkVersion: q()
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
g.makeResponse = (t, e, s) => ({
|
|
19
|
+
id: t,
|
|
20
|
+
success: !0,
|
|
21
|
+
version: s,
|
|
22
|
+
data: e
|
|
23
|
+
});
|
|
24
|
+
g.makeErrorResponse = (t, e, s) => ({
|
|
25
|
+
id: t,
|
|
26
|
+
success: !1,
|
|
27
|
+
error: e,
|
|
28
|
+
version: s
|
|
29
|
+
});
|
|
30
|
+
var r;
|
|
31
|
+
(function(t) {
|
|
32
|
+
t.sendTransactions = "sendTransactions", t.rpcCall = "rpcCall", t.getChainInfo = "getChainInfo", t.getSafeInfo = "getSafeInfo", t.getTxBySafeTxHash = "getTxBySafeTxHash", t.getSafeBalances = "getSafeBalances", t.signMessage = "signMessage", t.signTypedMessage = "signTypedMessage", t.getEnvironmentInfo = "getEnvironmentInfo", t.getOffChainSignature = "getOffChainSignature", t.requestAddressBook = "requestAddressBook", t.wallet_getPermissions = "wallet_getPermissions", t.wallet_requestPermissions = "wallet_requestPermissions";
|
|
33
|
+
})(r || (r = {}));
|
|
34
|
+
var m;
|
|
35
|
+
(function(t) {
|
|
36
|
+
t.requestAddressBook = "requestAddressBook";
|
|
37
|
+
})(m || (m = {}));
|
|
38
|
+
class H {
|
|
39
|
+
constructor(e = null, s = !1) {
|
|
40
|
+
this.allowedOrigins = null, this.callbacks = /* @__PURE__ */ new Map(), this.debugMode = !1, this.isServer = typeof window > "u", this.isValidMessage = ({ origin: a, data: n, source: i }) => {
|
|
41
|
+
const o = !n, l = !this.isServer && i === window.parent, u = typeof n.version < "u" && parseInt(n.version.split(".")[0]), B = typeof u == "number" && u >= 1;
|
|
42
|
+
let p = !0;
|
|
43
|
+
return Array.isArray(this.allowedOrigins) && (p = this.allowedOrigins.find((P) => P.test(a)) !== void 0), !o && l && B && p;
|
|
44
|
+
}, this.logIncomingMessage = (a) => {
|
|
45
|
+
console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `, a.data);
|
|
46
|
+
}, this.onParentMessage = (a) => {
|
|
47
|
+
this.isValidMessage(a) && (this.debugMode && this.logIncomingMessage(a), this.handleIncomingMessage(a.data));
|
|
48
|
+
}, this.handleIncomingMessage = (a) => {
|
|
49
|
+
const { id: n } = a, i = this.callbacks.get(n);
|
|
50
|
+
i && (i(a), this.callbacks.delete(n));
|
|
51
|
+
}, this.send = (a, n) => {
|
|
52
|
+
const i = g.makeRequest(a, n);
|
|
53
|
+
if (this.isServer)
|
|
54
|
+
throw new Error("Window doesn't exist");
|
|
55
|
+
return window.parent.postMessage(i, "*"), new Promise((o, l) => {
|
|
56
|
+
this.callbacks.set(i.id, (u) => {
|
|
57
|
+
if (!u.success) {
|
|
58
|
+
l(new Error(u.error));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
o(u);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}, this.allowedOrigins = e, this.debugMode = s, this.isServer || window.addEventListener("message", this.onParentMessage);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const b = (t) => typeof t == "object" && t != null && "domain" in t && "types" in t && "message" in t;
|
|
68
|
+
T();
|
|
69
|
+
class E {
|
|
70
|
+
constructor(e) {
|
|
71
|
+
this.communicator = e;
|
|
72
|
+
}
|
|
73
|
+
async getBySafeTxHash(e) {
|
|
74
|
+
if (!e)
|
|
75
|
+
throw new Error("Invalid safeTxHash");
|
|
76
|
+
return (await this.communicator.send(r.getTxBySafeTxHash, { safeTxHash: e })).data;
|
|
77
|
+
}
|
|
78
|
+
async signMessage(e) {
|
|
79
|
+
const s = {
|
|
80
|
+
message: e
|
|
81
|
+
};
|
|
82
|
+
return (await this.communicator.send(r.signMessage, s)).data;
|
|
83
|
+
}
|
|
84
|
+
async signTypedMessage(e) {
|
|
85
|
+
if (!b(e))
|
|
86
|
+
throw new Error("Invalid typed data");
|
|
87
|
+
return (await this.communicator.send(r.signTypedMessage, { typedData: e })).data;
|
|
88
|
+
}
|
|
89
|
+
async send({ txs: e, params: s }) {
|
|
90
|
+
if (!e || !e.length)
|
|
91
|
+
throw new Error("No transactions were passed");
|
|
92
|
+
const a = {
|
|
93
|
+
txs: e,
|
|
94
|
+
params: s
|
|
95
|
+
};
|
|
96
|
+
return (await this.communicator.send(r.sendTransactions, a)).data;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const c = {
|
|
100
|
+
eth_call: "eth_call",
|
|
101
|
+
eth_gasPrice: "eth_gasPrice",
|
|
102
|
+
eth_getLogs: "eth_getLogs",
|
|
103
|
+
eth_getBalance: "eth_getBalance",
|
|
104
|
+
eth_getCode: "eth_getCode",
|
|
105
|
+
eth_getBlockByHash: "eth_getBlockByHash",
|
|
106
|
+
eth_getBlockByNumber: "eth_getBlockByNumber",
|
|
107
|
+
eth_getStorageAt: "eth_getStorageAt",
|
|
108
|
+
eth_getTransactionByHash: "eth_getTransactionByHash",
|
|
109
|
+
eth_getTransactionReceipt: "eth_getTransactionReceipt",
|
|
110
|
+
eth_getTransactionCount: "eth_getTransactionCount",
|
|
111
|
+
eth_estimateGas: "eth_estimateGas",
|
|
112
|
+
safe_setSettings: "safe_setSettings"
|
|
113
|
+
}, h = {
|
|
114
|
+
defaultBlockParam: (t = "latest") => t,
|
|
115
|
+
returnFullTxObjectParam: (t = !1) => t,
|
|
116
|
+
blockNumberToHex: (t) => Number.isInteger(t) ? `0x${t.toString(16)}` : t
|
|
117
|
+
};
|
|
118
|
+
class A {
|
|
119
|
+
constructor(e) {
|
|
120
|
+
this.communicator = e, this.call = this.buildRequest({
|
|
121
|
+
call: c.eth_call,
|
|
122
|
+
formatters: [null, h.defaultBlockParam]
|
|
123
|
+
}), this.getBalance = this.buildRequest({
|
|
124
|
+
call: c.eth_getBalance,
|
|
125
|
+
formatters: [null, h.defaultBlockParam]
|
|
126
|
+
}), this.getCode = this.buildRequest({
|
|
127
|
+
call: c.eth_getCode,
|
|
128
|
+
formatters: [null, h.defaultBlockParam]
|
|
129
|
+
}), this.getStorageAt = this.buildRequest({
|
|
130
|
+
call: c.eth_getStorageAt,
|
|
131
|
+
formatters: [null, h.blockNumberToHex, h.defaultBlockParam]
|
|
132
|
+
}), this.getPastLogs = this.buildRequest({
|
|
133
|
+
call: c.eth_getLogs
|
|
134
|
+
}), this.getBlockByHash = this.buildRequest({
|
|
135
|
+
call: c.eth_getBlockByHash,
|
|
136
|
+
formatters: [null, h.returnFullTxObjectParam]
|
|
137
|
+
}), this.getBlockByNumber = this.buildRequest({
|
|
138
|
+
call: c.eth_getBlockByNumber,
|
|
139
|
+
formatters: [h.blockNumberToHex, h.returnFullTxObjectParam]
|
|
140
|
+
}), this.getTransactionByHash = this.buildRequest({
|
|
141
|
+
call: c.eth_getTransactionByHash
|
|
142
|
+
}), this.getTransactionReceipt = this.buildRequest({
|
|
143
|
+
call: c.eth_getTransactionReceipt
|
|
144
|
+
}), this.getTransactionCount = this.buildRequest({
|
|
145
|
+
call: c.eth_getTransactionCount,
|
|
146
|
+
formatters: [null, h.defaultBlockParam]
|
|
147
|
+
}), this.getGasPrice = this.buildRequest({
|
|
148
|
+
call: c.eth_gasPrice
|
|
149
|
+
}), this.getEstimateGas = (s) => this.buildRequest({
|
|
150
|
+
call: c.eth_estimateGas
|
|
151
|
+
})([s]), this.setSafeSettings = this.buildRequest({
|
|
152
|
+
call: c.safe_setSettings
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
buildRequest(e) {
|
|
156
|
+
const { call: s, formatters: a } = e;
|
|
157
|
+
return async (n) => {
|
|
158
|
+
a && Array.isArray(n) && a.forEach((l, u) => {
|
|
159
|
+
l && (n[u] = l(n[u]));
|
|
160
|
+
});
|
|
161
|
+
const i = {
|
|
162
|
+
call: s,
|
|
163
|
+
params: n || []
|
|
164
|
+
};
|
|
165
|
+
return (await this.communicator.send(r.rpcCall, i)).data;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const x = "0x1626ba7e", O = "0x20c13b0b", f = 4001;
|
|
170
|
+
class d extends Error {
|
|
171
|
+
constructor(e, s, a) {
|
|
172
|
+
super(e), this.code = s, this.data = a, Object.setPrototypeOf(this, d.prototype);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
class S {
|
|
176
|
+
constructor(e) {
|
|
177
|
+
this.communicator = e;
|
|
178
|
+
}
|
|
179
|
+
async getPermissions() {
|
|
180
|
+
return (await this.communicator.send(r.wallet_getPermissions, void 0)).data;
|
|
181
|
+
}
|
|
182
|
+
async requestPermissions(e) {
|
|
183
|
+
if (!this.isPermissionRequestValid(e))
|
|
184
|
+
throw new d("Permissions request is invalid", f);
|
|
185
|
+
try {
|
|
186
|
+
return (await this.communicator.send(r.wallet_requestPermissions, e)).data;
|
|
187
|
+
} catch {
|
|
188
|
+
throw new d("Permissions rejected", f);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
isPermissionRequestValid(e) {
|
|
192
|
+
return e.every((s) => typeof s == "object" ? Object.keys(s).every((a) => !!Object.values(m).includes(a)) : !1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const w = (t, e) => e.some((s) => s.parentCapability === t), V = () => (t, e, s) => {
|
|
196
|
+
const a = s.value;
|
|
197
|
+
return s.value = async function() {
|
|
198
|
+
const n = new S(this.communicator);
|
|
199
|
+
let i = await n.getPermissions();
|
|
200
|
+
if (w(e, i) || (i = await n.requestPermissions([{ [e]: {} }])), !w(e, i))
|
|
201
|
+
throw new d("Permissions rejected", f);
|
|
202
|
+
return a.apply(this);
|
|
203
|
+
}, s;
|
|
204
|
+
};
|
|
205
|
+
var M = function(t, e, s, a) {
|
|
206
|
+
var n = arguments.length, i = n < 3 ? e : a === null ? a = Object.getOwnPropertyDescriptor(e, s) : a, o;
|
|
207
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, s, a);
|
|
208
|
+
else for (var l = t.length - 1; l >= 0; l--) (o = t[l]) && (i = (n < 3 ? o(i) : n > 3 ? o(e, s, i) : o(e, s)) || i);
|
|
209
|
+
return n > 3 && i && Object.defineProperty(e, s, i), i;
|
|
210
|
+
};
|
|
211
|
+
class _ {
|
|
212
|
+
constructor(e) {
|
|
213
|
+
this.communicator = e;
|
|
214
|
+
}
|
|
215
|
+
async getChainInfo() {
|
|
216
|
+
return (await this.communicator.send(r.getChainInfo, void 0)).data;
|
|
217
|
+
}
|
|
218
|
+
async getInfo() {
|
|
219
|
+
return (await this.communicator.send(r.getSafeInfo, void 0)).data;
|
|
220
|
+
}
|
|
221
|
+
// There is a possibility that this method will change because we may add pagination to the endpoint
|
|
222
|
+
async experimental_getBalances({ currency: e = "usd" } = {}) {
|
|
223
|
+
return (await this.communicator.send(r.getSafeBalances, {
|
|
224
|
+
currency: e
|
|
225
|
+
})).data;
|
|
226
|
+
}
|
|
227
|
+
async check1271Signature(e, s = "0x") {
|
|
228
|
+
const a = await this.getInfo(), n = y({
|
|
229
|
+
abi: [
|
|
230
|
+
{
|
|
231
|
+
constant: !1,
|
|
232
|
+
inputs: [
|
|
233
|
+
{
|
|
234
|
+
name: "_dataHash",
|
|
235
|
+
type: "bytes32"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "_signature",
|
|
239
|
+
type: "bytes"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
name: "isValidSignature",
|
|
243
|
+
outputs: [
|
|
244
|
+
{
|
|
245
|
+
name: "",
|
|
246
|
+
type: "bytes4"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
payable: !1,
|
|
250
|
+
stateMutability: "nonpayable",
|
|
251
|
+
type: "function"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
functionName: "isValidSignature",
|
|
255
|
+
args: [e, s]
|
|
256
|
+
}), i = {
|
|
257
|
+
call: c.eth_call,
|
|
258
|
+
params: [
|
|
259
|
+
{
|
|
260
|
+
to: a.safeAddress,
|
|
261
|
+
data: n
|
|
262
|
+
},
|
|
263
|
+
"latest"
|
|
264
|
+
]
|
|
265
|
+
};
|
|
266
|
+
try {
|
|
267
|
+
return (await this.communicator.send(r.rpcCall, i)).data.slice(0, 10).toLowerCase() === x;
|
|
268
|
+
} catch {
|
|
269
|
+
return !1;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
async check1271SignatureBytes(e, s = "0x") {
|
|
273
|
+
const a = await this.getInfo(), n = y({
|
|
274
|
+
abi: [
|
|
275
|
+
{
|
|
276
|
+
constant: !1,
|
|
277
|
+
inputs: [
|
|
278
|
+
{
|
|
279
|
+
name: "_data",
|
|
280
|
+
type: "bytes"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "_signature",
|
|
284
|
+
type: "bytes"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
name: "isValidSignature",
|
|
288
|
+
outputs: [
|
|
289
|
+
{
|
|
290
|
+
name: "",
|
|
291
|
+
type: "bytes4"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
payable: !1,
|
|
295
|
+
stateMutability: "nonpayable",
|
|
296
|
+
type: "function"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
functionName: "isValidSignature",
|
|
300
|
+
args: [e, s]
|
|
301
|
+
}), i = {
|
|
302
|
+
call: c.eth_call,
|
|
303
|
+
params: [
|
|
304
|
+
{
|
|
305
|
+
to: a.safeAddress,
|
|
306
|
+
data: n
|
|
307
|
+
},
|
|
308
|
+
"latest"
|
|
309
|
+
]
|
|
310
|
+
};
|
|
311
|
+
try {
|
|
312
|
+
return (await this.communicator.send(r.rpcCall, i)).data.slice(0, 10).toLowerCase() === O;
|
|
313
|
+
} catch {
|
|
314
|
+
return !1;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
calculateMessageHash(e) {
|
|
318
|
+
return k(e);
|
|
319
|
+
}
|
|
320
|
+
calculateTypedMessageHash(e) {
|
|
321
|
+
const s = typeof e.domain.chainId == "object" ? e.domain.chainId.toNumber() : Number(e.domain.chainId);
|
|
322
|
+
let a = e.primaryType;
|
|
323
|
+
if (!a) {
|
|
324
|
+
const n = Object.values(e.types), i = Object.keys(e.types).filter((o) => n.every((l) => l.every(({ type: u }) => u.replace("[", "").replace("]", "") !== o)));
|
|
325
|
+
if (i.length === 0 || i.length > 1)
|
|
326
|
+
throw new Error("Please specify primaryType");
|
|
327
|
+
a = i[0];
|
|
328
|
+
}
|
|
329
|
+
return I({
|
|
330
|
+
message: e.message,
|
|
331
|
+
domain: {
|
|
332
|
+
...e.domain,
|
|
333
|
+
chainId: s,
|
|
334
|
+
verifyingContract: e.domain.verifyingContract,
|
|
335
|
+
salt: e.domain.salt
|
|
336
|
+
},
|
|
337
|
+
types: e.types,
|
|
338
|
+
primaryType: a
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
async getOffChainSignature(e) {
|
|
342
|
+
return (await this.communicator.send(r.getOffChainSignature, e)).data;
|
|
343
|
+
}
|
|
344
|
+
async isMessageSigned(e, s = "0x") {
|
|
345
|
+
let a;
|
|
346
|
+
if (typeof e == "string" && (a = async () => {
|
|
347
|
+
const n = this.calculateMessageHash(e);
|
|
348
|
+
return await this.isMessageHashSigned(n, s);
|
|
349
|
+
}), b(e) && (a = async () => {
|
|
350
|
+
const n = this.calculateTypedMessageHash(e);
|
|
351
|
+
return await this.isMessageHashSigned(n, s);
|
|
352
|
+
}), a)
|
|
353
|
+
return await a();
|
|
354
|
+
throw new Error("Invalid message type");
|
|
355
|
+
}
|
|
356
|
+
async isMessageHashSigned(e, s = "0x") {
|
|
357
|
+
const a = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)];
|
|
358
|
+
for (const n of a)
|
|
359
|
+
if (await n(e, s))
|
|
360
|
+
return !0;
|
|
361
|
+
return !1;
|
|
362
|
+
}
|
|
363
|
+
async getEnvironmentInfo() {
|
|
364
|
+
return (await this.communicator.send(r.getEnvironmentInfo, void 0)).data;
|
|
365
|
+
}
|
|
366
|
+
async requestAddressBook() {
|
|
367
|
+
return (await this.communicator.send(r.requestAddressBook, void 0)).data;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
M([
|
|
371
|
+
V()
|
|
372
|
+
], _.prototype, "requestAddressBook", null);
|
|
373
|
+
class L {
|
|
374
|
+
constructor(e = {}) {
|
|
375
|
+
const { allowedDomains: s = null, debug: a = !1 } = e;
|
|
376
|
+
this.communicator = new H(s, a), this.eth = new A(this.communicator), this.txs = new E(this.communicator), this.safe = new _(this.communicator), this.wallet = new S(this.communicator);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
export {
|
|
380
|
+
g as MessageFormatter,
|
|
381
|
+
r as Methods,
|
|
382
|
+
c as RPC_CALLS,
|
|
383
|
+
m as RestrictedMethods,
|
|
384
|
+
L as default,
|
|
385
|
+
q as getSDKVersion,
|
|
386
|
+
b as isObjectEIP712TypedData
|
|
387
|
+
};
|