@openzeppelin/ui-builder-adapter-stellar 1.1.3 → 1.3.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.
Files changed (83) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +540 -494
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +5 -1
  5. package/dist/index.d.ts +5 -1
  6. package/dist/index.js +122 -89
  7. package/dist/index.js.map +1 -1
  8. package/package.json +5 -5
  9. package/src/access-control/actions.ts +1 -1
  10. package/src/access-control/feature-detection.ts +2 -2
  11. package/src/access-control/indexer-client.ts +3 -7
  12. package/src/access-control/onchain-reader.ts +3 -7
  13. package/src/access-control/service.ts +3 -3
  14. package/src/access-control/validation.ts +3 -3
  15. package/src/adapter.ts +12 -3
  16. package/src/config.ts +1 -1
  17. package/src/configuration/__tests__/explorer.test.ts +1 -1
  18. package/src/configuration/__tests__/rpc.test.ts +4 -4
  19. package/src/configuration/execution.ts +2 -2
  20. package/src/configuration/explorer.ts +2 -2
  21. package/src/configuration/network-services.ts +2 -2
  22. package/src/configuration/rpc.ts +2 -7
  23. package/src/contract/loader.ts +2 -2
  24. package/src/contract/type.ts +2 -2
  25. package/src/mapping/constants.ts +39 -1
  26. package/src/mapping/enum-metadata.ts +2 -2
  27. package/src/mapping/field-generator.ts +2 -2
  28. package/src/mapping/index.ts +1 -0
  29. package/src/mapping/struct-fields.ts +2 -2
  30. package/src/mapping/tuple-components.ts +1 -1
  31. package/src/mapping/type-coverage-validator.ts +2 -2
  32. package/src/mapping/type-mapper.ts +1 -1
  33. package/src/networks/index.ts +1 -1
  34. package/src/networks/mainnet.ts +1 -1
  35. package/src/networks/testnet.ts +1 -1
  36. package/src/query/handler.ts +2 -2
  37. package/src/query/view-checker.ts +1 -1
  38. package/src/sac/spec-cache.ts +1 -1
  39. package/src/sac/spec-source.ts +1 -1
  40. package/src/sac/xdr.ts +1 -1
  41. package/src/transaction/components/AdvancedInfo.tsx +1 -1
  42. package/src/transaction/components/FeeConfiguration.tsx +1 -1
  43. package/src/transaction/components/StellarRelayerOptions.tsx +1 -1
  44. package/src/transaction/components/TransactionTiming.tsx +1 -1
  45. package/src/transaction/eoa.ts +2 -2
  46. package/src/transaction/execution-strategy.ts +1 -1
  47. package/src/transaction/formatter.ts +3 -3
  48. package/src/transaction/relayer.ts +2 -2
  49. package/src/transaction/sender.ts +2 -2
  50. package/src/transform/output-formatter.ts +2 -2
  51. package/src/transform/parsers/complex-parser.ts +1 -1
  52. package/src/transform/parsers/generic-parser.ts +2 -2
  53. package/src/transform/parsers/index.ts +2 -2
  54. package/src/transform/parsers/primitive-parser.ts +1 -1
  55. package/src/transform/parsers/scval-converter.ts +2 -2
  56. package/src/transform/parsers/struct-parser.ts +2 -2
  57. package/src/utils/input-parsing.ts +1 -1
  58. package/src/utils/type-detection.ts +1 -1
  59. package/src/validation/eoa.ts +2 -2
  60. package/src/validation/relayer.ts +1 -1
  61. package/src/wallet/README.md +1 -1
  62. package/src/wallet/components/StellarWalletUiRoot.tsx +2 -2
  63. package/src/wallet/components/account/AccountDisplay.tsx +22 -11
  64. package/src/wallet/components/connect/ConnectButton.tsx +14 -9
  65. package/src/wallet/components/connect/ConnectorDialog.tsx +3 -3
  66. package/src/wallet/connection.ts +2 -2
  67. package/src/wallet/hooks/facade-hooks.ts +1 -1
  68. package/src/wallet/hooks/useStellarConnect.ts +1 -1
  69. package/src/wallet/hooks/useUiKitConfig.ts +2 -2
  70. package/src/wallet/implementation/wallets-kit-implementation.ts +2 -6
  71. package/src/wallet/services/__tests__/configResolutionService.test.ts +1 -1
  72. package/src/wallet/services/configResolutionService.ts +2 -2
  73. package/src/wallet/stellar-wallets-kit/StellarWalletsKitConnectButton.tsx +1 -1
  74. package/src/wallet/stellar-wallets-kit/__tests__/export-service.test.ts +1 -1
  75. package/src/wallet/stellar-wallets-kit/config-generator.ts +1 -1
  76. package/src/wallet/stellar-wallets-kit/export-service.ts +1 -1
  77. package/src/wallet/stellar-wallets-kit/stellarUiKitManager.ts +2 -2
  78. package/src/wallet/types.ts +1 -1
  79. package/src/wallet/utils/__tests__/filterWalletComponents.test.ts +1 -1
  80. package/src/wallet/utils/__tests__/uiKitService.test.ts +1 -1
  81. package/src/wallet/utils/filterWalletComponents.ts +3 -3
  82. package/src/wallet/utils/stellarWalletImplementationManager.ts +2 -2
  83. package/src/wallet/utils/uiKitService.ts +2 -2
