signer-test-sdk-react 0.0.18 → 0.0.20

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 (58) hide show
  1. package/dist/src/AbstraxnProvider.d.ts +2 -2
  2. package/dist/src/AbstraxnProvider.js +603 -534
  3. package/dist/src/AbstraxnProvider.js.map +1 -1
  4. package/dist/src/ConnectButton.css +1 -1
  5. package/dist/src/ExternalWalletButtons.css +1 -1
  6. package/dist/src/WalletModal.css +193 -373
  7. package/dist/src/WalletModal.d.ts +1 -1
  8. package/dist/src/WalletModal.js +108 -45
  9. package/dist/src/WalletModal.js.map +1 -1
  10. package/dist/src/chains.d.ts +4 -3
  11. package/dist/src/chains.js +154 -84
  12. package/dist/src/chains.js.map +1 -1
  13. package/dist/src/components/OnboardingUI/OnboardingUI.css +6 -5
  14. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +6 -0
  15. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -1
  16. package/dist/src/components/WalletModal/components/ChainSelector.css +249 -102
  17. package/dist/src/components/WalletModal/components/ChainSelector.d.ts +7 -6
  18. package/dist/src/components/WalletModal/components/ChainSelector.js +68 -27
  19. package/dist/src/components/WalletModal/components/ChainSelector.js.map +1 -1
  20. package/dist/src/components/WalletModal/components/ExportKeyModal.css +89 -88
  21. package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +6 -1
  22. package/dist/src/components/WalletModal/components/ExportKeyModal.js +6 -11
  23. package/dist/src/components/WalletModal/components/ExportKeyModal.js.map +1 -1
  24. package/dist/src/components/WalletModal/components/ExportWarningModal.css +107 -2
  25. package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +7 -1
  26. package/dist/src/components/WalletModal/components/ExportWarningModal.js +5 -3
  27. package/dist/src/components/WalletModal/components/ExportWarningModal.js.map +1 -1
  28. package/dist/src/components/WalletModal/components/ManageWalletModal.css +90 -4
  29. package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +3 -3
  30. package/dist/src/components/WalletModal/components/ManageWalletModal.js +28 -13
  31. package/dist/src/components/WalletModal/components/ManageWalletModal.js.map +1 -1
  32. package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +3 -4
  33. package/dist/src/components/WalletModal/components/ReceiveModal.css +93 -58
  34. package/dist/src/components/WalletModal/components/ReceiveModal.js +1 -1
  35. package/dist/src/components/WalletModal/components/ReceiveModal.js.map +1 -1
  36. package/dist/src/components/WalletModal/components/SendModal.css +170 -127
  37. package/dist/src/components/WalletModal/components/SendModal.d.ts +4 -6
  38. package/dist/src/components/WalletModal/components/SendModal.js +131 -39
  39. package/dist/src/components/WalletModal/components/SendModal.js.map +1 -1
  40. package/dist/src/components/WalletModal/components/SuccessModal.css +7 -8
  41. package/dist/src/components/WalletModal/components/TokenSelectorModal.css +240 -0
  42. package/dist/src/components/WalletModal/components/TokenSelectorModal.d.ts +21 -0
  43. package/dist/src/components/WalletModal/components/TokenSelectorModal.js +44 -0
  44. package/dist/src/components/WalletModal/components/TokenSelectorModal.js.map +1 -0
  45. package/dist/src/components/WalletModal/components/index.d.ts +2 -0
  46. package/dist/src/components/WalletModal/components/index.js +1 -0
  47. package/dist/src/components/WalletModal/components/index.js.map +1 -1
  48. package/dist/src/hooks.js +5 -39
  49. package/dist/src/hooks.js.map +1 -1
  50. package/dist/src/index.d.ts +1 -0
  51. package/dist/src/index.js +1 -0
  52. package/dist/src/index.js.map +1 -1
  53. package/dist/src/types.d.ts +18 -0
  54. package/dist/src/wagmiConfig.d.ts +1 -1
  55. package/dist/src/wagmiConfig.js +9 -8
  56. package/dist/src/wagmiConfig.js.map +1 -1
  57. package/dist/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +1 -1
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import type { AbstraxnWalletConfig, User, WhoamiResponse } from "signer-test-sdk-core";
5
5
  import type { Theme } from "signer-test-sdk-core";
6
+ import type { Config, State } from 'wagmi';
6
7
  /**
7
8
  * UI Configuration for the provider
8
9
  */
