@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.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) {
|
|
@@ -3672,11 +3678,12 @@ var StellarIndexerClient = class {
|
|
|
3672
3678
|
}
|
|
3673
3679
|
const grantMap = /* @__PURE__ */ new Map();
|
|
3674
3680
|
for (const entry of result.data.accessControlEvents.nodes) {
|
|
3675
|
-
|
|
3676
|
-
|
|
3681
|
+
const account = entry.account || "";
|
|
3682
|
+
if (account && !grantMap.has(account)) {
|
|
3683
|
+
grantMap.set(account, {
|
|
3677
3684
|
timestamp: entry.timestamp,
|
|
3678
3685
|
txId: entry.txHash,
|
|
3679
|
-
ledger: parseInt(entry.
|
|
3686
|
+
ledger: parseInt(entry.blockNumber, 10)
|
|
3680
3687
|
});
|
|
3681
3688
|
}
|
|
3682
3689
|
}
|
|
@@ -3793,10 +3800,17 @@ var StellarIndexerClient = class {
|
|
|
3793
3800
|
import_ui_utils20.logger.debug(LOG_SYSTEM3, `Ownership transfer was completed for ${contractAddress}`);
|
|
3794
3801
|
return null;
|
|
3795
3802
|
}
|
|
3796
|
-
if (!latestInitiation.
|
|
3803
|
+
if (!latestInitiation.previousOwner) {
|
|
3797
3804
|
import_ui_utils20.logger.warn(
|
|
3798
3805
|
LOG_SYSTEM3,
|
|
3799
|
-
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without
|
|
3806
|
+
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without previousOwner field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3807
|
+
);
|
|
3808
|
+
return null;
|
|
3809
|
+
}
|
|
3810
|
+
if (!latestInitiation.newOwner) {
|
|
3811
|
+
import_ui_utils20.logger.warn(
|
|
3812
|
+
LOG_SYSTEM3,
|
|
3813
|
+
`Indexer returned OWNERSHIP_TRANSFER_STARTED event without newOwner field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3800
3814
|
);
|
|
3801
3815
|
return null;
|
|
3802
3816
|
}
|
|
@@ -3809,14 +3823,14 @@ var StellarIndexerClient = class {
|
|
|
3809
3823
|
}
|
|
3810
3824
|
import_ui_utils20.logger.info(
|
|
3811
3825
|
LOG_SYSTEM3,
|
|
3812
|
-
`Found pending ownership transfer for ${contractAddress}: pending owner=${latestInitiation.
|
|
3826
|
+
`Found pending ownership transfer for ${contractAddress}: pending owner=${latestInitiation.newOwner}, expires at ledger ${latestInitiation.liveUntilLedger}`
|
|
3813
3827
|
);
|
|
3814
3828
|
return {
|
|
3815
|
-
previousOwner: latestInitiation.
|
|
3816
|
-
pendingOwner: latestInitiation.
|
|
3829
|
+
previousOwner: latestInitiation.previousOwner,
|
|
3830
|
+
pendingOwner: latestInitiation.newOwner,
|
|
3817
3831
|
txHash: latestInitiation.txHash,
|
|
3818
3832
|
timestamp: latestInitiation.timestamp,
|
|
3819
|
-
ledger: parseInt(latestInitiation.
|
|
3833
|
+
ledger: parseInt(latestInitiation.blockNumber, 10),
|
|
3820
3834
|
liveUntilLedger: latestInitiation.liveUntilLedger
|
|
3821
3835
|
};
|
|
3822
3836
|
} catch (error) {
|
|
@@ -3934,10 +3948,17 @@ var StellarIndexerClient = class {
|
|
|
3934
3948
|
import_ui_utils20.logger.debug(LOG_SYSTEM3, `Admin transfer was completed for ${contractAddress}`);
|
|
3935
3949
|
return null;
|
|
3936
3950
|
}
|
|
3937
|
-
if (!latestInitiation.
|
|
3951
|
+
if (!latestInitiation.previousAdmin) {
|
|
3938
3952
|
import_ui_utils20.logger.warn(
|
|
3939
3953
|
LOG_SYSTEM3,
|
|
3940
|
-
`Indexer returned ADMIN_TRANSFER_INITIATED event without
|
|
3954
|
+
`Indexer returned ADMIN_TRANSFER_INITIATED event without previousAdmin field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3955
|
+
);
|
|
3956
|
+
return null;
|
|
3957
|
+
}
|
|
3958
|
+
if (!latestInitiation.newAdmin) {
|
|
3959
|
+
import_ui_utils20.logger.warn(
|
|
3960
|
+
LOG_SYSTEM3,
|
|
3961
|
+
`Indexer returned ADMIN_TRANSFER_INITIATED event without newAdmin field for ${contractAddress}. This indicates incomplete indexer data. Treating as no valid pending transfer.`
|
|
3941
3962
|
);
|
|
3942
3963
|
return null;
|
|
3943
3964
|
}
|
|
@@ -3950,14 +3971,14 @@ var StellarIndexerClient = class {
|
|
|
3950
3971
|
}
|
|
3951
3972
|
import_ui_utils20.logger.info(
|
|
3952
3973
|
LOG_SYSTEM3,
|
|
3953
|
-
`Found pending admin transfer for ${contractAddress}: pending admin=${latestInitiation.
|
|
3974
|
+
`Found pending admin transfer for ${contractAddress}: pending admin=${latestInitiation.newAdmin}, expires at ledger ${latestInitiation.liveUntilLedger}`
|
|
3954
3975
|
);
|
|
3955
3976
|
return {
|
|
3956
|
-
previousAdmin: latestInitiation.
|
|
3957
|
-
pendingAdmin: latestInitiation.
|
|
3977
|
+
previousAdmin: latestInitiation.previousAdmin,
|
|
3978
|
+
pendingAdmin: latestInitiation.newAdmin,
|
|
3958
3979
|
txHash: latestInitiation.txHash,
|
|
3959
3980
|
timestamp: latestInitiation.timestamp,
|
|
3960
|
-
ledger: parseInt(latestInitiation.
|
|
3981
|
+
ledger: parseInt(latestInitiation.blockNumber, 10),
|
|
3961
3982
|
liveUntilLedger: latestInitiation.liveUntilLedger
|
|
3962
3983
|
};
|
|
3963
3984
|
} catch (error) {
|
|
@@ -3981,11 +4002,6 @@ var StellarIndexerClient = class {
|
|
|
3981
4002
|
* Note: The OpenZeppelin Stellar contract emits `ownership_transfer` event
|
|
3982
4003
|
* which is indexed as `OWNERSHIP_TRANSFER_STARTED`.
|
|
3983
4004
|
*
|
|
3984
|
-
* Schema mapping:
|
|
3985
|
-
* - `account`: pending new owner
|
|
3986
|
-
* - `admin`: current owner who initiated the transfer
|
|
3987
|
-
* - `ledger`: block height of the event
|
|
3988
|
-
* - `liveUntilLedger`: expiration ledger for the pending transfer
|
|
3989
4005
|
*/
|
|
3990
4006
|
buildOwnershipTransferStartedQuery() {
|
|
3991
4007
|
return `
|
|
@@ -3993,19 +4009,18 @@ var StellarIndexerClient = class {
|
|
|
3993
4009
|
accessControlEvents(
|
|
3994
4010
|
filter: {
|
|
3995
4011
|
contract: { equalTo: $contract }
|
|
3996
|
-
|
|
4012
|
+
eventType: { equalTo: OWNERSHIP_TRANSFER_STARTED }
|
|
3997
4013
|
}
|
|
3998
4014
|
orderBy: TIMESTAMP_DESC
|
|
3999
4015
|
first: 1
|
|
4000
4016
|
) {
|
|
4001
4017
|
nodes {
|
|
4002
4018
|
id
|
|
4003
|
-
|
|
4004
|
-
|
|
4019
|
+
previousOwner
|
|
4020
|
+
newOwner
|
|
4005
4021
|
txHash
|
|
4006
4022
|
timestamp
|
|
4007
|
-
|
|
4008
|
-
blockHeight
|
|
4023
|
+
blockNumber
|
|
4009
4024
|
liveUntilLedger
|
|
4010
4025
|
}
|
|
4011
4026
|
}
|
|
@@ -4021,7 +4036,7 @@ var StellarIndexerClient = class {
|
|
|
4021
4036
|
accessControlEvents(
|
|
4022
4037
|
filter: {
|
|
4023
4038
|
contract: { equalTo: $contract }
|
|
4024
|
-
|
|
4039
|
+
eventType: { equalTo: OWNERSHIP_TRANSFER_COMPLETED }
|
|
4025
4040
|
timestamp: { greaterThan: $afterTimestamp }
|
|
4026
4041
|
}
|
|
4027
4042
|
orderBy: TIMESTAMP_DESC
|
|
@@ -4041,12 +4056,6 @@ var StellarIndexerClient = class {
|
|
|
4041
4056
|
*
|
|
4042
4057
|
* Note: The OpenZeppelin Stellar contract emits `admin_transfer_initiated` event
|
|
4043
4058
|
* which is indexed as `ADMIN_TRANSFER_INITIATED`.
|
|
4044
|
-
*
|
|
4045
|
-
* Schema mapping:
|
|
4046
|
-
* - `account`: pending new admin
|
|
4047
|
-
* - `admin`: current admin who initiated the transfer
|
|
4048
|
-
* - `ledger`: block height of the event
|
|
4049
|
-
* - `liveUntilLedger`: expiration ledger for the pending transfer
|
|
4050
4059
|
*/
|
|
4051
4060
|
buildAdminTransferInitiatedQuery() {
|
|
4052
4061
|
return `
|
|
@@ -4054,19 +4063,18 @@ var StellarIndexerClient = class {
|
|
|
4054
4063
|
accessControlEvents(
|
|
4055
4064
|
filter: {
|
|
4056
4065
|
contract: { equalTo: $contract }
|
|
4057
|
-
|
|
4066
|
+
eventType: { equalTo: ADMIN_TRANSFER_INITIATED }
|
|
4058
4067
|
}
|
|
4059
4068
|
orderBy: TIMESTAMP_DESC
|
|
4060
4069
|
first: 1
|
|
4061
4070
|
) {
|
|
4062
4071
|
nodes {
|
|
4063
4072
|
id
|
|
4064
|
-
|
|
4065
|
-
|
|
4073
|
+
previousAdmin
|
|
4074
|
+
newAdmin
|
|
4066
4075
|
txHash
|
|
4067
4076
|
timestamp
|
|
4068
|
-
|
|
4069
|
-
blockHeight
|
|
4077
|
+
blockNumber
|
|
4070
4078
|
liveUntilLedger
|
|
4071
4079
|
}
|
|
4072
4080
|
}
|
|
@@ -4082,7 +4090,7 @@ var StellarIndexerClient = class {
|
|
|
4082
4090
|
accessControlEvents(
|
|
4083
4091
|
filter: {
|
|
4084
4092
|
contract: { equalTo: $contract }
|
|
4085
|
-
|
|
4093
|
+
eventType: { equalTo: ADMIN_TRANSFER_COMPLETED }
|
|
4086
4094
|
timestamp: { greaterThan: $afterTimestamp }
|
|
4087
4095
|
}
|
|
4088
4096
|
orderBy: TIMESTAMP_DESC
|
|
@@ -4154,8 +4162,9 @@ var StellarIndexerClient = class {
|
|
|
4154
4162
|
this.resolvedEndpoints = endpoints;
|
|
4155
4163
|
return endpoints;
|
|
4156
4164
|
}
|
|
4157
|
-
|
|
4158
|
-
|
|
4165
|
+
const defaultHttpUrl = this.networkConfig.accessControlIndexerUrl ?? this.networkConfig.indexerUri;
|
|
4166
|
+
if (defaultHttpUrl) {
|
|
4167
|
+
endpoints.http = defaultHttpUrl;
|
|
4159
4168
|
import_ui_utils20.logger.info(
|
|
4160
4169
|
LOG_SYSTEM3,
|
|
4161
4170
|
`Using network config indexer URI for ${networkId}: ${endpoints.http}`
|
|
@@ -4179,17 +4188,24 @@ var StellarIndexerClient = class {
|
|
|
4179
4188
|
}
|
|
4180
4189
|
/**
|
|
4181
4190
|
* Maps internal changeType to GraphQL EventType enum
|
|
4182
|
-
* GraphQL enum values: ROLE_GRANTED, ROLE_REVOKED, OWNERSHIP_TRANSFER_STARTED,
|
|
4183
|
-
* OWNERSHIP_TRANSFER_COMPLETED, ADMIN_TRANSFER_INITIATED, ADMIN_TRANSFER_COMPLETED
|
|
4184
4191
|
*/
|
|
4185
4192
|
mapChangeTypeToGraphQLEnum(changeType) {
|
|
4186
4193
|
const mapping = {
|
|
4187
4194
|
GRANTED: "ROLE_GRANTED",
|
|
4188
4195
|
REVOKED: "ROLE_REVOKED",
|
|
4196
|
+
ROLE_ADMIN_CHANGED: "ROLE_ADMIN_CHANGED",
|
|
4189
4197
|
OWNERSHIP_TRANSFER_STARTED: "OWNERSHIP_TRANSFER_STARTED",
|
|
4190
4198
|
OWNERSHIP_TRANSFER_COMPLETED: "OWNERSHIP_TRANSFER_COMPLETED",
|
|
4199
|
+
OWNERSHIP_RENOUNCED: "OWNERSHIP_RENOUNCED",
|
|
4191
4200
|
ADMIN_TRANSFER_INITIATED: "ADMIN_TRANSFER_INITIATED",
|
|
4192
4201
|
ADMIN_TRANSFER_COMPLETED: "ADMIN_TRANSFER_COMPLETED",
|
|
4202
|
+
ADMIN_TRANSFER_CANCELED: "UNKNOWN",
|
|
4203
|
+
// EVM-only event, not applicable to Stellar
|
|
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
|
|
4193
4209
|
UNKNOWN: "UNKNOWN"
|
|
4194
4210
|
};
|
|
4195
4211
|
return mapping[changeType];
|
|
@@ -4200,7 +4216,7 @@ var StellarIndexerClient = class {
|
|
|
4200
4216
|
buildHistoryQuery(_contractAddress, options) {
|
|
4201
4217
|
const roleFilter = options?.roleId ? ", role: { equalTo: $role }" : "";
|
|
4202
4218
|
const accountFilter = options?.account ? ", account: { equalTo: $account }" : "";
|
|
4203
|
-
const typeFilter = options?.changeType ? `,
|
|
4219
|
+
const typeFilter = options?.changeType ? `, eventType: { equalTo: ${this.mapChangeTypeToGraphQLEnum(options.changeType)} }` : "";
|
|
4204
4220
|
const txFilter = options?.txId ? ", txHash: { equalTo: $txHash }" : "";
|
|
4205
4221
|
const timestampConditions = [];
|
|
4206
4222
|
if (options?.timestampFrom) {
|
|
@@ -4210,7 +4226,7 @@ var StellarIndexerClient = class {
|
|
|
4210
4226
|
timestampConditions.push("lessThanOrEqualTo: $timestampTo");
|
|
4211
4227
|
}
|
|
4212
4228
|
const timestampFilter = timestampConditions.length > 0 ? `, timestamp: { ${timestampConditions.join(", ")} }` : "";
|
|
4213
|
-
const ledgerFilter = options?.ledger ? ",
|
|
4229
|
+
const ledgerFilter = options?.ledger ? ", blockNumber: { equalTo: $blockNumber }" : "";
|
|
4214
4230
|
const limitClause = options?.limit ? ", first: $limit" : "";
|
|
4215
4231
|
const cursorClause = options?.cursor ? ", after: $cursor" : "";
|
|
4216
4232
|
const varDeclarations = [
|
|
@@ -4220,7 +4236,7 @@ var StellarIndexerClient = class {
|
|
|
4220
4236
|
options?.txId ? "$txHash: String" : "",
|
|
4221
4237
|
options?.timestampFrom ? "$timestampFrom: Datetime" : "",
|
|
4222
4238
|
options?.timestampTo ? "$timestampTo: Datetime" : "",
|
|
4223
|
-
options?.ledger ? "$
|
|
4239
|
+
options?.ledger ? "$blockNumber: BigFloat" : "",
|
|
4224
4240
|
options?.limit ? "$limit: Int" : "",
|
|
4225
4241
|
options?.cursor ? "$cursor: Cursor" : ""
|
|
4226
4242
|
].filter(Boolean).join(", ");
|
|
@@ -4236,10 +4252,14 @@ var StellarIndexerClient = class {
|
|
|
4236
4252
|
id
|
|
4237
4253
|
role
|
|
4238
4254
|
account
|
|
4239
|
-
|
|
4255
|
+
eventType
|
|
4240
4256
|
txHash
|
|
4241
4257
|
timestamp
|
|
4242
|
-
|
|
4258
|
+
blockNumber
|
|
4259
|
+
previousOwner
|
|
4260
|
+
newOwner
|
|
4261
|
+
previousAdmin
|
|
4262
|
+
newAdmin
|
|
4243
4263
|
}
|
|
4244
4264
|
pageInfo {
|
|
4245
4265
|
hasNextPage
|
|
@@ -4272,7 +4292,7 @@ var StellarIndexerClient = class {
|
|
|
4272
4292
|
variables.timestampTo = options.timestampTo;
|
|
4273
4293
|
}
|
|
4274
4294
|
if (options?.ledger) {
|
|
4275
|
-
variables.
|
|
4295
|
+
variables.blockNumber = String(options.ledger);
|
|
4276
4296
|
}
|
|
4277
4297
|
if (options?.limit) {
|
|
4278
4298
|
variables.limit = options.limit;
|
|
@@ -4293,7 +4313,7 @@ var StellarIndexerClient = class {
|
|
|
4293
4313
|
accessControlEvents(
|
|
4294
4314
|
filter: {
|
|
4295
4315
|
contract: { equalTo: $contract }
|
|
4296
|
-
|
|
4316
|
+
eventType: { in: [ROLE_GRANTED, ROLE_REVOKED] }
|
|
4297
4317
|
}
|
|
4298
4318
|
) {
|
|
4299
4319
|
nodes {
|
|
@@ -4316,7 +4336,7 @@ var StellarIndexerClient = class {
|
|
|
4316
4336
|
contract: { equalTo: $contract }
|
|
4317
4337
|
role: { equalTo: $role }
|
|
4318
4338
|
account: { in: $accounts }
|
|
4319
|
-
|
|
4339
|
+
eventType: { equalTo: ROLE_GRANTED }
|
|
4320
4340
|
}
|
|
4321
4341
|
orderBy: TIMESTAMP_DESC
|
|
4322
4342
|
) {
|
|
@@ -4324,12 +4344,32 @@ var StellarIndexerClient = class {
|
|
|
4324
4344
|
account
|
|
4325
4345
|
txHash
|
|
4326
4346
|
timestamp
|
|
4327
|
-
|
|
4347
|
+
blockNumber
|
|
4328
4348
|
}
|
|
4329
4349
|
}
|
|
4330
4350
|
}
|
|
4331
4351
|
`;
|
|
4332
4352
|
}
|
|
4353
|
+
/**
|
|
4354
|
+
* Normalize account from indexer entry
|
|
4355
|
+
*
|
|
4356
|
+
* Multi-chain schema uses different fields for different event types:
|
|
4357
|
+
* - Role events: `account` field
|
|
4358
|
+
* - Ownership events: `newOwner` field (pending/new owner)
|
|
4359
|
+
* - Admin events: `newAdmin` field (pending/new admin)
|
|
4360
|
+
*/
|
|
4361
|
+
normalizeAccount(entry) {
|
|
4362
|
+
if (entry.eventType === "ROLE_GRANTED" || entry.eventType === "ROLE_REVOKED" || entry.eventType === "ROLE_ADMIN_CHANGED") {
|
|
4363
|
+
return entry.account || "";
|
|
4364
|
+
}
|
|
4365
|
+
if (entry.eventType === "OWNERSHIP_TRANSFER_STARTED" || entry.eventType === "OWNERSHIP_TRANSFER_COMPLETED" || entry.eventType === "OWNERSHIP_RENOUNCED") {
|
|
4366
|
+
return entry.newOwner || "";
|
|
4367
|
+
}
|
|
4368
|
+
if (entry.eventType === "ADMIN_TRANSFER_INITIATED" || entry.eventType === "ADMIN_TRANSFER_COMPLETED" || entry.eventType === "ADMIN_RENOUNCED") {
|
|
4369
|
+
return entry.newAdmin || "";
|
|
4370
|
+
}
|
|
4371
|
+
return entry.account || "";
|
|
4372
|
+
}
|
|
4333
4373
|
/**
|
|
4334
4374
|
* Transform indexer entries to standard HistoryEntry format
|
|
4335
4375
|
*/
|
|
@@ -4340,39 +4380,48 @@ var StellarIndexerClient = class {
|
|
|
4340
4380
|
// Map ownership events to special role
|
|
4341
4381
|
};
|
|
4342
4382
|
let changeType;
|
|
4343
|
-
switch (entry.
|
|
4383
|
+
switch (entry.eventType) {
|
|
4344
4384
|
case "ROLE_GRANTED":
|
|
4345
4385
|
changeType = "GRANTED";
|
|
4346
4386
|
break;
|
|
4347
4387
|
case "ROLE_REVOKED":
|
|
4348
4388
|
changeType = "REVOKED";
|
|
4349
4389
|
break;
|
|
4390
|
+
case "ROLE_ADMIN_CHANGED":
|
|
4391
|
+
changeType = "ROLE_ADMIN_CHANGED";
|
|
4392
|
+
break;
|
|
4350
4393
|
case "OWNERSHIP_TRANSFER_STARTED":
|
|
4351
4394
|
changeType = "OWNERSHIP_TRANSFER_STARTED";
|
|
4352
4395
|
break;
|
|
4353
4396
|
case "OWNERSHIP_TRANSFER_COMPLETED":
|
|
4354
4397
|
changeType = "OWNERSHIP_TRANSFER_COMPLETED";
|
|
4355
4398
|
break;
|
|
4399
|
+
case "OWNERSHIP_RENOUNCED":
|
|
4400
|
+
changeType = "OWNERSHIP_RENOUNCED";
|
|
4401
|
+
break;
|
|
4356
4402
|
case "ADMIN_TRANSFER_INITIATED":
|
|
4357
4403
|
changeType = "ADMIN_TRANSFER_INITIATED";
|
|
4358
4404
|
break;
|
|
4359
4405
|
case "ADMIN_TRANSFER_COMPLETED":
|
|
4360
4406
|
changeType = "ADMIN_TRANSFER_COMPLETED";
|
|
4361
4407
|
break;
|
|
4408
|
+
case "ADMIN_RENOUNCED":
|
|
4409
|
+
changeType = "ADMIN_RENOUNCED";
|
|
4410
|
+
break;
|
|
4362
4411
|
default:
|
|
4363
4412
|
import_ui_utils20.logger.warn(
|
|
4364
4413
|
LOG_SYSTEM3,
|
|
4365
|
-
`Unknown event type: ${entry.
|
|
4414
|
+
`Unknown event type: ${entry.eventType}, assigning changeType to UNKNOWN`
|
|
4366
4415
|
);
|
|
4367
4416
|
changeType = "UNKNOWN";
|
|
4368
4417
|
}
|
|
4369
4418
|
return {
|
|
4370
4419
|
role,
|
|
4371
|
-
account: entry
|
|
4420
|
+
account: this.normalizeAccount(entry),
|
|
4372
4421
|
changeType,
|
|
4373
4422
|
txId: entry.txHash,
|
|
4374
4423
|
timestamp: entry.timestamp,
|
|
4375
|
-
ledger: parseInt(entry.
|
|
4424
|
+
ledger: parseInt(entry.blockNumber, 10)
|
|
4376
4425
|
};
|
|
4377
4426
|
});
|
|
4378
4427
|
}
|
|
@@ -4708,6 +4757,17 @@ var StellarAccessControlService = class {
|
|
|
4708
4757
|
"StellarAccessControlService.getOwnership",
|
|
4709
4758
|
`Reading ownership status for ${contractAddress}`
|
|
4710
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
|
+
}
|
|
4711
4771
|
const basicOwnership = await readOwnership(contractAddress, this.networkConfig);
|
|
4712
4772
|
if (basicOwnership.owner === null) {
|
|
4713
4773
|
import_ui_utils22.logger.debug(
|
|
@@ -5000,6 +5060,25 @@ var StellarAccessControlService = class {
|
|
|
5000
5060
|
import_ui_utils22.logger.info("StellarAccessControlService.revokeRole", `Role revoked. TxHash: ${result.txHash}`);
|
|
5001
5061
|
return { id: result.txHash };
|
|
5002
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
|
+
}
|
|
5003
5082
|
/**
|
|
5004
5083
|
* Transfers ownership of the contract using two-step transfer
|
|
5005
5084
|
*
|
|
@@ -5153,6 +5232,17 @@ var StellarAccessControlService = class {
|
|
|
5153
5232
|
"StellarAccessControlService.getAdminInfo",
|
|
5154
5233
|
`Reading admin status for ${contractAddress}`
|
|
5155
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
|
+
}
|
|
5156
5246
|
const currentAdmin = await getAdmin(contractAddress, this.networkConfig);
|
|
5157
5247
|
if (currentAdmin === null) {
|
|
5158
5248
|
import_ui_utils22.logger.debug(
|
|
@@ -5448,6 +5538,17 @@ var StellarAccessControlService = class {
|
|
|
5448
5538
|
"StellarAccessControlService.getAdminAccount",
|
|
5449
5539
|
`Reading admin for ${contractAddress}`
|
|
5450
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
|
+
}
|
|
5451
5552
|
return getAdmin(contractAddress, this.networkConfig);
|
|
5452
5553
|
}
|
|
5453
5554
|
/**
|
|
@@ -8422,8 +8523,53 @@ var StellarAdapter = class {
|
|
|
8422
8523
|
}
|
|
8423
8524
|
};
|
|
8424
8525
|
|
|
8425
|
-
// src/
|
|
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
|
|
8426
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");
|
|
8427
8573
|
var stellarPublic = {
|
|
8428
8574
|
id: "stellar-public",
|
|
8429
8575
|
exportConstName: "stellarPublic",
|
|
@@ -8436,12 +8582,12 @@ var stellarPublic = {
|
|
|
8436
8582
|
sorobanRpcUrl: "https://mainnet.sorobanrpc.com",
|
|
8437
8583
|
networkPassphrase: "Public Global Stellar Network ; September 2015",
|
|
8438
8584
|
explorerUrl: "https://stellar.expert/explorer/public",
|
|
8439
|
-
iconComponent:
|
|
8440
|
-
|
|
8585
|
+
iconComponent: import_react12.NetworkStellar,
|
|
8586
|
+
accessControlIndexerUrl: "https://openzeppelin-stellar-mainnet.graphql.subquery.network/"
|
|
8441
8587
|
};
|
|
8442
8588
|
|
|
8443
8589
|
// src/networks/testnet.ts
|
|
8444
|
-
var
|
|
8590
|
+
var import_react13 = require("@web3icons/react");
|
|
8445
8591
|
var stellarTestnet = {
|
|
8446
8592
|
id: "stellar-testnet",
|
|
8447
8593
|
exportConstName: "stellarTestnet",
|
|
@@ -8454,8 +8600,8 @@ var stellarTestnet = {
|
|
|
8454
8600
|
sorobanRpcUrl: "https://soroban-testnet.stellar.org",
|
|
8455
8601
|
networkPassphrase: "Test SDF Network ; September 2015",
|
|
8456
8602
|
explorerUrl: "https://stellar.expert/explorer/testnet",
|
|
8457
|
-
iconComponent:
|
|
8458
|
-
|
|
8603
|
+
iconComponent: import_react13.NetworkStellar,
|
|
8604
|
+
accessControlIndexerUrl: "https://openzepplin-stellar-testnet.graphql.subquery.network"
|
|
8459
8605
|
};
|
|
8460
8606
|
|
|
8461
8607
|
// src/networks/index.ts
|
|
@@ -8466,45 +8612,20 @@ var stellarNetworks = [
|
|
|
8466
8612
|
...stellarTestnetNetworks
|
|
8467
8613
|
];
|
|
8468
8614
|
|
|
8469
|
-
// src/
|
|
8470
|
-
var
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
dependencies: {
|
|
8476
|
-
// Runtime dependencies
|
|
8477
|
-
runtime: {
|
|
8478
|
-
// Core Stellar libraries
|
|
8479
|
-
"@stellar/stellar-sdk": "^14.1.1",
|
|
8480
|
-
// SAC (Stellar Asset Contract) support - dynamically loaded from CDN
|
|
8481
|
-
// These are needed for XDR encoding when working with SAC contracts
|
|
8482
|
-
"@stellar/stellar-xdr-json": "^23.0.0",
|
|
8483
|
-
"lossless-json": "^4.0.2",
|
|
8484
|
-
// Wallet connection and integration
|
|
8485
|
-
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
8486
|
-
// OpenZeppelin Relayer integration (optional, for gasless transactions)
|
|
8487
|
-
"@openzeppelin/relayer-sdk": "1.1.0",
|
|
8488
|
-
// React integration for wallet components
|
|
8489
|
-
react: "^19.0.0",
|
|
8490
|
-
"react-dom": "^19.0.0"
|
|
8491
|
-
},
|
|
8492
|
-
// Development dependencies
|
|
8493
|
-
dev: {
|
|
8494
|
-
"@types/react": "^19.0.0",
|
|
8495
|
-
"@types/react-dom": "^19.0.0"
|
|
8496
|
-
}
|
|
8497
|
-
}
|
|
8615
|
+
// src/index.ts
|
|
8616
|
+
var ecosystemDefinition = {
|
|
8617
|
+
...ecosystemMetadata,
|
|
8618
|
+
networks: stellarNetworks,
|
|
8619
|
+
createAdapter: (config) => new StellarAdapter(config),
|
|
8620
|
+
adapterConfig: stellarAdapterConfig
|
|
8498
8621
|
};
|
|
8499
8622
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8500
8623
|
0 && (module.exports = {
|
|
8501
8624
|
StellarAdapter,
|
|
8625
|
+
ecosystemDefinition,
|
|
8626
|
+
ecosystemMetadata,
|
|
8502
8627
|
isStellarContractArtifacts,
|
|
8503
|
-
stellarAdapterConfig,
|
|
8504
|
-
stellarMainnetNetworks,
|
|
8505
|
-
stellarNetworks,
|
|
8506
8628
|
stellarPublic,
|
|
8507
|
-
stellarTestnet
|
|
8508
|
-
stellarTestnetNetworks
|
|
8629
|
+
stellarTestnet
|
|
8509
8630
|
});
|
|
8510
8631
|
//# sourceMappingURL=index.cjs.map
|