@openzeppelin/ui-builder-adapter-stellar 1.4.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 +222 -101
- 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 +219 -96
- 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 +10 -5
- package/src/access-control/feature-detection.ts +12 -0
- package/src/access-control/indexer-client.ts +142 -68
- package/src/access-control/service.ts +68 -0
- package/src/config.ts +2 -2
- 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) {
|
|
@@ -3663,11 +3671,12 @@ var StellarIndexerClient = class {
|
|
|
3663
3671
|
}
|
|
3664
3672
|
const grantMap = /* @__PURE__ */ new Map();
|
|
3665
3673
|
for (const entry of result.data.accessControlEvents.nodes) {
|
|
3666
|
-
|
|
3667
|
-
|
|
3674
|
+
const account = entry.account || "";
|
|
3675
|
+
if (account && !grantMap.has(account)) {
|
|
3676
|
+
grantMap.set(account, {
|
|
3668
3677
|
timestamp: entry.timestamp,
|
|
3669
3678
|
txId: entry.txHash,
|
|
3670
|
-
ledger: parseInt(entry.
|
|
3679
|
+
ledger: parseInt(entry.blockNumber, 10)
|
|
3671
3680
|
});
|
|
3672
3681
|
}
|
|
3673
3682
|
}
|
|
@@ -3784,10 +3793,17 @@ var StellarIndexerClient = class {
|
|
|
3784
3793
|
logger19.debug(LOG_SYSTEM3, `Ownership transfer was completed for ${contractAddress}`);
|
|
3785
3794
|
return null;
|
|
3786
3795
|
}
|
|
3787
|
-
if (!latestInitiation.
|
|
3796
|
+
if (!latestInitiation.previousOwner) {
|
|
3788
3797
|
logger19.warn(
|
|
3789
3798
|
LOG_SYSTEM3,
|
|
3790
|
-
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without
|
|
3799
|
+
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without previousOwner field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3800
|
+
);
|
|
3801
|
+
return null;
|
|
3802
|
+
}
|
|
3803
|
+
if (!latestInitiation.newOwner) {
|
|
3804
|
+
logger19.warn(
|
|
3805
|
+
LOG_SYSTEM3,
|
|
3806
|
+
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without newOwner field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3791
3807
|
);
|
|
3792
3808
|
return null;
|
|
3793
3809
|
}
|
|
@@ -3800,14 +3816,14 @@ var StellarIndexerClient = class {
|
|
|
3800
3816
|
}
|
|
3801
3817
|
logger19.info(
|
|
3802
3818
|
LOG_SYSTEM3,
|
|
3803
|
-
`Found pending ownership transfer for ${contractAddress}: pending owner=${latestInitiation.
|
|
3819
|
+
`Found pending ownership transfer for ${contractAddress}: pending owner=${latestInitiation.newOwner}, expires at ledger ${latestInitiation.liveUntilLedger}`
|
|
3804
3820
|
);
|
|
3805
3821
|
return {
|
|
3806
|
-
previousOwner: latestInitiation.
|
|
3807
|
-
pendingOwner: latestInitiation.
|
|
3822
|
+
previousOwner: latestInitiation.previousOwner,
|
|
3823
|
+
pendingOwner: latestInitiation.newOwner,
|
|
3808
3824
|
txHash: latestInitiation.txHash,
|
|
3809
3825
|
timestamp: latestInitiation.timestamp,
|
|
3810
|
-
ledger: parseInt(latestInitiation.
|
|
3826
|
+
ledger: parseInt(latestInitiation.blockNumber, 10),
|
|
3811
3827
|
liveUntilLedger: latestInitiation.liveUntilLedger
|
|
3812
3828
|
};
|
|
3813
3829
|
} catch (error) {
|
|
@@ -3925,10 +3941,17 @@ var StellarIndexerClient = class {
|
|
|
3925
3941
|
logger19.debug(LOG_SYSTEM3, `Admin transfer was completed for ${contractAddress}`);
|
|
3926
3942
|
return null;
|
|
3927
3943
|
}
|
|
3928
|
-
if (!latestInitiation.
|
|
3944
|
+
if (!latestInitiation.previousAdmin) {
|
|
3929
3945
|
logger19.warn(
|
|
3930
3946
|
LOG_SYSTEM3,
|
|
3931
|
-
`Indexer returned ADMIN_TRANSFER_INITIATED event without
|
|
3947
|
+
`Indexer returned ADMIN_TRANSFER_INITIATED event without previousAdmin field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3948
|
+
);
|
|
3949
|
+
return null;
|
|
3950
|
+
}
|
|
3951
|
+
if (!latestInitiation.newAdmin) {
|
|
3952
|
+
logger19.warn(
|
|
3953
|
+
LOG_SYSTEM3,
|
|
3954
|
+
`Indexer returned ADMIN_TRANSFER_INITIATED event without newAdmin field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3932
3955
|
);
|
|
3933
3956
|
return null;
|
|
3934
3957
|
}
|
|
@@ -3941,14 +3964,14 @@ var StellarIndexerClient = class {
|
|
|
3941
3964
|
}
|
|
3942
3965
|
logger19.info(
|
|
3943
3966
|
LOG_SYSTEM3,
|
|
3944
|
-
`Found pending admin transfer for ${contractAddress}: pending admin=${latestInitiation.
|
|
3967
|
+
`Found pending admin transfer for ${contractAddress}: pending admin=${latestInitiation.newAdmin}, expires at ledger ${latestInitiation.liveUntilLedger}`
|
|
3945
3968
|
);
|
|
3946
3969
|
return {
|
|
3947
|
-
previousAdmin: latestInitiation.
|
|
3948
|
-
pendingAdmin: latestInitiation.
|
|
3970
|
+
previousAdmin: latestInitiation.previousAdmin,
|
|
3971
|
+
pendingAdmin: latestInitiation.newAdmin,
|
|
3949
3972
|
txHash: latestInitiation.txHash,
|
|
3950
3973
|
timestamp: latestInitiation.timestamp,
|
|
3951
|
-
ledger: parseInt(latestInitiation.
|
|
3974
|
+
ledger: parseInt(latestInitiation.blockNumber, 10),
|
|
3952
3975
|
liveUntilLedger: latestInitiation.liveUntilLedger
|
|
3953
3976
|
};
|
|
3954
3977
|
} catch (error) {
|
|
@@ -3972,11 +3995,6 @@ var StellarIndexerClient = class {
|
|
|
3972
3995
|
* Note: The OpenZeppelin Stellar contract emits `ownership_transfer` event
|
|
3973
3996
|
* which is indexed as `OWNERSHIP_TRANSFER_STARTED`.
|
|
3974
3997
|
*
|
|
3975
|
-
* Schema mapping:
|
|
3976
|
-
* - `account`: pending new owner
|
|
3977
|
-
* - `admin`: current owner who initiated the transfer
|
|
3978
|
-
* - `ledger`: block height of the event
|
|
3979
|
-
* - `liveUntilLedger`: expiration ledger for the pending transfer
|
|
3980
3998
|
*/
|
|
3981
3999
|
buildOwnershipTransferStartedQuery() {
|
|
3982
4000
|
return `
|
|
@@ -3984,19 +4002,18 @@ var StellarIndexerClient = class {
|
|
|
3984
4002
|
accessControlEvents(
|
|
3985
4003
|
filter: {
|
|
3986
4004
|
contract: { equalTo: $contract }
|
|
3987
|
-
|
|
4005
|
+
eventType: { equalTo: OWNERSHIP_TRANSFER_STARTED }
|
|
3988
4006
|
}
|
|
3989
4007
|
orderBy: TIMESTAMP_DESC
|
|
3990
4008
|
first: 1
|
|
3991
4009
|
) {
|
|
3992
4010
|
nodes {
|
|
3993
4011
|
id
|
|
3994
|
-
|
|
3995
|
-
|
|
4012
|
+
previousOwner
|
|
4013
|
+
newOwner
|
|
3996
4014
|
txHash
|
|
3997
4015
|
timestamp
|
|
3998
|
-
|
|
3999
|
-
blockHeight
|
|
4016
|
+
blockNumber
|
|
4000
4017
|
liveUntilLedger
|
|
4001
4018
|
}
|
|
4002
4019
|
}
|
|
@@ -4012,7 +4029,7 @@ var StellarIndexerClient = class {
|
|
|
4012
4029
|
accessControlEvents(
|
|
4013
4030
|
filter: {
|
|
4014
4031
|
contract: { equalTo: $contract }
|
|
4015
|
-
|
|
4032
|
+
eventType: { equalTo: OWNERSHIP_TRANSFER_COMPLETED }
|
|
4016
4033
|
timestamp: { greaterThan: $afterTimestamp }
|
|
4017
4034
|
}
|
|
4018
4035
|
orderBy: TIMESTAMP_DESC
|
|
@@ -4032,12 +4049,6 @@ var StellarIndexerClient = class {
|
|
|
4032
4049
|
*
|
|
4033
4050
|
* Note: The OpenZeppelin Stellar contract emits `admin_transfer_initiated` event
|
|
4034
4051
|
* which is indexed as `ADMIN_TRANSFER_INITIATED`.
|
|
4035
|
-
*
|
|
4036
|
-
* Schema mapping:
|
|
4037
|
-
* - `account`: pending new admin
|
|
4038
|
-
* - `admin`: current admin who initiated the transfer
|
|
4039
|
-
* - `ledger`: block height of the event
|
|
4040
|
-
* - `liveUntilLedger`: expiration ledger for the pending transfer
|
|
4041
4052
|
*/
|
|
4042
4053
|
buildAdminTransferInitiatedQuery() {
|
|
4043
4054
|
return `
|
|
@@ -4045,19 +4056,18 @@ var StellarIndexerClient = class {
|
|
|
4045
4056
|
accessControlEvents(
|
|
4046
4057
|
filter: {
|
|
4047
4058
|
contract: { equalTo: $contract }
|
|
4048
|
-
|
|
4059
|
+
eventType: { equalTo: ADMIN_TRANSFER_INITIATED }
|
|
4049
4060
|
}
|
|
4050
4061
|
orderBy: TIMESTAMP_DESC
|
|
4051
4062
|
first: 1
|
|
4052
4063
|
) {
|
|
4053
4064
|
nodes {
|
|
4054
4065
|
id
|
|
4055
|
-
|
|
4056
|
-
|
|
4066
|
+
previousAdmin
|
|
4067
|
+
newAdmin
|
|
4057
4068
|
txHash
|
|
4058
4069
|
timestamp
|
|
4059
|
-
|
|
4060
|
-
blockHeight
|
|
4070
|
+
blockNumber
|
|
4061
4071
|
liveUntilLedger
|
|
4062
4072
|
}
|
|
4063
4073
|
}
|
|
@@ -4073,7 +4083,7 @@ var StellarIndexerClient = class {
|
|
|
4073
4083
|
accessControlEvents(
|
|
4074
4084
|
filter: {
|
|
4075
4085
|
contract: { equalTo: $contract }
|
|
4076
|
-
|
|
4086
|
+
eventType: { equalTo: ADMIN_TRANSFER_COMPLETED }
|
|
4077
4087
|
timestamp: { greaterThan: $afterTimestamp }
|
|
4078
4088
|
}
|
|
4079
4089
|
orderBy: TIMESTAMP_DESC
|
|
@@ -4145,8 +4155,9 @@ var StellarIndexerClient = class {
|
|
|
4145
4155
|
this.resolvedEndpoints = endpoints;
|
|
4146
4156
|
return endpoints;
|
|
4147
4157
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4158
|
+
const defaultHttpUrl = this.networkConfig.accessControlIndexerUrl ?? this.networkConfig.indexerUri;
|
|
4159
|
+
if (defaultHttpUrl) {
|
|
4160
|
+
endpoints.http = defaultHttpUrl;
|
|
4150
4161
|
logger19.info(
|
|
4151
4162
|
LOG_SYSTEM3,
|
|
4152
4163
|
`Using network config indexer URI for ${networkId}: ${endpoints.http}`
|
|
@@ -4170,17 +4181,24 @@ var StellarIndexerClient = class {
|
|
|
4170
4181
|
}
|
|
4171
4182
|
/**
|
|
4172
4183
|
* Maps internal changeType to GraphQL EventType enum
|
|
4173
|
-
* GraphQL enum values: ROLE_GRANTED, ROLE_REVOKED, OWNERSHIP_TRANSFER_STARTED,
|
|
4174
|
-
* OWNERSHIP_TRANSFER_COMPLETED, ADMIN_TRANSFER_INITIATED, ADMIN_TRANSFER_COMPLETED
|
|
4175
4184
|
*/
|
|
4176
4185
|
mapChangeTypeToGraphQLEnum(changeType) {
|
|
4177
4186
|
const mapping = {
|
|
4178
4187
|
GRANTED: "ROLE_GRANTED",
|
|
4179
4188
|
REVOKED: "ROLE_REVOKED",
|
|
4189
|
+
ROLE_ADMIN_CHANGED: "ROLE_ADMIN_CHANGED",
|
|
4180
4190
|
OWNERSHIP_TRANSFER_STARTED: "OWNERSHIP_TRANSFER_STARTED",
|
|
4181
4191
|
OWNERSHIP_TRANSFER_COMPLETED: "OWNERSHIP_TRANSFER_COMPLETED",
|
|
4192
|
+
OWNERSHIP_RENOUNCED: "OWNERSHIP_RENOUNCED",
|
|
4182
4193
|
ADMIN_TRANSFER_INITIATED: "ADMIN_TRANSFER_INITIATED",
|
|
4183
4194
|
ADMIN_TRANSFER_COMPLETED: "ADMIN_TRANSFER_COMPLETED",
|
|
4195
|
+
ADMIN_TRANSFER_CANCELED: "UNKNOWN",
|
|
4196
|
+
// EVM-only event, not applicable to Stellar
|
|
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
|
|
4184
4202
|
UNKNOWN: "UNKNOWN"
|
|
4185
4203
|
};
|
|
4186
4204
|
return mapping[changeType];
|
|
@@ -4191,7 +4209,7 @@ var StellarIndexerClient = class {
|
|
|
4191
4209
|
buildHistoryQuery(_contractAddress, options) {
|
|
4192
4210
|
const roleFilter = options?.roleId ? ", role: { equalTo: $role }" : "";
|
|
4193
4211
|
const accountFilter = options?.account ? ", account: { equalTo: $account }" : "";
|
|
4194
|
-
const typeFilter = options?.changeType ? `,
|
|
4212
|
+
const typeFilter = options?.changeType ? `, eventType: { equalTo: ${this.mapChangeTypeToGraphQLEnum(options.changeType)} }` : "";
|
|
4195
4213
|
const txFilter = options?.txId ? ", txHash: { equalTo: $txHash }" : "";
|
|
4196
4214
|
const timestampConditions = [];
|
|
4197
4215
|
if (options?.timestampFrom) {
|
|
@@ -4201,7 +4219,7 @@ var StellarIndexerClient = class {
|
|
|
4201
4219
|
timestampConditions.push("lessThanOrEqualTo: $timestampTo");
|
|
4202
4220
|
}
|
|
4203
4221
|
const timestampFilter = timestampConditions.length > 0 ? `, timestamp: { ${timestampConditions.join(", ")} }` : "";
|
|
4204
|
-
const ledgerFilter = options?.ledger ? ",
|
|
4222
|
+
const ledgerFilter = options?.ledger ? ", blockNumber: { equalTo: $blockNumber }" : "";
|
|
4205
4223
|
const limitClause = options?.limit ? ", first: $limit" : "";
|
|
4206
4224
|
const cursorClause = options?.cursor ? ", after: $cursor" : "";
|
|
4207
4225
|
const varDeclarations = [
|
|
@@ -4211,7 +4229,7 @@ var StellarIndexerClient = class {
|
|
|
4211
4229
|
options?.txId ? "$txHash: String" : "",
|
|
4212
4230
|
options?.timestampFrom ? "$timestampFrom: Datetime" : "",
|
|
4213
4231
|
options?.timestampTo ? "$timestampTo: Datetime" : "",
|
|
4214
|
-
options?.ledger ? "$
|
|
4232
|
+
options?.ledger ? "$blockNumber: BigFloat" : "",
|
|
4215
4233
|
options?.limit ? "$limit: Int" : "",
|
|
4216
4234
|
options?.cursor ? "$cursor: Cursor" : ""
|
|
4217
4235
|
].filter(Boolean).join(", ");
|
|
@@ -4227,10 +4245,14 @@ var StellarIndexerClient = class {
|
|
|
4227
4245
|
id
|
|
4228
4246
|
role
|
|
4229
4247
|
account
|
|
4230
|
-
|
|
4248
|
+
eventType
|
|
4231
4249
|
txHash
|
|
4232
4250
|
timestamp
|
|
4233
|
-
|
|
4251
|
+
blockNumber
|
|
4252
|
+
previousOwner
|
|
4253
|
+
newOwner
|
|
4254
|
+
previousAdmin
|
|
4255
|
+
newAdmin
|
|
4234
4256
|
}
|
|
4235
4257
|
pageInfo {
|
|
4236
4258
|
hasNextPage
|
|
@@ -4263,7 +4285,7 @@ var StellarIndexerClient = class {
|
|
|
4263
4285
|
variables.timestampTo = options.timestampTo;
|
|
4264
4286
|
}
|
|
4265
4287
|
if (options?.ledger) {
|
|
4266
|
-
variables.
|
|
4288
|
+
variables.blockNumber = String(options.ledger);
|
|
4267
4289
|
}
|
|
4268
4290
|
if (options?.limit) {
|
|
4269
4291
|
variables.limit = options.limit;
|
|
@@ -4284,7 +4306,7 @@ var StellarIndexerClient = class {
|
|
|
4284
4306
|
accessControlEvents(
|
|
4285
4307
|
filter: {
|
|
4286
4308
|
contract: { equalTo: $contract }
|
|
4287
|
-
|
|
4309
|
+
eventType: { in: [ROLE_GRANTED, ROLE_REVOKED] }
|
|
4288
4310
|
}
|
|
4289
4311
|
) {
|
|
4290
4312
|
nodes {
|
|
@@ -4307,7 +4329,7 @@ var StellarIndexerClient = class {
|
|
|
4307
4329
|
contract: { equalTo: $contract }
|
|
4308
4330
|
role: { equalTo: $role }
|
|
4309
4331
|
account: { in: $accounts }
|
|
4310
|
-
|
|
4332
|
+
eventType: { equalTo: ROLE_GRANTED }
|
|
4311
4333
|
}
|
|
4312
4334
|
orderBy: TIMESTAMP_DESC
|
|
4313
4335
|
) {
|
|
@@ -4315,12 +4337,32 @@ var StellarIndexerClient = class {
|
|
|
4315
4337
|
account
|
|
4316
4338
|
txHash
|
|
4317
4339
|
timestamp
|
|
4318
|
-
|
|
4340
|
+
blockNumber
|
|
4319
4341
|
}
|
|
4320
4342
|
}
|
|
4321
4343
|
}
|
|
4322
4344
|
`;
|
|
4323
4345
|
}
|
|
4346
|
+
/**
|
|
4347
|
+
* Normalize account from indexer entry
|
|
4348
|
+
*
|
|
4349
|
+
* Multi-chain schema uses different fields for different event types:
|
|
4350
|
+
* - Role events: `account` field
|
|
4351
|
+
* - Ownership events: `newOwner` field (pending/new owner)
|
|
4352
|
+
* - Admin events: `newAdmin` field (pending/new admin)
|
|
4353
|
+
*/
|
|
4354
|
+
normalizeAccount(entry) {
|
|
4355
|
+
if (entry.eventType === "ROLE_GRANTED" || entry.eventType === "ROLE_REVOKED" || entry.eventType === "ROLE_ADMIN_CHANGED") {
|
|
4356
|
+
return entry.account || "";
|
|
4357
|
+
}
|
|
4358
|
+
if (entry.eventType === "OWNERSHIP_TRANSFER_STARTED" || entry.eventType === "OWNERSHIP_TRANSFER_COMPLETED" || entry.eventType === "OWNERSHIP_RENOUNCED") {
|
|
4359
|
+
return entry.newOwner || "";
|
|
4360
|
+
}
|
|
4361
|
+
if (entry.eventType === "ADMIN_TRANSFER_INITIATED" || entry.eventType === "ADMIN_TRANSFER_COMPLETED" || entry.eventType === "ADMIN_RENOUNCED") {
|
|
4362
|
+
return entry.newAdmin || "";
|
|
4363
|
+
}
|
|
4364
|
+
return entry.account || "";
|
|
4365
|
+
}
|
|
4324
4366
|
/**
|
|
4325
4367
|
* Transform indexer entries to standard HistoryEntry format
|
|
4326
4368
|
*/
|
|
@@ -4331,39 +4373,48 @@ var StellarIndexerClient = class {
|
|
|
4331
4373
|
// Map ownership events to special role
|
|
4332
4374
|
};
|
|
4333
4375
|
let changeType;
|
|
4334
|
-
switch (entry.
|
|
4376
|
+
switch (entry.eventType) {
|
|
4335
4377
|
case "ROLE_GRANTED":
|
|
4336
4378
|
changeType = "GRANTED";
|
|
4337
4379
|
break;
|
|
4338
4380
|
case "ROLE_REVOKED":
|
|
4339
4381
|
changeType = "REVOKED";
|
|
4340
4382
|
break;
|
|
4383
|
+
case "ROLE_ADMIN_CHANGED":
|
|
4384
|
+
changeType = "ROLE_ADMIN_CHANGED";
|
|
4385
|
+
break;
|
|
4341
4386
|
case "OWNERSHIP_TRANSFER_STARTED":
|
|
4342
4387
|
changeType = "OWNERSHIP_TRANSFER_STARTED";
|
|
4343
4388
|
break;
|
|
4344
4389
|
case "OWNERSHIP_TRANSFER_COMPLETED":
|
|
4345
4390
|
changeType = "OWNERSHIP_TRANSFER_COMPLETED";
|
|
4346
4391
|
break;
|
|
4392
|
+
case "OWNERSHIP_RENOUNCED":
|
|
4393
|
+
changeType = "OWNERSHIP_RENOUNCED";
|
|
4394
|
+
break;
|
|
4347
4395
|
case "ADMIN_TRANSFER_INITIATED":
|
|
4348
4396
|
changeType = "ADMIN_TRANSFER_INITIATED";
|
|
4349
4397
|
break;
|
|
4350
4398
|
case "ADMIN_TRANSFER_COMPLETED":
|
|
4351
4399
|
changeType = "ADMIN_TRANSFER_COMPLETED";
|
|
4352
4400
|
break;
|
|
4401
|
+
case "ADMIN_RENOUNCED":
|
|
4402
|
+
changeType = "ADMIN_RENOUNCED";
|
|
4403
|
+
break;
|
|
4353
4404
|
default:
|
|
4354
4405
|
logger19.warn(
|
|
4355
4406
|
LOG_SYSTEM3,
|
|
4356
|
-
`Unknown event type: ${entry.
|
|
4407
|
+
`Unknown event type: ${entry.eventType}, assigning changeType to UNKNOWN`
|
|
4357
4408
|
);
|
|
4358
4409
|
changeType = "UNKNOWN";
|
|
4359
4410
|
}
|
|
4360
4411
|
return {
|
|
4361
4412
|
role,
|
|
4362
|
-
account: entry
|
|
4413
|
+
account: this.normalizeAccount(entry),
|
|
4363
4414
|
changeType,
|
|
4364
4415
|
txId: entry.txHash,
|
|
4365
4416
|
timestamp: entry.timestamp,
|
|
4366
|
-
ledger: parseInt(entry.
|
|
4417
|
+
ledger: parseInt(entry.blockNumber, 10)
|
|
4367
4418
|
};
|
|
4368
4419
|
});
|
|
4369
4420
|
}
|
|
@@ -4699,6 +4750,17 @@ var StellarAccessControlService = class {
|
|
|
4699
4750
|
"StellarAccessControlService.getOwnership",
|
|
4700
4751
|
`Reading ownership status for ${contractAddress}`
|
|
4701
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
|
+
}
|
|
4702
4764
|
const basicOwnership = await readOwnership(contractAddress, this.networkConfig);
|
|
4703
4765
|
if (basicOwnership.owner === null) {
|
|
4704
4766
|
logger20.debug(
|
|
@@ -4991,6 +5053,25 @@ var StellarAccessControlService = class {
|
|
|
4991
5053
|
logger20.info("StellarAccessControlService.revokeRole", `Role revoked. TxHash: ${result.txHash}`);
|
|
4992
5054
|
return { id: result.txHash };
|
|
4993
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
|
+
}
|
|
4994
5075
|
/**
|
|
4995
5076
|
* Transfers ownership of the contract using two-step transfer
|
|
4996
5077
|
*
|
|
@@ -5144,6 +5225,17 @@ var StellarAccessControlService = class {
|
|
|
5144
5225
|
"StellarAccessControlService.getAdminInfo",
|
|
5145
5226
|
`Reading admin status for ${contractAddress}`
|
|
5146
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
|
+
}
|
|
5147
5239
|
const currentAdmin = await getAdmin(contractAddress, this.networkConfig);
|
|
5148
5240
|
if (currentAdmin === null) {
|
|
5149
5241
|
logger20.debug(
|
|
@@ -5439,6 +5531,17 @@ var StellarAccessControlService = class {
|
|
|
5439
5531
|
"StellarAccessControlService.getAdminAccount",
|
|
5440
5532
|
`Reading admin for ${contractAddress}`
|
|
5441
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
|
+
}
|
|
5442
5545
|
return getAdmin(contractAddress, this.networkConfig);
|
|
5443
5546
|
}
|
|
5444
5547
|
/**
|
|
@@ -8424,8 +8527,53 @@ var StellarAdapter = class {
|
|
|
8424
8527
|
}
|
|
8425
8528
|
};
|
|
8426
8529
|
|
|
8427
|
-
// 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
|
|
8428
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";
|
|
8429
8577
|
var stellarPublic = {
|
|
8430
8578
|
id: "stellar-public",
|
|
8431
8579
|
exportConstName: "stellarPublic",
|
|
@@ -8438,12 +8586,12 @@ var stellarPublic = {
|
|
|
8438
8586
|
sorobanRpcUrl: "https://mainnet.sorobanrpc.com",
|
|
8439
8587
|
networkPassphrase: "Public Global Stellar Network ; September 2015",
|
|
8440
8588
|
explorerUrl: "https://stellar.expert/explorer/public",
|
|
8441
|
-
iconComponent:
|
|
8442
|
-
|
|
8589
|
+
iconComponent: NetworkStellar2,
|
|
8590
|
+
accessControlIndexerUrl: "https://openzeppelin-stellar-mainnet.graphql.subquery.network/"
|
|
8443
8591
|
};
|
|
8444
8592
|
|
|
8445
8593
|
// src/networks/testnet.ts
|
|
8446
|
-
import { NetworkStellar as
|
|
8594
|
+
import { NetworkStellar as NetworkStellar3 } from "@web3icons/react";
|
|
8447
8595
|
var stellarTestnet = {
|
|
8448
8596
|
id: "stellar-testnet",
|
|
8449
8597
|
exportConstName: "stellarTestnet",
|
|
@@ -8456,8 +8604,8 @@ var stellarTestnet = {
|
|
|
8456
8604
|
sorobanRpcUrl: "https://soroban-testnet.stellar.org",
|
|
8457
8605
|
networkPassphrase: "Test SDF Network ; September 2015",
|
|
8458
8606
|
explorerUrl: "https://stellar.expert/explorer/testnet",
|
|
8459
|
-
iconComponent:
|
|
8460
|
-
|
|
8607
|
+
iconComponent: NetworkStellar3,
|
|
8608
|
+
accessControlIndexerUrl: "https://openzepplin-stellar-testnet.graphql.subquery.network"
|
|
8461
8609
|
};
|
|
8462
8610
|
|
|
8463
8611
|
// src/networks/index.ts
|
|
@@ -8468,44 +8616,19 @@ var stellarNetworks = [
|
|
|
8468
8616
|
...stellarTestnetNetworks
|
|
8469
8617
|
];
|
|
8470
8618
|
|
|
8471
|
-
// src/
|
|
8472
|
-
var
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
dependencies: {
|
|
8478
|
-
// Runtime dependencies
|
|
8479
|
-
runtime: {
|
|
8480
|
-
// Core Stellar libraries
|
|
8481
|
-
"@stellar/stellar-sdk": "^14.1.1",
|
|
8482
|
-
// SAC (Stellar Asset Contract) support - dynamically loaded from CDN
|
|
8483
|
-
// These are needed for XDR encoding when working with SAC contracts
|
|
8484
|
-
"@stellar/stellar-xdr-json": "^23.0.0",
|
|
8485
|
-
"lossless-json": "^4.0.2",
|
|
8486
|
-
// Wallet connection and integration
|
|
8487
|
-
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
8488
|
-
// OpenZeppelin Relayer integration (optional, for gasless transactions)
|
|
8489
|
-
"@openzeppelin/relayer-sdk": "1.1.0",
|
|
8490
|
-
// React integration for wallet components
|
|
8491
|
-
react: "^19.0.0",
|
|
8492
|
-
"react-dom": "^19.0.0"
|
|
8493
|
-
},
|
|
8494
|
-
// Development dependencies
|
|
8495
|
-
dev: {
|
|
8496
|
-
"@types/react": "^19.0.0",
|
|
8497
|
-
"@types/react-dom": "^19.0.0"
|
|
8498
|
-
}
|
|
8499
|
-
}
|
|
8619
|
+
// src/index.ts
|
|
8620
|
+
var ecosystemDefinition = {
|
|
8621
|
+
...ecosystemMetadata,
|
|
8622
|
+
networks: stellarNetworks,
|
|
8623
|
+
createAdapter: (config) => new StellarAdapter(config),
|
|
8624
|
+
adapterConfig: stellarAdapterConfig
|
|
8500
8625
|
};
|
|
8501
8626
|
export {
|
|
8502
8627
|
StellarAdapter,
|
|
8628
|
+
ecosystemDefinition,
|
|
8629
|
+
ecosystemMetadata,
|
|
8503
8630
|
isStellarContractArtifacts,
|
|
8504
|
-
stellarAdapterConfig,
|
|
8505
|
-
stellarMainnetNetworks,
|
|
8506
|
-
stellarNetworks,
|
|
8507
8631
|
stellarPublic,
|
|
8508
|
-
stellarTestnet
|
|
8509
|
-
stellarTestnetNetworks
|
|
8632
|
+
stellarTestnet
|
|
8510
8633
|
};
|
|
8511
8634
|
//# sourceMappingURL=index.js.map
|