@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.cjs CHANGED
@@ -5660,6 +5660,24 @@ async function testWithFallbackMethod(rpcConfig, signal, startTime) {
5660
5660
  }
5661
5661
 
5662
5662
  // src/configuration/network-services.ts
5663
+ function getStellarDefaultServiceConfig(networkConfig, serviceId) {
5664
+ switch (serviceId) {
5665
+ case "rpc":
5666
+ if (networkConfig.sorobanRpcUrl) {
5667
+ return { sorobanRpcUrl: networkConfig.sorobanRpcUrl };
5668
+ }
5669
+ break;
5670
+ case "indexer":
5671
+ if (networkConfig.indexerUri && networkConfig.indexerWsUri) {
5672
+ return {
5673
+ indexerUri: networkConfig.indexerUri,
5674
+ indexerWsUri: networkConfig.indexerWsUri
5675
+ };
5676
+ }
5677
+ break;
5678
+ }
5679
+ return null;
5680
+ }
5663
5681
  function getStellarNetworkServiceForms(exclude = []) {
5664
5682
  const forms = [
5665
5683
  {
@@ -7728,11 +7746,15 @@ var ConnectorDialog = ({ open, onOpenChange }) => {
7728
7746
  var import_jsx_runtime8 = require("react/jsx-runtime");
7729
7747
  var CustomConnectButton = ({
7730
7748
  className,
7749
+ size,
7750
+ variant,
7751
+ fullWidth,
7731
7752
  hideWhenConnected = true
7732
7753
  }) => {
7733
7754
  const [dialogOpen, setDialogOpen] = (0, import_react10.useState)(false);
7734
7755
  const { isConnected, isConnecting } = useStellarAccount();
7735
7756
  const [isManuallyInitiated, setIsManuallyInitiated] = (0, import_react10.useState)(false);
7757
+ const sizeProps = (0, import_ui_utils39.getWalletButtonSizeProps)(size);
7736
7758
  (0, import_react10.useEffect)(() => {
7737
7759
  if (isConnected && hideWhenConnected) {
7738
7760
  setDialogOpen(false);
@@ -7759,18 +7781,18 @@ var CustomConnectButton = ({
7759
7781
  return null;
7760
7782
  }
7761
7783
  const showButtonLoading = isConnecting || isManuallyInitiated;
7762
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_ui_utils39.cn)("flex items-center", className), children: [
7784
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_ui_utils39.cn)("flex items-center", fullWidth && "w-full", className), children: [
7763
7785
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
7764
7786
  import_ui_components6.Button,
7765
7787
  {
7766
7788
  onClick: handleConnectClick,
7767
7789
  disabled: showButtonLoading || isConnected,
7768
- variant: "outline",
7769
- size: "sm",
7770
- className: "h-8 px-2 text-xs",
7790
+ variant: variant || "outline",
7791
+ size: sizeProps.size,
7792
+ className: (0, import_ui_utils39.cn)(sizeProps.className, fullWidth && "w-full"),
7771
7793
  title: isConnected ? "Connected" : "Connect Wallet",
7772
7794
  children: [
7773
- showButtonLoading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader2, { className: "size-3.5 animate-spin mr-1" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Wallet, { className: "size-3.5 mr-1" }),
7795
+ showButtonLoading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader2, { className: (0, import_ui_utils39.cn)(sizeProps.iconSize, "animate-spin mr-1") }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Wallet, { className: (0, import_ui_utils39.cn)(sizeProps.iconSize, "mr-1") }),
7774
7796
  showButtonLoading ? "Connecting..." : "Connect Wallet"
7775
7797
  ]
7776
7798
  }
@@ -7795,26 +7817,32 @@ var import_lucide_react3 = require("lucide-react");
7795
7817
  var import_ui_components7 = require("@openzeppelin/ui-components");
7796
7818
  var import_ui_utils40 = require("@openzeppelin/ui-utils");
7797
7819
  var import_jsx_runtime9 = require("react/jsx-runtime");
7798
- var CustomAccountDisplay = ({ className }) => {
7820
+ var CustomAccountDisplay = ({
7821
+ className,
7822
+ size,
7823
+ variant,
7824
+ fullWidth
7825
+ }) => {
7799
7826
  const { isConnected, address } = useStellarAccount();
7800
7827
  const { disconnect } = useStellarDisconnect();
7828
+ const sizeProps = (0, import_ui_utils40.getWalletAccountDisplaySizeProps)(size);
7801
7829
  if (!isConnected || !address || !disconnect) {
7802
7830
  return null;
7803
7831
  }
7804
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_ui_utils40.cn)("flex items-center gap-2", className), children: [
7805
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col", children: [
7806
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium", children: (0, import_ui_utils40.truncateMiddle)(address, 4, 4) }),
7807
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[9px] text-muted-foreground -mt-0.5", children: "Stellar Account" })
7832
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_ui_utils40.cn)("flex items-center gap-2", fullWidth && "w-full", className), children: [
7833
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_ui_utils40.cn)("flex flex-col", fullWidth && "flex-1"), children: [
7834
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: (0, import_ui_utils40.cn)(sizeProps.textSize, "font-medium"), children: (0, import_ui_utils40.truncateMiddle)(address, 4, 4) }),
7835
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: (0, import_ui_utils40.cn)(sizeProps.subTextSize, "text-muted-foreground -mt-0.5"), children: "Stellar Account" })
7808
7836
  ] }),
7809
7837
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
7810
7838
  import_ui_components7.Button,
7811
7839
  {
7812
7840
  onClick: () => disconnect(),
7813
- variant: "ghost",
7841
+ variant: variant || "ghost",
7814
7842
  size: "icon",
7815
- className: "size-6 p-0",
7843
+ className: (0, import_ui_utils40.cn)(sizeProps.iconButtonSize, "p-0"),
7816
7844
  title: "Disconnect wallet",
7817
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LogOut, { className: "size-3.5" })
7845
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LogOut, { className: sizeProps.iconSize })
7818
7846
  }
7819
7847
  )
7820
7848
  ] });
@@ -8007,6 +8035,12 @@ var StellarAdapter = class {
8007
8035
  async testNetworkServiceConnection(serviceId, values) {
8008
8036
  return testStellarNetworkServiceConnection(serviceId, values);
8009
8037
  }
8038
+ /**
8039
+ * @inheritdoc
8040
+ */
8041
+ getDefaultServiceConfig(serviceId) {
8042
+ return getStellarDefaultServiceConfig(this.networkConfig, serviceId);
8043
+ }
8010
8044
  /**
8011
8045
  * NOTE about artifact inputs (single input with auto-detection):
8012
8046
  *