@openzeppelin/ui-builder-adapter-stellar 1.5.0 → 1.6.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 +133 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -15
- package/dist/index.d.ts +4 -15
- package/dist/index.js +130 -43
- package/dist/index.js.map +1 -1
- package/dist/metadata.cjs +42 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +5 -0
- package/dist/metadata.d.ts +5 -0
- package/dist/metadata.js +17 -0
- package/dist/metadata.js.map +1 -0
- package/package.json +9 -4
- package/src/access-control/feature-detection.ts +12 -0
- package/src/access-control/indexer-client.ts +8 -3
- package/src/access-control/service.ts +68 -0
- package/src/index.ts +18 -13
- package/src/metadata.ts +16 -0
- package/src/networks/mainnet.ts +1 -1
- package/src/networks/testnet.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AccessControlService, TypeMappingInfo, EcosystemExport } from '@openzeppelin/ui-types';
|
|
2
|
+
export { ecosystemMetadata } from './metadata.cjs';
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AccessControlService, TypeMappingInfo, AdapterConfig } from '@openzeppelin/ui-types';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Stellar-specific wallet connection status extending the base interface.
|
|
@@ -253,18 +254,6 @@ declare const stellarPublic: StellarNetworkConfig;
|
|
|
253
254
|
|
|
254
255
|
declare const stellarTestnet: StellarNetworkConfig;
|
|
255
256
|
|
|
256
|
-
declare const
|
|
257
|
-
declare const stellarTestnetNetworks: StellarNetworkConfig[];
|
|
258
|
-
declare const stellarNetworks: StellarNetworkConfig[];
|
|
257
|
+
declare const ecosystemDefinition: EcosystemExport;
|
|
259
258
|
|
|
260
|
-
|
|
261
|
-
* Configuration for the Stellar adapter
|
|
262
|
-
*
|
|
263
|
-
* This file defines the dependencies required by the Stellar adapter
|
|
264
|
-
* when generating exported projects. It follows the AdapterConfig
|
|
265
|
-
* interface to provide a structured approach to dependency management.
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
declare const stellarAdapterConfig: AdapterConfig;
|
|
269
|
-
|
|
270
|
-
export { StellarAdapter, type StellarContractArtifacts, isStellarContractArtifacts, stellarAdapterConfig, stellarMainnetNetworks, stellarNetworks, stellarPublic, stellarTestnet, stellarTestnetNetworks };
|
|
259
|
+
export { StellarAdapter, type StellarContractArtifacts, ecosystemDefinition, isStellarContractArtifacts, stellarPublic, stellarTestnet };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AccessControlService, TypeMappingInfo, EcosystemExport } from '@openzeppelin/ui-types';
|
|
2
|
+
export { ecosystemMetadata } from './metadata.js';
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AccessControlService, TypeMappingInfo, AdapterConfig } from '@openzeppelin/ui-types';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Stellar-specific wallet connection status extending the base interface.
|
|
@@ -253,18 +254,6 @@ declare const stellarPublic: StellarNetworkConfig;
|
|
|
253
254
|
|
|
254
255
|
declare const stellarTestnet: StellarNetworkConfig;
|
|
255
256
|
|
|
256
|
-
declare const
|
|
257
|
-
declare const stellarTestnetNetworks: StellarNetworkConfig[];
|
|
258
|
-
declare const stellarNetworks: StellarNetworkConfig[];
|
|
257
|
+
declare const ecosystemDefinition: EcosystemExport;
|
|
259
258
|
|
|
260
|
-
|
|
261
|
-
* Configuration for the Stellar adapter
|
|
262
|
-
*
|
|
263
|
-
* This file defines the dependencies required by the Stellar adapter
|
|
264
|
-
* when generating exported projects. It follows the AdapterConfig
|
|
265
|
-
* interface to provide a structured approach to dependency management.
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
declare const stellarAdapterConfig: AdapterConfig;
|
|
269
|
-
|
|
270
|
-
export { StellarAdapter, type StellarContractArtifacts, isStellarContractArtifacts, stellarAdapterConfig, stellarMainnetNetworks, stellarNetworks, stellarPublic, stellarTestnet, stellarTestnetNetworks };
|
|
259
|
+
export { StellarAdapter, type StellarContractArtifacts, ecosystemDefinition, isStellarContractArtifacts, stellarPublic, stellarTestnet };
|
package/dist/index.js
CHANGED
|
@@ -3272,6 +3272,10 @@ function detectAccessControlCapabilities(contractSchema, indexerAvailable = fals
|
|
|
3272
3272
|
if (!hasOwnable && !hasAccessControl) {
|
|
3273
3273
|
notes.push("No OpenZeppelin access control interfaces detected");
|
|
3274
3274
|
}
|
|
3275
|
+
const hasRenounceOwnership = hasOwnable && functionNames.has("renounce_ownership");
|
|
3276
|
+
const hasRenounceRole = false;
|
|
3277
|
+
const hasCancelAdminTransfer = false;
|
|
3278
|
+
const hasAdminDelayManagement = false;
|
|
3275
3279
|
return {
|
|
3276
3280
|
hasOwnable,
|
|
3277
3281
|
hasTwoStepOwnable,
|
|
@@ -3280,7 +3284,11 @@ function detectAccessControlCapabilities(contractSchema, indexerAvailable = fals
|
|
|
3280
3284
|
hasEnumerableRoles,
|
|
3281
3285
|
supportsHistory,
|
|
3282
3286
|
verifiedAgainstOZInterfaces,
|
|
3283
|
-
notes: notes.length > 0 ? notes : void 0
|
|
3287
|
+
notes: notes.length > 0 ? notes : void 0,
|
|
3288
|
+
hasRenounceOwnership,
|
|
3289
|
+
hasRenounceRole,
|
|
3290
|
+
hasCancelAdminTransfer,
|
|
3291
|
+
hasAdminDelayManagement
|
|
3284
3292
|
};
|
|
3285
3293
|
}
|
|
3286
3294
|
function verifyOZInterface(functionNames, hasOwnable, hasAccessControl, hasTwoStepOwnable = false, hasTwoStepAdmin = false) {
|
|
@@ -4147,8 +4155,9 @@ var StellarIndexerClient = class {
|
|
|
4147
4155
|
this.resolvedEndpoints = endpoints;
|
|
4148
4156
|
return endpoints;
|
|
4149
4157
|
}
|
|
4150
|
-
|
|
4151
|
-
|
|
4158
|
+
const defaultHttpUrl = this.networkConfig.accessControlIndexerUrl ?? this.networkConfig.indexerUri;
|
|
4159
|
+
if (defaultHttpUrl) {
|
|
4160
|
+
endpoints.http = defaultHttpUrl;
|
|
4152
4161
|
logger19.info(
|
|
4153
4162
|
LOG_SYSTEM3,
|
|
4154
4163
|
`Using network config indexer URI for ${networkId}: ${endpoints.http}`
|
|
@@ -4183,7 +4192,13 @@ var StellarIndexerClient = class {
|
|
|
4183
4192
|
OWNERSHIP_RENOUNCED: "OWNERSHIP_RENOUNCED",
|
|
4184
4193
|
ADMIN_TRANSFER_INITIATED: "ADMIN_TRANSFER_INITIATED",
|
|
4185
4194
|
ADMIN_TRANSFER_COMPLETED: "ADMIN_TRANSFER_COMPLETED",
|
|
4195
|
+
ADMIN_TRANSFER_CANCELED: "UNKNOWN",
|
|
4196
|
+
// EVM-only event, not applicable to Stellar
|
|
4186
4197
|
ADMIN_RENOUNCED: "ADMIN_RENOUNCED",
|
|
4198
|
+
ADMIN_DELAY_CHANGE_SCHEDULED: "UNKNOWN",
|
|
4199
|
+
// EVM-only event, not applicable to Stellar
|
|
4200
|
+
ADMIN_DELAY_CHANGE_CANCELED: "UNKNOWN",
|
|
4201
|
+
// EVM-only event, not applicable to Stellar
|
|
4187
4202
|
UNKNOWN: "UNKNOWN"
|
|
4188
4203
|
};
|
|
4189
4204
|
return mapping[changeType];
|
|
@@ -4735,6 +4750,17 @@ var StellarAccessControlService = class {
|
|
|
4735
4750
|
"StellarAccessControlService.getOwnership",
|
|
4736
4751
|
`Reading ownership status for ${contractAddress}`
|
|
4737
4752
|
);
|
|
4753
|
+
const context = this.contractContexts.get(contractAddress);
|
|
4754
|
+
if (context) {
|
|
4755
|
+
const capabilities = detectAccessControlCapabilities(context.contractSchema);
|
|
4756
|
+
if (!capabilities.hasOwnable) {
|
|
4757
|
+
throw new OperationFailed3(
|
|
4758
|
+
"Contract does not implement the Ownable interface \u2014 no get_owner() function available",
|
|
4759
|
+
contractAddress,
|
|
4760
|
+
"getOwnership"
|
|
4761
|
+
);
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4738
4764
|
const basicOwnership = await readOwnership(contractAddress, this.networkConfig);
|
|
4739
4765
|
if (basicOwnership.owner === null) {
|
|
4740
4766
|
logger20.debug(
|
|
@@ -5027,6 +5053,25 @@ var StellarAccessControlService = class {
|
|
|
5027
5053
|
logger20.info("StellarAccessControlService.revokeRole", `Role revoked. TxHash: ${result.txHash}`);
|
|
5028
5054
|
return { id: result.txHash };
|
|
5029
5055
|
}
|
|
5056
|
+
// ── Expiration Metadata ────────────────────────────────────────────────
|
|
5057
|
+
/**
|
|
5058
|
+
* Get expiration metadata for a transfer type.
|
|
5059
|
+
*
|
|
5060
|
+
* Stellar semantics: Both ownership and admin transfers require a user-provided
|
|
5061
|
+
* expiration ledger number.
|
|
5062
|
+
*
|
|
5063
|
+
* @param contractAddress - Contract address (validated but not used for Stellar)
|
|
5064
|
+
* @param _transferType - 'ownership' or 'admin' (same semantics for both on Stellar)
|
|
5065
|
+
* @returns Expiration metadata indicating required ledger number input
|
|
5066
|
+
*/
|
|
5067
|
+
async getExpirationMetadata(contractAddress, _transferType) {
|
|
5068
|
+
validateContractAddress(contractAddress);
|
|
5069
|
+
return {
|
|
5070
|
+
mode: "required",
|
|
5071
|
+
label: "Expiration Ledger",
|
|
5072
|
+
unit: "ledger number"
|
|
5073
|
+
};
|
|
5074
|
+
}
|
|
5030
5075
|
/**
|
|
5031
5076
|
* Transfers ownership of the contract using two-step transfer
|
|
5032
5077
|
*
|
|
@@ -5180,6 +5225,17 @@ var StellarAccessControlService = class {
|
|
|
5180
5225
|
"StellarAccessControlService.getAdminInfo",
|
|
5181
5226
|
`Reading admin status for ${contractAddress}`
|
|
5182
5227
|
);
|
|
5228
|
+
const context = this.contractContexts.get(contractAddress);
|
|
5229
|
+
if (context) {
|
|
5230
|
+
const capabilities = detectAccessControlCapabilities(context.contractSchema);
|
|
5231
|
+
if (!capabilities.hasTwoStepAdmin) {
|
|
5232
|
+
throw new OperationFailed3(
|
|
5233
|
+
"Contract does not implement the two-step admin interface \u2014 no get_admin() / accept_admin_transfer() functions available",
|
|
5234
|
+
contractAddress,
|
|
5235
|
+
"getAdminInfo"
|
|
5236
|
+
);
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5183
5239
|
const currentAdmin = await getAdmin(contractAddress, this.networkConfig);
|
|
5184
5240
|
if (currentAdmin === null) {
|
|
5185
5241
|
logger20.debug(
|
|
@@ -5475,6 +5531,17 @@ var StellarAccessControlService = class {
|
|
|
5475
5531
|
"StellarAccessControlService.getAdminAccount",
|
|
5476
5532
|
`Reading admin for ${contractAddress}`
|
|
5477
5533
|
);
|
|
5534
|
+
const context = this.contractContexts.get(contractAddress);
|
|
5535
|
+
if (context) {
|
|
5536
|
+
const capabilities = detectAccessControlCapabilities(context.contractSchema);
|
|
5537
|
+
if (!capabilities.hasTwoStepAdmin) {
|
|
5538
|
+
throw new OperationFailed3(
|
|
5539
|
+
"Contract does not implement the two-step admin interface \u2014 no get_admin() function available",
|
|
5540
|
+
contractAddress,
|
|
5541
|
+
"getAdminAccount"
|
|
5542
|
+
);
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5478
5545
|
return getAdmin(contractAddress, this.networkConfig);
|
|
5479
5546
|
}
|
|
5480
5547
|
/**
|
|
@@ -8460,8 +8527,53 @@ var StellarAdapter = class {
|
|
|
8460
8527
|
}
|
|
8461
8528
|
};
|
|
8462
8529
|
|
|
8463
|
-
// src/
|
|
8530
|
+
// src/config.ts
|
|
8531
|
+
var stellarAdapterConfig = {
|
|
8532
|
+
/**
|
|
8533
|
+
* Dependencies required by the Stellar adapter
|
|
8534
|
+
* These will be included in exported projects that use this adapter
|
|
8535
|
+
*/
|
|
8536
|
+
dependencies: {
|
|
8537
|
+
// Runtime dependencies
|
|
8538
|
+
runtime: {
|
|
8539
|
+
// Core Stellar libraries
|
|
8540
|
+
"@stellar/stellar-sdk": "^14.1.1",
|
|
8541
|
+
// SAC (Stellar Asset Contract) support - dynamically loaded from CDN
|
|
8542
|
+
// These are needed for XDR encoding when working with SAC contracts
|
|
8543
|
+
"@stellar/stellar-xdr-json": "^23.0.0",
|
|
8544
|
+
"lossless-json": "^4.0.2",
|
|
8545
|
+
// Wallet connection and integration
|
|
8546
|
+
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
8547
|
+
// OpenZeppelin Relayer integration for gasless transactions
|
|
8548
|
+
"@openzeppelin/relayer-sdk": "1.9.0",
|
|
8549
|
+
// React integration for wallet components
|
|
8550
|
+
react: "^19.0.0",
|
|
8551
|
+
"react-dom": "^19.0.0"
|
|
8552
|
+
},
|
|
8553
|
+
// Development dependencies
|
|
8554
|
+
dev: {
|
|
8555
|
+
"@types/react": "^19.0.0",
|
|
8556
|
+
"@types/react-dom": "^19.0.0"
|
|
8557
|
+
}
|
|
8558
|
+
}
|
|
8559
|
+
};
|
|
8560
|
+
|
|
8561
|
+
// src/metadata.ts
|
|
8464
8562
|
import { NetworkStellar } from "@web3icons/react";
|
|
8563
|
+
var ecosystemMetadata = {
|
|
8564
|
+
id: "stellar",
|
|
8565
|
+
name: "Stellar",
|
|
8566
|
+
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.",
|
|
8567
|
+
explorerGuidance: "contract IDs on Stellar Expert",
|
|
8568
|
+
addressExample: "GCKFBEIYV2U22IO2BJ4KVJOIP7XPWQGQFKKWXR6DOSJBV7STMAQSMTGG",
|
|
8569
|
+
iconComponent: NetworkStellar,
|
|
8570
|
+
bgColorClass: "bg-sky-100",
|
|
8571
|
+
textColorClass: "text-sky-900",
|
|
8572
|
+
defaultFeatureConfig: { enabled: true, showInUI: true }
|
|
8573
|
+
};
|
|
8574
|
+
|
|
8575
|
+
// src/networks/mainnet.ts
|
|
8576
|
+
import { NetworkStellar as NetworkStellar2 } from "@web3icons/react";
|
|
8465
8577
|
var stellarPublic = {
|
|
8466
8578
|
id: "stellar-public",
|
|
8467
8579
|
exportConstName: "stellarPublic",
|
|
@@ -8474,12 +8586,12 @@ var stellarPublic = {
|
|
|
8474
8586
|
sorobanRpcUrl: "https://mainnet.sorobanrpc.com",
|
|
8475
8587
|
networkPassphrase: "Public Global Stellar Network ; September 2015",
|
|
8476
8588
|
explorerUrl: "https://stellar.expert/explorer/public",
|
|
8477
|
-
iconComponent:
|
|
8478
|
-
|
|
8589
|
+
iconComponent: NetworkStellar2,
|
|
8590
|
+
accessControlIndexerUrl: "https://openzeppelin-stellar-mainnet.graphql.subquery.network/"
|
|
8479
8591
|
};
|
|
8480
8592
|
|
|
8481
8593
|
// src/networks/testnet.ts
|
|
8482
|
-
import { NetworkStellar as
|
|
8594
|
+
import { NetworkStellar as NetworkStellar3 } from "@web3icons/react";
|
|
8483
8595
|
var stellarTestnet = {
|
|
8484
8596
|
id: "stellar-testnet",
|
|
8485
8597
|
exportConstName: "stellarTestnet",
|
|
@@ -8492,8 +8604,8 @@ var stellarTestnet = {
|
|
|
8492
8604
|
sorobanRpcUrl: "https://soroban-testnet.stellar.org",
|
|
8493
8605
|
networkPassphrase: "Test SDF Network ; September 2015",
|
|
8494
8606
|
explorerUrl: "https://stellar.expert/explorer/testnet",
|
|
8495
|
-
iconComponent:
|
|
8496
|
-
|
|
8607
|
+
iconComponent: NetworkStellar3,
|
|
8608
|
+
accessControlIndexerUrl: "https://openzepplin-stellar-testnet.graphql.subquery.network"
|
|
8497
8609
|
};
|
|
8498
8610
|
|
|
8499
8611
|
// src/networks/index.ts
|
|
@@ -8504,44 +8616,19 @@ var stellarNetworks = [
|
|
|
8504
8616
|
...stellarTestnetNetworks
|
|
8505
8617
|
];
|
|
8506
8618
|
|
|
8507
|
-
// src/
|
|
8508
|
-
var
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
dependencies: {
|
|
8514
|
-
// Runtime dependencies
|
|
8515
|
-
runtime: {
|
|
8516
|
-
// Core Stellar libraries
|
|
8517
|
-
"@stellar/stellar-sdk": "^14.1.1",
|
|
8518
|
-
// SAC (Stellar Asset Contract) support - dynamically loaded from CDN
|
|
8519
|
-
// These are needed for XDR encoding when working with SAC contracts
|
|
8520
|
-
"@stellar/stellar-xdr-json": "^23.0.0",
|
|
8521
|
-
"lossless-json": "^4.0.2",
|
|
8522
|
-
// Wallet connection and integration
|
|
8523
|
-
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
8524
|
-
// OpenZeppelin Relayer integration for gasless transactions
|
|
8525
|
-
"@openzeppelin/relayer-sdk": "1.9.0",
|
|
8526
|
-
// React integration for wallet components
|
|
8527
|
-
react: "^19.0.0",
|
|
8528
|
-
"react-dom": "^19.0.0"
|
|
8529
|
-
},
|
|
8530
|
-
// Development dependencies
|
|
8531
|
-
dev: {
|
|
8532
|
-
"@types/react": "^19.0.0",
|
|
8533
|
-
"@types/react-dom": "^19.0.0"
|
|
8534
|
-
}
|
|
8535
|
-
}
|
|
8619
|
+
// src/index.ts
|
|
8620
|
+
var ecosystemDefinition = {
|
|
8621
|
+
...ecosystemMetadata,
|
|
8622
|
+
networks: stellarNetworks,
|
|
8623
|
+
createAdapter: (config) => new StellarAdapter(config),
|
|
8624
|
+
adapterConfig: stellarAdapterConfig
|
|
8536
8625
|
};
|
|
8537
8626
|
export {
|
|
8538
8627
|
StellarAdapter,
|
|
8628
|
+
ecosystemDefinition,
|
|
8629
|
+
ecosystemMetadata,
|
|
8539
8630
|
isStellarContractArtifacts,
|
|
8540
|
-
stellarAdapterConfig,
|
|
8541
|
-
stellarMainnetNetworks,
|
|
8542
|
-
stellarNetworks,
|
|
8543
8631
|
stellarPublic,
|
|
8544
|
-
stellarTestnet
|
|
8545
|
-
stellarTestnetNetworks
|
|
8632
|
+
stellarTestnet
|
|
8546
8633
|
};
|
|
8547
8634
|
//# sourceMappingURL=index.js.map
|