@dropfi/xrpl-react 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -117
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +95 -91
- package/dist/index.mjs.map +1 -0
- package/dist/provider.d.ts +12 -0
- package/dist/{index.d.mts → useXrplReact.d.ts} +1 -13
- package/package.json +36 -26
package/dist/index.cjs
CHANGED
|
@@ -1,124 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
XrplProvider: () => XrplProvider,
|
|
24
|
-
useXrplReact: () => useXrplReact
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
27
5
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var XrplContext = (0, import_react.createContext)(null);
|
|
32
|
-
var XrplProvider = ({ config, children }) => {
|
|
33
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(XrplContext.Provider, { value: { config }, children });
|
|
6
|
+
const XrplContext = react.createContext(null);
|
|
7
|
+
const XrplProvider = ({ config, children }) => {
|
|
8
|
+
return jsxRuntime.jsx(XrplContext.Provider, { value: { config }, children: children });
|
|
34
9
|
};
|
|
35
10
|
|
|
36
|
-
// src/useXrplReact.tsx
|
|
37
|
-
var import_react2 = require("react");
|
|
38
11
|
function useXrplReact() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
const [address, setAddress] = (0, import_react2.useState)();
|
|
44
|
-
const [connectedAccounts, setConnectedAccounts] = (0, import_react2.useState)([]);
|
|
45
|
-
const [network, setNetwork] = (0, import_react2.useState)("mainnet");
|
|
46
|
-
const [initialized, setInitialized] = (0, import_react2.useState)(false);
|
|
47
|
-
const [error, setError] = (0, import_react2.useState)(null);
|
|
48
|
-
const [isConnecting, setIsConnecting] = (0, import_react2.useState)(false);
|
|
49
|
-
(0, import_react2.useEffect)(() => {
|
|
50
|
-
if (typeof window === "undefined" || !window.xrpl) return;
|
|
51
|
-
window.xrpl?.initialize?.();
|
|
52
|
-
setInitialized(true);
|
|
53
|
-
}, []);
|
|
54
|
-
(0, import_react2.useEffect)(() => {
|
|
55
|
-
if (typeof window === "undefined" || !window.xrpl) return;
|
|
56
|
-
const handleSelectedNetwork = (val) => setNetwork(val);
|
|
57
|
-
const handleSelectedAddress = (val) => setAddress(val);
|
|
58
|
-
const handleConnectedAccounts = (val) => setConnectedAccounts(val);
|
|
59
|
-
window.xrpl?.on?.("xrpl_selectedNetwork", handleSelectedNetwork);
|
|
60
|
-
window.xrpl?.on?.("xrpl_selectedAddress", handleSelectedAddress);
|
|
61
|
-
window.xrpl?.on?.("xrpl_connectedAccounts", handleConnectedAccounts);
|
|
62
|
-
return () => {
|
|
63
|
-
window.xrpl?.off?.("xrpl_selectedNetwork", handleSelectedNetwork);
|
|
64
|
-
window.xrpl?.off?.("xrpl_selectedAddress", handleSelectedAddress);
|
|
65
|
-
window.xrpl?.off?.("xrpl_connectedAccounts", handleConnectedAccounts);
|
|
66
|
-
};
|
|
67
|
-
}, []);
|
|
68
|
-
const connect = async () => {
|
|
69
|
-
setIsConnecting(true);
|
|
70
|
-
try {
|
|
71
|
-
if (!window.xrpl) throw new Error("No window.xrpl found");
|
|
72
|
-
const response = await window.xrpl.connect();
|
|
73
|
-
setAddress(response);
|
|
74
|
-
return response;
|
|
75
|
-
} catch (err) {
|
|
76
|
-
setError(err.message);
|
|
77
|
-
throw err;
|
|
78
|
-
} finally {
|
|
79
|
-
setIsConnecting(false);
|
|
12
|
+
const context = react.useContext(XrplContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error('useXrplReact must be used within a XrplProvider');
|
|
80
15
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
16
|
+
const [address, setAddress] = react.useState();
|
|
17
|
+
const [connectedAccounts, setConnectedAccounts] = react.useState([]);
|
|
18
|
+
const [network, setNetwork] = react.useState('mainnet');
|
|
19
|
+
const [initialized, setInitialized] = react.useState(false);
|
|
20
|
+
const [error, setError] = react.useState(null);
|
|
21
|
+
const [isConnecting, setIsConnecting] = react.useState(false);
|
|
22
|
+
react.useEffect(() => {
|
|
23
|
+
if (typeof window === 'undefined' || !window.xrpl)
|
|
24
|
+
return;
|
|
25
|
+
window.xrpl?.initialize?.();
|
|
26
|
+
setInitialized(true);
|
|
27
|
+
}, []);
|
|
28
|
+
react.useEffect(() => {
|
|
29
|
+
if (typeof window === 'undefined' || !window.xrpl)
|
|
30
|
+
return;
|
|
31
|
+
const handleSelectedNetwork = (val) => setNetwork(val);
|
|
32
|
+
const handleSelectedAddress = (val) => setAddress(val);
|
|
33
|
+
const handleConnectedAccounts = (val) => setConnectedAccounts(val);
|
|
34
|
+
window.xrpl?.on?.('xrpl_selectedNetwork', handleSelectedNetwork);
|
|
35
|
+
window.xrpl?.on?.('xrpl_selectedAddress', handleSelectedAddress);
|
|
36
|
+
window.xrpl?.on?.('xrpl_connectedAccounts', handleConnectedAccounts);
|
|
37
|
+
return () => {
|
|
38
|
+
window.xrpl?.off?.('xrpl_selectedNetwork', handleSelectedNetwork);
|
|
39
|
+
window.xrpl?.off?.('xrpl_selectedAddress', handleSelectedAddress);
|
|
40
|
+
window.xrpl?.off?.('xrpl_connectedAccounts', handleConnectedAccounts);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
const connect = async () => {
|
|
44
|
+
setIsConnecting(true);
|
|
45
|
+
try {
|
|
46
|
+
if (!window.xrpl)
|
|
47
|
+
throw new Error('No window.xrpl found');
|
|
48
|
+
const response = await window.xrpl.connect();
|
|
49
|
+
setAddress(response);
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
setError(err.message);
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
setIsConnecting(false);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const disconnect = async () => {
|
|
61
|
+
if (!window.xrpl)
|
|
62
|
+
throw new Error('No window.xrpl found');
|
|
63
|
+
await window.xrpl.disconnect(address);
|
|
64
|
+
setAddress(undefined);
|
|
65
|
+
};
|
|
66
|
+
const sendTransaction = async (tx) => {
|
|
67
|
+
if (!window.xrpl)
|
|
68
|
+
throw new Error('No window.xrpl found');
|
|
69
|
+
return await window.xrpl.sendTransaction(tx);
|
|
70
|
+
};
|
|
71
|
+
const changeNetwork = async (network) => {
|
|
72
|
+
if (!window.xrpl)
|
|
73
|
+
throw new Error('No window.xrpl found');
|
|
74
|
+
return await window.xrpl.changeNetwork(network);
|
|
75
|
+
};
|
|
76
|
+
const signMessage = async (message) => {
|
|
77
|
+
if (!window.xrpl)
|
|
78
|
+
throw new Error('No window.xrpl found');
|
|
79
|
+
const res = await window.xrpl.signMessage(message);
|
|
80
|
+
if (res.error)
|
|
81
|
+
throw new Error(res.error);
|
|
82
|
+
return res;
|
|
83
|
+
};
|
|
84
|
+
return react.useMemo(() => ({
|
|
85
|
+
address,
|
|
86
|
+
wallet: address,
|
|
87
|
+
isConnected: connectedAccounts.includes(address || ''),
|
|
88
|
+
connect,
|
|
89
|
+
disconnect,
|
|
90
|
+
sendTransaction,
|
|
91
|
+
changeNetwork,
|
|
92
|
+
connectedAccounts,
|
|
93
|
+
network,
|
|
94
|
+
error,
|
|
95
|
+
isConnecting,
|
|
96
|
+
signMessage,
|
|
97
|
+
initialized,
|
|
98
|
+
}), [address, connectedAccounts, network, error, isConnecting, initialized]);
|
|
119
99
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
100
|
+
|
|
101
|
+
exports.XrplProvider = XrplProvider;
|
|
102
|
+
exports.useXrplReact = useXrplReact;
|
|
103
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/provider.tsx","../src/useXrplReact.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface XrplProviderConfig {\n // Add any future config options here\n}\n\ninterface XrplContextValue {\n config?: XrplProviderConfig;\n}\n\nexport const XrplContext = createContext<XrplContextValue | null>(null);\n\nexport interface XrplProviderProps {\n config?: XrplProviderConfig;\n children: React.ReactNode;\n}\n\nexport const XrplProvider: React.FC<XrplProviderProps> = ({ config, children }) => {\n return <XrplContext.Provider value={{ config }}>{children}</XrplContext.Provider>;\n};\n","import { useContext, useEffect, useMemo, useState } from 'react';\nimport { XrplContext } from './provider';\n\nexport function useXrplReact() {\n const context = useContext(XrplContext);\n if (!context) {\n throw new Error('useXrplReact must be used within a XrplProvider');\n }\n\n const [address, setAddress] = useState<string | undefined>();\n const [connectedAccounts, setConnectedAccounts] = useState<string[]>([]);\n const [network, setNetwork] = useState<string>('mainnet');\n const [initialized, setInitialized] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [isConnecting, setIsConnecting] = useState(false);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.xrpl) return;\n window.xrpl?.initialize?.();\n setInitialized(true);\n }, []);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.xrpl) return;\n\n const handleSelectedNetwork = (val: string) => setNetwork(val);\n const handleSelectedAddress = (val: string) => setAddress(val);\n const handleConnectedAccounts = (val: string[]) => setConnectedAccounts(val);\n\n window.xrpl?.on?.('xrpl_selectedNetwork', handleSelectedNetwork);\n window.xrpl?.on?.('xrpl_selectedAddress', handleSelectedAddress);\n window.xrpl?.on?.('xrpl_connectedAccounts', handleConnectedAccounts);\n\n return () => {\n window.xrpl?.off?.('xrpl_selectedNetwork', handleSelectedNetwork);\n window.xrpl?.off?.('xrpl_selectedAddress', handleSelectedAddress);\n window.xrpl?.off?.('xrpl_connectedAccounts', handleConnectedAccounts);\n };\n }, []);\n\n const connect = async () => {\n setIsConnecting(true);\n try {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n const response = await window.xrpl.connect();\n setAddress(response);\n return response;\n } catch (err: any) {\n setError(err.message);\n throw err;\n } finally {\n setIsConnecting(false);\n }\n };\n\n const disconnect = async () => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n await window.xrpl.disconnect(address);\n setAddress(undefined);\n };\n\n const sendTransaction = async (tx: any) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n return await window.xrpl.sendTransaction(tx);\n };\n\n const changeNetwork = async (network: string) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n return await window.xrpl.changeNetwork(network);\n };\n\n const signMessage = async (message: string) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n const res = await window.xrpl.signMessage(message);\n if (res.error) throw new Error(res.error);\n return res;\n };\n\n return useMemo(\n () => ({\n address,\n wallet: address,\n isConnected: connectedAccounts.includes(address || ''),\n connect,\n disconnect,\n sendTransaction,\n changeNetwork,\n connectedAccounts,\n network,\n error,\n isConnecting,\n signMessage,\n initialized,\n }),\n [address, connectedAccounts, network, error, isConnecting, initialized],\n );\n}\n"],"names":["createContext","_jsx","useContext","useState","useEffect","useMemo"],"mappings":";;;;;AAUO,MAAM,WAAW,GAAGA,mBAAa,CAA0B,IAAI,CAAC;AAOhE,MAAM,YAAY,GAAgC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAI;AAC9E,IAAA,OAAOC,cAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAA,QAAA,EAAG,QAAQ,GAAwB;AACrF;;SChBgB,YAAY,GAAA;AACxB,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,WAAW,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;;IAGtE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,EAAsB;IAC5D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAGA,cAAQ,CAAW,EAAE,CAAC;IACxE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGA,cAAQ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CAAC;QACzD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;QAClD,IAAI,GAAG,CAAC,KAAK;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;AACzC,QAAA,OAAO,GAAG;AACd,KAAC;AAED,IAAA,OAAOC,aAAO,CACV,OAAO;QACH,OAAO;AACP,QAAA,MAAM,EAAE,OAAO;QACf,WAAW,EAAE,iBAAiB,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;QACtD,OAAO;QACP,UAAU;QACV,eAAe;QACf,aAAa;QACb,iBAAiB;QACjB,OAAO;QACP,KAAK;QACL,YAAY;QACZ,WAAW;QACX,WAAW;AACd,KAAA,CAAC,EACF,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,CAC1E;AACL;;;;;"}
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
CHANGED
|
@@ -1,96 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
import { createContext } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
const XrplContext = createContext(null);
|
|
5
|
+
const XrplProvider = ({ config, children }) => {
|
|
6
|
+
return jsx(XrplContext.Provider, { value: { config }, children: children });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// src/useXrplReact.tsx
|
|
10
|
-
import { useContext as useContext2, useEffect, useMemo, useState } from "react";
|
|
11
9
|
function useXrplReact() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
const [address, setAddress] = useState();
|
|
17
|
-
const [connectedAccounts, setConnectedAccounts] = useState([]);
|
|
18
|
-
const [network, setNetwork] = useState("mainnet");
|
|
19
|
-
const [initialized, setInitialized] = useState(false);
|
|
20
|
-
const [error, setError] = useState(null);
|
|
21
|
-
const [isConnecting, setIsConnecting] = useState(false);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (typeof window === "undefined" || !window.xrpl) return;
|
|
24
|
-
window.xrpl?.initialize?.();
|
|
25
|
-
setInitialized(true);
|
|
26
|
-
}, []);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (typeof window === "undefined" || !window.xrpl) return;
|
|
29
|
-
const handleSelectedNetwork = (val) => setNetwork(val);
|
|
30
|
-
const handleSelectedAddress = (val) => setAddress(val);
|
|
31
|
-
const handleConnectedAccounts = (val) => setConnectedAccounts(val);
|
|
32
|
-
window.xrpl?.on?.("xrpl_selectedNetwork", handleSelectedNetwork);
|
|
33
|
-
window.xrpl?.on?.("xrpl_selectedAddress", handleSelectedAddress);
|
|
34
|
-
window.xrpl?.on?.("xrpl_connectedAccounts", handleConnectedAccounts);
|
|
35
|
-
return () => {
|
|
36
|
-
window.xrpl?.off?.("xrpl_selectedNetwork", handleSelectedNetwork);
|
|
37
|
-
window.xrpl?.off?.("xrpl_selectedAddress", handleSelectedAddress);
|
|
38
|
-
window.xrpl?.off?.("xrpl_connectedAccounts", handleConnectedAccounts);
|
|
39
|
-
};
|
|
40
|
-
}, []);
|
|
41
|
-
const connect = async () => {
|
|
42
|
-
setIsConnecting(true);
|
|
43
|
-
try {
|
|
44
|
-
if (!window.xrpl) throw new Error("No window.xrpl found");
|
|
45
|
-
const response = await window.xrpl.connect();
|
|
46
|
-
setAddress(response);
|
|
47
|
-
return response;
|
|
48
|
-
} catch (err) {
|
|
49
|
-
setError(err.message);
|
|
50
|
-
throw err;
|
|
51
|
-
} finally {
|
|
52
|
-
setIsConnecting(false);
|
|
10
|
+
const context = useContext(XrplContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error('useXrplReact must be used within a XrplProvider');
|
|
53
13
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
14
|
+
const [address, setAddress] = useState();
|
|
15
|
+
const [connectedAccounts, setConnectedAccounts] = useState([]);
|
|
16
|
+
const [network, setNetwork] = useState('mainnet');
|
|
17
|
+
const [initialized, setInitialized] = useState(false);
|
|
18
|
+
const [error, setError] = useState(null);
|
|
19
|
+
const [isConnecting, setIsConnecting] = useState(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (typeof window === 'undefined' || !window.xrpl)
|
|
22
|
+
return;
|
|
23
|
+
window.xrpl?.initialize?.();
|
|
24
|
+
setInitialized(true);
|
|
25
|
+
}, []);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (typeof window === 'undefined' || !window.xrpl)
|
|
28
|
+
return;
|
|
29
|
+
const handleSelectedNetwork = (val) => setNetwork(val);
|
|
30
|
+
const handleSelectedAddress = (val) => setAddress(val);
|
|
31
|
+
const handleConnectedAccounts = (val) => setConnectedAccounts(val);
|
|
32
|
+
window.xrpl?.on?.('xrpl_selectedNetwork', handleSelectedNetwork);
|
|
33
|
+
window.xrpl?.on?.('xrpl_selectedAddress', handleSelectedAddress);
|
|
34
|
+
window.xrpl?.on?.('xrpl_connectedAccounts', handleConnectedAccounts);
|
|
35
|
+
return () => {
|
|
36
|
+
window.xrpl?.off?.('xrpl_selectedNetwork', handleSelectedNetwork);
|
|
37
|
+
window.xrpl?.off?.('xrpl_selectedAddress', handleSelectedAddress);
|
|
38
|
+
window.xrpl?.off?.('xrpl_connectedAccounts', handleConnectedAccounts);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const connect = async () => {
|
|
42
|
+
setIsConnecting(true);
|
|
43
|
+
try {
|
|
44
|
+
if (!window.xrpl)
|
|
45
|
+
throw new Error('No window.xrpl found');
|
|
46
|
+
const response = await window.xrpl.connect();
|
|
47
|
+
setAddress(response);
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
setError(err.message);
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setIsConnecting(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const disconnect = async () => {
|
|
59
|
+
if (!window.xrpl)
|
|
60
|
+
throw new Error('No window.xrpl found');
|
|
61
|
+
await window.xrpl.disconnect(address);
|
|
62
|
+
setAddress(undefined);
|
|
63
|
+
};
|
|
64
|
+
const sendTransaction = async (tx) => {
|
|
65
|
+
if (!window.xrpl)
|
|
66
|
+
throw new Error('No window.xrpl found');
|
|
67
|
+
return await window.xrpl.sendTransaction(tx);
|
|
68
|
+
};
|
|
69
|
+
const changeNetwork = async (network) => {
|
|
70
|
+
if (!window.xrpl)
|
|
71
|
+
throw new Error('No window.xrpl found');
|
|
72
|
+
return await window.xrpl.changeNetwork(network);
|
|
73
|
+
};
|
|
74
|
+
const signMessage = async (message) => {
|
|
75
|
+
if (!window.xrpl)
|
|
76
|
+
throw new Error('No window.xrpl found');
|
|
77
|
+
const res = await window.xrpl.signMessage(message);
|
|
78
|
+
if (res.error)
|
|
79
|
+
throw new Error(res.error);
|
|
80
|
+
return res;
|
|
81
|
+
};
|
|
82
|
+
return useMemo(() => ({
|
|
83
|
+
address,
|
|
84
|
+
wallet: address,
|
|
85
|
+
isConnected: connectedAccounts.includes(address || ''),
|
|
86
|
+
connect,
|
|
87
|
+
disconnect,
|
|
88
|
+
sendTransaction,
|
|
89
|
+
changeNetwork,
|
|
90
|
+
connectedAccounts,
|
|
91
|
+
network,
|
|
92
|
+
error,
|
|
93
|
+
isConnecting,
|
|
94
|
+
signMessage,
|
|
95
|
+
initialized,
|
|
96
|
+
}), [address, connectedAccounts, network, error, isConnecting, initialized]);
|
|
92
97
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
98
|
+
|
|
99
|
+
export { XrplProvider, useXrplReact };
|
|
100
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/provider.tsx","../src/useXrplReact.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface XrplProviderConfig {\n // Add any future config options here\n}\n\ninterface XrplContextValue {\n config?: XrplProviderConfig;\n}\n\nexport const XrplContext = createContext<XrplContextValue | null>(null);\n\nexport interface XrplProviderProps {\n config?: XrplProviderConfig;\n children: React.ReactNode;\n}\n\nexport const XrplProvider: React.FC<XrplProviderProps> = ({ config, children }) => {\n return <XrplContext.Provider value={{ config }}>{children}</XrplContext.Provider>;\n};\n","import { useContext, useEffect, useMemo, useState } from 'react';\nimport { XrplContext } from './provider';\n\nexport function useXrplReact() {\n const context = useContext(XrplContext);\n if (!context) {\n throw new Error('useXrplReact must be used within a XrplProvider');\n }\n\n const [address, setAddress] = useState<string | undefined>();\n const [connectedAccounts, setConnectedAccounts] = useState<string[]>([]);\n const [network, setNetwork] = useState<string>('mainnet');\n const [initialized, setInitialized] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [isConnecting, setIsConnecting] = useState(false);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.xrpl) return;\n window.xrpl?.initialize?.();\n setInitialized(true);\n }, []);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.xrpl) return;\n\n const handleSelectedNetwork = (val: string) => setNetwork(val);\n const handleSelectedAddress = (val: string) => setAddress(val);\n const handleConnectedAccounts = (val: string[]) => setConnectedAccounts(val);\n\n window.xrpl?.on?.('xrpl_selectedNetwork', handleSelectedNetwork);\n window.xrpl?.on?.('xrpl_selectedAddress', handleSelectedAddress);\n window.xrpl?.on?.('xrpl_connectedAccounts', handleConnectedAccounts);\n\n return () => {\n window.xrpl?.off?.('xrpl_selectedNetwork', handleSelectedNetwork);\n window.xrpl?.off?.('xrpl_selectedAddress', handleSelectedAddress);\n window.xrpl?.off?.('xrpl_connectedAccounts', handleConnectedAccounts);\n };\n }, []);\n\n const connect = async () => {\n setIsConnecting(true);\n try {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n const response = await window.xrpl.connect();\n setAddress(response);\n return response;\n } catch (err: any) {\n setError(err.message);\n throw err;\n } finally {\n setIsConnecting(false);\n }\n };\n\n const disconnect = async () => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n await window.xrpl.disconnect(address);\n setAddress(undefined);\n };\n\n const sendTransaction = async (tx: any) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n return await window.xrpl.sendTransaction(tx);\n };\n\n const changeNetwork = async (network: string) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n return await window.xrpl.changeNetwork(network);\n };\n\n const signMessage = async (message: string) => {\n if (!window.xrpl) throw new Error('No window.xrpl found');\n const res = await window.xrpl.signMessage(message);\n if (res.error) throw new Error(res.error);\n return res;\n };\n\n return useMemo(\n () => ({\n address,\n wallet: address,\n isConnected: connectedAccounts.includes(address || ''),\n connect,\n disconnect,\n sendTransaction,\n changeNetwork,\n connectedAccounts,\n network,\n error,\n isConnecting,\n signMessage,\n initialized,\n }),\n [address, connectedAccounts, network, error, isConnecting, initialized],\n );\n}\n"],"names":["_jsx"],"mappings":";;;AAUO,MAAM,WAAW,GAAG,aAAa,CAA0B,IAAI,CAAC;AAOhE,MAAM,YAAY,GAAgC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAI;AAC9E,IAAA,OAAO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AA,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;QACzD,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;AAChD,KAAC;AAED,IAAA,MAAM,aAAa,GAAG,OAAO,OAAe,KAAI;QAC5C,IAAI,CAAC,MAAM,CAAC,IAAI;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;QACzD,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;AACnD,KAAC;AAED,IAAA,MAAM,WAAW,GAAG,OAAO,OAAe,KAAI;QAC1C,IAAI,CAAC,MAAM,CAAC,IAAI;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;QACzD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;QAClD,IAAI,GAAG,CAAC,KAAK;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;AACzC,QAAA,OAAO,GAAG;AACd,KAAC;AAED,IAAA,OAAO,OAAO,CACV,OAAO;QACH,OAAO;AACP,QAAA,MAAM,EAAE,OAAO;QACf,WAAW,EAAE,iBAAiB,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;QACtD,OAAO;QACP,UAAU;QACV,eAAe;QACf,aAAa;QACb,iBAAiB;QACjB,OAAO;QACP,KAAK;QACL,YAAY;QACZ,WAAW;QACX,WAAW;AACd,KAAA,CAAC,EACF,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,CAC1E;AACL;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface XrplProviderConfig {
|
|
2
|
+
}
|
|
3
|
+
interface XrplContextValue {
|
|
4
|
+
config?: XrplProviderConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare const XrplContext: import("react").Context<XrplContextValue | null>;
|
|
7
|
+
export interface XrplProviderProps {
|
|
8
|
+
config?: XrplProviderConfig;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const XrplProvider: React.FC<XrplProviderProps>;
|
|
12
|
+
export {};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface XrplProviderConfig {
|
|
4
|
-
}
|
|
5
|
-
interface XrplProviderProps {
|
|
6
|
-
config?: XrplProviderConfig;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
declare const XrplProvider: React.FC<XrplProviderProps>;
|
|
10
|
-
|
|
11
|
-
declare function useXrplReact(): {
|
|
1
|
+
export declare function useXrplReact(): {
|
|
12
2
|
address: string | undefined;
|
|
13
3
|
wallet: string | undefined;
|
|
14
4
|
isConnected: boolean;
|
|
@@ -26,5 +16,3 @@ declare function useXrplReact(): {
|
|
|
26
16
|
}>;
|
|
27
17
|
initialized: boolean;
|
|
28
18
|
};
|
|
29
|
-
|
|
30
|
-
export { XrplProvider, useXrplReact };
|
package/package.json
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropfi/xrpl-react",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "React
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "React provider and hook for XRPL dApps using DropFi wallet",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
8
|
+
"type": "module",
|
|
11
9
|
"exports": {
|
|
12
10
|
".": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
15
13
|
}
|
|
16
14
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"react",
|
|
20
|
-
"wallet",
|
|
21
|
-
"dropfi",
|
|
22
|
-
"provider",
|
|
23
|
-
"hook"
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
24
17
|
],
|
|
25
|
-
"author": "Travis Delly",
|
|
26
|
-
"license": "MIT",
|
|
27
18
|
"scripts": {
|
|
28
|
-
"build": "
|
|
19
|
+
"build": "rollup -c",
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"prepublishOnly": "pnpm run clean && pnpm run build"
|
|
29
22
|
},
|
|
30
23
|
"peerDependencies": {
|
|
31
|
-
"react": "
|
|
32
|
-
"react-dom": "
|
|
24
|
+
"react": "^18.0.0",
|
|
25
|
+
"react-dom": "^18.0.0"
|
|
33
26
|
},
|
|
34
27
|
"devDependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
28
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
29
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
30
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
31
|
+
"@types/react": "^19.1.8",
|
|
32
|
+
"@types/react-dom": "^19.1.6",
|
|
33
|
+
"rollup": "^4.0.0",
|
|
34
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
35
|
+
"typescript": "^5.0.0"
|
|
36
|
+
},
|
|
37
|
+
"author": "DropFi",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/DropFi/xrpl-react.git"
|
|
40
42
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
+
"keywords": [
|
|
44
|
+
"xrpl",
|
|
45
|
+
"dropfi",
|
|
46
|
+
"react",
|
|
47
|
+
"wallet",
|
|
48
|
+
"provider",
|
|
49
|
+
"hook"
|
|
50
|
+
],
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"tslib": "^2.8.1"
|
|
43
53
|
}
|
|
44
54
|
}
|