@openzeppelin/ui-builder-adapter-stellar 1.5.0 → 1.7.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
@@ -33,13 +33,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33
33
  var index_exports = {};
34
34
  __export(index_exports, {
35
35
  StellarAdapter: () => StellarAdapter,
36
+ ecosystemDefinition: () => ecosystemDefinition,
37
+ ecosystemMetadata: () => ecosystemMetadata,
36
38
  isStellarContractArtifacts: () => isStellarContractArtifacts,
37
- stellarAdapterConfig: () => stellarAdapterConfig,
38
- stellarMainnetNetworks: () => stellarMainnetNetworks,
39
- stellarNetworks: () => stellarNetworks,
40
39
  stellarPublic: () => stellarPublic,
41
- stellarTestnet: () => stellarTestnet,
42
- stellarTestnetNetworks: () => stellarTestnetNetworks
40
+ stellarTestnet: () => stellarTestnet
43
41
  });
44
42
  module.exports = __toCommonJS(index_exports);
45
43
 
@@ -3286,6 +3284,10 @@ function detectAccessControlCapabilities(contractSchema, indexerAvailable = fals
3286
3284
  if (!hasOwnable && !hasAccessControl) {
3287
3285
  notes.push("No OpenZeppelin access control interfaces detected");
3288
3286
  }
3287
+ const hasRenounceOwnership = hasOwnable && functionNames.has("renounce_ownership");
3288
+ const hasRenounceRole = false;
3289
+ const hasCancelAdminTransfer = false;
3290
+ const hasAdminDelayManagement = false;
3289
3291
  return {
3290
3292
  hasOwnable,
3291
3293
  hasTwoStepOwnable,
@@ -3294,7 +3296,11 @@ function detectAccessControlCapabilities(contractSchema, indexerAvailable = fals
3294
3296
  hasEnumerableRoles,
3295
3297
  supportsHistory,
3296
3298
  verifiedAgainstOZInterfaces,
3297
- notes: notes.length > 0 ? notes : void 0
3299
+ notes: notes.length > 0 ? notes : void 0,
3300
+ hasRenounceOwnership,
3301
+ hasRenounceRole,
3302
+ hasCancelAdminTransfer,
3303
+ hasAdminDelayManagement
3298
3304
  };
3299
3305
  }
3300
3306
  function verifyOZInterface(functionNames, hasOwnable, hasAccessControl, hasTwoStepOwnable = false, hasTwoStepAdmin = false) {
@@ -4156,8 +4162,9 @@ var StellarIndexerClient = class {
4156
4162
  this.resolvedEndpoints = endpoints;
4157
4163
  return endpoints;
4158
4164
  }
4159
- if (this.networkConfig.indexerUri) {
4160
- endpoints.http = this.networkConfig.indexerUri;
4165
+ const defaultHttpUrl = this.networkConfig.accessControlIndexerUrl ?? this.networkConfig.indexerUri;
4166
+ if (defaultHttpUrl) {
4167
+ endpoints.http = defaultHttpUrl;
4161
4168
  import_ui_utils20.logger.info(
4162
4169
  LOG_SYSTEM3,
4163
4170
  `Using network config indexer URI for ${networkId}: ${endpoints.http}`
@@ -4192,7 +4199,13 @@ var StellarIndexerClient = class {
4192
4199
  OWNERSHIP_RENOUNCED: "OWNERSHIP_RENOUNCED",
4193
4200
  ADMIN_TRANSFER_INITIATED: "ADMIN_TRANSFER_INITIATED",
4194
4201
  ADMIN_TRANSFER_COMPLETED: "ADMIN_TRANSFER_COMPLETED",
4202
+ ADMIN_TRANSFER_CANCELED: "UNKNOWN",
4203
+ // EVM-only event, not applicable to Stellar
4195
4204
  ADMIN_RENOUNCED: "ADMIN_RENOUNCED",
4205
+ ADMIN_DELAY_CHANGE_SCHEDULED: "UNKNOWN",
4206
+ // EVM-only event, not applicable to Stellar
4207
+ ADMIN_DELAY_CHANGE_CANCELED: "UNKNOWN",
4208
+ // EVM-only event, not applicable to Stellar
4196
4209
  UNKNOWN: "UNKNOWN"
4197
4210
  };
4198
4211
  return mapping[changeType];
@@ -4744,6 +4757,17 @@ var StellarAccessControlService = class {
4744
4757
  "StellarAccessControlService.getOwnership",
4745
4758
  `Reading ownership status for ${contractAddress}`
4746
4759
  );
4760
+ const context = this.contractContexts.get(contractAddress);
4761
+ if (context) {
4762
+ const capabilities = detectAccessControlCapabilities(context.contractSchema);
4763
+ if (!capabilities.hasOwnable) {
4764
+ throw new import_ui_types9.OperationFailed(
4765
+ "Contract does not implement the Ownable interface \u2014 no get_owner() function available",
4766
+ contractAddress,
4767
+ "getOwnership"
4768
+ );
4769
+ }
4770
+ }
4747
4771
  const basicOwnership = await readOwnership(contractAddress, this.networkConfig);
4748
4772
  if (basicOwnership.owner === null) {
4749
4773
  import_ui_utils22.logger.debug(
@@ -5036,6 +5060,25 @@ var StellarAccessControlService = class {
5036
5060
  import_ui_utils22.logger.info("StellarAccessControlService.revokeRole", `Role revoked. TxHash: ${result.txHash}`);
5037
5061
  return { id: result.txHash };
5038
5062
  }
5063
+ // ── Expiration Metadata ────────────────────────────────────────────────
5064
+ /**
5065
+ * Get expiration metadata for a transfer type.
5066
+ *
5067
+ * Stellar semantics: Both ownership and admin transfers require a user-provided
5068
+ * expiration ledger number.
5069
+ *
5070
+ * @param contractAddress - Contract address (validated but not used for Stellar)
5071
+ * @param _transferType - 'ownership' or 'admin' (same semantics for both on Stellar)
5072
+ * @returns Expiration metadata indicating required ledger number input
5073
+ */
5074
+ async getExpirationMetadata(contractAddress, _transferType) {
5075
+ validateContractAddress(contractAddress);
5076
+ return {
5077
+ mode: "required",
5078
+ label: "Expiration Ledger",
5079
+ unit: "ledger number"
5080
+ };
5081
+ }
5039
5082
  /**
5040
5083
  * Transfers ownership of the contract using two-step transfer
5041
5084
  *
@@ -5189,6 +5232,17 @@ var StellarAccessControlService = class {
5189
5232
  "StellarAccessControlService.getAdminInfo",
5190
5233
  `Reading admin status for ${contractAddress}`
5191
5234
  );
5235
+ const context = this.contractContexts.get(contractAddress);
5236
+ if (context) {
5237
+ const capabilities = detectAccessControlCapabilities(context.contractSchema);
5238
+ if (!capabilities.hasTwoStepAdmin) {
5239
+ throw new import_ui_types9.OperationFailed(
5240
+ "Contract does not implement the two-step admin interface \u2014 no get_admin() / accept_admin_transfer() functions available",
5241
+ contractAddress,
5242
+ "getAdminInfo"
5243
+ );
5244
+ }
5245
+ }
5192
5246
  const currentAdmin = await getAdmin(contractAddress, this.networkConfig);
5193
5247
  if (currentAdmin === null) {
5194
5248
  import_ui_utils22.logger.debug(
@@ -5484,6 +5538,17 @@ var StellarAccessControlService = class {
5484
5538
  "StellarAccessControlService.getAdminAccount",
5485
5539
  `Reading admin for ${contractAddress}`
5486
5540
  );
5541
+ const context = this.contractContexts.get(contractAddress);
5542
+ if (context) {
5543
+ const capabilities = detectAccessControlCapabilities(context.contractSchema);
5544
+ if (!capabilities.hasTwoStepAdmin) {
5545
+ throw new import_ui_types9.OperationFailed(
5546
+ "Contract does not implement the two-step admin interface \u2014 no get_admin() function available",
5547
+ contractAddress,
5548
+ "getAdminAccount"
5549
+ );
5550
+ }
5551
+ }
5487
5552
  return getAdmin(contractAddress, this.networkConfig);
5488
5553
  }
5489
5554
  /**
@@ -8458,8 +8523,53 @@ var StellarAdapter = class {
8458
8523
  }
8459
8524
  };
8460
8525
 
8461
- // src/networks/mainnet.ts
8526
+ // src/config.ts
8527
+ var stellarAdapterConfig = {
8528
+ /**
8529
+ * Dependencies required by the Stellar adapter
8530
+ * These will be included in exported projects that use this adapter
8531
+ */
8532
+ dependencies: {
8533
+ // Runtime dependencies
8534
+ runtime: {
8535
+ // Core Stellar libraries
8536
+ "@stellar/stellar-sdk": "^14.1.1",
8537
+ // SAC (Stellar Asset Contract) support - dynamically loaded from CDN
8538
+ // These are needed for XDR encoding when working with SAC contracts
8539
+ "@stellar/stellar-xdr-json": "^23.0.0",
8540
+ "lossless-json": "^4.0.2",
8541
+ // Wallet connection and integration
8542
+ "@creit.tech/stellar-wallets-kit": "^1.9.5",
8543
+ // OpenZeppelin Relayer integration for gasless transactions
8544
+ "@openzeppelin/relayer-sdk": "1.9.0",
8545
+ // React integration for wallet components
8546
+ react: "^19.0.0",
8547
+ "react-dom": "^19.0.0"
8548
+ },
8549
+ // Development dependencies
8550
+ dev: {
8551
+ "@types/react": "^19.0.0",
8552
+ "@types/react-dom": "^19.0.0"
8553
+ }
8554
+ }
8555
+ };
8556
+
8557
+ // src/metadata.ts
8462
8558
  var import_react11 = require("@web3icons/react");
8559
+ var ecosystemMetadata = {
8560
+ id: "stellar",
8561
+ name: "Stellar",
8562
+ description: "Stellar is a fast, energy-efficient blockchain network designed for real-world financial applications. It enables near-instant global payments at low cost, connects digital assets to traditional finance, and supports smart contracts through Soroban.",
8563
+ explorerGuidance: "contract IDs on Stellar Expert",
8564
+ addressExample: "GCKFBEIYV2U22IO2BJ4KVJOIP7XPWQGQFKKWXR6DOSJBV7STMAQSMTGG",
8565
+ iconComponent: import_react11.NetworkStellar,
8566
+ bgColorClass: "bg-sky-100",
8567
+ textColorClass: "text-sky-900",
8568
+ defaultFeatureConfig: { enabled: true, showInUI: true }
8569
+ };
8570
+
8571
+ // src/networks/mainnet.ts
8572
+ var import_react12 = require("@web3icons/react");
8463
8573
  var stellarPublic = {
8464
8574
  id: "stellar-public",
8465
8575
  exportConstName: "stellarPublic",
@@ -8472,12 +8582,12 @@ var stellarPublic = {
8472
8582
  sorobanRpcUrl: "https://mainnet.sorobanrpc.com",
8473
8583
  networkPassphrase: "Public Global Stellar Network ; September 2015",
8474
8584
  explorerUrl: "https://stellar.expert/explorer/public",
8475
- iconComponent: import_react11.NetworkStellar,
8476
- indexerUri: "https://openzeppelin-stellar-mainnet.graphql.subquery.network/"
8585
+ iconComponent: import_react12.NetworkStellar,
8586
+ accessControlIndexerUrl: "https://openzeppelin-stellar-mainnet.graphql.subquery.network/"
8477
8587
  };
8478
8588
 
8479
8589
  // src/networks/testnet.ts
8480
- var import_react12 = require("@web3icons/react");
8590
+ var import_react13 = require("@web3icons/react");
8481
8591
  var stellarTestnet = {
8482
8592
  id: "stellar-testnet",
8483
8593
  exportConstName: "stellarTestnet",
@@ -8490,8 +8600,8 @@ var stellarTestnet = {
8490
8600
  sorobanRpcUrl: "https://soroban-testnet.stellar.org",
8491
8601
  networkPassphrase: "Test SDF Network ; September 2015",
8492
8602
  explorerUrl: "https://stellar.expert/explorer/testnet",
8493
- iconComponent: import_react12.NetworkStellar,
8494
- indexerUri: "https://openzepplin-stellar-testnet.graphql.subquery.network"
8603
+ iconComponent: import_react13.NetworkStellar,
8604
+ accessControlIndexerUrl: "https://openzepplin-stellar-testnet.graphql.subquery.network"
8495
8605
  };
8496
8606
 
8497
8607
  // src/networks/index.ts
@@ -8502,45 +8612,20 @@ var stellarNetworks = [
8502
8612
  ...stellarTestnetNetworks
8503
8613
  ];
8504
8614
 
8505
- // src/config.ts
8506
- var stellarAdapterConfig = {
8507
- /**
8508
- * Dependencies required by the Stellar adapter
8509
- * These will be included in exported projects that use this adapter
8510
- */
8511
- dependencies: {
8512
- // Runtime dependencies
8513
- runtime: {
8514
- // Core Stellar libraries
8515
- "@stellar/stellar-sdk": "^14.1.1",
8516
- // SAC (Stellar Asset Contract) support - dynamically loaded from CDN
8517
- // These are needed for XDR encoding when working with SAC contracts
8518
- "@stellar/stellar-xdr-json": "^23.0.0",
8519
- "lossless-json": "^4.0.2",
8520
- // Wallet connection and integration
8521
- "@creit.tech/stellar-wallets-kit": "^1.9.5",
8522
- // OpenZeppelin Relayer integration for gasless transactions
8523
- "@openzeppelin/relayer-sdk": "1.9.0",
8524
- // React integration for wallet components
8525
- react: "^19.0.0",
8526
- "react-dom": "^19.0.0"
8527
- },
8528
- // Development dependencies
8529
- dev: {
8530
- "@types/react": "^19.0.0",
8531
- "@types/react-dom": "^19.0.0"
8532
- }
8533
- }
8615
+ // src/index.ts
8616
+ var ecosystemDefinition = {
8617
+ ...ecosystemMetadata,
8618
+ networks: stellarNetworks,
8619
+ createAdapter: (config) => new StellarAdapter(config),
8620
+ adapterConfig: stellarAdapterConfig
8534
8621
  };
8535
8622
  // Annotate the CommonJS export names for ESM import in node:
8536
8623
  0 && (module.exports = {
8537
8624
  StellarAdapter,
8625
+ ecosystemDefinition,
8626
+ ecosystemMetadata,
8538
8627
  isStellarContractArtifacts,
8539
- stellarAdapterConfig,
8540
- stellarMainnetNetworks,
8541
- stellarNetworks,
8542
8628
  stellarPublic,
8543
- stellarTestnet,
8544
- stellarTestnetNetworks
8629
+ stellarTestnet
8545
8630
  });
8546
8631
  //# sourceMappingURL=index.cjs.map