@@ -100,6 +101,12 @@ export interface ExternalWalletConfig {
100
101
  * @default ['injected']
101
102
  */
102
103
  connectors?: ("injected" | "metaMask" | "walletConnect")[];
104
+ /**
105
+ * Enable SSR support (uses cookie storage)
106
+ * Recommended for Next.js applications
107
+ * @default false
108
+ */
109
+ ssr?: boolean;
103
110
  }
104
111
  /**
105
112
  * Chain Configuration
@@ -148,6 +155,17 @@ export interface AbstraxnProviderConfig extends AbstraxnWalletConfig {
148
155
  * Chain configuration
149
156
  */
150
157
  chains?: ChainConfig;
158
+ /**
159
+ * Optional custom wagmi config
160
+ * If provided, this will be used instead of creating a new one
161
+ * Useful for Next.js SSR or custom connector setups
162
+ */
163
+ wagmiConfig?: Config;
164
+ /**
165
+ * Optional initial state for hydration
166
+ * Useful for Next.js SSR with cookie storage
167
+ */
168
+ initialState?: State;
151
169
  }
152
170
  /**
153
171
  * Context value type
@@ -9,7 +9,7 @@ import { type Chain as CoreChain } from 'signer-test-sdk-core';
9
9
  * Note: Uses 'injected' connector which automatically detects MetaMask and other wallets
10
10
  * without requiring @metamask/sdk
11
11
  */
12
- export declare function createWagmiConfig(chains?: CoreChain[] | Chain[], walletConnectProjectId?: string, enabledConnectors?: ('injected' | 'metaMask' | 'walletConnect')[], theme?: 'light' | 'dark'): Config;
12
+ export declare function createWagmiConfig(chains?: CoreChain[] | Chain[], walletConnectProjectId?: string, enabledConnectors?: ('injected' | 'metaMask' | 'walletConnect')[], theme?: 'light' | 'dark', ssr?: boolean): Config;
13
13
  /**
14
14
  * External wallet connector types
15
15
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wagmi configuration for external wallet support
3
3
  */
4
- import { createConfig, createStorage, http } from '@wagmi/core';
4
+ import { createConfig, createStorage, http, cookieStorage } from '@wagmi/core';
5
5
  import { injected, walletConnect } from 'wagmi/connectors';
6
6
  import { polygonAmoy } from 'viem/chains';
7
7
  import { SUPPORTED_CHAINS } from 'signer-test-sdk-core';
@@ -30,7 +30,7 @@ function convertToViemChain(chain) {
30
30
  * Note: Uses 'injected' connector which automatically detects MetaMask and other wallets
31
31
  * without requiring @metamask/sdk
32
32
  */
33
- export function createWagmiConfig(chains, walletConnectProjectId, enabledConnectors, theme) {
33
+ export function createWagmiConfig(chains, walletConnectProjectId, enabledConnectors, theme, ssr) {
34
34
  // Check if chains are already viem Chain objects (have rpcUrls.default.http structure)
35
35
  const isViemChains = chains && chains?.length > 0 && chains[0].rpcUrls?.default?.http;
36
36
  const viemChains = chains
@@ -78,12 +78,13 @@ export function createWagmiConfig(chains, walletConnectProjectId, enabledConnect
78
78
  acc[chain.id] = http();
79
79
  return acc;
80
80
  }, {}),
81
- // Configure storage to use localStorage for persistence
82
- // This enables automatic connection restoration on page reload
83
- storage: typeof window !== 'undefined'
84
- ? createStorage({ storage: window.localStorage })
85
- : undefined,
86
- ssr: false,
81
+ // Configure storage based on SSR setting
82
+ storage: ssr
83
+ ? createStorage({ storage: cookieStorage })
84
+ : (typeof window !== 'undefined'
85
+ ? createStorage({ storage: window.localStorage })
86
+ : undefined),
87
+ ssr: !!ssr,
87
88
  });
88
89
  }
89
90
  //# sourceMappingURL=wagmiConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wagmiConfig.js","sourceRoot":"","sources":["../../src/wagmiConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,EAAe,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAA2B,MAAM,sBAAsB,CAAC;AAEjF;;;GAGG;AACH,SAAS,kBAAkB,CAAC,KAAgB;IAC1C,0DAA0D;IAC1D,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QACvB,OAAO,WAAW,CAAC;IACrB,CAAC;IA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