@use-glyph/sdk-react 0.4.1 → 1.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/LICENSE +1 -3
- package/dist/EIP1193Strategy.js +114 -83
- package/dist/PrivyStrategy.js +93 -71
- package/dist/assets/sdk-react.css +1 -1
- package/dist/glyph-widget.es.js +30 -0
- package/dist/glyph-widget.umd.js +150 -0
- package/dist/index.js +8360 -7219
- package/dist/types/components/NativeGlyphConnectButton.d.ts +2 -0
- package/dist/types/context/GlyphProvider.d.ts +7 -2
- package/dist/types/context/strategies/EIP1193Strategy.d.ts +2 -2
- package/dist/types/context/strategies/PrivyStrategy.d.ts +2 -2
- package/dist/types/hooks/useGlyph.d.ts +2 -2
- package/dist/types/hooks/useGlyphFunding.d.ts +6 -0
- package/dist/types/hooks/useNativeGlyphConnection.d.ts +4 -5
- package/dist/types/index.d.ts +5 -4
- package/dist/types/lib/constants.d.ts +2 -0
- package/dist/types/lib/eip1193/GlyphWalletProvider.d.ts +6 -6
- package/dist/types/lib/popup.d.ts +1 -1
- package/dist/types/lib/privy/GlyphPrivyProvider.d.ts +5 -2
- package/dist/types/lib/providers.d.ts +162 -162
- package/dist/types/lib/utils.d.ts +4 -3
- package/dist/types/types/GlyphWidgetTypes.d.ts +20 -2
- package/package.json +22 -26
- package/dist/sdk-react.es.js +0 -28
- package/dist/sdk-react.umd.js +0 -151
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { GlyphProviderOptions } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A react provider that provides the GlyphContext to its children.
|
|
5
|
+
*
|
|
6
|
+
* See more at: {@link https://docs.useglyph.io/reference/components/GlyphProvider/}
|
|
7
|
+
*/
|
|
8
|
+
export declare const GlyphProvider: FC<GlyphProviderOptions>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const EIP1193Strategy: FC<
|
|
2
|
+
import { BaseGlyphProviderOptionsWithSignature } from '../../types';
|
|
3
|
+
declare const EIP1193Strategy: FC<BaseGlyphProviderOptionsWithSignature>;
|
|
4
4
|
export default EIP1193Strategy;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const _default: import('react').NamedExoticComponent<
|
|
1
|
+
import { BaseGlyphProviderOptions } from '../../types';
|
|
2
|
+
declare const _default: import('react').NamedExoticComponent<BaseGlyphProviderOptions>;
|
|
3
3
|
export default _default;
|
|
@@ -30,9 +30,9 @@ export interface GlyphInterface {
|
|
|
30
30
|
login: () => void;
|
|
31
31
|
logout: () => void;
|
|
32
32
|
/**
|
|
33
|
-
* The base URL for the Glyph Widget API (optional, uses default if not provided)
|
|
33
|
+
* The base URL for the Glyph Widget API (optional, uses default DASHBOARD_BASE_URL from envs if not provided)
|
|
34
34
|
*/
|
|
35
|
-
glyphUrl
|
|
35
|
+
glyphUrl: string;
|
|
36
36
|
}
|
|
37
37
|
export interface GlyphHook extends GlyphInterface {
|
|
38
38
|
/**
|
|
@@ -2,6 +2,11 @@ import { FUND_STATUS_API, FundQuoteDTO } from './useGlyphFundingApi';
|
|
|
2
2
|
type INITIAL_FUND_STATUS = "STARTED";
|
|
3
3
|
export type GLYPH_FUND_STATUS = INITIAL_FUND_STATUS | FUND_STATUS_API;
|
|
4
4
|
export declare function useGlyphFunding(): {
|
|
5
|
+
userCurrency: string;
|
|
6
|
+
fundMinAmount: number;
|
|
7
|
+
fundMaxAmount: number;
|
|
8
|
+
fundIntermediaryToken: string | undefined;
|
|
9
|
+
fundIntermediaryChain: string | undefined;
|
|
5
10
|
fundAmount: string;
|
|
6
11
|
fundAmountError: string | null;
|
|
7
12
|
fundDone: boolean;
|
|
@@ -10,6 +15,7 @@ export declare function useGlyphFunding(): {
|
|
|
10
15
|
fundQuote: FundQuoteDTO | null;
|
|
11
16
|
fundStatus: GLYPH_FUND_STATUS;
|
|
12
17
|
isOnrampEnabled: boolean;
|
|
18
|
+
onramppDisabledError: string | null;
|
|
13
19
|
quoteLoading: boolean;
|
|
14
20
|
doFunding: (onSuccess: () => void, onError: (error: string) => void) => Promise<void>;
|
|
15
21
|
setFundAmount: (val: React.SetStateAction<string>) => void;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
interface GlyphLogin {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
connect: () => void;
|
|
3
|
+
disconnect: () => void;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Use the `useNativeGlyphConnection` hook to login with Glyph.
|
|
7
|
-
* @
|
|
8
|
-
* @returns The login and logout functions.
|
|
7
|
+
* @returns The connect and disconnect functions. Used to connect and disconnect from Glyph.
|
|
9
8
|
*/
|
|
10
|
-
export declare const useNativeGlyphConnection: (
|
|
9
|
+
export declare const useNativeGlyphConnection: () => GlyphLogin;
|
|
11
10
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,18 +2,19 @@ import { default as GlyphWidget } from './components/GlyphWidget';
|
|
|
2
2
|
import { default as LoginButton } from './components/LoginButton';
|
|
3
3
|
import { default as LogoutButton } from './components/LogoutButton';
|
|
4
4
|
import { default as SignUpButton } from './components/SignUpButton';
|
|
5
|
-
import {
|
|
5
|
+
import { GlyphProvider } from './context/GlyphProvider';
|
|
6
6
|
export { useBalances } from './hooks/useBalances';
|
|
7
7
|
export { useGlyph } from './hooks/useGlyph';
|
|
8
8
|
export { useGlyphFunding, type GLYPH_FUND_STATUS } from './hooks/useGlyphFunding';
|
|
9
9
|
export { useGlyphView } from './hooks/useGlyphView';
|
|
10
10
|
export { glyphConnectorDetails } from './lib/constants';
|
|
11
|
-
export { GlyphViewType as GlyphView, StrategyType } from './types';
|
|
11
|
+
export { GlyphViewType as GlyphView, StrategyType, WalletClientType } from './types';
|
|
12
12
|
export { GlyphProvider, GlyphWidget, LoginButton, LogoutButton, SignUpButton };
|
|
13
|
-
export {
|
|
13
|
+
export { NativeGlyphConnectButton } from './components/NativeGlyphConnectButton';
|
|
14
|
+
export { useNativeGlyphConnection } from './hooks/useNativeGlyphConnection';
|
|
14
15
|
export { glyphWalletConnector } from './lib/eip1193/glyphWalletConnector';
|
|
16
|
+
export { GlyphWalletProvider } from './lib/eip1193/GlyphWalletProvider';
|
|
15
17
|
export { glyphWalletRK, glyphWalletRKStaging } from './lib/eip1193/glyphWalletRK';
|
|
16
|
-
export { useNativeGlyphConnection } from './hooks/useNativeGlyphConnection';
|
|
17
18
|
export { GLYPH_ICON_URL, GLYPH_PRIVY_APP_ID, STAGING_GLYPH_PRIVY_APP_ID } from './lib/constants';
|
|
18
19
|
export { GLYPH_APP_LOGIN_METHOD, GlyphPrivyProvider, STAGING_GLYPH_APP_LOGIN_METHOD } from './lib/privy/GlyphPrivyProvider';
|
|
19
20
|
export { InjectWagmiConnector } from './lib/privy/InjectWagmiConnector';
|
|
@@ -35,6 +35,8 @@ export declare enum SendView {
|
|
|
35
35
|
END = "send-end"
|
|
36
36
|
}
|
|
37
37
|
export declare const TOKEN_LOGOS: Record<string, React.FC<React.SVGProps<SVGSVGElement>>>;
|
|
38
|
+
export declare const TESTNET_CLASS = "gw-grayscale";
|
|
39
|
+
export declare const IS_TESTNET_CHAIN: Map<number, boolean>;
|
|
38
40
|
export declare const glyphConnectorDetails: {
|
|
39
41
|
readonly id: "io.useglyph.privy";
|
|
40
42
|
readonly name: "Glyph";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { Chain, Transport } from 'viem';
|
|
4
|
+
import { BaseGlyphProviderOptionsWithSignature } from '../../types';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for the GlyphWalletProvider.
|
|
6
7
|
* @interface GlyphWalletProviderProps
|
|
@@ -9,19 +10,17 @@ import { Chain, Transport } from 'viem';
|
|
|
9
10
|
* @property {QueryClient} queryClient - Optional query client to use, defaults to a standard query client.
|
|
10
11
|
* @property {React.ReactNode} children - The children to render.
|
|
11
12
|
*/
|
|
12
|
-
interface GlyphWalletProviderProps {
|
|
13
|
+
interface GlyphWalletProviderProps extends BaseGlyphProviderOptionsWithSignature {
|
|
13
14
|
chains: [Chain, ...Chain[]];
|
|
14
15
|
transports?: Record<number, Transport>;
|
|
15
16
|
queryClient?: QueryClient;
|
|
16
17
|
children: React.ReactNode;
|
|
17
|
-
glyphUrl?: string;
|
|
18
|
-
useStagingTenant?: boolean;
|
|
19
18
|
ssr?: boolean;
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* GlyphWalletProvider is a React provider that wraps the WagmiProvider and QueryClientProvider.
|
|
23
22
|
* It provides the GlyphWalletContext to its children.
|
|
24
|
-
*
|
|
23
|
+
*
|
|
25
24
|
* ```tsx
|
|
26
25
|
* import { GlyphWalletProvider } from '@use-glyph/sdk-react';
|
|
27
26
|
*
|
|
@@ -34,7 +33,8 @@ interface GlyphWalletProviderProps {
|
|
|
34
33
|
* );
|
|
35
34
|
* };
|
|
36
35
|
* ```
|
|
37
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* See more at: {@link https://docs.useglyph.io/reference/components/GlyphWalletProvider/}
|
|
38
38
|
*/
|
|
39
|
-
export declare const GlyphWalletProvider: ({ chains, transports, queryClient, children,
|
|
39
|
+
export declare const GlyphWalletProvider: ({ chains, transports, queryClient, children, ssr, ...glyphProviderOptions }: GlyphWalletProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export {};
|
|
@@ -7,5 +7,5 @@ type OpenPopupProps = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Open a popup in the center of the screen with the specified size.
|
|
9
9
|
*/
|
|
10
|
-
export declare function openPopup({ url, target, height, width }: OpenPopupProps):
|
|
10
|
+
export declare function openPopup({ url, target, height, width }: OpenPopupProps): Window | null;
|
|
11
11
|
export {};
|
|
@@ -2,6 +2,7 @@ import { LoginMethodOrderOption, PrivyProviderProps } from '@privy-io/react-auth
|
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { Chain, Transport } from 'viem';
|
|
4
4
|
import { default as React } from 'react';
|
|
5
|
+
import { BaseGlyphProviderOptions } from '../../types/GlyphWidgetTypes.js';
|
|
5
6
|
export declare const GLYPH_APP_LOGIN_METHOD: LoginMethodOrderOption;
|
|
6
7
|
export declare const STAGING_GLYPH_APP_LOGIN_METHOD: LoginMethodOrderOption;
|
|
7
8
|
/**
|
|
@@ -12,8 +13,10 @@ export declare const STAGING_GLYPH_APP_LOGIN_METHOD: LoginMethodOrderOption;
|
|
|
12
13
|
* @property {Record<number, Transport>} transports - Optional transports to use, defaults to standard http.
|
|
13
14
|
* @property {QueryClient} queryClient - Optional query client to use, defaults to a standard query client.
|
|
14
15
|
* @property {boolean} ssr - Optional ssr to use, defaults to true.
|
|
16
|
+
* @property {Function} onLogin - Optional onLogin function to use, defaults to a noop.
|
|
17
|
+
* @property {Function} onLogout - Optional onLogout function to use, defaults to a noop.
|
|
15
18
|
*/
|
|
16
|
-
interface GlyphPrivyProviderProps extends PrivyProviderProps {
|
|
19
|
+
interface GlyphPrivyProviderProps extends PrivyProviderProps, BaseGlyphProviderOptions {
|
|
17
20
|
chains: [Chain, ...Chain[]];
|
|
18
21
|
transports?: Record<number, Transport>;
|
|
19
22
|
queryClient?: QueryClient;
|
|
@@ -21,5 +24,5 @@ interface GlyphPrivyProviderProps extends PrivyProviderProps {
|
|
|
21
24
|
useStagingTenant?: boolean;
|
|
22
25
|
ssr?: boolean;
|
|
23
26
|
}
|
|
24
|
-
export declare const GlyphPrivyProvider: React.MemoExoticComponent<({ chains, transports, queryClient, glyphUrl, useStagingTenant, ssr, ...props }: GlyphPrivyProviderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
27
|
+
export declare const GlyphPrivyProvider: React.MemoExoticComponent<({ chains, transports, queryClient, glyphUrl, useStagingTenant, ssr, onLogin, onLogout, ...props }: GlyphPrivyProviderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
25
28
|
export {};
|