@use-glyph/sdk-react 0.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.
Files changed (117) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +152 -0
  3. package/dist/EIP1193Strategy.js +116 -0
  4. package/dist/PrivyStrategy.js +92 -0
  5. package/dist/assets/sdk-react.css +1 -0
  6. package/dist/index.js +17858 -0
  7. package/dist/sdk-react.es.js +28 -0
  8. package/dist/sdk-react.umd.js +151 -0
  9. package/dist/types/assets/svg/APEIcon.d.ts +2 -0
  10. package/dist/types/assets/svg/APE_ETH.d.ts +1 -0
  11. package/dist/types/assets/svg/APE_USD.d.ts +1 -0
  12. package/dist/types/assets/svg/APE_WAPE.d.ts +1 -0
  13. package/dist/types/assets/svg/ActivityIcon.d.ts +5 -0
  14. package/dist/types/assets/svg/ApechainIcon.d.ts +1 -0
  15. package/dist/types/assets/svg/ApecoinIcon.d.ts +2 -0
  16. package/dist/types/assets/svg/BackIcon.d.ts +2 -0
  17. package/dist/types/assets/svg/CaretDownIcon.d.ts +1 -0
  18. package/dist/types/assets/svg/CopyIcon.d.ts +5 -0
  19. package/dist/types/assets/svg/EditIcon.d.ts +2 -0
  20. package/dist/types/assets/svg/FailureIcon.d.ts +1 -0
  21. package/dist/types/assets/svg/GlyphIcon.d.ts +2 -0
  22. package/dist/types/assets/svg/HelpIcon.d.ts +1 -0
  23. package/dist/types/assets/svg/HomeIcon.d.ts +2 -0
  24. package/dist/types/assets/svg/InfoIcon.d.ts +1 -0
  25. package/dist/types/assets/svg/LinkIcon.d.ts +1 -0
  26. package/dist/types/assets/svg/LoadingCircleIcon..d.ts +2 -0
  27. package/dist/types/assets/svg/NetworkIcon.d.ts +1 -0
  28. package/dist/types/assets/svg/NoTokenIcon.d.ts +1 -0
  29. package/dist/types/assets/svg/PlusSign.d.ts +1 -0
  30. package/dist/types/assets/svg/ProfileViewPattern.d.ts +2 -0
  31. package/dist/types/assets/svg/QRIcon.d.ts +1 -0
  32. package/dist/types/assets/svg/SuccessIcon.d.ts +1 -0
  33. package/dist/types/assets/svg/SuccessViewPattern.d.ts +2 -0
  34. package/dist/types/assets/svg/TokensIcon.d.ts +2 -0
  35. package/dist/types/assets/svg/TxReceiveIcon.d.ts +1 -0
  36. package/dist/types/assets/svg/TxSendIcon.d.ts +1 -0
  37. package/dist/types/assets/svg/WalletIcon.d.ts +1 -0
  38. package/dist/types/assets/svg/WalletsTabFilledIcon.d.ts +2 -0
  39. package/dist/types/assets/svg/WalletsTabOutlinedIcon.d.ts +2 -0
  40. package/dist/types/components/GlyphWidget.d.ts +3 -0
  41. package/dist/types/components/GlyphWidgetButton.d.ts +3 -0
  42. package/dist/types/components/LoginButton.d.ts +2 -0
  43. package/dist/types/components/LogoutButton.d.ts +2 -0
  44. package/dist/types/components/SignUpButton.d.ts +2 -0
  45. package/dist/types/components/shared/ActivityRow.d.ts +10 -0
  46. package/dist/types/components/shared/CopyButton.d.ts +10 -0
  47. package/dist/types/components/shared/LinkWithIcon.d.ts +4 -0
  48. package/dist/types/components/shared/UserAvatar.d.ts +8 -0
  49. package/dist/types/components/shared/WalletViewFooterNav.d.ts +8 -0
  50. package/dist/types/components/shared/WalletViewHeader.d.ts +11 -0
  51. package/dist/types/components/shared/WalletViewTemplate.d.ts +10 -0
  52. package/dist/types/components/shared/skeletons/ActivityRowSkeleton.d.ts +1 -0
  53. package/dist/types/components/ui/accordion.d.ts +7 -0
  54. package/dist/types/components/ui/button.d.ts +15 -0
  55. package/dist/types/components/ui/drawer.d.ts +27 -0
  56. package/dist/types/components/ui/input-helper.d.ts +8 -0
  57. package/dist/types/components/ui/input.d.ts +26 -0
  58. package/dist/types/components/ui/popover.d.ts +6 -0
  59. package/dist/types/components/ui/select.d.ts +13 -0
  60. package/dist/types/components/ui/skeleton.d.ts +2 -0
  61. package/dist/types/components/ui/sonner.d.ts +4 -0
  62. package/dist/types/components/ui/tooltip-element.d.ts +14 -0
  63. package/dist/types/components/ui/tooltip.d.ts +8 -0
  64. package/dist/types/components/widget/UnsupportedChainOverlay.d.ts +5 -0
  65. package/dist/types/components/widget/Wallet.d.ts +4 -0
  66. package/dist/types/components/widget/WalletActivityTab.d.ts +4 -0
  67. package/dist/types/components/widget/WalletFundFailedView.d.ts +8 -0
  68. package/dist/types/components/widget/WalletFundPendingView.d.ts +8 -0
  69. package/dist/types/components/widget/WalletFundSuccessView.d.ts +8 -0
  70. package/dist/types/components/widget/WalletFundView.d.ts +8 -0
  71. package/dist/types/components/widget/WalletHomeTab.d.ts +6 -0
  72. package/dist/types/components/widget/WalletLinkedAccountsTab.d.ts +1 -0
  73. package/dist/types/components/widget/WalletMainView.d.ts +12 -0
  74. package/dist/types/components/widget/WalletProfileView.d.ts +4 -0
  75. package/dist/types/components/widget/WalletReceiveView.d.ts +4 -0
  76. package/dist/types/components/widget/WalletSendFundEnterAddressView.d.ts +12 -0
  77. package/dist/types/components/widget/WalletSendFundFailedView.d.ts +10 -0
  78. package/dist/types/components/widget/WalletSendFundPendingView.d.ts +13 -0
  79. package/dist/types/components/widget/WalletSendFundSuccessView.d.ts +10 -0
  80. package/dist/types/components/widget/WalletSendFundView.d.ts +23 -0
  81. package/dist/types/components/widget/WalletTokensTab.d.ts +1 -0
  82. package/dist/types/components/widget/WidgetGradient.d.ts +4 -0
  83. package/dist/types/context/GlyphContext.d.ts +18 -0
  84. package/dist/types/context/GlyphProvider.d.ts +3 -0
  85. package/dist/types/context/GlyphUserDataContext.d.ts +9 -0
  86. package/dist/types/context/GlyphUserDataProvider.d.ts +5 -0
  87. package/dist/types/context/GlyphViewContext.d.ts +12 -0
  88. package/dist/types/context/GlyphViewProvider.d.ts +4 -0
  89. package/dist/types/context/strategies/EIP1193Strategy.d.ts +4 -0
  90. package/dist/types/context/strategies/LoadingStrategy.d.ts +5 -0
  91. package/dist/types/context/strategies/PrivyStrategy.d.ts +3 -0
  92. package/dist/types/hooks/useActivity.d.ts +30 -0
  93. package/dist/types/hooks/useBalances.d.ts +4 -0
  94. package/dist/types/hooks/useGlyph.d.ts +49 -0
  95. package/dist/types/hooks/useGlyphApi.d.ts +3 -0
  96. package/dist/types/hooks/useGlyphFunding.d.ts +17 -0
  97. package/dist/types/hooks/useGlyphFundingApi.d.ts +45 -0
  98. package/dist/types/hooks/useGlyphView.d.ts +3 -0
  99. package/dist/types/hooks/useMediaQuery.d.ts +2 -0
  100. package/dist/types/hooks/useNativeGlyphConnection.d.ts +11 -0
  101. package/dist/types/index.d.ts +20 -0
  102. package/dist/types/lib/constants.d.ts +45 -0
  103. package/dist/types/lib/eip1193/GlyphWalletProvider.d.ts +40 -0
  104. package/dist/types/lib/eip1193/glyphWalletConnector.d.ts +35 -0
  105. package/dist/types/lib/eip1193/glyphWalletRK.d.ts +18 -0
  106. package/dist/types/lib/intl.d.ts +2 -0
  107. package/dist/types/lib/numericInputs.d.ts +2 -0
  108. package/dist/types/lib/popup.d.ts +11 -0
  109. package/dist/types/lib/privy/GlyphPrivyProvider.d.ts +25 -0
  110. package/dist/types/lib/privy/InjectWagmiConnector.d.ts +5 -0
  111. package/dist/types/lib/privy/usePrivyCrossAppProvider.d.ts +15 -0
  112. package/dist/types/lib/providers.d.ts +6889 -0
  113. package/dist/types/lib/svg.d.ts +4 -0
  114. package/dist/types/lib/utils.d.ts +128 -0
  115. package/dist/types/types/GlyphWidgetTypes.d.ts +90 -0
  116. package/dist/types/types/index.d.ts +1 -0
  117. package/package.json +98 -0
