@cordystackx/cordy_minikit 1.5.34 → 2.0.1
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 +438 -58
- package/dist/components/Connect_wallet_bt.d.ts.map +1 -1
- package/dist/components/Connect_wallet_bt.js +62 -11
- package/dist/components/UI_Comp.d.ts.map +1 -1
- package/dist/components/UI_Comp.js +79 -17
- package/dist/config/Image.json +4 -3
- package/dist/controllers/DisConnect.d.ts +6 -0
- package/dist/controllers/DisConnect.d.ts.map +1 -0
- package/dist/controllers/DisConnect.js +56 -0
- package/dist/controllers/Get_Account_Info.d.ts +26 -0
- package/dist/controllers/Get_Account_Info.d.ts.map +1 -0
- package/dist/controllers/Get_Account_Info.js +158 -0
- package/dist/controllers/Get_Balance.d.ts.map +1 -1
- package/dist/controllers/Get_Balance.js +16 -3
- package/dist/controllers/StellarButton.d.ts +10 -0
- package/dist/controllers/StellarButton.d.ts.map +1 -0
- package/dist/controllers/StellarButton.js +43 -0
- package/dist/controllers/Transactions.d.ts +6 -0
- package/dist/controllers/Transactions.d.ts.map +1 -1
- package/dist/controllers/Transactions.js +87 -2
- package/dist/controllers/WagmiButton.d.ts.map +1 -1
- package/dist/controllers/WagmiButton.js +6 -2
- package/dist/controllers/index.d.ts +6 -1
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +6 -1
- package/dist/controllers/loadStellarBalance.d.ts +7 -0
- package/dist/controllers/loadStellarBalance.d.ts.map +1 -0
- package/dist/controllers/loadStellarBalance.js +23 -0
- package/dist/css/UI_Comp/styles.module.css +193 -44
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/package.json +16 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wagmi__providers.d.ts +12 -1
- package/dist/wagmi__providers.d.ts.map +1 -1
- package/dist/wagmi__providers.js +52 -3
- package/package.json +16 -4
- package/dist/controllers/Get_Sessions.d.ts +0 -2
- package/dist/controllers/Get_Sessions.d.ts.map +0 -1
- package/dist/controllers/Get_Sessions.js +0 -2
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Dispatch, SetStateAction } from "react";
|
|
2
2
|
type WalletContextType = {
|
|
3
3
|
openModal: () => void;
|
|
4
4
|
closeModal: () => void;
|
|
5
5
|
};
|
|
6
|
+
type StellarWalletState = {
|
|
7
|
+
address: string | null;
|
|
8
|
+
network?: string;
|
|
9
|
+
balance?: string;
|
|
10
|
+
manuallyDisconnected?: boolean;
|
|
11
|
+
};
|
|
6
12
|
export default function WalletProviders({ children }: {
|
|
7
13
|
children: ReactNode;
|
|
8
14
|
}): import("react").JSX.Element;
|
|
9
15
|
export declare function useWalletModal(): WalletContextType;
|
|
16
|
+
export declare function useStellarWallet(): {
|
|
17
|
+
stellarWallet: StellarWalletState;
|
|
18
|
+
setStellarWallet: Dispatch<SetStateAction<StellarWalletState>>;
|
|
19
|
+
clearStellarWallet: () => void;
|
|
20
|
+
};
|
|
10
21
|
export {};
|
|
11
22
|
//# sourceMappingURL=wagmi__providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wagmi__providers.d.ts","sourceRoot":"","sources":["../wagmi__providers.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"wagmi__providers.d.ts","sourceRoot":"","sources":["../wagmi__providers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkD,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAM5G,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAkCF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BA4C5E;AAED,wBAAgB,cAAc,sBAI7B;AAED,wBAAgB,gBAAgB;mBAlFf,kBAAkB;sBACf,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;wBAC1C,MAAM,IAAI;EAoF/B"}
|
package/dist/wagmi__providers.js
CHANGED
|
@@ -1,18 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState } from "react";
|
|
3
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { WagmiProvider } from "wagmi";
|
|
6
6
|
import { config } from "./config/walletConfig";
|
|
7
7
|
import { UI_Comp } from "./components";
|
|
8
8
|
const WalletContext = createContext(null);
|
|
9
|
+
const StellarWalletContext = createContext(null);
|
|
9
10
|
const queryClient = new QueryClient();
|
|
11
|
+
const STELLAR_WALLET_STORAGE_KEY = "cordy_minikit_stellar_wallet";
|
|
12
|
+
const ACTIVE_WALLET_SESSION_KEY = "cordy_minikit_active_wallet_session";
|
|
13
|
+
function readStellarWallet() {
|
|
14
|
+
if (typeof window === "undefined") {
|
|
15
|
+
return { address: null };
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const raw = window.localStorage.getItem(STELLAR_WALLET_STORAGE_KEY);
|
|
19
|
+
if (!raw)
|
|
20
|
+
return { address: null };
|
|
21
|
+
const parsed = JSON.parse(raw);
|
|
22
|
+
return {
|
|
23
|
+
address: parsed.address ?? null,
|
|
24
|
+
network: parsed.network,
|
|
25
|
+
balance: parsed.balance,
|
|
26
|
+
manuallyDisconnected: parsed.manuallyDisconnected,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { address: null };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
10
33
|
export default function WalletProviders({ children }) {
|
|
11
34
|
const [open, setOpen] = useState(false);
|
|
12
|
-
|
|
35
|
+
const [stellarWallet, setStellarWallet] = useState(() => readStellarWallet());
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (typeof window === "undefined")
|
|
38
|
+
return;
|
|
39
|
+
if (!stellarWallet.address) {
|
|
40
|
+
window.localStorage.removeItem(STELLAR_WALLET_STORAGE_KEY);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
window.localStorage.setItem(STELLAR_WALLET_STORAGE_KEY, JSON.stringify(stellarWallet));
|
|
44
|
+
}, [stellarWallet]);
|
|
45
|
+
return (_jsx(WagmiProvider, { config: config, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(WalletContext.Provider, { value: {
|
|
13
46
|
openModal: () => setOpen(true),
|
|
14
47
|
closeModal: () => setOpen(false),
|
|
15
|
-
}, children:
|
|
48
|
+
}, children: _jsxs(StellarWalletContext.Provider, { value: {
|
|
49
|
+
stellarWallet,
|
|
50
|
+
setStellarWallet,
|
|
51
|
+
clearStellarWallet: () => {
|
|
52
|
+
if (typeof window !== "undefined") {
|
|
53
|
+
window.localStorage.removeItem(STELLAR_WALLET_STORAGE_KEY);
|
|
54
|
+
window.localStorage.removeItem(ACTIVE_WALLET_SESSION_KEY);
|
|
55
|
+
}
|
|
56
|
+
setStellarWallet({ address: null, manuallyDisconnected: true });
|
|
57
|
+
},
|
|
58
|
+
}, children: [children, open && _jsx(UI_Comp, {}), " "] }) }) }) }));
|
|
16
59
|
}
|
|
17
60
|
export function useWalletModal() {
|
|
18
61
|
const ctx = useContext(WalletContext);
|
|
@@ -20,3 +63,9 @@ export function useWalletModal() {
|
|
|
20
63
|
throw new Error("Wrap in <WalletProviders>");
|
|
21
64
|
return ctx;
|
|
22
65
|
}
|
|
66
|
+
export function useStellarWallet() {
|
|
67
|
+
const ctx = useContext(StellarWalletContext);
|
|
68
|
+
if (!ctx)
|
|
69
|
+
throw new Error("Wrap in <WalletProviders>");
|
|
70
|
+
return ctx;
|
|
71
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cordystackx/cordy_minikit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"description": "Cordy Minikit - Open Source Web3 Dev Toolkit
|
|
7
|
+
"description": "Cordy Minikit - Open Source Web3 Dev Toolkit for both EVM and Non-EVM Wallets",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"files": [
|
|
@@ -20,12 +20,19 @@
|
|
|
20
20
|
"blockchain",
|
|
21
21
|
"wallet-connect",
|
|
22
22
|
"npm-package",
|
|
23
|
-
"cordy-minikit"
|
|
23
|
+
"cordy-minikit",
|
|
24
|
+
"EVM Wallets",
|
|
25
|
+
"Non-EVM Wallets",
|
|
26
|
+
"Stellar",
|
|
27
|
+
"Coinbased"
|
|
24
28
|
],
|
|
25
|
-
"author": "Marc Giestin Louis Cordova",
|
|
29
|
+
"author": "Marc Giestin Louis Cordova a.k.a. (CordyStackX)",
|
|
26
30
|
"license": "MIT",
|
|
27
31
|
"dependencies": {
|
|
28
32
|
"@coinbase/wallet-sdk": "4.3.7",
|
|
33
|
+
"@metamask/connect-evm": "^2.1.0",
|
|
34
|
+
"@stellar/freighter-api": "^6.0.1",
|
|
35
|
+
"@stellar/stellar-sdk": "^16.0.1",
|
|
29
36
|
"@tanstack/react-query": "^5.101.0",
|
|
30
37
|
"@walletconnect/ethereum-provider": "^2.23.9",
|
|
31
38
|
"ethers": "^6.17.0",
|
|
@@ -41,6 +48,11 @@
|
|
|
41
48
|
"@types/react": "^19.2.17",
|
|
42
49
|
"@types/react-dom": "^19.2.3"
|
|
43
50
|
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"next": ">=13",
|
|
53
|
+
"react": ">=18",
|
|
54
|
+
"react-dom": ">=18"
|
|
55
|
+
},
|
|
44
56
|
"scripts": {
|
|
45
57
|
"build": "tsc && pnpm run copy-css",
|
|
46
58
|
"copy-css": "mkdir -p dist/css/UI_Comp && cp css/UI_Comp/styles.module.css dist/css/UI_Comp/",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Get_Sessions.d.ts","sourceRoot":"","sources":["../../controllers/Get_Sessions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc,SAErC"}
|