@openzeppelin/ui-builder-adapter-stellar 1.2.0 → 1.4.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/index.d.cts CHANGED
@@ -35,6 +35,10 @@ declare class StellarAdapter implements ContractAdapter {
35
35
  latency?: number;
36
36
  error?: string;
37
37
  }>;
38
+ /**
39
+ * @inheritdoc
40
+ */
41
+ getDefaultServiceConfig(serviceId: string): Record<string, unknown> | null;
38
42
  /**
39
43
  * NOTE about artifact inputs (single input with auto-detection):
40
44
  *
package/dist/index.d.ts CHANGED
@@ -35,6 +35,10 @@ declare class StellarAdapter implements ContractAdapter {
35
35
  latency?: number;
36
36
  error?: string;
37
37
  }>;
38
+ /**
39
+ * @inheritdoc
40
+ */
41
+ getDefaultServiceConfig(serviceId: string): Record<string, unknown> | null;
38
42
  /**
39
43
  * NOTE about artifact inputs (single input with auto-detection):
40
44
  *
package/dist/index.js CHANGED
@@ -5651,6 +5651,24 @@ async function testWithFallbackMethod(rpcConfig, signal, startTime) {
5651
5651
  }
5652
5652
 
5653
5653
  // src/configuration/network-services.ts
5654
+ function getStellarDefaultServiceConfig(networkConfig, serviceId) {
5655
+ switch (serviceId) {
5656
+ case "rpc":
5657
+ if (networkConfig.sorobanRpcUrl) {
5658
+ return { sorobanRpcUrl: networkConfig.sorobanRpcUrl };
5659
+ }
5660
+ break;
5661
+ case "indexer":
5662
+ if (networkConfig.indexerUri && networkConfig.indexerWsUri) {
5663
+ return {
5664
+ indexerUri: networkConfig.indexerUri,
5665
+ indexerWsUri: networkConfig.indexerWsUri
5666
+ };
5667
+ }
5668
+ break;
5669
+ }
5670
+ return null;
5671
+ }
5654
5672
  function getStellarNetworkServiceForms(exclude = []) {
5655
5673
  const forms = [
5656
5674
  {
@@ -7643,7 +7661,7 @@ function loadInitialConfigFromAppService() {
7643
7661
  import { Loader2, Wallet } from "lucide-react";
7644
7662
  import { useEffect as useEffect5, useState as useState6 } from "react";
7645
7663
  import { Button as Button4 } from "@openzeppelin/ui-components";
7646
- import { cn } from "@openzeppelin/ui-utils";
7664
+ import { cn, getWalletButtonSizeProps } from "@openzeppelin/ui-utils";
7647
7665
 
7648
7666
  // src/wallet/components/connect/ConnectorDialog.tsx
7649
7667
  import { useEffect as useEffect4, useState as useState5 } from "react";
@@ -7730,11 +7748,15 @@ var ConnectorDialog = ({ open, onOpenChange }) => {
7730
7748
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
7731
7749
  var CustomConnectButton = ({
7732
7750
  className,
7751
+ size,
7752
+ variant,
7753
+ fullWidth,
7733
7754
  hideWhenConnected = true
7734
7755
  }) => {
7735
7756
  const [dialogOpen, setDialogOpen] = useState6(false);
7736
7757
  const { isConnected, isConnecting } = useStellarAccount();
7737
7758
  const [isManuallyInitiated, setIsManuallyInitiated] = useState6(false);
7759
+ const sizeProps = getWalletButtonSizeProps(size);
7738
7760
  useEffect5(() => {
7739
7761
  if (isConnected && hideWhenConnected) {
7740
7762
  setDialogOpen(false);
@@ -7761,18 +7783,18 @@ var CustomConnectButton = ({
7761
7783
  return null;
7762
7784
  }
7763
7785
  const showButtonLoading = isConnecting || isManuallyInitiated;
7764
- return /* @__PURE__ */ jsxs6("div", { className: cn("flex items-center", className), children: [
7786
+ return /* @__PURE__ */ jsxs6("div", { className: cn("flex items-center", fullWidth && "w-full", className), children: [
7765
7787
  /* @__PURE__ */ jsxs6(
7766
7788
  Button4,
7767
7789
  {
7768
7790
  onClick: handleConnectClick,
7769
7791
  disabled: showButtonLoading || isConnected,
7770
- variant: "outline",
7771
- size: "sm",
7772
- className: "h-8 px-2 text-xs",
7792
+ variant: variant || "outline",
7793
+ size: sizeProps.size,
7794
+ className: cn(sizeProps.className, fullWidth && "w-full"),
7773
7795
  title: isConnected ? "Connected" : "Connect Wallet",
7774
7796
  children: [
7775
- showButtonLoading ? /* @__PURE__ */ jsx8(Loader2, { className: "size-3.5 animate-spin mr-1" }) : /* @__PURE__ */ jsx8(Wallet, { className: "size-3.5 mr-1" }),
7797
+ showButtonLoading ? /* @__PURE__ */ jsx8(Loader2, { className: cn(sizeProps.iconSize, "animate-spin mr-1") }) : /* @__PURE__ */ jsx8(Wallet, { className: cn(sizeProps.iconSize, "mr-1") }),
7776
7798
  showButtonLoading ? "Connecting..." : "Connect Wallet"
7777
7799
  ]
7778
7800
  }
@@ -7795,28 +7817,34 @@ var CustomConnectButton = ({
7795
7817
  // src/wallet/components/account/AccountDisplay.tsx
7796
7818
  import { LogOut } from "lucide-react";
7797
7819
  import { Button as Button5 } from "@openzeppelin/ui-components";
7798
- import { cn as cn2, truncateMiddle } from "@openzeppelin/ui-utils";
7820
+ import { cn as cn2, getWalletAccountDisplaySizeProps, truncateMiddle } from "@openzeppelin/ui-utils";
7799
7821
  import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
7800
- var CustomAccountDisplay = ({ className }) => {
7822
+ var CustomAccountDisplay = ({
7823
+ className,
7824
+ size,
7825
+ variant,
7826
+ fullWidth
7827
+ }) => {
7801
7828
  const { isConnected, address } = useStellarAccount();
7802
7829
  const { disconnect } = useStellarDisconnect();
7830
+ const sizeProps = getWalletAccountDisplaySizeProps(size);
7803
7831
  if (!isConnected || !address || !disconnect) {
7804
7832
  return null;
7805
7833
  }
7806
- return /* @__PURE__ */ jsxs7("div", { className: cn2("flex items-center gap-2", className), children: [
7807
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-col", children: [
7808
- /* @__PURE__ */ jsx9("span", { className: "text-xs font-medium", children: truncateMiddle(address, 4, 4) }),
7809
- /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground -mt-0.5", children: "Stellar Account" })
7834
+ return /* @__PURE__ */ jsxs7("div", { className: cn2("flex items-center gap-2", fullWidth && "w-full", className), children: [
7835
+ /* @__PURE__ */ jsxs7("div", { className: cn2("flex flex-col", fullWidth && "flex-1"), children: [
7836
+ /* @__PURE__ */ jsx9("span", { className: cn2(sizeProps.textSize, "font-medium"), children: truncateMiddle(address, 4, 4) }),
7837
+ /* @__PURE__ */ jsx9("span", { className: cn2(sizeProps.subTextSize, "text-muted-foreground -mt-0.5"), children: "Stellar Account" })
7810
7838
  ] }),
7811
7839
  /* @__PURE__ */ jsx9(
7812
7840
  Button5,
7813
7841
  {
7814
7842
  onClick: () => disconnect(),
7815
- variant: "ghost",
7843
+ variant: variant || "ghost",
7816
7844
  size: "icon",
7817
- className: "size-6 p-0",
7845
+ className: cn2(sizeProps.iconButtonSize, "p-0"),
7818
7846
  title: "Disconnect wallet",
7819
- children: /* @__PURE__ */ jsx9(LogOut, { className: "size-3.5" })
7847
+ children: /* @__PURE__ */ jsx9(LogOut, { className: sizeProps.iconSize })
7820
7848
  }
7821
7849
  )
7822
7850
  ] });
@@ -8009,6 +8037,12 @@ var StellarAdapter = class {
8009
8037
  async testNetworkServiceConnection(serviceId, values) {
8010
8038
  return testStellarNetworkServiceConnection(serviceId, values);
8011
8039
  }
8040
+ /**
8041
+ * @inheritdoc
8042
+ */
8043
+ getDefaultServiceConfig(serviceId) {
8044
+ return getStellarDefaultServiceConfig(this.networkConfig, serviceId);
8045
+ }
8012
8046
  /**
8013
8047
  * NOTE about artifact inputs (single input with auto-detection):
8014
8048
  *