@coin-voyage/crypto 2.3.1-beta.0 → 2.4.0-beta.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/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +1 -0
- package/dist/{lib/connectors → connectors}/coinbase.d.ts +1 -1
- package/dist/{lib/connectors → connectors}/coinbase.js +1 -1
- package/dist/connectors/index.d.ts +3 -0
- package/dist/connectors/index.js +3 -0
- package/dist/{lib/connectors → connectors}/metaMask.d.ts +1 -1
- package/dist/{lib/connectors → connectors}/metaMask.js +1 -1
- package/dist/{lib/connectors → connectors}/walletConnect.d.ts +1 -1
- package/dist/{lib/connectors → connectors}/walletConnect.js +1 -1
- package/dist/evm/create-default-evm-config.js +6 -6
- package/dist/evm/index.d.ts +7 -0
- package/dist/evm/index.js +7 -0
- package/dist/evm/use-evm-transaction.js +1 -1
- package/dist/evm/use-sign-in-with-evm.d.ts +1 -1
- package/dist/evm/use-sign-in-with-evm.js +2 -2
- package/dist/hooks/use-account.js +1 -1
- package/dist/hooks/use-installed-wallets.js +3 -3
- package/dist/hooks/use-last-connector.js +2 -2
- package/dist/solana/index.d.ts +6 -0
- package/dist/solana/index.js +6 -0
- package/dist/solana/provider/provider.d.ts +1 -1
- package/dist/solana/use-solana-transaction.js +1 -1
- package/dist/sui/index.d.ts +6 -0
- package/dist/sui/index.js +6 -0
- package/dist/sui/provider/provider.d.ts +1 -1
- package/dist/sui/use-sign-in-with-sui.js +1 -1
- package/dist/sui/use-sui-transaction.js +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +6 -0
- package/dist/{lib/utils → utils}/connector.d.ts +2 -2
- package/dist/{lib/utils → utils}/get-connector-icon.d.ts +1 -1
- package/dist/{lib/utils → utils}/get-connector-icon.js +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +6 -0
- package/dist/{lib/utils → utils}/message.d.ts +1 -1
- package/dist/utxo/index.d.ts +10 -0
- package/dist/utxo/index.js +10 -0
- package/dist/utxo/provider/provider.d.ts +1 -1
- package/dist/utxo/provider/provider.js +2 -2
- package/dist/utxo/use-utxo-transaction.js +1 -1
- package/dist/wallets/index.d.ts +1 -0
- package/dist/wallets/index.js +1 -0
- package/dist/wallets/wallet-provider.d.ts +1 -1
- package/package.json +63 -7
- package/dist/sui/provider.d.ts +0 -9
- package/dist/sui/provider.js +0 -17
- /package/dist/{lib/config → config}/chain.d.ts +0 -0
- /package/dist/{lib/config → config}/chain.js +0 -0
- /package/dist/{lib/utils → utils}/connector.js +0 -0
- /package/dist/{lib/utils → utils}/conversions.d.ts +0 -0
- /package/dist/{lib/utils → utils}/conversions.js +0 -0
- /package/dist/{lib/utils → utils}/get-wallet-priority.d.ts +0 -0
- /package/dist/{lib/utils → utils}/get-wallet-priority.js +0 -0
- /package/dist/{lib/utils → utils}/is-wallet-installed.d.ts +0 -0
- /package/dist/{lib/utils → utils}/is-wallet-installed.js +0 -0
- /package/dist/{lib/utils → utils}/message.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chain";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chain";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type CoinbaseWalletParameters } from "wagmi/connectors";
|
|
2
|
-
export declare const createCoinbaseConnector: (params: CoinbaseWalletParameters) => import("
|
|
2
|
+
export declare const createCoinbaseConnector: (params: CoinbaseWalletParameters) => import("../evm").CreateConnectorFnExtended;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { coinbaseWallet } from "wagmi/connectors";
|
|
2
|
-
import { extendConnector } from "
|
|
2
|
+
import { extendConnector } from "../evm/utils";
|
|
3
3
|
export const createCoinbaseConnector = (params) => extendConnector(coinbaseWallet(params), "coinbaseWalletSDK", "Coinbase Wallet");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { MetaMaskParameters } from "wagmi/connectors";
|
|
2
|
-
export declare const createMetaMaskConnector: (params: MetaMaskParameters) => import("
|
|
2
|
+
export declare const createMetaMaskConnector: (params: MetaMaskParameters) => import("../evm").CreateConnectorFnExtended;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { WalletConnectParameters } from "wagmi/connectors";
|
|
2
|
-
export declare const createWalletConnectConnector: (params: WalletConnectParameters) => import("
|
|
2
|
+
export declare const createWalletConnectConnector: (params: WalletConnectParameters) => import("../evm").CreateConnectorFnExtended;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { walletConnect } from "wagmi/connectors";
|
|
2
|
-
import { extendConnector } from "
|
|
2
|
+
import { extendConnector } from "../evm/utils";
|
|
3
3
|
export const createWalletConnectConnector = (params) => extendConnector(walletConnect({
|
|
4
4
|
showQrModal: false,
|
|
5
5
|
qrModalOptions: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getValue } from "@coin-voyage/shared/
|
|
1
|
+
import { getValue } from "@coin-voyage/shared/utils";
|
|
2
2
|
import { fallback, http } from "viem";
|
|
3
3
|
import { createConfig, injected } from "wagmi";
|
|
4
4
|
import { safe, } from "wagmi/connectors";
|
|
5
|
-
import { DEFAULT_CHAINS } from "../
|
|
6
|
-
import { createCoinbaseConnector } from "../
|
|
7
|
-
import { createMetaMaskConnector } from "../
|
|
8
|
-
import { createWalletConnectConnector } from "../
|
|
9
|
-
import { isWalletInstalled } from "../
|
|
5
|
+
import { DEFAULT_CHAINS } from "../config/chain";
|
|
6
|
+
import { createCoinbaseConnector } from "../connectors/coinbase";
|
|
7
|
+
import { createMetaMaskConnector } from "../connectors/metaMask";
|
|
8
|
+
import { createWalletConnectConnector } from "../connectors/walletConnect";
|
|
9
|
+
import { isWalletInstalled } from "../utils/is-wallet-installed";
|
|
10
10
|
import { extendConnector, fallbackRPCUrls } from "./utils";
|
|
11
11
|
export function createDefaultEVMConfig(props) {
|
|
12
12
|
const connectors = [...(props?.connectors ?? [])];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEvmPaymentData } from "@coin-voyage/shared/
|
|
1
|
+
import { getEvmPaymentData } from "@coin-voyage/shared/payment";
|
|
2
2
|
import { estimateFeesPerGas } from "viem/actions";
|
|
3
3
|
import { useConfig, useSendTransaction, useWriteContract } from "wagmi";
|
|
4
4
|
export function useEVMTransaction() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SignInWith } from "../types/sign-in-with";
|
|
2
2
|
export declare function useSignInWithEvm({ signIn, onError, generateNonce }: SignInWith): {
|
|
3
3
|
onSelect: (id: string) => Promise<void>;
|
|
4
|
-
wallets: import("../types
|
|
4
|
+
wallets: import("../types").BaseConnector[];
|
|
5
5
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomStringForEntropy } from "@stablelib/random";
|
|
2
2
|
import { useCallback, useMemo } from "react";
|
|
3
3
|
import { useAccount, useConnect, useConnectors, useSignMessage } from "wagmi";
|
|
4
|
-
import { isWalletInstalled } from "../
|
|
5
|
-
import { toMessage } from "../
|
|
4
|
+
import { isWalletInstalled } from "../utils/is-wallet-installed";
|
|
5
|
+
import { toMessage } from "../utils/message";
|
|
6
6
|
import { toBaseConnector } from "./utils";
|
|
7
7
|
export function useSignInWithEvm({ signIn, onError, generateNonce }) {
|
|
8
8
|
const { address, connector, isConnected } = useAccount();
|
|
@@ -5,7 +5,7 @@ import { useCurrentAccount, useCurrentWallet } from "@mysten/dapp-kit";
|
|
|
5
5
|
import { useWallet } from "@solana/wallet-adapter-react";
|
|
6
6
|
import { useCallback, useRef, useSyncExternalStore } from "react";
|
|
7
7
|
import { useAccount as useAccountInternal } from "wagmi";
|
|
8
|
-
import { getConnector } from "../
|
|
8
|
+
import { getConnector } from "../utils/connector";
|
|
9
9
|
import { extendsWalletAdapter } from "../solana/utils";
|
|
10
10
|
import { useLastConnector } from "./use-last-connector";
|
|
11
11
|
const defaultAccount = {
|
|
@@ -5,9 +5,9 @@ import { WalletReadyState } from "@solana/wallet-adapter-base";
|
|
|
5
5
|
import { useWallet } from "@solana/wallet-adapter-react";
|
|
6
6
|
import { useContext, useMemo } from "react";
|
|
7
7
|
import { WagmiContext } from "wagmi";
|
|
8
|
-
import { getConnectorIcon } from "../
|
|
9
|
-
import { getWalletPriority } from "../
|
|
10
|
-
import { isWalletInstalled } from "../
|
|
8
|
+
import { getConnectorIcon } from "../utils/get-connector-icon";
|
|
9
|
+
import { getWalletPriority } from "../utils/get-wallet-priority";
|
|
10
|
+
import { isWalletInstalled } from "../utils/is-wallet-installed";
|
|
11
11
|
import { extendsWalletAdapter } from "../solana/utils";
|
|
12
12
|
// canonical wallet ID for multi-chain wallets
|
|
13
13
|
const getCanonicalWalletId = (idOrName) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getValue, setValue } from "@coin-voyage/shared/
|
|
1
|
+
import { getValue, setValue } from "@coin-voyage/shared/utils";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { getConnectorId } from "../
|
|
3
|
+
import { getConnectorId } from "../utils/connector";
|
|
4
4
|
export const useLastConnector = () => {
|
|
5
5
|
const [lastConnectorIdWithChain, setLastConnectorIdWithChain] = useState(() => {
|
|
6
6
|
const stored = getValue("@coin-voyage/recentConnectorId");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SolanaConfiguration } from "
|
|
1
|
+
import type { SolanaConfiguration } from "../../types/wallet";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
import { WalletConnectParameters } from "wagmi/connectors";
|
|
4
4
|
export declare function useInSolanaContext(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSolanaPaymentData } from "@coin-voyage/shared/
|
|
1
|
+
import { getSolanaPaymentData } from "@coin-voyage/shared/payment";
|
|
2
2
|
import { hex } from "@scure/base";
|
|
3
3
|
import { createTransferCheckedInstruction, getAssociatedTokenAddress } from "@solana/spl-token";
|
|
4
4
|
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SuiConfiguration } from "
|
|
1
|
+
import type { SuiConfiguration } from "../../types/wallet";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
export declare function useInSuiContext(): boolean;
|
|
4
4
|
export declare function SuiProvider({ children, config, }: PropsWithChildren<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useConnectWallet, useCurrentWallet, useSignPersonalMessage, useWallets } from "@mysten/dapp-kit";
|
|
2
2
|
import { randomStringForEntropy } from "@stablelib/random";
|
|
3
|
-
import { toMessage } from "../
|
|
3
|
+
import { toMessage } from "../utils/message";
|
|
4
4
|
export function useSignInWithSui({ signIn, onError, generateNonce }) {
|
|
5
5
|
const { mutate: connect } = useConnectWallet();
|
|
6
6
|
const { currentWallet, isConnected } = useCurrentWallet();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSuiPaymentData } from "@coin-voyage/shared/
|
|
1
|
+
import { getSuiPaymentData } from "@coin-voyage/shared/payment";
|
|
2
2
|
import { useReportTransactionEffects, useSignTransaction, useSuiClient } from "@mysten/dapp-kit";
|
|
3
3
|
import { Transaction } from "@mysten/sui/transactions";
|
|
4
4
|
import { SUI_PACKAGE_IDS } from "./constants";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChainType } from "@coin-voyage/shared/types";
|
|
2
|
-
import type { ChainTypeWalletConnector } from "
|
|
3
|
-
import type { WalletConnector } from "
|
|
2
|
+
import type { ChainTypeWalletConnector } from "../types/wallet";
|
|
3
|
+
import type { WalletConnector } from "../types/wallet-connector";
|
|
4
4
|
export declare const getConnectorId: (connector: WalletConnector) => string;
|
|
5
5
|
export declare const getConnector: (walletConnector: ChainTypeWalletConnector[], chainType?: ChainType) => WalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector } from "
|
|
1
|
+
import { WalletConnector } from "../types/wallet-connector";
|
|
2
2
|
export declare const getConnectorIcon: (connector?: WalletConnector) => string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getWalletIcon } from "
|
|
1
|
+
import { getWalletIcon } from "../assets/icons";
|
|
2
2
|
export const getConnectorIcon = (connector) => {
|
|
3
3
|
const connectorId = connector?.id;
|
|
4
4
|
return connectorId ? getWalletIcon(connectorId) || connector?.icon : connector?.icon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SignInMessage } from "
|
|
1
|
+
import { SignInMessage } from "../types/sign-in-with";
|
|
2
2
|
export declare const toMessage: (message: SignInMessage, accountName: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./create-default-utxo-config";
|
|
2
|
+
export * from "./create-psbt-tx";
|
|
3
|
+
export * from "./create-utxo-transport";
|
|
4
|
+
export * from "./estimate-fee";
|
|
5
|
+
export * from "./get-address-utxo";
|
|
6
|
+
export * from "./send-btc";
|
|
7
|
+
export * from "./use-utxo-transaction";
|
|
8
|
+
export * from "./utxo-public-client";
|
|
9
|
+
export * from "./verify-message";
|
|
10
|
+
export * from "./provider/provider";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./create-default-utxo-config";
|
|
2
|
+
export * from "./create-psbt-tx";
|
|
3
|
+
export * from "./create-utxo-transport";
|
|
4
|
+
export * from "./estimate-fee";
|
|
5
|
+
export * from "./get-address-utxo";
|
|
6
|
+
export * from "./send-btc";
|
|
7
|
+
export * from "./use-utxo-transaction";
|
|
8
|
+
export * from "./utxo-public-client";
|
|
9
|
+
export * from "./verify-message";
|
|
10
|
+
export * from "./provider/provider";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UTXOConfiguration } from "
|
|
1
|
+
import type { UTXOConfiguration } from "../create-default-utxo-config";
|
|
2
2
|
import { type PropsWithChildren } from "react";
|
|
3
3
|
export declare function useInBigmiContext(): boolean;
|
|
4
4
|
export declare function UTXOProvider({ children, config }: PropsWithChildren<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { BigmiContext } from "@bigmi/react";
|
|
3
|
-
import { UTXOBaseProvider } from "
|
|
4
|
-
import { UTXOExternalContext } from "
|
|
3
|
+
import { UTXOBaseProvider } from "./base-provider";
|
|
4
|
+
import { UTXOExternalContext } from "./external-context";
|
|
5
5
|
import { useContext } from "react";
|
|
6
6
|
export function useInBigmiContext() {
|
|
7
7
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAccount } from "@bigmi/react";
|
|
2
|
-
import { getBitcoinPaymentData } from "@coin-voyage/shared/
|
|
2
|
+
import { getBitcoinPaymentData } from "@coin-voyage/shared/payment";
|
|
3
3
|
import { sendBtc } from "./send-btc";
|
|
4
4
|
export function useUTXOTransaction() {
|
|
5
5
|
const { account, connector } = useAccount();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./wallet-provider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./wallet-provider";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WalletConfiguration } from "../types";
|
|
2
2
|
import { type PropsWithChildren } from "react";
|
|
3
3
|
export declare function WalletProvider({ children, config, }: PropsWithChildren<{
|
|
4
4
|
config?: WalletConfiguration;
|
package/package.json
CHANGED
|
@@ -1,19 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coin-voyage/crypto",
|
|
3
3
|
"description": "Crypto utilities for Coin Voyage",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0-beta.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "Lars <lars@coinvoyage.io>",
|
|
8
8
|
"homepage": "https://coinvoyage.io",
|
|
9
9
|
"exports": {
|
|
10
|
+
"./config": {
|
|
11
|
+
"types": "./dist/config/index.d.ts",
|
|
12
|
+
"default": "./dist/config/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./connectors": {
|
|
15
|
+
"types": "./dist/connectors/index.d.ts",
|
|
16
|
+
"default": "./dist/connectors/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./evm": {
|
|
19
|
+
"types": "./dist/evm/index.d.ts",
|
|
20
|
+
"default": "./dist/evm/index.js"
|
|
21
|
+
},
|
|
10
22
|
"./hooks": {
|
|
11
23
|
"types": "./dist/hooks/index.d.ts",
|
|
12
24
|
"default": "./dist/hooks/index.js"
|
|
13
25
|
},
|
|
14
|
-
"
|
|
15
|
-
"types": "./dist
|
|
16
|
-
"default": "./dist
|
|
26
|
+
"./solana": {
|
|
27
|
+
"types": "./dist/solana/index.d.ts",
|
|
28
|
+
"default": "./dist/solana/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./sui": {
|
|
31
|
+
"types": "./dist/sui/index.d.ts",
|
|
32
|
+
"default": "./dist/sui/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./types": {
|
|
35
|
+
"types": "./dist/types/index.d.ts",
|
|
36
|
+
"default": "./dist/types/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./utils": {
|
|
39
|
+
"types": "./dist/utils/index.d.ts",
|
|
40
|
+
"default": "./dist/utils/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./utxo": {
|
|
43
|
+
"types": "./dist/utxo/index.d.ts",
|
|
44
|
+
"default": "./dist/utxo/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./wallets": {
|
|
47
|
+
"types": "./dist/wallets/index.d.ts",
|
|
48
|
+
"default": "./dist/wallets/index.js"
|
|
17
49
|
}
|
|
18
50
|
},
|
|
19
51
|
"files": [
|
|
@@ -21,11 +53,35 @@
|
|
|
21
53
|
],
|
|
22
54
|
"typesVersions": {
|
|
23
55
|
"*": {
|
|
56
|
+
"config": [
|
|
57
|
+
"dist/config/index.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"connectors": [
|
|
60
|
+
"dist/connectors/index.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"evm": [
|
|
63
|
+
"dist/evm/index.d.ts"
|
|
64
|
+
],
|
|
24
65
|
"hooks": [
|
|
25
66
|
"dist/hooks/index.d.ts"
|
|
26
67
|
],
|
|
27
|
-
"
|
|
28
|
-
"dist
|
|
68
|
+
"solana": [
|
|
69
|
+
"dist/solana/index.d.ts"
|
|
70
|
+
],
|
|
71
|
+
"sui": [
|
|
72
|
+
"dist/sui/index.d.ts"
|
|
73
|
+
],
|
|
74
|
+
"types": [
|
|
75
|
+
"dist/types/index.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"utils": [
|
|
78
|
+
"dist/utils/index.d.ts"
|
|
79
|
+
],
|
|
80
|
+
"utxo": [
|
|
81
|
+
"dist/utxo/index.d.ts"
|
|
82
|
+
],
|
|
83
|
+
"wallets": [
|
|
84
|
+
"dist/wallets/index.d.ts"
|
|
29
85
|
]
|
|
30
86
|
}
|
|
31
87
|
},
|
|
@@ -50,7 +106,7 @@
|
|
|
50
106
|
"@solana/wallet-adapter-walletconnect": "0.1.21",
|
|
51
107
|
"@solana/wallet-adapter-base": "0.9.27",
|
|
52
108
|
"@solana/wallet-adapter-coinbase": "0.1.23",
|
|
53
|
-
"@coin-voyage/shared": "2.
|
|
109
|
+
"@coin-voyage/shared": "2.4.0-beta.0"
|
|
54
110
|
},
|
|
55
111
|
"devDependencies": {
|
|
56
112
|
"@types/elliptic": "6.4.18"
|
package/dist/sui/provider.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WalletProviderProps } from "@mysten/dapp-kit";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
export declare function useInSuiContext(): boolean;
|
|
4
|
-
export declare function SuiProvider({ children, config, }: PropsWithChildren<{
|
|
5
|
-
config?: {
|
|
6
|
-
rpcUrl?: string;
|
|
7
|
-
walletConfiguration?: WalletProviderProps;
|
|
8
|
-
};
|
|
9
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
package/dist/sui/provider.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SuiBaseProvider } from "@coin-voyage/crypto/sui/provider/base-provider";
|
|
3
|
-
import { SuiExternalContext } from "@coin-voyage/crypto/sui/provider/external-context";
|
|
4
|
-
import { useSuiClientContext } from "@mysten/dapp-kit";
|
|
5
|
-
export function useInSuiContext() {
|
|
6
|
-
try {
|
|
7
|
-
const externalSuiContext = useSuiClientContext();
|
|
8
|
-
return Boolean(externalSuiContext.config);
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export function SuiProvider({ children, config, }) {
|
|
15
|
-
const inSUIContext = useInSuiContext();
|
|
16
|
-
return inSUIContext ? (_jsx(SuiExternalContext.Provider, { value: inSUIContext, children: children })) : (_jsx(SuiBaseProvider, { config: config, children: children }));
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|