@moveindustries/wallet-adapter-react 7.2.2
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/LICENSE +201 -0
- package/README.md +306 -0
- package/dist/WalletProvider.d.ts +12 -0
- package/dist/WalletProvider.d.ts.map +1 -0
- package/dist/components/AboutMovementConnect.d.ts +29 -0
- package/dist/components/AboutMovementConnect.d.ts.map +1 -0
- package/dist/components/AboutPetraWeb.d.ts +31 -0
- package/dist/components/AboutPetraWeb.d.ts.map +1 -0
- package/dist/components/MovementPrivacyPolicy.d.ts +12 -0
- package/dist/components/MovementPrivacyPolicy.d.ts.map +1 -0
- package/dist/components/WalletItem.d.ts +16 -0
- package/dist/components/WalletItem.d.ts.map +1 -0
- package/dist/components/utils.d.ts +20 -0
- package/dist/components/utils.d.ts.map +1 -0
- package/dist/graphics/LinkGraphic.d.ts +3 -0
- package/dist/graphics/LinkGraphic.d.ts.map +1 -0
- package/dist/graphics/SmallMovementLogo.d.ts +3 -0
- package/dist/graphics/SmallMovementLogo.d.ts.map +1 -0
- package/dist/graphics/WalletGraphic.d.ts +3 -0
- package/dist/graphics/WalletGraphic.d.ts.map +1 -0
- package/dist/graphics/Web3Graphic.d.ts +3 -0
- package/dist/graphics/Web3Graphic.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +632 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +606 -0
- package/dist/index.mjs.map +1 -0
- package/dist/useWallet.d.ts +31 -0
- package/dist/useWallet.d.ts.map +1 -0
- package/package.json +60 -0
- package/src/WalletProvider.tsx +424 -0
- package/src/components/AboutMovementConnect.tsx +60 -0
- package/src/components/AboutPetraWeb.tsx +63 -0
- package/src/components/MovementPrivacyPolicy.tsx +44 -0
- package/src/components/WalletItem.tsx +122 -0
- package/src/components/utils.tsx +70 -0
- package/src/graphics/LinkGraphic.tsx +26 -0
- package/src/graphics/SmallMovementLogo.tsx +25 -0
- package/src/graphics/WalletGraphic.tsx +42 -0
- package/src/graphics/Web3Graphic.tsx +31 -0
- package/src/index.tsx +7 -0
- package/src/useWallet.tsx +67 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/index.tsx
|
|
54
|
+
export * from "@moveindustries/wallet-adapter-core";
|
|
55
|
+
|
|
56
|
+
// src/WalletProvider.tsx
|
|
57
|
+
import {
|
|
58
|
+
WalletCore,
|
|
59
|
+
WalletReadyState
|
|
60
|
+
} from "@moveindustries/wallet-adapter-core";
|
|
61
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
62
|
+
|
|
63
|
+
// src/useWallet.tsx
|
|
64
|
+
import { useContext, createContext } from "react";
|
|
65
|
+
var DEFAULT_CONTEXT = {
|
|
66
|
+
connected: false
|
|
67
|
+
};
|
|
68
|
+
var WalletContext = createContext(
|
|
69
|
+
DEFAULT_CONTEXT
|
|
70
|
+
);
|
|
71
|
+
function useWallet() {
|
|
72
|
+
const context = useContext(WalletContext);
|
|
73
|
+
if (!context) {
|
|
74
|
+
throw new Error("useWallet must be used within a WalletContextState");
|
|
75
|
+
}
|
|
76
|
+
return context;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/WalletProvider.tsx
|
|
80
|
+
import { jsx } from "react/jsx-runtime";
|
|
81
|
+
var initialState = {
|
|
82
|
+
connected: false,
|
|
83
|
+
account: null,
|
|
84
|
+
network: null,
|
|
85
|
+
wallet: null
|
|
86
|
+
};
|
|
87
|
+
var MovementWalletAdapterProvider = ({
|
|
88
|
+
children,
|
|
89
|
+
optInWallets,
|
|
90
|
+
autoConnect = false,
|
|
91
|
+
dappConfig,
|
|
92
|
+
disableTelemetry = false,
|
|
93
|
+
onError
|
|
94
|
+
}) => {
|
|
95
|
+
const didAttemptAutoConnectRef = useRef(false);
|
|
96
|
+
const [{ account, network, connected, wallet }, setState] = useState(initialState);
|
|
97
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
98
|
+
const [walletCore, setWalletCore] = useState();
|
|
99
|
+
const [wallets, setWallets] = useState([]);
|
|
100
|
+
const [notDetectedWallets, setNotDetectedWallets] = useState([]);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const walletCore2 = new WalletCore(
|
|
103
|
+
optInWallets,
|
|
104
|
+
dappConfig,
|
|
105
|
+
disableTelemetry
|
|
106
|
+
);
|
|
107
|
+
setWalletCore(walletCore2);
|
|
108
|
+
}, []);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
setWallets((_a = walletCore == null ? void 0 : walletCore.wallets) != null ? _a : []);
|
|
112
|
+
setNotDetectedWallets((_b = walletCore == null ? void 0 : walletCore.notDetectedWallets) != null ? _b : []);
|
|
113
|
+
}, [walletCore]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (didAttemptAutoConnectRef.current || !(walletCore == null ? void 0 : walletCore.wallets.length)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
didAttemptAutoConnectRef.current = true;
|
|
119
|
+
if (!autoConnect) {
|
|
120
|
+
setIsLoading(false);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const walletName = localStorage.getItem("MovementWalletName");
|
|
124
|
+
if (!walletName) {
|
|
125
|
+
setIsLoading(false);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const selectedWallet = walletCore.wallets.find(
|
|
129
|
+
(e) => e.name === walletName
|
|
130
|
+
);
|
|
131
|
+
if (!selectedWallet || selectedWallet.readyState !== WalletReadyState.Installed) {
|
|
132
|
+
setIsLoading(false);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!connected) {
|
|
136
|
+
(() => __async(null, null, function* () {
|
|
137
|
+
try {
|
|
138
|
+
let shouldConnect = true;
|
|
139
|
+
if (typeof autoConnect === "function") {
|
|
140
|
+
shouldConnect = yield autoConnect(walletCore, selectedWallet);
|
|
141
|
+
} else {
|
|
142
|
+
shouldConnect = autoConnect;
|
|
143
|
+
}
|
|
144
|
+
if (shouldConnect) yield connect(walletName);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (onError) onError(error);
|
|
147
|
+
return Promise.reject(error);
|
|
148
|
+
} finally {
|
|
149
|
+
setIsLoading(false);
|
|
150
|
+
}
|
|
151
|
+
}))();
|
|
152
|
+
} else {
|
|
153
|
+
setIsLoading(false);
|
|
154
|
+
}
|
|
155
|
+
}, [autoConnect, wallets]);
|
|
156
|
+
const connect = (walletName) => __async(null, null, function* () {
|
|
157
|
+
try {
|
|
158
|
+
setIsLoading(true);
|
|
159
|
+
yield walletCore == null ? void 0 : walletCore.connect(walletName);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
if (onError) onError(error);
|
|
162
|
+
return Promise.reject(error);
|
|
163
|
+
} finally {
|
|
164
|
+
setIsLoading(false);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const signIn = (args) => __async(null, null, function* () {
|
|
168
|
+
if (!walletCore) {
|
|
169
|
+
throw new Error("WalletCore is not initialized");
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
setIsLoading(true);
|
|
173
|
+
return yield walletCore == null ? void 0 : walletCore.signIn(args);
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (onError) onError(error);
|
|
176
|
+
return Promise.reject(error);
|
|
177
|
+
} finally {
|
|
178
|
+
setIsLoading(false);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const disconnect = () => __async(null, null, function* () {
|
|
182
|
+
try {
|
|
183
|
+
yield walletCore == null ? void 0 : walletCore.disconnect();
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (onError) onError(error);
|
|
186
|
+
return Promise.reject(error);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const signAndSubmitTransaction = (transaction) => __async(null, null, function* () {
|
|
190
|
+
try {
|
|
191
|
+
if (!walletCore) {
|
|
192
|
+
throw new Error("WalletCore is not initialized");
|
|
193
|
+
}
|
|
194
|
+
return yield walletCore.signAndSubmitTransaction(transaction);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (onError) onError(error);
|
|
197
|
+
return Promise.reject(error);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const signTransaction = (args) => __async(null, null, function* () {
|
|
201
|
+
const { transactionOrPayload, asFeePayer, options } = args;
|
|
202
|
+
if (!walletCore) {
|
|
203
|
+
throw new Error("WalletCore is not initialized");
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
return yield walletCore.signTransaction({
|
|
207
|
+
transactionOrPayload,
|
|
208
|
+
asFeePayer
|
|
209
|
+
});
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (onError) onError(error);
|
|
212
|
+
return Promise.reject(error);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
const submitTransaction = (transaction) => __async(null, null, function* () {
|
|
216
|
+
if (!walletCore) {
|
|
217
|
+
throw new Error("WalletCore is not initialized");
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
return yield walletCore == null ? void 0 : walletCore.submitTransaction(transaction);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
if (onError) onError(error);
|
|
223
|
+
return Promise.reject(error);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
const signMessage = (message) => __async(null, null, function* () {
|
|
227
|
+
if (!walletCore) {
|
|
228
|
+
throw new Error("WalletCore is not initialized");
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
return yield walletCore == null ? void 0 : walletCore.signMessage(message);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
if (onError) onError(error);
|
|
234
|
+
return Promise.reject(error);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const signMessageAndVerify = (message) => __async(null, null, function* () {
|
|
238
|
+
if (!walletCore) {
|
|
239
|
+
throw new Error("WalletCore is not initialized");
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
return yield walletCore == null ? void 0 : walletCore.signMessageAndVerify(message);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (onError) onError(error);
|
|
245
|
+
return Promise.reject(error);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
const changeNetwork = (network2) => __async(null, null, function* () {
|
|
249
|
+
if (!walletCore) {
|
|
250
|
+
throw new Error("WalletCore is not initialized");
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
return yield walletCore == null ? void 0 : walletCore.changeNetwork(network2);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (onError) onError(error);
|
|
256
|
+
return Promise.reject(error);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
const handleConnect = () => {
|
|
260
|
+
setState((state) => {
|
|
261
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
262
|
+
connected: true,
|
|
263
|
+
account: (walletCore == null ? void 0 : walletCore.account) || null,
|
|
264
|
+
network: (walletCore == null ? void 0 : walletCore.network) || null,
|
|
265
|
+
wallet: (walletCore == null ? void 0 : walletCore.wallet) || null
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
const handleAccountChange = useCallback(() => {
|
|
270
|
+
if (!connected) return;
|
|
271
|
+
if (!(walletCore == null ? void 0 : walletCore.wallet)) return;
|
|
272
|
+
setState((state) => {
|
|
273
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
274
|
+
account: (walletCore == null ? void 0 : walletCore.account) || null
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
}, [connected]);
|
|
278
|
+
const handleNetworkChange = useCallback(() => {
|
|
279
|
+
if (!connected) return;
|
|
280
|
+
if (!(walletCore == null ? void 0 : walletCore.wallet)) return;
|
|
281
|
+
setState((state) => {
|
|
282
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
283
|
+
network: (walletCore == null ? void 0 : walletCore.network) || null
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
}, [connected]);
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
if (connected) {
|
|
289
|
+
walletCore == null ? void 0 : walletCore.onAccountChange();
|
|
290
|
+
walletCore == null ? void 0 : walletCore.onNetworkChange();
|
|
291
|
+
}
|
|
292
|
+
}, [connected]);
|
|
293
|
+
const handleDisconnect = () => {
|
|
294
|
+
if (!connected) return;
|
|
295
|
+
setState((state) => {
|
|
296
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
297
|
+
connected: false,
|
|
298
|
+
account: (walletCore == null ? void 0 : walletCore.account) || null,
|
|
299
|
+
network: (walletCore == null ? void 0 : walletCore.network) || null,
|
|
300
|
+
wallet: null
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
const handleStandardWalletsAdded = (standardWallet) => {
|
|
305
|
+
const existingWalletIndex = wallets.findIndex(
|
|
306
|
+
(wallet2) => wallet2.name == standardWallet.name
|
|
307
|
+
);
|
|
308
|
+
if (existingWalletIndex !== -1) {
|
|
309
|
+
setWallets((wallets2) => [
|
|
310
|
+
...wallets2.slice(0, existingWalletIndex),
|
|
311
|
+
standardWallet,
|
|
312
|
+
...wallets2.slice(existingWalletIndex + 1)
|
|
313
|
+
]);
|
|
314
|
+
} else {
|
|
315
|
+
setWallets((wallets2) => [...wallets2, standardWallet]);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
const handleStandardNotDetectedWalletsAdded = (notDetectedWallet) => {
|
|
319
|
+
const existingWalletIndex = wallets.findIndex(
|
|
320
|
+
(wallet2) => wallet2.name == notDetectedWallet.name
|
|
321
|
+
);
|
|
322
|
+
if (existingWalletIndex !== -1) {
|
|
323
|
+
setNotDetectedWallets((wallets2) => [
|
|
324
|
+
...wallets2.slice(0, existingWalletIndex),
|
|
325
|
+
notDetectedWallet,
|
|
326
|
+
...wallets2.slice(existingWalletIndex + 1)
|
|
327
|
+
]);
|
|
328
|
+
} else {
|
|
329
|
+
setNotDetectedWallets((wallets2) => [...wallets2, notDetectedWallet]);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
useEffect(() => {
|
|
333
|
+
walletCore == null ? void 0 : walletCore.on("connect", handleConnect);
|
|
334
|
+
walletCore == null ? void 0 : walletCore.on("accountChange", handleAccountChange);
|
|
335
|
+
walletCore == null ? void 0 : walletCore.on("networkChange", handleNetworkChange);
|
|
336
|
+
walletCore == null ? void 0 : walletCore.on("disconnect", handleDisconnect);
|
|
337
|
+
walletCore == null ? void 0 : walletCore.on("standardWalletsAdded", handleStandardWalletsAdded);
|
|
338
|
+
walletCore == null ? void 0 : walletCore.on(
|
|
339
|
+
"standardNotDetectedWalletAdded",
|
|
340
|
+
handleStandardNotDetectedWalletsAdded
|
|
341
|
+
);
|
|
342
|
+
return () => {
|
|
343
|
+
walletCore == null ? void 0 : walletCore.off("connect", handleConnect);
|
|
344
|
+
walletCore == null ? void 0 : walletCore.off("accountChange", handleAccountChange);
|
|
345
|
+
walletCore == null ? void 0 : walletCore.off("networkChange", handleNetworkChange);
|
|
346
|
+
walletCore == null ? void 0 : walletCore.off("disconnect", handleDisconnect);
|
|
347
|
+
walletCore == null ? void 0 : walletCore.off("standardWalletsAdded", handleStandardWalletsAdded);
|
|
348
|
+
walletCore == null ? void 0 : walletCore.off(
|
|
349
|
+
"standardNotDetectedWalletAdded",
|
|
350
|
+
handleStandardNotDetectedWalletsAdded
|
|
351
|
+
);
|
|
352
|
+
};
|
|
353
|
+
}, [wallets, account]);
|
|
354
|
+
return /* @__PURE__ */ jsx(
|
|
355
|
+
WalletContext.Provider,
|
|
356
|
+
{
|
|
357
|
+
value: {
|
|
358
|
+
connect,
|
|
359
|
+
signIn,
|
|
360
|
+
disconnect,
|
|
361
|
+
signAndSubmitTransaction,
|
|
362
|
+
signTransaction,
|
|
363
|
+
signMessage,
|
|
364
|
+
signMessageAndVerify,
|
|
365
|
+
changeNetwork,
|
|
366
|
+
submitTransaction,
|
|
367
|
+
account,
|
|
368
|
+
network,
|
|
369
|
+
connected,
|
|
370
|
+
wallet,
|
|
371
|
+
wallets,
|
|
372
|
+
notDetectedWallets,
|
|
373
|
+
isLoading
|
|
374
|
+
},
|
|
375
|
+
children
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/components/utils.tsx
|
|
381
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
382
|
+
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
383
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
384
|
+
function createHeadlessComponent(displayName, elementType, props) {
|
|
385
|
+
const component = forwardRef(({ className, asChild, children }, ref) => {
|
|
386
|
+
const Component = asChild ? Slot : elementType;
|
|
387
|
+
const _a = typeof props === "function" ? props(displayName) : props != null ? props : {}, { children: defaultChildren } = _a, resolvedProps = __objRest(_a, ["children"]);
|
|
388
|
+
const resolvedChildren = (
|
|
389
|
+
/**
|
|
390
|
+
* Use props' default children if no children are set in the component element's children and when asChild is true.
|
|
391
|
+
*/
|
|
392
|
+
asChild && isValidElement(children) && !children.props.children ? cloneElement(children, {}, defaultChildren) : children != null ? children : defaultChildren
|
|
393
|
+
);
|
|
394
|
+
return (
|
|
395
|
+
/**
|
|
396
|
+
* Due to the complexity of the types at play, TypeScript reports the
|
|
397
|
+
* following error for our JSX below:
|
|
398
|
+
*
|
|
399
|
+
* `Expression produces a union type that is too complex to represent.`
|
|
400
|
+
*
|
|
401
|
+
* We can safely ignore this error and retain accurate return types for
|
|
402
|
+
* consumers of this function. The only drawback is that type-checking is
|
|
403
|
+
* ignored for the JSX block below.
|
|
404
|
+
*/
|
|
405
|
+
// @ts-expect-error
|
|
406
|
+
/* @__PURE__ */ jsx2(Component, __spreadProps(__spreadValues({ ref, className }, resolvedProps), { children: resolvedChildren }))
|
|
407
|
+
);
|
|
408
|
+
});
|
|
409
|
+
component.displayName = displayName;
|
|
410
|
+
return component;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/components/AboutMovementConnect.tsx
|
|
414
|
+
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
415
|
+
var Root = ({ children }) => {
|
|
416
|
+
return /* @__PURE__ */ jsx3(Fragment, { children });
|
|
417
|
+
};
|
|
418
|
+
Root.displayName = "AboutMovementConnect";
|
|
419
|
+
var Trigger = createHeadlessComponent(
|
|
420
|
+
"AboutMovementConnect.Trigger",
|
|
421
|
+
"button",
|
|
422
|
+
() => ({
|
|
423
|
+
// No-op since social sign-in is disabled
|
|
424
|
+
onClick: () => {
|
|
425
|
+
},
|
|
426
|
+
style: { display: "none" }
|
|
427
|
+
})
|
|
428
|
+
);
|
|
429
|
+
var AboutMovementConnect = Object.assign(Root, {
|
|
430
|
+
Trigger
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// src/components/AboutPetraWeb.tsx
|
|
434
|
+
import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
|
|
435
|
+
var EXPLORE_ECOSYSTEM_URL = "https://movementlabs.xyz/ecosystem";
|
|
436
|
+
var Root2 = ({ children }) => {
|
|
437
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children });
|
|
438
|
+
};
|
|
439
|
+
Root2.displayName = "AboutPetraWeb";
|
|
440
|
+
var Trigger2 = createHeadlessComponent(
|
|
441
|
+
"AboutPetraWeb.Trigger",
|
|
442
|
+
"button",
|
|
443
|
+
() => ({
|
|
444
|
+
// No-op since social sign-in is disabled
|
|
445
|
+
onClick: () => {
|
|
446
|
+
},
|
|
447
|
+
style: { display: "none" }
|
|
448
|
+
})
|
|
449
|
+
);
|
|
450
|
+
var AboutPetraWeb = Object.assign(Root2, {
|
|
451
|
+
Trigger: Trigger2
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// src/components/MovementPrivacyPolicy.tsx
|
|
455
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
456
|
+
|
|
457
|
+
// src/graphics/SmallMovementLogo.tsx
|
|
458
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
459
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
460
|
+
var SmallMovementLogo = forwardRef2((props, ref) => {
|
|
461
|
+
return /* @__PURE__ */ jsx5(
|
|
462
|
+
"svg",
|
|
463
|
+
__spreadProps(__spreadValues({
|
|
464
|
+
ref,
|
|
465
|
+
width: "12",
|
|
466
|
+
height: "12",
|
|
467
|
+
viewBox: "0 0 12 12",
|
|
468
|
+
fill: "none"
|
|
469
|
+
}, props), {
|
|
470
|
+
children: /* @__PURE__ */ jsx5(
|
|
471
|
+
"path",
|
|
472
|
+
{
|
|
473
|
+
fillRule: "evenodd",
|
|
474
|
+
clipRule: "evenodd",
|
|
475
|
+
d: "M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z",
|
|
476
|
+
fill: "currentColor"
|
|
477
|
+
}
|
|
478
|
+
)
|
|
479
|
+
})
|
|
480
|
+
);
|
|
481
|
+
});
|
|
482
|
+
SmallMovementLogo.displayName = "SmallMovementLogo";
|
|
483
|
+
|
|
484
|
+
// src/components/MovementPrivacyPolicy.tsx
|
|
485
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
486
|
+
var MOVEMENT_PRIVACY_POLICY_URL = "https://movementlabs.xyz/privacy";
|
|
487
|
+
var Root3 = createHeadlessComponent("MovementPrivacyPolicy.Root", "div");
|
|
488
|
+
var Disclaimer = createHeadlessComponent(
|
|
489
|
+
"MovementPrivacyPolicy.Disclaimer",
|
|
490
|
+
"span",
|
|
491
|
+
{ children: "By continuing, you agree to Movement Labs'" }
|
|
492
|
+
);
|
|
493
|
+
var Link = createHeadlessComponent("MovementPrivacyPolicy.Disclaimer", "a", {
|
|
494
|
+
href: MOVEMENT_PRIVACY_POLICY_URL,
|
|
495
|
+
target: "_blank",
|
|
496
|
+
rel: "noopener noreferrer",
|
|
497
|
+
children: "Privacy Policy"
|
|
498
|
+
});
|
|
499
|
+
var PoweredBy = forwardRef3(({ className }, ref) => {
|
|
500
|
+
return /* @__PURE__ */ jsxs("div", { ref, className, children: [
|
|
501
|
+
/* @__PURE__ */ jsx6("span", { children: "Powered by" }),
|
|
502
|
+
/* @__PURE__ */ jsx6(SmallMovementLogo, {}),
|
|
503
|
+
/* @__PURE__ */ jsx6("span", { children: "Movement Labs" })
|
|
504
|
+
] });
|
|
505
|
+
});
|
|
506
|
+
PoweredBy.displayName = "MovementPrivacyPolicy.PoweredBy";
|
|
507
|
+
var MovementPrivacyPolicy = Object.assign(Root3, {
|
|
508
|
+
Disclaimer,
|
|
509
|
+
Link,
|
|
510
|
+
PoweredBy
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
// src/components/WalletItem.tsx
|
|
514
|
+
import {
|
|
515
|
+
WalletReadyState as WalletReadyState2,
|
|
516
|
+
isRedirectable
|
|
517
|
+
} from "@moveindustries/wallet-adapter-core";
|
|
518
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
519
|
+
import { createContext as createContext2, forwardRef as forwardRef4, useCallback as useCallback2, useContext as useContext2 } from "react";
|
|
520
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
521
|
+
function useWalletItemContext(displayName) {
|
|
522
|
+
const context = useContext2(WalletItemContext);
|
|
523
|
+
if (!context) {
|
|
524
|
+
throw new Error(`\`${displayName}\` must be used within \`WalletItem\``);
|
|
525
|
+
}
|
|
526
|
+
return context;
|
|
527
|
+
}
|
|
528
|
+
var WalletItemContext = createContext2(null);
|
|
529
|
+
var Root4 = forwardRef4(
|
|
530
|
+
({ wallet, onConnect, className, asChild, children }, ref) => {
|
|
531
|
+
const { connect } = useWallet();
|
|
532
|
+
const connectWallet = useCallback2(() => {
|
|
533
|
+
connect(wallet.name);
|
|
534
|
+
onConnect == null ? void 0 : onConnect();
|
|
535
|
+
}, [connect, wallet.name, onConnect]);
|
|
536
|
+
const isWalletReady = wallet.readyState === WalletReadyState2.Installed;
|
|
537
|
+
const mobileSupport = "deeplinkProvider" in wallet && wallet.deeplinkProvider;
|
|
538
|
+
if (!isWalletReady && isRedirectable() && !mobileSupport) return null;
|
|
539
|
+
const Component = asChild ? Slot2 : "div";
|
|
540
|
+
return /* @__PURE__ */ jsx7(WalletItemContext.Provider, { value: { wallet, connectWallet }, children: /* @__PURE__ */ jsx7(Component, { ref, className, children }) });
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
Root4.displayName = "WalletItem";
|
|
544
|
+
var Icon = createHeadlessComponent(
|
|
545
|
+
"WalletItem.Icon",
|
|
546
|
+
"img",
|
|
547
|
+
(displayName) => {
|
|
548
|
+
const context = useWalletItemContext(displayName);
|
|
549
|
+
return {
|
|
550
|
+
src: context.wallet.icon,
|
|
551
|
+
alt: `${context.wallet.name} icon`
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
var Name = createHeadlessComponent(
|
|
556
|
+
"WalletItem.Name",
|
|
557
|
+
"div",
|
|
558
|
+
(displayName) => {
|
|
559
|
+
const context = useWalletItemContext(displayName);
|
|
560
|
+
return {
|
|
561
|
+
children: context.wallet.name
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
var ConnectButton = createHeadlessComponent(
|
|
566
|
+
"WalletItem.ConnectButton",
|
|
567
|
+
"button",
|
|
568
|
+
(displayName) => {
|
|
569
|
+
const context = useWalletItemContext(displayName);
|
|
570
|
+
return {
|
|
571
|
+
onClick: context.connectWallet,
|
|
572
|
+
children: "Connect"
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
var InstallLink = createHeadlessComponent(
|
|
577
|
+
"WalletItem.InstallLink",
|
|
578
|
+
"a",
|
|
579
|
+
(displayName) => {
|
|
580
|
+
const context = useWalletItemContext(displayName);
|
|
581
|
+
return {
|
|
582
|
+
href: context.wallet.url,
|
|
583
|
+
target: "_blank",
|
|
584
|
+
rel: "noopener noreferrer",
|
|
585
|
+
children: "Install"
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
var WalletItem = Object.assign(Root4, {
|
|
590
|
+
Icon,
|
|
591
|
+
Name,
|
|
592
|
+
ConnectButton,
|
|
593
|
+
InstallLink
|
|
594
|
+
});
|
|
595
|
+
export {
|
|
596
|
+
AboutMovementConnect,
|
|
597
|
+
AboutPetraWeb,
|
|
598
|
+
EXPLORE_ECOSYSTEM_URL,
|
|
599
|
+
MOVEMENT_PRIVACY_POLICY_URL,
|
|
600
|
+
MovementPrivacyPolicy,
|
|
601
|
+
MovementWalletAdapterProvider,
|
|
602
|
+
WalletContext,
|
|
603
|
+
WalletItem,
|
|
604
|
+
useWallet
|
|
605
|
+
};
|
|
606
|
+
//# sourceMappingURL=index.mjs.map
|