@@ -1,7 +1,7 @@
1
1
  import { nativeToScVal, xdr } from '@stellar/stellar-sdk';
2
2
 
3
- import { isEnumValue, type FunctionParameter } from '@openzeppelin/ui-builder-types';
4
- import { isPlainObject, logger } from '@openzeppelin/ui-builder-utils';
3
+ import { isEnumValue, type FunctionParameter } from '@openzeppelin/ui-types';
4
+ import { isPlainObject, logger } from '@openzeppelin/ui-utils';
5
5
 
6
6
  import { convertStellarTypeToScValType } from '../../utils/formatting';
7
7
  import { isLikelyEnumType } from '../../utils/type-detection';
@@ -1,6 +1,6 @@
1
1
  import { nativeToScVal, xdr } from '@stellar/stellar-sdk';
2
2
 
3
- import { detectBytesEncoding, logger, stringToBytes } from '@openzeppelin/ui-builder-utils';
3
+ import { detectBytesEncoding, logger, stringToBytes } from '@openzeppelin/ui-utils';
4
4
 
5
5
  // Import types for internal use
6
6
  import type {
@@ -1,6 +1,6 @@
1
1
  import * as StellarSdk from '@stellar/stellar-sdk';
2
2
 
3
- import { isDevelopmentOrTestEnvironment, logger } from '@openzeppelin/ui-builder-utils';
3
+ import { isDevelopmentOrTestEnvironment, logger } from '@openzeppelin/ui-utils';
4
4
 
5
5
  /**
6
6
  * Utility functions for detecting and analyzing Stellar/Soroban parameter types
@@ -1,5 +1,5 @@
1
- import { EoaExecutionConfig } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import { EoaExecutionConfig } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { StellarWalletConnectionStatus } from '../wallet/types';
5
5
  import { isValidAddress } from './address';
@@ -1,4 +1,4 @@
1
- import { RelayerExecutionConfig } from '@openzeppelin/ui-builder-types';
1
+ import { RelayerExecutionConfig } from '@openzeppelin/ui-types';
2
2
 
3
3
  export async function validateRelayerConfig(
4
4
  config: RelayerExecutionConfig
@@ -90,4 +90,4 @@ wallet/
90
90
 
91
91
  ## Usage in Application
92
92
 
93
- `StellarWalletUiRoot` is returned by the adapter and used by the Builder’s `WalletStateProvider`. Use `useWalletState()` and facade hooks from `@openzeppelin/ui-builder-react-core` to render the wallet UI components from `getEcosystemWalletComponents()`.
93
+ `StellarWalletUiRoot` is returned by the adapter and used by the Builder’s `WalletStateProvider`. Use `useWalletState()` and facade hooks from `@openzeppelin/ui-react` to render the wallet UI components from `getEcosystemWalletComponents()`.
@@ -1,8 +1,8 @@
1
1
  import type { ISupportedWallet } from '@creit.tech/stellar-wallets-kit';
2
2
  import { ReactNode, useCallback, useEffect, useState } from 'react';
3
3
 
4
- import type { UiKitConfiguration } from '@openzeppelin/ui-builder-types';
5
- import { logger } from '@openzeppelin/ui-builder-utils';
4
+ import type { UiKitConfiguration } from '@openzeppelin/ui-types';
5
+ import { logger } from '@openzeppelin/ui-utils';
6
6
 
7
7
  import {
8
8
  connectStellarWallet,
@@ -1,9 +1,9 @@
1
1
  import { LogOut } from 'lucide-react';
2
2
  import React from 'react';
3
3
 
4
- import type { BaseComponentProps } from '@openzeppelin/ui-builder-types';
5
- import { Button } from '@openzeppelin/ui-builder-ui';
6
- import { cn, truncateMiddle } from '@openzeppelin/ui-builder-utils';
4
+ import { Button } from '@openzeppelin/ui-components';
5
+ import type { BaseComponentProps } from '@openzeppelin/ui-types';
6
+ import { cn, getWalletAccountDisplaySizeProps, truncateMiddle } from '@openzeppelin/ui-utils';
7
7
 
8
8
  import { useStellarAccount, useStellarDisconnect } from '../../hooks';
9
9
 
@@ -11,28 +11,39 @@ import { useStellarAccount, useStellarDisconnect } from '../../hooks';
11
11
  * A component that displays the connected account address.
12
12
  * Also includes a disconnect button.
13
13
  */
14
- export const CustomAccountDisplay: React.FC<BaseComponentProps> = ({ className }) => {
14
+ export const CustomAccountDisplay: React.FC<BaseComponentProps> = ({
15
+ className,
16
+ size,
17
+ variant,
18
+ fullWidth,
19
+ }) => {
15
20
  const { isConnected, address } = useStellarAccount();
16
21
  const { disconnect } = useStellarDisconnect();
17
22
 
23
+ const sizeProps = getWalletAccountDisplaySizeProps(size);
24
+
18
25
  if (!isConnected || !address || !disconnect) {
19
26
  return null;
20
27
  }
21
28
 
22
29
  return (
23
- <div className={cn('flex items-center gap-2', className)}>
24
- <div className="flex flex-col">
25
- <span className="text-xs font-medium">{truncateMiddle(address, 4, 4)}</span>
26
- <span className="text-[9px] text-muted-foreground -mt-0.5">Stellar Account</span>
30
+ <div className={cn('flex items-center gap-2', fullWidth && 'w-full', className)}>
31
+ <div className={cn('flex flex-col', fullWidth && 'flex-1')}>
32
+ <span className={cn(sizeProps.textSize, 'font-medium')}>
33
+ {truncateMiddle(address, 4, 4)}
34
+ </span>
35
+ <span className={cn(sizeProps.subTextSize, 'text-muted-foreground -mt-0.5')}>
36
+ Stellar Account
37
+ </span>
27
38
  </div>
28
39
  <Button
29
40
  onClick={() => disconnect()}
30
- variant="ghost"
41
+ variant={variant || 'ghost'}
31
42
  size="icon"
32
- className="size-6 p-0"
43
+ className={cn(sizeProps.iconButtonSize, 'p-0')}
33
44
  title="Disconnect wallet"
34
45
  >
35
- <LogOut className="size-3.5" />
46
+ <LogOut className={sizeProps.iconSize} />
36
47
  </Button>
37
48
  </div>
38
49
  );
@@ -1,9 +1,9 @@
1
1
  import { Loader2, Wallet } from 'lucide-react';
2
2
  import React, { useEffect, useState } from 'react';
3
3
 
4
- import type { BaseComponentProps } from '@openzeppelin/ui-builder-types';
5
- import { Button } from '@openzeppelin/ui-builder-ui';
6
- import { cn } from '@openzeppelin/ui-builder-utils';
4
+ import { Button } from '@openzeppelin/ui-components';
5
+ import type { BaseComponentProps } from '@openzeppelin/ui-types';
6
+ import { cn, getWalletButtonSizeProps } from '@openzeppelin/ui-utils';
7
7
 
8
8
  import { useStellarAccount } from '../../hooks';
9
9
  import { ConnectorDialog } from './ConnectorDialog';
@@ -19,6 +19,9 @@ export interface ConnectButtonProps extends BaseComponentProps {
19
19
 
20
20
  export const CustomConnectButton: React.FC<ConnectButtonProps> = ({
21
21
  className,
22
+ size,
23
+ variant,
24
+ fullWidth,
22
25
  hideWhenConnected = true,
23
26
  }) => {
24
27
  const [dialogOpen, setDialogOpen] = useState(false);
@@ -27,6 +30,8 @@ export const CustomConnectButton: React.FC<ConnectButtonProps> = ({
27
30
  // Local state to indicate the button has been clicked and dialog is open, awaiting user selection
28
31
  const [isManuallyInitiated, setIsManuallyInitiated] = useState(false);
29
32
 
33
+ const sizeProps = getWalletButtonSizeProps(size);
34
+
30
35
  useEffect(() => {
31
36
  if (isConnected && hideWhenConnected) {
32
37
  setDialogOpen(false);
@@ -63,19 +68,19 @@ export const CustomConnectButton: React.FC<ConnectButtonProps> = ({
63
68
  const showButtonLoading = isConnecting || isManuallyInitiated;
64
69
 
65
70
  return (
66
- <div className={cn('flex items-center', className)}>
71
+ <div className={cn('flex items-center', fullWidth && 'w-full', className)}>
67
72
  <Button
68
73
  onClick={handleConnectClick}
69
74
  disabled={showButtonLoading || isConnected}
70
- variant="outline"
71
- size="sm"
72
- className="h-8 px-2 text-xs"
75
+ variant={variant || 'outline'}
76
+ size={sizeProps.size}
77
+ className={cn(sizeProps.className, fullWidth && 'w-full')}
73
78
  title={isConnected ? 'Connected' : 'Connect Wallet'}
74
79
  >
75
80
  {showButtonLoading ? (
76
- <Loader2 className="size-3.5 animate-spin mr-1" />
81
+ <Loader2 className={cn(sizeProps.iconSize, 'animate-spin mr-1')} />
77
82
  ) : (
78
- <Wallet className="size-3.5 mr-1" />
83
+ <Wallet className={cn(sizeProps.iconSize, 'mr-1')} />
79
84
  )}
80
85
  {showButtonLoading ? 'Connecting...' : 'Connect Wallet'}
81
86
  </Button>
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
 
3
- import type { Connector } from '@openzeppelin/ui-builder-types';
4
3
  import {
5
4
  Button,
6
5
  Dialog,
@@ -8,8 +7,9 @@ import {
8
7
  DialogDescription,
9
8
  DialogHeader,
10
9
  DialogTitle,
11
- } from '@openzeppelin/ui-builder-ui';
12
- import { logger } from '@openzeppelin/ui-builder-utils';
10
+ } from '@openzeppelin/ui-components';
11
+ import type { Connector } from '@openzeppelin/ui-types';
12
+ import { logger } from '@openzeppelin/ui-utils';
13
13
 
14
14
  import { getStellarAvailableConnectors } from '../../connection';
15
15
  import { useStellarAccount, useStellarConnect } from '../../hooks';
@@ -1,5 +1,5 @@
1
- import type { Connector } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { Connector } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import {
5
5
  getInitializedStellarWalletImplementation,
@@ -1,4 +1,4 @@
1
- import type { EcosystemSpecificReactHooks } from '@openzeppelin/ui-builder-types';
1
+ import type { EcosystemSpecificReactHooks } from '@openzeppelin/ui-types';
2
2
 
3
3
  import { useStellarAccount } from './useStellarAccount';
4
4
  import { useStellarConnect } from './useStellarConnect';
@@ -1,7 +1,7 @@
1
1
  import type { ISupportedWallet } from '@creit.tech/stellar-wallets-kit';
2
2
  import { useCallback, useState } from 'react';
3
3
 
4
- import type { Connector } from '@openzeppelin/ui-builder-types';
4
+ import type { Connector } from '@openzeppelin/ui-types';
5
5
 
6
6
  import { useStellarWalletContext } from '../context';
7
7
 
@@ -1,5 +1,5 @@
1
- import type { UiKitConfiguration } from '@openzeppelin/ui-builder-types';
2
- import { appConfigService, logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { UiKitConfiguration } from '@openzeppelin/ui-types';
2
+ import { appConfigService, logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  /**
5
5
  * Default configuration when no specific configuration is provided
@@ -11,12 +11,8 @@ import {
11
11
  WalletNetwork,
12
12
  } from '@creit.tech/stellar-wallets-kit';
13
13
 
14
- import type {
15
- Connector,
16
- StellarNetworkConfig,
17
- UiKitConfiguration,
18
- } from '@openzeppelin/ui-builder-types';
19
- import { logger } from '@openzeppelin/ui-builder-utils';
14
+ import type { Connector, StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-types';
15
+ import { logger } from '@openzeppelin/ui-utils';
20
16
 
21
17
  import type { StellarConnectionStatusListener, StellarWalletConnectionStatus } from '../types';
22
18
 
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it, vi } from 'vitest';
2
2
 
3
- import type { UiKitConfiguration, UiKitName } from '@openzeppelin/ui-builder-types';
3
+ import type { UiKitConfiguration, UiKitName } from '@openzeppelin/ui-types';
4
4
 
5
5
  import { resolveFullUiKitConfiguration } from '../configResolutionService';
6
6
 
@@ -1,5 +1,5 @@
1
- import type { NativeConfigLoader, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { NativeConfigLoader, UiKitConfiguration } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  /**
5
5
  * Resolves the final, complete UiKitConfiguration for Stellar by merging various sources.
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
 
3
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import { logger } from '@openzeppelin/ui-utils';
4
4
 
5
5
  import { setStellarConnectedAddress } from '../connection';
6
6
  import { stellarUiKitManager } from './stellarUiKitManager';
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import type { UiKitConfiguration } from '@openzeppelin/ui-builder-types';
3
+ import type { UiKitConfiguration } from '@openzeppelin/ui-types';
4
4
 
5
5
  import { generateStellarWalletsKitExportables } from '../export-service';
6
6
 
@@ -1,4 +1,4 @@
1
- import type { UiKitConfiguration } from '@openzeppelin/ui-builder-types';
1
+ import type { UiKitConfiguration } from '@openzeppelin/ui-types';
2
2
 
3
3
  /**
4
4
  * Generates the content for a `stellar-wallets-kit.config.ts` file for an exported project.
@@ -1,4 +1,4 @@
1
- import type { UiKitConfiguration } from '@openzeppelin/ui-builder-types';
1
+ import type { UiKitConfiguration } from '@openzeppelin/ui-types';
2
2
 
3
3
  import { generateStellarWalletsKitConfigFile } from './config-generator';
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { allowAllModules, StellarWalletsKit, WalletNetwork } from '@creit.tech/stellar-wallets-kit';
2
2
 
3
- import type { StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
4
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import type { StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-types';
4
+ import { logger } from '@openzeppelin/ui-utils';
5
5
 
6
6
  import { getStellarWalletImplementation } from '../utils/stellarWalletImplementationManager';
7
7
 
@@ -1,4 +1,4 @@
1
- import type { WalletConnectionStatus } from '@openzeppelin/ui-builder-types';
1
+ import type { WalletConnectionStatus } from '@openzeppelin/ui-types';
2
2
 
3
3
  /**
4
4
  * Stellar-specific wallet connection status extending the base interface.
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import type { EcosystemWalletComponents } from '@openzeppelin/ui-builder-types';
3
+ import type { EcosystemWalletComponents } from '@openzeppelin/ui-types';
4
4
 
5
5
  import {
6
6
  filterWalletComponents,
@@ -1,6 +1,6 @@
1
1
  import { beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
- import type { UiKitConfiguration, UiKitName } from '@openzeppelin/ui-builder-types';
3
+ import type { UiKitConfiguration, UiKitName } from '@openzeppelin/ui-types';
4
4
 
5
5
  import { CustomAccountDisplay, CustomConnectButton } from '../../components';
6
6
  import { getResolvedWalletComponents } from '../uiKitService';
@@ -1,6 +1,6 @@
1
- import type { EcosystemWalletComponents, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
2
- import { ECOSYSTEM_WALLET_COMPONENT_KEYS } from '@openzeppelin/ui-builder-types';
3
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { EcosystemWalletComponents, UiKitConfiguration } from '@openzeppelin/ui-types';
2
+ import { ECOSYSTEM_WALLET_COMPONENT_KEYS } from '@openzeppelin/ui-types';
3
+ import { logger } from '@openzeppelin/ui-utils';
4
4
 
5
5
  /**
6
6
  * Filters a set of wallet components based on an exclusion list.
@@ -1,5 +1,5 @@
1
- import type { StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
2
- import { appConfigService, logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-types';
2
+ import { appConfigService, logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { WalletsKitImplementation } from '../implementation/wallets-kit-implementation';
5
5
 
@@ -1,5 +1,5 @@
1
- import type { EcosystemWalletComponents, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { EcosystemWalletComponents, UiKitConfiguration } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { CustomAccountDisplay, CustomConnectButton } from '../components';
5
5
  import { StellarWalletsKitConnectButton } from '../stellar-wallets-kit';