@@ -0,0 +1,12 @@
1
+ import { WalletView, WalletMainViewTab } from '../lib/constants';
2
+ import { GlyphViewType } from '../types';
3
+ interface GlyphViewContextType {
4
+ glyphView: GlyphViewType;
5
+ setGlyphView: React.Dispatch<React.SetStateAction<GlyphViewType>>;
6
+ walletView: WalletView;
7
+ setWalletView: React.Dispatch<React.SetStateAction<WalletView>>;
8
+ walletMainViewTab: WalletMainViewTab;
9
+ setWalletMainViewTab: React.Dispatch<React.SetStateAction<WalletMainViewTab>>;
10
+ }
11
+ export declare const GlyphViewContext: import('react').Context<GlyphViewContextType | undefined>;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const GlyphViewProvider: React.FC<{
3
+ children: ReactNode;
4
+ }>;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { GlyphProviderOptions } from '../../types';
3
+ declare const EIP1193Strategy: FC<GlyphProviderOptions>;
4
+ export default EIP1193Strategy;
@@ -0,0 +1,5 @@
1
+ import { default as React, FC } from 'react';
2
+ declare const LoadingStrategy: FC<{
3
+ children: React.ReactNode;
4
+ }>;
5
+ export default LoadingStrategy;
@@ -0,0 +1,3 @@
1
+ import { GlyphProviderOptions } from '../../types';
2
+ declare const _default: import('react').NamedExoticComponent<GlyphProviderOptions>;
3
+ export default _default;
@@ -0,0 +1,30 @@
1
+ export type ActivityBlockExplorerItem = {
2
+ url: string;
3
+ text: string;
4
+ };
5
+ export type ActivityItem = {
6
+ id: string;
7
+ type: "fund" | "send";
8
+ type_text: string;
9
+ status: string;
10
+ status_text: string | null;
11
+ status_color: string;
12
+ symbol: string;
13
+ value: string;
14
+ amount: string;
15
+ amount_currency: string;
16
+ allowIdCopy: boolean;
17
+ blockExplorerTxns?: ActivityBlockExplorerItem[];
18
+ };
19
+ export type ActivityGroup = {
20
+ label: string;
21
+ transactions: ActivityItem[];
22
+ };
23
+ export declare function useActivity(pageSize?: number): {
24
+ transactionGroups: ActivityGroup[];
25
+ fetchTransactions: (reset?: boolean) => Promise<ActivityGroup[] | null>;
26
+ loadMore: () => Promise<boolean>;
27
+ reset: () => Promise<void>;
28
+ hasMore: boolean;
29
+ isLoading: boolean;
30
+ };
@@ -0,0 +1,4 @@
1
+ export declare function useBalances(): {
2
+ balances: import('../types').GlyphWidgetBalances | null;
3
+ refreshBalances: (force?: boolean, cbs?: Record<string, (diffAmount: number) => void>) => Promise<void>;
4
+ };
@@ -0,0 +1,49 @@
1
+ import { UnsignedTransactionRequest } from '@privy-io/react-auth';
2
+ import { Hex } from 'viem';
3
+ import { GlyphWidgetBalances, GlyphWidgetUser } from '../types';
4
+ export interface GlyphInterface {
5
+ /**
6
+ * Check whether the `GlyphContext` is ready to be used. You should wait for this to
7
+ * be true before using values such as `authenticated` and `user`.
8
+ */
9
+ ready: boolean;
10
+ /**
11
+ * True if the user is authenticated, false otherwise.
12
+ *
13
+ * You should always check that `ready` is true before using this value. Otherwise,
14
+ * the value may outdated while the Glyph context finishes its initialization.
15
+ */
16
+ authenticated: boolean;
17
+ /**
18
+ * Whether to hide the Glyph Widget.
19
+ */
20
+ hideWidget?: boolean;
21
+ symbol: string;
22
+ signMessage: (params: {
23
+ message: string;
24
+ }) => Promise<unknown>;
25
+ sendTransaction: (params: {
26
+ transaction: Omit<UnsignedTransactionRequest, "chainId">;
27
+ }) => Promise<string | {
28
+ hash: Hex;
29
+ }>;
30
+ login: () => void;
31
+ logout: () => void;
32
+ /**
33
+ * The base URL for the Glyph Widget API (optional, uses default if not provided)
34
+ */
35
+ glyphUrl?: string;
36
+ }
37
+ export interface GlyphHook extends GlyphInterface {
38
+ /**
39
+ * The user object, or null if the user is not authenticated.
40
+ */
41
+ user: GlyphWidgetUser | null;
42
+ refreshUser: (force?: boolean) => Promise<void>;
43
+ /**
44
+ * The balances object, or null if the user is not authenticated.
45
+ */
46
+ balances: GlyphWidgetBalances | null;
47
+ refreshBalances: (force?: boolean, cbs?: Record<string, (diffAmount: number) => void>) => Promise<void>;
48
+ }
49
+ export declare const useGlyph: () => GlyphHook;
@@ -0,0 +1,3 @@
1
+ export declare function useGlyphApi(): {
2
+ glyphApiFetch: import('../context/GlyphContext').GlyphApiFetch | null;
3
+ };
@@ -0,0 +1,17 @@
1
+ import { FUND_STATUS_API, FundQuoteDTO } from './useGlyphFundingApi';
2
+ type INITIAL_FUND_STATUS = "STARTED";
3
+ export type GLYPH_FUND_STATUS = INITIAL_FUND_STATUS | FUND_STATUS_API;
4
+ export declare function useGlyphFunding(): {
5
+ fundAmount: string;
6
+ fundAmountError: string | null;
7
+ fundDone: boolean;
8
+ fundError: string | null;
9
+ fundInProgress: boolean;
10
+ fundQuote: FundQuoteDTO | null;
11
+ fundStatus: GLYPH_FUND_STATUS;
12
+ isOnrampEnabled: boolean;
13
+ quoteLoading: boolean;
14
+ doFunding: (onSuccess: () => void, onError: (error: string) => void) => Promise<void>;
15
+ setFundAmount: (val: React.SetStateAction<string>) => void;
16
+ };
17
+ export {};
@@ -0,0 +1,45 @@
1
+ export type FUND_STATUS_API = "WAITING" | "IN_PROGRESS" | "SUCCESS" | "FAILED";
2
+ export type FundQuoteDTO = {
3
+ id: string;
4
+ in_amount: number;
5
+ estimated_fees_amount: number;
6
+ currency: string;
7
+ out_tokens_amount: number;
8
+ ape_to_currency: number;
9
+ deposit_address: string;
10
+ refresh_in_seconds: number;
11
+ error?: string;
12
+ };
13
+ export type FundQuoteStatusOk = {
14
+ ok: true;
15
+ status: FUND_STATUS_API;
16
+ details: string;
17
+ };
18
+ export type FundQuoteStatusError = {
19
+ ok: false;
20
+ status: null;
21
+ details?: string;
22
+ };
23
+ export type FundQuoteStatus = FundQuoteStatusOk | FundQuoteStatusError;
24
+ export declare function useGlyphFundingApi(): {
25
+ getPaymentLink: (quote: FundQuoteDTO) => Promise<{
26
+ url: any;
27
+ ok: boolean;
28
+ error: any;
29
+ } | {
30
+ url: null;
31
+ ok: boolean;
32
+ error?: undefined;
33
+ }>;
34
+ createQuote: (address: string, amount: string, currency: string, country: string, subdivision?: string, takeLatest?: boolean) => Promise<{
35
+ quote: FundQuoteDTO | null;
36
+ ok: boolean;
37
+ error: string | undefined;
38
+ }>;
39
+ getQuoteStatus: (quote: FundQuoteDTO) => Promise<FundQuoteStatus>;
40
+ refreshQuote: (quote_id: string, amount: string) => Promise<{
41
+ quote: FundQuoteDTO | null;
42
+ ok: boolean;
43
+ error: string | undefined;
44
+ }>;
45
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useGlyphView: () => {
2
+ setGlyphView: import('react').Dispatch<import('react').SetStateAction<import('..').GlyphView>>;
3
+ };
@@ -0,0 +1,2 @@
1
+ declare const useMediaQuery: (query: string) => boolean;
2
+ export default useMediaQuery;
@@ -0,0 +1,11 @@
1
+ interface GlyphLogin {
2
+ login: () => void;
3
+ logout: () => void;
4
+ }
5
+ /**
6
+ * Use the `useNativeGlyphConnection` hook to login with Glyph.
7
+ * @param askForSignature - Whether to ask for a signature from the user. Pass true if you want to use the Glyph Widget or want the useGlyph hook to be ready for use. Defaults to true.
8
+ * @returns The login and logout functions.
9
+ */
10
+ export declare const useNativeGlyphConnection: (askForSignature?: boolean) => GlyphLogin;
11
+ export {};
@@ -0,0 +1,20 @@
1
+ import { default as GlyphWidget } from './components/GlyphWidget';
2
+ import { default as LoginButton } from './components/LoginButton';
3
+ import { default as LogoutButton } from './components/LogoutButton';
4
+ import { default as SignUpButton } from './components/SignUpButton';
5
+ import { default as GlyphProvider } from './context/GlyphProvider';
6
+ export { useBalances } from './hooks/useBalances';
7
+ export { useGlyph } from './hooks/useGlyph';
8
+ export { useGlyphFunding, type GLYPH_FUND_STATUS } from './hooks/useGlyphFunding';
9
+ export { useGlyphView } from './hooks/useGlyphView';
10
+ export { glyphConnectorDetails } from './lib/constants';
11
+ export { GlyphViewType as GlyphView, StrategyType } from './types';
12
+ export { GlyphProvider, GlyphWidget, LoginButton, LogoutButton, SignUpButton };
13
+ export { GlyphWalletProvider } from './lib/eip1193/GlyphWalletProvider';
14
+ export { glyphWalletConnector } from './lib/eip1193/glyphWalletConnector';
15
+ export { glyphWalletRK, glyphWalletRKStaging } from './lib/eip1193/glyphWalletRK';
16
+ export { useNativeGlyphConnection } from './hooks/useNativeGlyphConnection';
17
+ export { GLYPH_ICON_URL, GLYPH_PRIVY_APP_ID, STAGING_GLYPH_PRIVY_APP_ID } from './lib/constants';
18
+ export { GLYPH_APP_LOGIN_METHOD, GlyphPrivyProvider, STAGING_GLYPH_APP_LOGIN_METHOD } from './lib/privy/GlyphPrivyProvider';
19
+ export { InjectWagmiConnector } from './lib/privy/InjectWagmiConnector';
20
+ export { usePrivyCrossAppProvider } from './lib/privy/usePrivyCrossAppProvider';
@@ -0,0 +1,45 @@
1
+ export declare const DASHBOARD_BASE_URL: string;
2
+ export declare const GLYPH_PRIVY_APP_ID: string;
3
+ export declare const STAGING_GLYPH_PRIVY_APP_ID = "clxt9p8e601al6tgmsyhu7j3t";
4
+ export declare const WIDGET_API_BASE_URL: string;
5
+ export declare const GLYPH_ICON_URL = "https://i.ibb.co/TxcwPQyr/Group-12489-1.png";
6
+ export declare const USER_REFRESH_INTERVAL_MS: number;
7
+ export declare const TOKEN_REFRESH_INTERVAL_MS: number;
8
+ export declare enum INTERNAL_GRADIENT_TYPE {
9
+ PRIMARY = "primary",
10
+ SUCCESS = "success",
11
+ ERROR = "error"
12
+ }
13
+ export declare enum WalletView {
14
+ MAIN = "main",
15
+ FUND = "fund",
16
+ SEND = "send",
17
+ RECEIVE = "receive",
18
+ PROFILE = "profile"
19
+ }
20
+ export declare enum WalletMainViewTab {
21
+ HOME = "home",
22
+ ACTIVITY = "activity",
23
+ TOKENS = "tokens",
24
+ LINKED_ACCOUNTS = "linked-accounts"
25
+ }
26
+ export declare enum FundView {
27
+ BUY = "fund-buy",
28
+ WAIT = "fund-wait",
29
+ END = "fund-end"
30
+ }
31
+ export declare enum SendView {
32
+ ENTER_ADDRESS = "send-enter-address",
33
+ ENTER_AMOUNT = "send-enter-amount",
34
+ WAIT = "send-wait",
35
+ END = "send-end"
36
+ }
37
+ export declare const TOKEN_LOGOS: Record<string, React.FC<React.SVGProps<SVGSVGElement>>>;
38
+ export declare const glyphConnectorDetails: {
39
+ readonly id: "io.useglyph.privy";
40
+ readonly name: "Glyph";
41
+ readonly iconUrl: "https://i.ibb.co/TxcwPQyr/Group-12489-1.png";
42
+ readonly iconBackground: "#ffffff";
43
+ readonly shortName: "Glyph";
44
+ readonly type: "injected";
45
+ };
@@ -0,0 +1,40 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { default as React } from 'react';
3
+ import { Chain, Transport } from 'viem';
4
+ /**
5
+ * Configuration options for the GlyphWalletProvider.
6
+ * @interface GlyphWalletProviderProps
7
+ * @property {[Chain, ...Chain[]]} chains - The chains to use, defaults to apeChain.
8
+ * @property {Record<number, Transport>} transports - Optional transports to use, defaults to standard http.
9
+ * @property {QueryClient} queryClient - Optional query client to use, defaults to a standard query client.
10
+ * @property {React.ReactNode} children - The children to render.
11
+ */
12
+ interface GlyphWalletProviderProps {
13
+ chains: [Chain, ...Chain[]];
14
+ transports?: Record<number, Transport>;
15
+ queryClient?: QueryClient;
16
+ children: React.ReactNode;
17
+ glyphUrl?: string;
18
+ useStagingTenant?: boolean;
19
+ ssr?: boolean;
20
+ }
21
+ /**
22
+ * GlyphWalletProvider is a React provider that wraps the WagmiProvider and QueryClientProvider.
23
+ * It provides the GlyphWalletContext to its children.
24
+ * @example
25
+ * ```tsx
26
+ * import { GlyphWalletProvider } from '@yuga-labs/glyph-sdk-react';
27
+ *
28
+ * const App = () => {
29
+ * const queryClient = new QueryClient()
30
+ * return (
31
+ * <GlyphWalletProvider chains={[apeChain]} queryClient={queryClient}>
32
+ * <Component {...pageProps} />
33
+ * </GlyphWalletProvider>
34
+ * );
35
+ * };
36
+ * ```
37
+ * @param {GlyphWalletConfig} config - The configuration for the GlyphWalletProvider.
38
+ */
39
+ export declare const GlyphWalletProvider: ({ chains, transports, queryClient, children, glyphUrl, useStagingTenant, ssr }: GlyphWalletProviderProps) => import("react/jsx-runtime").JSX.Element;
40
+ export {};
@@ -0,0 +1,35 @@
1
+ import { EIP1193EventMap, EIP1193RequestFn, EIP1474Methods } from 'viem';
2
+ import { WalletDetailsParams } from '@rainbow-me/rainbowkit';
3
+ import { CreateConnectorFn } from 'wagmi';
4
+ interface GlyphWalletConnectorOptions {
5
+ /** RainbowKit connector details */
6
+ rkDetails: WalletDetailsParams;
7
+ /** Optional custom paymaster handler */
8
+ useStagingTenant?: boolean;
9
+ }
10
+ /**
11
+ * Create a wagmi connector for the Glyph Global Wallet.
12
+ *
13
+ * Adapted from wagmi injected connector as a reference implementation:
14
+ * https://github.com/wevm/wagmi/blob/main/packages/core/src/connectors/injected.ts#L94
15
+ *
16
+ * @example
17
+ * import { createConfig, http } from "wagmi";
18
+ * import { apeChain } from "wagmi/chains";
19
+ * import { glyphWalletConnector } from "@yuga-labs/glyph-sdk-react"
20
+ *
21
+ * export const wagmiConfig = createConfig({
22
+ * chains: [apeChain],
23
+ * transports: {
24
+ * [apeChain.id]: http(),
25
+ * },
26
+ * connectors: [glyphWalletConnector()],
27
+ * ssr: true,
28
+ * });
29
+ */
30
+ declare function glyphWalletConnector(options?: Partial<GlyphWalletConnectorOptions>): CreateConnectorFn<{
31
+ on: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
32
+ removeListener: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
33
+ request: EIP1193RequestFn<EIP1474Methods>;
34
+ }, Record<string, unknown>, Record<string, unknown>>;
35
+ export { glyphWalletConnector };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Create a RainbowKit wallet for Glyph Global Wallet
3
+ *
4
+ * @example
5
+ * import { connectorsForWallets } from "@rainbow-me/rainbowkit";
6
+ * import { glyphWalletRK } from "@yuga-labs/glyph-sdk-react"
7
+ *
8
+ * const connectors = connectorsForWallets(
9
+ * [
10
+ * {
11
+ * groupName: "Glyph",
12
+ * wallets: [glyphWalletRK],
13
+ * },
14
+ * ]);
15
+ */
16
+ declare const glyphWalletRK: () => import('@rainbow-me/rainbowkit').Wallet;
17
+ declare const glyphWalletRKStaging: () => import('@rainbow-me/rainbowkit').Wallet;
18
+ export { glyphWalletRK, glyphWalletRKStaging };
@@ -0,0 +1,2 @@
1
+ export declare const formatCurrency: (amount?: number | string, currency?: string | null) => string;
2
+ export declare const currencyToSymbol: (currency?: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare function limitDecimals(value: string, separator: string, maxDecimals: number): string;
2
+ export declare function formatInputNumber(value: string, maxDecimals: number): string;
@@ -0,0 +1,11 @@
1
+ type OpenPopupProps = {
2
+ url: string;
3
+ height: number;
4
+ width: number;
5
+ target?: string;
6
+ };
7
+ /**
8
+ * Open a popup in the center of the screen with the specified size.
9
+ */
10
+ export declare function openPopup({ url, target, height, width }: OpenPopupProps): void;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ import { LoginMethodOrderOption, PrivyProviderProps } from '@privy-io/react-auth';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { Chain, Transport } from 'viem';
4
+ import { default as React } from 'react';
5
+ export declare const GLYPH_APP_LOGIN_METHOD: LoginMethodOrderOption;
6
+ export declare const STAGING_GLYPH_APP_LOGIN_METHOD: LoginMethodOrderOption;
7
+ /**
8
+ * Configuration options for the GlyphPrivyProvider.
9
+ * @interface GlyphPrivyProviderProps
10
+ * @extends PrivyProviderProps
11
+ * @property {[Chain, ...Chain[]]} chains - The chains to use, defaults to apeChain.
12
+ * @property {Record<number, Transport>} transports - Optional transports to use, defaults to standard http.
13
+ * @property {QueryClient} queryClient - Optional query client to use, defaults to a standard query client.
14
+ * @property {boolean} ssr - Optional ssr to use, defaults to true.
15
+ */
16
+ interface GlyphPrivyProviderProps extends PrivyProviderProps {
17
+ chains: [Chain, ...Chain[]];
18
+ transports?: Record<number, Transport>;
19
+ queryClient?: QueryClient;
20
+ glyphUrl?: string;
21
+ useStagingTenant?: boolean;
22
+ ssr?: boolean;
23
+ }
24
+ export declare const GlyphPrivyProvider: React.MemoExoticComponent<({ chains, transports, queryClient, glyphUrl, useStagingTenant, ssr, ...props }: GlyphPrivyProviderProps) => import("react/jsx-runtime").JSX.Element>;
25
+ export {};
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export declare const InjectWagmiConnector: ({ children, useStagingTenant }: {
3
+ children: React.ReactNode;
4
+ useStagingTenant?: boolean;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { Chain, EIP1193RequestFn, EIP1474Methods } from 'viem';
2
+ interface UsePrivyCrossAppEIP1193Props {
3
+ chains: readonly Chain[];
4
+ useStagingTenant?: boolean;
5
+ }
6
+ export declare const usePrivyCrossAppProvider: ({ chains, useStagingTenant }: UsePrivyCrossAppEIP1193Props) => {
7
+ ready: boolean | null;
8
+ provider: {
9
+ on: <event extends keyof import('viem').EIP1193EventMap>(event: event, listener: import('viem').EIP1193EventMap[event]) => void;
10
+ removeListener: <event extends keyof import('viem').EIP1193EventMap>(event: event, listener: import('viem').EIP1193EventMap[event]) => void;
11
+ request: EIP1193RequestFn<EIP1474Methods>;
12
+ };
13
+ chainId: number;
14
+ };
15
+ export {};