@openzeppelin/ui-builder-adapter-stellar 0.13.0 → 0.14.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 +455 -297
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -5
- package/dist/index.d.ts +78 -5
- package/dist/index.js +446 -288
- package/dist/index.js.map +1 -1
- package/dist/vite-config.cjs +52 -0
- package/dist/vite-config.cjs.map +1 -0
- package/dist/vite-config.d.cts +46 -0
- package/dist/vite-config.d.ts +46 -0
- package/dist/vite-config.js +27 -0
- package/dist/vite-config.js.map +1 -0
- package/package.json +9 -4
- package/src/adapter.ts +99 -19
- package/src/configuration/index.ts +1 -0
- package/src/configuration/network-services.ts +51 -0
- package/src/vite-config.ts +67 -0
- package/src/wallet/stellar-wallets-kit/StellarWalletsKitConnectButton.tsx +23 -0
- package/src/wallet/stellar-wallets-kit/config-generator.ts +2 -19
- package/src/wallet/stellar-wallets-kit/stellarUiKitManager.ts +61 -0
package/dist/index.js
CHANGED
|
@@ -6,9 +6,155 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6
6
|
import { isStellarNetworkConfig } from "@openzeppelin/ui-builder-types";
|
|
7
7
|
import { logger as logger35 } from "@openzeppelin/ui-builder-utils";
|
|
8
8
|
|
|
9
|
+
// src/configuration/rpc.ts
|
|
10
|
+
import {
|
|
11
|
+
appConfigService,
|
|
12
|
+
isValidUrl,
|
|
13
|
+
logger,
|
|
14
|
+
userRpcConfigService
|
|
15
|
+
} from "@openzeppelin/ui-builder-utils";
|
|
16
|
+
function validateStellarRpcEndpoint(rpcConfig) {
|
|
17
|
+
try {
|
|
18
|
+
if (!isValidUrl(rpcConfig.url)) {
|
|
19
|
+
logger.error("validateStellarRpcEndpoint", `Invalid RPC URL format: ${rpcConfig.url}`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
logger.error("validateStellarRpcEndpoint", "Error validating RPC endpoint:", error);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function testStellarRpcConnection(rpcConfig, timeoutMs = 5e3) {
|
|
29
|
+
if (!rpcConfig.url) {
|
|
30
|
+
return { success: false, error: "Soroban RPC URL is required" };
|
|
31
|
+
}
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
34
|
+
try {
|
|
35
|
+
const startTime = Date.now();
|
|
36
|
+
const response = await fetch(rpcConfig.url, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: {
|
|
39
|
+
"Content-Type": "application/json"
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
jsonrpc: "2.0",
|
|
43
|
+
id: 1,
|
|
44
|
+
method: "getHealth"
|
|
45
|
+
}),
|
|
46
|
+
signal: controller.signal
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
return { success: false, error: `HTTP error: ${response.status}` };
|
|
50
|
+
}
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
const latency = Date.now() - startTime;
|
|
53
|
+
if (data.error) {
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: `Soroban RPC error: ${data.error.message || "Unknown RPC error"}`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (!data.result) {
|
|
60
|
+
return await testWithFallbackMethod(rpcConfig, controller.signal, startTime);
|
|
61
|
+
}
|
|
62
|
+
const healthStatus = data.result.status;
|
|
63
|
+
if (healthStatus && healthStatus !== "healthy") {
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
error: `Soroban RPC service unhealthy: ${healthStatus}`,
|
|
67
|
+
latency
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { success: true, latency };
|
|
71
|
+
} catch (error) {
|
|
72
|
+
logger.error("testStellarRpcConnection", "Connection test failed:", error);
|
|
73
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error: `Connection timeout after ${timeoutMs}ms`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return await testWithFallbackMethod(rpcConfig, controller.signal, Date.now());
|
|
81
|
+
} catch {
|
|
82
|
+
return {
|
|
83
|
+
success: false,
|
|
84
|
+
error: error instanceof Error ? error.message : "Connection failed"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
clearTimeout(timeoutId);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function testWithFallbackMethod(rpcConfig, signal, startTime) {
|
|
92
|
+
const response = await fetch(rpcConfig.url, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: {
|
|
95
|
+
"Content-Type": "application/json"
|
|
96
|
+
},
|
|
97
|
+
body: JSON.stringify({
|
|
98
|
+
jsonrpc: "2.0",
|
|
99
|
+
id: 1,
|
|
100
|
+
method: "getLatestLedger"
|
|
101
|
+
}),
|
|
102
|
+
signal
|
|
103
|
+
});
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
return { success: false, error: `HTTP error: ${response.status}` };
|
|
106
|
+
}
|
|
107
|
+
const data = await response.json();
|
|
108
|
+
const latency = Date.now() - startTime;
|
|
109
|
+
if (data.error) {
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: `Soroban RPC error: ${data.error.message || "Unknown RPC error"}`
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (data.result && data.result.sequence) {
|
|
116
|
+
return { success: true, latency };
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: "Unexpected response format from Soroban RPC endpoint"
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/configuration/network-services.ts
|
|
125
|
+
function getStellarNetworkServiceForms() {
|
|
126
|
+
return [
|
|
127
|
+
{
|
|
128
|
+
id: "rpc",
|
|
129
|
+
label: "RPC Provider",
|
|
130
|
+
fields: [
|
|
131
|
+
{
|
|
132
|
+
id: "stellar-rpc-url",
|
|
133
|
+
name: "sorobanRpcUrl",
|
|
134
|
+
type: "text",
|
|
135
|
+
label: "Soroban RPC URL",
|
|
136
|
+
placeholder: "https://soroban.stellar.org",
|
|
137
|
+
validation: { required: true, pattern: "^https?://.+" },
|
|
138
|
+
width: "full"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
async function validateStellarNetworkServiceConfig(serviceId, values) {
|
|
145
|
+
if (serviceId !== "rpc") return true;
|
|
146
|
+
const cfg = { url: String(values.sorobanRpcUrl || ""), isCustom: true };
|
|
147
|
+
return validateStellarRpcEndpoint(cfg);
|
|
148
|
+
}
|
|
149
|
+
async function testStellarNetworkServiceConnection(serviceId, values) {
|
|
150
|
+
if (serviceId !== "rpc") return { success: true };
|
|
151
|
+
const cfg = { url: String(values.sorobanRpcUrl || ""), isCustom: true };
|
|
152
|
+
return testStellarRpcConnection(cfg);
|
|
153
|
+
}
|
|
154
|
+
|
|
9
155
|
// src/contract/loader.ts
|
|
10
156
|
import * as StellarSdk2 from "@stellar/stellar-sdk";
|
|
11
|
-
import { logger as
|
|
157
|
+
import { logger as logger16 } from "@openzeppelin/ui-builder-utils";
|
|
12
158
|
|
|
13
159
|
// src/validation/address.ts
|
|
14
160
|
import { StrKey } from "@stellar/stellar-sdk";
|
|
@@ -91,7 +237,7 @@ function isValidAddress(address, addressType) {
|
|
|
91
237
|
}
|
|
92
238
|
|
|
93
239
|
// src/validation/eoa.ts
|
|
94
|
-
import { logger } from "@openzeppelin/ui-builder-utils";
|
|
240
|
+
import { logger as logger2 } from "@openzeppelin/ui-builder-utils";
|
|
95
241
|
var SYSTEM_LOG_TAG = "StellarEoaValidator";
|
|
96
242
|
async function validateEoaConfig(config, walletStatus) {
|
|
97
243
|
if (!config.allowAny) {
|
|
@@ -106,7 +252,7 @@ async function validateEoaConfig(config, walletStatus) {
|
|
|
106
252
|
return `Connected wallet address (${walletStatus.address}) does not match the required specific Stellar address (${config.specificAddress}). Please connect the correct wallet.`;
|
|
107
253
|
}
|
|
108
254
|
} else if (walletStatus.isConnected && !walletStatus.address) {
|
|
109
|
-
|
|
255
|
+
logger2.warn(
|
|
110
256
|
SYSTEM_LOG_TAG,
|
|
111
257
|
"Wallet is connected but address is unavailable for Stellar EOA validation."
|
|
112
258
|
);
|
|
@@ -146,11 +292,11 @@ function getStellarExplorerTxUrl(txHash, networkConfig) {
|
|
|
146
292
|
|
|
147
293
|
// src/mapping/struct-fields.ts
|
|
148
294
|
import { xdr as xdr2 } from "@stellar/stellar-sdk";
|
|
149
|
-
import { logger as
|
|
295
|
+
import { logger as logger4 } from "@openzeppelin/ui-builder-utils";
|
|
150
296
|
|
|
151
297
|
// src/utils/type-detection.ts
|
|
152
298
|
import * as StellarSdk from "@stellar/stellar-sdk";
|
|
153
|
-
import { isDevelopmentOrTestEnvironment, logger as
|
|
299
|
+
import { isDevelopmentOrTestEnvironment, logger as logger3 } from "@openzeppelin/ui-builder-utils";
|
|
154
300
|
function extractSorobanTypeFromScSpec(scSpecType) {
|
|
155
301
|
try {
|
|
156
302
|
const typeSwitch = scSpecType.switch();
|
|
@@ -231,7 +377,7 @@ function extractSorobanTypeFromScSpec(scSpecType) {
|
|
|
231
377
|
return udtType.name().toString();
|
|
232
378
|
}
|
|
233
379
|
default:
|
|
234
|
-
|
|
380
|
+
logger3.error("extractSorobanTypeFromScSpec", `\u{1F6A8} MISSING SCSPEC TYPE HANDLER \u{1F6A8}`, {
|
|
235
381
|
typeSwitchValue: typeSwitch.value,
|
|
236
382
|
typeSwitchName: typeSwitch.name,
|
|
237
383
|
rawScSpecType: scSpecType,
|
|
@@ -250,11 +396,11 @@ function extractSorobanTypeFromScSpec(scSpecType) {
|
|
|
250
396
|
`Missing ScSpec type handler: ${typeSwitch.name} (value: ${typeSwitch.value}). Please add support for this type.`
|
|
251
397
|
);
|
|
252
398
|
}
|
|
253
|
-
|
|
399
|
+
logger3.error("STELLAR_ADAPTER_MISSING_TYPE", "Missing ScSpec type handler:", errorReport);
|
|
254
400
|
return "unknown";
|
|
255
401
|
}
|
|
256
402
|
} catch (error) {
|
|
257
|
-
|
|
403
|
+
logger3.error("extractSorobanTypeFromScSpec", "Failed to extract type:", error);
|
|
258
404
|
return "unknown";
|
|
259
405
|
}
|
|
260
406
|
}
|
|
@@ -306,7 +452,7 @@ function extractStructFields(entries, structName) {
|
|
|
306
452
|
}
|
|
307
453
|
return null;
|
|
308
454
|
} catch (error) {
|
|
309
|
-
|
|
455
|
+
logger4.error(
|
|
310
456
|
"extractStructFields",
|
|
311
457
|
`Failed to extract struct fields for ${structName}:`,
|
|
312
458
|
error
|
|
@@ -331,7 +477,7 @@ function isStructType(entries, typeName) {
|
|
|
331
477
|
const isStruct = entryKind.value === xdr2.ScSpecEntryKind.scSpecEntryUdtStructV0().value;
|
|
332
478
|
return isStruct;
|
|
333
479
|
} catch (error) {
|
|
334
|
-
|
|
480
|
+
logger4.error("isStructType", `Failed to check if ${typeName} is struct:`, error);
|
|
335
481
|
return false;
|
|
336
482
|
}
|
|
337
483
|
}
|
|
@@ -347,15 +493,15 @@ import {
|
|
|
347
493
|
rpc as StellarRpc,
|
|
348
494
|
TransactionBuilder
|
|
349
495
|
} from "@stellar/stellar-sdk";
|
|
350
|
-
import { logger as
|
|
496
|
+
import { logger as logger11, userRpcConfigService as userRpcConfigService2 } from "@openzeppelin/ui-builder-utils";
|
|
351
497
|
|
|
352
498
|
// src/transform/parsers/index.ts
|
|
353
499
|
import { isEnumValue as isEnumValue2 } from "@openzeppelin/ui-builder-types";
|
|
354
|
-
import { isPlainObject as isPlainObject2, logger as
|
|
500
|
+
import { isPlainObject as isPlainObject2, logger as logger9 } from "@openzeppelin/ui-builder-utils";
|
|
355
501
|
|
|
356
502
|
// src/transform/parsers/generic-parser.ts
|
|
357
503
|
import { isMapEntryArray } from "@openzeppelin/ui-builder-types";
|
|
358
|
-
import { logger as
|
|
504
|
+
import { logger as logger5 } from "@openzeppelin/ui-builder-utils";
|
|
359
505
|
var SYSTEM_LOG_TAG2 = "GenericParser";
|
|
360
506
|
function parseGenericType(typeString) {
|
|
361
507
|
const match = typeString.match(/^(\w+)<(.*)>$/);
|
|
@@ -454,11 +600,11 @@ function parseGeneric(value, parameterType, parseInnerValue) {
|
|
|
454
600
|
return value;
|
|
455
601
|
}
|
|
456
602
|
default:
|
|
457
|
-
|
|
603
|
+
logger5.warn(SYSTEM_LOG_TAG2, `Unknown generic type: ${baseType}`);
|
|
458
604
|
return null;
|
|
459
605
|
}
|
|
460
606
|
} catch (error) {
|
|
461
|
-
|
|
607
|
+
logger5.error(SYSTEM_LOG_TAG2, `Failed to parse generic type ${parameterType}:`, error);
|
|
462
608
|
throw error;
|
|
463
609
|
}
|
|
464
610
|
}
|
|
@@ -469,7 +615,7 @@ function isGenericType(parameterType) {
|
|
|
469
615
|
|
|
470
616
|
// src/transform/parsers/primitive-parser.ts
|
|
471
617
|
import { Address } from "@stellar/stellar-sdk";
|
|
472
|
-
import { detectBytesEncoding, logger as
|
|
618
|
+
import { detectBytesEncoding, logger as logger6, stringToBytes } from "@openzeppelin/ui-builder-utils";
|
|
473
619
|
var SYSTEM_LOG_TAG3 = "PrimitiveParser";
|
|
474
620
|
function parsePrimitive(value, parameterType) {
|
|
475
621
|
try {
|
|
@@ -543,7 +689,7 @@ function parsePrimitive(value, parameterType) {
|
|
|
543
689
|
return null;
|
|
544
690
|
}
|
|
545
691
|
} catch (error) {
|
|
546
|
-
|
|
692
|
+
logger6.error(SYSTEM_LOG_TAG3, `Failed to parse primitive ${parameterType}:`, error);
|
|
547
693
|
throw error;
|
|
548
694
|
}
|
|
549
695
|
}
|
|
@@ -739,7 +885,7 @@ function convertStellarTypeToScValType(stellarType) {
|
|
|
739
885
|
|
|
740
886
|
// src/utils/input-parsing.ts
|
|
741
887
|
import { nativeToScVal, xdr as xdr3 } from "@stellar/stellar-sdk";
|
|
742
|
-
import { detectBytesEncoding as detectBytesEncoding2, logger as
|
|
888
|
+
import { detectBytesEncoding as detectBytesEncoding2, logger as logger7, stringToBytes as stringToBytes2 } from "@openzeppelin/ui-builder-utils";
|
|
743
889
|
var SYSTEM_LOG_TAG4 = "StellarInputParsingUtils";
|
|
744
890
|
function isMapArray(argValue) {
|
|
745
891
|
try {
|
|
@@ -770,7 +916,7 @@ function getScValFromPrimitive(v) {
|
|
|
770
916
|
const typeHint = convertStellarTypeToScValType(v.type);
|
|
771
917
|
return nativeToScVal(v.value, { type: typeHint });
|
|
772
918
|
} catch (error) {
|
|
773
|
-
|
|
919
|
+
logger7.error(SYSTEM_LOG_TAG4, `Failed to convert primitive ${v.type}:`, error);
|
|
774
920
|
throw new Error(`Failed to convert primitive value of type ${v.type}: ${error}`);
|
|
775
921
|
}
|
|
776
922
|
}
|
|
@@ -817,7 +963,7 @@ function convertEnumToScVal(obj, scVals) {
|
|
|
817
963
|
const tupleVec = xdr3.ScVal.scvVec([tagSymbol, ...valuesVal]);
|
|
818
964
|
return tupleVec;
|
|
819
965
|
} catch (error) {
|
|
820
|
-
|
|
966
|
+
logger7.error(SYSTEM_LOG_TAG4, "Failed to convert enum:", error);
|
|
821
967
|
throw new Error(`Failed to convert enum: ${error}`);
|
|
822
968
|
}
|
|
823
969
|
}
|
|
@@ -846,7 +992,7 @@ function convertObjectToMap(mapArray) {
|
|
|
846
992
|
}, {});
|
|
847
993
|
return { mapVal, mapType };
|
|
848
994
|
} catch (error) {
|
|
849
|
-
|
|
995
|
+
logger7.error(SYSTEM_LOG_TAG4, "Failed to convert map:", error);
|
|
850
996
|
throw new Error(`Failed to convert map: ${error}`);
|
|
851
997
|
}
|
|
852
998
|
}
|
|
@@ -857,7 +1003,7 @@ import { isEnumValue } from "@openzeppelin/ui-builder-types";
|
|
|
857
1003
|
|
|
858
1004
|
// src/transform/parsers/struct-parser.ts
|
|
859
1005
|
import { nativeToScVal as nativeToScVal3 } from "@stellar/stellar-sdk";
|
|
860
|
-
import { isPlainObject, logger as
|
|
1006
|
+
import { isPlainObject, logger as logger8 } from "@openzeppelin/ui-builder-utils";
|
|
861
1007
|
var SYSTEM_LOG_TAG5 = "StructParser";
|
|
862
1008
|
function needsParsing(value, fieldType) {
|
|
863
1009
|
if ((fieldType === "Bytes" || fieldType.startsWith("BytesN<")) && value instanceof Uint8Array) {
|
|
@@ -934,13 +1080,13 @@ function convertStructToScVal(structObj, parameterType, paramSchema, parseInnerV
|
|
|
934
1080
|
);
|
|
935
1081
|
}
|
|
936
1082
|
}
|
|
937
|
-
|
|
1083
|
+
logger8.debug(SYSTEM_LOG_TAG5, "convertStructToScVal final values:", {
|
|
938
1084
|
parameterType,
|
|
939
1085
|
convertedValue,
|
|
940
1086
|
typeHints
|
|
941
1087
|
});
|
|
942
1088
|
const scVal = nativeToScVal3(convertedValue, { type: typeHints });
|
|
943
|
-
|
|
1089
|
+
logger8.debug(SYSTEM_LOG_TAG5, "convertStructToScVal generated ScVal:", {
|
|
944
1090
|
parameterType,
|
|
945
1091
|
scValType: scVal.switch().name,
|
|
946
1092
|
scValValue: scVal.value()
|
|
@@ -1102,14 +1248,14 @@ function parseStellarInput(value, parameterType) {
|
|
|
1102
1248
|
}
|
|
1103
1249
|
throw new Error(`Unsupported parameter type: ${parameterType} with value type ${typeof value}`);
|
|
1104
1250
|
} catch (error) {
|
|
1105
|
-
|
|
1251
|
+
logger9.error(SYSTEM_LOG_TAG6, "Failed to parse Stellar input:", error);
|
|
1106
1252
|
throw error;
|
|
1107
1253
|
}
|
|
1108
1254
|
}
|
|
1109
1255
|
|
|
1110
1256
|
// src/transform/output-formatter.ts
|
|
1111
1257
|
import { scValToNative, xdr as xdr7 } from "@stellar/stellar-sdk";
|
|
1112
|
-
import { bytesToHex, logger as
|
|
1258
|
+
import { bytesToHex, logger as logger10 } from "@openzeppelin/ui-builder-utils";
|
|
1113
1259
|
|
|
1114
1260
|
// src/types/artifacts.ts
|
|
1115
1261
|
function isStellarContractArtifacts(obj) {
|
|
@@ -1132,7 +1278,7 @@ function validateAndConvertStellarArtifacts(source) {
|
|
|
1132
1278
|
// src/transform/output-formatter.ts
|
|
1133
1279
|
function formatStellarFunctionResult(result, functionDetails) {
|
|
1134
1280
|
if (!functionDetails.outputs || !Array.isArray(functionDetails.outputs)) {
|
|
1135
|
-
|
|
1281
|
+
logger10.warn(
|
|
1136
1282
|
"formatStellarFunctionResult",
|
|
1137
1283
|
`Output definition missing or invalid for function ${functionDetails.name}.`
|
|
1138
1284
|
);
|
|
@@ -1154,7 +1300,7 @@ function formatStellarFunctionResult(result, functionDetails) {
|
|
|
1154
1300
|
valueToFormat = new Uint8Array(valueToFormat);
|
|
1155
1301
|
}
|
|
1156
1302
|
} catch (error) {
|
|
1157
|
-
|
|
1303
|
+
logger10.error("formatStellarFunctionResult", "Failed to convert ScVal to native", {
|
|
1158
1304
|
functionName: functionDetails.name,
|
|
1159
1305
|
error
|
|
1160
1306
|
});
|
|
@@ -1195,7 +1341,7 @@ function formatStellarFunctionResult(result, functionDetails) {
|
|
|
1195
1341
|
}
|
|
1196
1342
|
} catch (error) {
|
|
1197
1343
|
const errorMessage = `Error formatting result for ${functionDetails.name}: ${error.message}`;
|
|
1198
|
-
|
|
1344
|
+
logger10.error("formatStellarFunctionResult", errorMessage, {
|
|
1199
1345
|
functionName: functionDetails.name,
|
|
1200
1346
|
result,
|
|
1201
1347
|
error
|
|
@@ -1227,12 +1373,12 @@ function getStellarWritableFunctions(contractSchema) {
|
|
|
1227
1373
|
|
|
1228
1374
|
// src/query/handler.ts
|
|
1229
1375
|
function getSorobanRpcServer(networkConfig) {
|
|
1230
|
-
const customRpcConfig =
|
|
1376
|
+
const customRpcConfig = userRpcConfigService2.getUserRpcConfig(networkConfig.id);
|
|
1231
1377
|
const rpcUrl = customRpcConfig?.url || networkConfig.sorobanRpcUrl;
|
|
1232
1378
|
if (!rpcUrl) {
|
|
1233
1379
|
throw new Error(`No Soroban RPC URL available for network ${networkConfig.name}`);
|
|
1234
1380
|
}
|
|
1235
|
-
|
|
1381
|
+
logger11.info(
|
|
1236
1382
|
"getSorobanRpcServer",
|
|
1237
1383
|
`Creating Soroban RPC server for ${networkConfig.name} using RPC: ${rpcUrl}`
|
|
1238
1384
|
);
|
|
@@ -1263,12 +1409,12 @@ async function createSimulationTransaction(contractAddress, functionName, args,
|
|
|
1263
1409
|
}).addOperation(contract2.call(functionName, ...scValArgs)).setTimeout(30);
|
|
1264
1410
|
return transaction;
|
|
1265
1411
|
} catch (error) {
|
|
1266
|
-
|
|
1412
|
+
logger11.error("createSimulationTransaction", "Failed to create simulation transaction:", error);
|
|
1267
1413
|
throw new Error(`Failed to create simulation transaction: ${error.message}`);
|
|
1268
1414
|
}
|
|
1269
1415
|
}
|
|
1270
1416
|
async function checkStellarFunctionStateMutability(contractAddress, functionName, networkConfig, inputTypes = []) {
|
|
1271
|
-
|
|
1417
|
+
logger11.info(
|
|
1272
1418
|
"checkStellarFunctionStateMutability",
|
|
1273
1419
|
`Checking state mutability for function: ${functionName} on ${contractAddress}`
|
|
1274
1420
|
);
|
|
@@ -1310,7 +1456,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1310
1456
|
networkConfig
|
|
1311
1457
|
);
|
|
1312
1458
|
const transaction = transactionBuilder.build();
|
|
1313
|
-
|
|
1459
|
+
logger11.debug(
|
|
1314
1460
|
"checkStellarFunctionStateMutability",
|
|
1315
1461
|
`[Check ${functionName}] Simulating transaction for state mutability check`
|
|
1316
1462
|
);
|
|
@@ -1318,7 +1464,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1318
1464
|
try {
|
|
1319
1465
|
simulationResult = await rpcServer.simulateTransaction(transaction);
|
|
1320
1466
|
} catch (simulationError) {
|
|
1321
|
-
|
|
1467
|
+
logger11.warn(
|
|
1322
1468
|
"checkStellarFunctionStateMutability",
|
|
1323
1469
|
`[Check ${functionName}] Simulation failed, assuming function modifies state:`,
|
|
1324
1470
|
simulationError
|
|
@@ -1326,7 +1472,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1326
1472
|
return true;
|
|
1327
1473
|
}
|
|
1328
1474
|
if (StellarRpc.Api.isSimulationError(simulationResult)) {
|
|
1329
|
-
|
|
1475
|
+
logger11.warn(
|
|
1330
1476
|
"checkStellarFunctionStateMutability",
|
|
1331
1477
|
`[Check ${functionName}] Simulation error, assuming function modifies state:`,
|
|
1332
1478
|
simulationResult.error
|
|
@@ -1334,7 +1480,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1334
1480
|
return true;
|
|
1335
1481
|
}
|
|
1336
1482
|
const hasStateChanges = simulationResult.stateChanges && simulationResult.stateChanges.length > 0;
|
|
1337
|
-
|
|
1483
|
+
logger11.info(
|
|
1338
1484
|
"checkStellarFunctionStateMutability",
|
|
1339
1485
|
`[Check ${functionName}] State mutability check complete:`,
|
|
1340
1486
|
{
|
|
@@ -1345,7 +1491,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1345
1491
|
);
|
|
1346
1492
|
return Boolean(hasStateChanges);
|
|
1347
1493
|
} catch (error) {
|
|
1348
|
-
|
|
1494
|
+
logger11.warn(
|
|
1349
1495
|
"checkStellarFunctionStateMutability",
|
|
1350
1496
|
`Failed to check state mutability for ${functionName}, assuming it modifies state:`,
|
|
1351
1497
|
error
|
|
@@ -1354,7 +1500,7 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
|
|
|
1354
1500
|
}
|
|
1355
1501
|
}
|
|
1356
1502
|
async function queryStellarViewFunction(contractAddress, functionId, networkConfig, params = [], contractSchema, loadContractFn) {
|
|
1357
|
-
|
|
1503
|
+
logger11.info(
|
|
1358
1504
|
"queryStellarViewFunction",
|
|
1359
1505
|
`Querying Stellar view function: ${functionId} on ${contractAddress} (${networkConfig.name})`,
|
|
1360
1506
|
{ params }
|
|
@@ -1396,7 +1542,7 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1396
1542
|
const rawValue = params[index];
|
|
1397
1543
|
return parseStellarInput(rawValue, inputParam.type);
|
|
1398
1544
|
});
|
|
1399
|
-
|
|
1545
|
+
logger11.debug("queryStellarViewFunction", "Parsed Args for contract call:", args);
|
|
1400
1546
|
const paramTypes = expectedInputs.map((input) => input.type);
|
|
1401
1547
|
const transactionBuilder = await createSimulationTransaction(
|
|
1402
1548
|
contractAddress,
|
|
@@ -1406,7 +1552,7 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1406
1552
|
stellarConfig
|
|
1407
1553
|
);
|
|
1408
1554
|
const transaction = transactionBuilder.build();
|
|
1409
|
-
|
|
1555
|
+
logger11.debug(
|
|
1410
1556
|
"queryStellarViewFunction",
|
|
1411
1557
|
`[Query ${functionDetails.name}] Simulating transaction:`,
|
|
1412
1558
|
transaction.toXDR()
|
|
@@ -1415,7 +1561,7 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1415
1561
|
try {
|
|
1416
1562
|
simulationResult = await rpcServer.simulateTransaction(transaction);
|
|
1417
1563
|
} catch (simulationError) {
|
|
1418
|
-
|
|
1564
|
+
logger11.error(
|
|
1419
1565
|
"queryStellarViewFunction",
|
|
1420
1566
|
`[Query ${functionDetails.name}] Simulation failed:`,
|
|
1421
1567
|
simulationError
|
|
@@ -1425,7 +1571,7 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1425
1571
|
);
|
|
1426
1572
|
}
|
|
1427
1573
|
if (StellarRpc.Api.isSimulationError(simulationResult)) {
|
|
1428
|
-
|
|
1574
|
+
logger11.error(
|
|
1429
1575
|
"queryStellarViewFunction",
|
|
1430
1576
|
`[Query ${functionDetails.name}] Simulation error:`,
|
|
1431
1577
|
simulationResult.error
|
|
@@ -1436,13 +1582,13 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1436
1582
|
throw new Error(`No result returned from contract simulation for ${functionDetails.name}`);
|
|
1437
1583
|
}
|
|
1438
1584
|
const rawResult = simulationResult.result.retval;
|
|
1439
|
-
|
|
1585
|
+
logger11.debug(
|
|
1440
1586
|
"queryStellarViewFunction",
|
|
1441
1587
|
`[Query ${functionDetails.name}] Raw simulation result:`,
|
|
1442
1588
|
rawResult
|
|
1443
1589
|
);
|
|
1444
1590
|
const formattedResult = formatStellarFunctionResult(rawResult, functionDetails);
|
|
1445
|
-
|
|
1591
|
+
logger11.info(
|
|
1446
1592
|
"queryStellarViewFunction",
|
|
1447
1593
|
`[Query ${functionDetails.name}] Formatted result:`,
|
|
1448
1594
|
formattedResult
|
|
@@ -1450,7 +1596,7 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1450
1596
|
return formattedResult;
|
|
1451
1597
|
} catch (error) {
|
|
1452
1598
|
const errorMessage = `Failed to query Stellar view function ${functionId} on network ${networkConfig.name}: ${error.message}`;
|
|
1453
|
-
|
|
1599
|
+
logger11.error("queryStellarViewFunction", errorMessage, {
|
|
1454
1600
|
contractAddress,
|
|
1455
1601
|
functionId,
|
|
1456
1602
|
params,
|
|
@@ -1462,10 +1608,10 @@ async function queryStellarViewFunction(contractAddress, functionId, networkConf
|
|
|
1462
1608
|
}
|
|
1463
1609
|
|
|
1464
1610
|
// src/sac/spec-cache.ts
|
|
1465
|
-
import { logger as
|
|
1611
|
+
import { logger as logger14 } from "@openzeppelin/ui-builder-utils";
|
|
1466
1612
|
|
|
1467
1613
|
// src/sac/spec-source.ts
|
|
1468
|
-
import { logger as
|
|
1614
|
+
import { logger as logger12 } from "@openzeppelin/ui-builder-utils";
|
|
1469
1615
|
var DEFAULT_SPEC = {
|
|
1470
1616
|
repo: "stellar/stellar-asset-contract-spec",
|
|
1471
1617
|
path: "refs/heads/main",
|
|
@@ -1486,7 +1632,7 @@ async function fetchSacSpecJson(cfg = {}) {
|
|
|
1486
1632
|
}
|
|
1487
1633
|
return await res.text();
|
|
1488
1634
|
} catch (error) {
|
|
1489
|
-
|
|
1635
|
+
logger12.error("stellar:sac:spec-source", "Failed to fetch SAC spec:", url, error);
|
|
1490
1636
|
throw new Error("Failed to load Stellar Asset Contract spec. Please try again later.");
|
|
1491
1637
|
}
|
|
1492
1638
|
}
|
|
@@ -1495,7 +1641,7 @@ async function fetchSacSpecJson(cfg = {}) {
|
|
|
1495
1641
|
import { xdr as xdr8 } from "@stellar/stellar-sdk";
|
|
1496
1642
|
import { parse, stringify } from "lossless-json";
|
|
1497
1643
|
import stellarXdrJsonPackage from "@stellar/stellar-xdr-json/package.json";
|
|
1498
|
-
import { logger as
|
|
1644
|
+
import { logger as logger13 } from "@openzeppelin/ui-builder-utils";
|
|
1499
1645
|
var stellarXdrJsonVersion = stellarXdrJsonPackage.version ?? "23.0.0";
|
|
1500
1646
|
var CDN_WASM_URL = `https://unpkg.com/@stellar/stellar-xdr-json@${stellarXdrJsonVersion}/stellar_xdr_json_bg.wasm`;
|
|
1501
1647
|
var initialized = false;
|
|
@@ -1509,7 +1655,7 @@ async function ensureXdrJsonInitialized() {
|
|
|
1509
1655
|
encode = stellarXdrJson.encode;
|
|
1510
1656
|
initialized = true;
|
|
1511
1657
|
} catch (error) {
|
|
1512
|
-
|
|
1658
|
+
logger13.error("stellar:sac:xdr", "Failed to initialize WASM module:", error);
|
|
1513
1659
|
throw error;
|
|
1514
1660
|
}
|
|
1515
1661
|
}
|
|
@@ -1531,7 +1677,7 @@ async function encodeSacSpecEntries(jsonString) {
|
|
|
1531
1677
|
}
|
|
1532
1678
|
return result;
|
|
1533
1679
|
} catch (error) {
|
|
1534
|
-
|
|
1680
|
+
logger13.error("stellar:sac:xdr", "Failed to encode SAC spec to XDR", error);
|
|
1535
1681
|
throw new Error("Failed to process SAC spec.");
|
|
1536
1682
|
}
|
|
1537
1683
|
}
|
|
@@ -1546,7 +1692,7 @@ async function getSacSpecArtifacts(cfg = {}) {
|
|
|
1546
1692
|
const cacheKey = getSacSpecUrl(cfg);
|
|
1547
1693
|
const cached = sacSpecCache.get(cacheKey);
|
|
1548
1694
|
if (cached) {
|
|
1549
|
-
|
|
1695
|
+
logger14.debug("stellar:sac:spec-cache", "Returning cached SAC spec artifacts");
|
|
1550
1696
|
return cached;
|
|
1551
1697
|
}
|
|
1552
1698
|
const inflight = sacSpecInflight.get(cacheKey);
|
|
@@ -1563,7 +1709,7 @@ async function getSacSpecArtifacts(cfg = {}) {
|
|
|
1563
1709
|
};
|
|
1564
1710
|
sacSpecCache.set(cacheKey, entry);
|
|
1565
1711
|
sacSpecInflight.delete(cacheKey);
|
|
1566
|
-
|
|
1712
|
+
logger14.debug("stellar:sac:spec-cache", "Cached SAC spec artifacts for future re-use");
|
|
1567
1713
|
return entry;
|
|
1568
1714
|
})().catch((error) => {
|
|
1569
1715
|
sacSpecInflight.delete(cacheKey);
|
|
@@ -1575,9 +1721,9 @@ async function getSacSpecArtifacts(cfg = {}) {
|
|
|
1575
1721
|
|
|
1576
1722
|
// src/contract/type.ts
|
|
1577
1723
|
import { Contract as Contract2, rpc as StellarRpc2, xdr as xdr9 } from "@stellar/stellar-sdk";
|
|
1578
|
-
import { logger as
|
|
1724
|
+
import { logger as logger15, userRpcConfigService as userRpcConfigService3 } from "@openzeppelin/ui-builder-utils";
|
|
1579
1725
|
function getSorobanRpcServer2(networkConfig) {
|
|
1580
|
-
const customRpcConfig =
|
|
1726
|
+
const customRpcConfig = userRpcConfigService3.getUserRpcConfig(networkConfig.id);
|
|
1581
1727
|
const rpcUrl = customRpcConfig?.url || networkConfig.sorobanRpcUrl;
|
|
1582
1728
|
if (!rpcUrl) {
|
|
1583
1729
|
throw new Error(`No Soroban RPC URL available for network ${networkConfig.name}`);
|
|
@@ -1608,7 +1754,7 @@ async function getStellarContractType(contractId, networkConfig) {
|
|
|
1608
1754
|
if (detected === execStellarAssetType) return "contractExecutableStellarAsset";
|
|
1609
1755
|
return null;
|
|
1610
1756
|
} catch (error) {
|
|
1611
|
-
|
|
1757
|
+
logger15.error("stellar:contract-type", "Failed to detect contract type:", error);
|
|
1612
1758
|
throw new Error(
|
|
1613
1759
|
`Something went wrong getting contract type by contract ID. ${error.message}`
|
|
1614
1760
|
);
|
|
@@ -1617,7 +1763,7 @@ async function getStellarContractType(contractId, networkConfig) {
|
|
|
1617
1763
|
|
|
1618
1764
|
// src/contract/loader.ts
|
|
1619
1765
|
async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
1620
|
-
|
|
1766
|
+
logger16.info("loadStellarContractFromAddress", "Loading contract:", {
|
|
1621
1767
|
contractAddress,
|
|
1622
1768
|
network: networkConfig.name,
|
|
1623
1769
|
rpcUrl: networkConfig.sorobanRpcUrl,
|
|
@@ -1648,7 +1794,7 @@ async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
|
1648
1794
|
};
|
|
1649
1795
|
}
|
|
1650
1796
|
} catch (e) {
|
|
1651
|
-
|
|
1797
|
+
logger16.warn(
|
|
1652
1798
|
"loadStellarContractFromAddress",
|
|
1653
1799
|
"SAC detection failed, falling back to regular client:",
|
|
1654
1800
|
e
|
|
@@ -1665,12 +1811,12 @@ async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
|
1665
1811
|
const message = e?.message || String(e);
|
|
1666
1812
|
if (message.includes("Cannot destructure property 'length'")) {
|
|
1667
1813
|
const friendly = "Unable to fetch contract metadata from RPC. The contract appears to have no published Wasm/definition on this network.";
|
|
1668
|
-
|
|
1814
|
+
logger16.error("loadStellarContractFromAddress", friendly);
|
|
1669
1815
|
throw new Error(`NO_WASM: ${friendly}`);
|
|
1670
1816
|
}
|
|
1671
1817
|
throw e;
|
|
1672
1818
|
}
|
|
1673
|
-
|
|
1819
|
+
logger16.info("loadStellarContractFromAddress", "Contract client created successfully");
|
|
1674
1820
|
let specEntries = [];
|
|
1675
1821
|
try {
|
|
1676
1822
|
if (contractClient.spec && typeof contractClient.spec === "object") {
|
|
@@ -1685,20 +1831,20 @@ async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
|
1685
1831
|
try {
|
|
1686
1832
|
specEntries = spec.entries();
|
|
1687
1833
|
} catch (e) {
|
|
1688
|
-
|
|
1834
|
+
logger16.warn("loadStellarContractFromAddress", "entries() method failed:", e);
|
|
1689
1835
|
}
|
|
1690
1836
|
}
|
|
1691
1837
|
if (specEntries.length === 0 && typeof spec.entries === "function") {
|
|
1692
1838
|
try {
|
|
1693
1839
|
specEntries = spec.entries();
|
|
1694
1840
|
} catch (e) {
|
|
1695
|
-
|
|
1841
|
+
logger16.warn("loadStellarContractFromAddress", "direct entries() method failed:", e);
|
|
1696
1842
|
}
|
|
1697
1843
|
}
|
|
1698
|
-
|
|
1844
|
+
logger16.info("loadStellarContractFromAddress", `Found ${specEntries.length} spec entries`);
|
|
1699
1845
|
}
|
|
1700
1846
|
} catch (specError) {
|
|
1701
|
-
|
|
1847
|
+
logger16.warn("loadStellarContractFromAddress", "Could not extract spec entries:", specError);
|
|
1702
1848
|
}
|
|
1703
1849
|
const functions = await extractFunctionsFromSpec(
|
|
1704
1850
|
contractClient.spec,
|
|
@@ -1706,7 +1852,7 @@ async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
|
1706
1852
|
specEntries,
|
|
1707
1853
|
networkConfig
|
|
1708
1854
|
);
|
|
1709
|
-
|
|
1855
|
+
logger16.info(
|
|
1710
1856
|
"loadStellarContractFromAddress",
|
|
1711
1857
|
`Successfully extracted ${functions.length} functions`
|
|
1712
1858
|
);
|
|
@@ -1721,28 +1867,28 @@ async function loadStellarContractFromAddress(contractAddress, networkConfig) {
|
|
|
1721
1867
|
} catch (error) {
|
|
1722
1868
|
const msg = error?.message || String(error);
|
|
1723
1869
|
if (msg.startsWith("NO_WASM:")) {
|
|
1724
|
-
|
|
1870
|
+
logger16.error("loadStellarContractFromAddress", msg);
|
|
1725
1871
|
throw new Error(msg);
|
|
1726
1872
|
}
|
|
1727
|
-
|
|
1873
|
+
logger16.error("loadStellarContractFromAddress", "Failed to load contract:", error);
|
|
1728
1874
|
throw new Error(`Failed to load contract: ${msg}`);
|
|
1729
1875
|
}
|
|
1730
1876
|
}
|
|
1731
1877
|
async function extractFunctionsFromSpec(spec, contractAddress, specEntries, networkConfig) {
|
|
1732
1878
|
try {
|
|
1733
1879
|
const specFunctions = spec.funcs();
|
|
1734
|
-
|
|
1880
|
+
logger16.info("extractFunctionsFromSpec", `Found ${specFunctions.length} functions in spec`);
|
|
1735
1881
|
return await Promise.all(
|
|
1736
1882
|
specFunctions.map(async (func, index) => {
|
|
1737
1883
|
try {
|
|
1738
1884
|
const functionName = func.name().toString();
|
|
1739
|
-
|
|
1885
|
+
logger16.info("extractFunctionsFromSpec", `Processing function: ${functionName}`);
|
|
1740
1886
|
const inputs = func.inputs().map((input, inputIndex) => {
|
|
1741
1887
|
try {
|
|
1742
1888
|
const inputName = input.name().toString();
|
|
1743
1889
|
const inputType = extractSorobanTypeFromScSpec(input.type());
|
|
1744
1890
|
if (inputType === "unknown") {
|
|
1745
|
-
|
|
1891
|
+
logger16.warn(
|
|
1746
1892
|
"extractFunctionsFromSpec",
|
|
1747
1893
|
`Unknown type for parameter "${inputName}" in function "${functionName}"`
|
|
1748
1894
|
);
|
|
@@ -1752,12 +1898,12 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1752
1898
|
const structFields = extractStructFields(specEntries, inputType);
|
|
1753
1899
|
if (structFields && structFields.length > 0) {
|
|
1754
1900
|
components = structFields;
|
|
1755
|
-
|
|
1901
|
+
logger16.debug(
|
|
1756
1902
|
"extractFunctionsFromSpec",
|
|
1757
1903
|
`Extracted ${structFields.length} fields for struct type "${inputType}": ${structFields.map((f) => `${f.name}:${f.type}`).join(", ")}`
|
|
1758
1904
|
);
|
|
1759
1905
|
} else {
|
|
1760
|
-
|
|
1906
|
+
logger16.warn(
|
|
1761
1907
|
"extractFunctionsFromSpec",
|
|
1762
1908
|
`No fields extracted for struct "${inputType}"`
|
|
1763
1909
|
);
|
|
@@ -1769,7 +1915,7 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1769
1915
|
...components && { components }
|
|
1770
1916
|
};
|
|
1771
1917
|
} catch (error) {
|
|
1772
|
-
|
|
1918
|
+
logger16.warn(
|
|
1773
1919
|
"extractFunctionsFromSpec",
|
|
1774
1920
|
`Failed to parse input ${inputIndex}:`,
|
|
1775
1921
|
error
|
|
@@ -1788,7 +1934,7 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1788
1934
|
type: outputType
|
|
1789
1935
|
};
|
|
1790
1936
|
} catch (error) {
|
|
1791
|
-
|
|
1937
|
+
logger16.warn(
|
|
1792
1938
|
"extractFunctionsFromSpec",
|
|
1793
1939
|
`Failed to parse output ${outputIndex}:`,
|
|
1794
1940
|
error
|
|
@@ -1804,7 +1950,7 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1804
1950
|
if (networkConfig) {
|
|
1805
1951
|
try {
|
|
1806
1952
|
const inputTypes = inputs.map((input) => input.type);
|
|
1807
|
-
|
|
1953
|
+
logger16.debug(
|
|
1808
1954
|
"extractFunctionsFromSpec",
|
|
1809
1955
|
`Checking state mutability for ${functionName} with input types: ${inputTypes.join(", ")}`
|
|
1810
1956
|
);
|
|
@@ -1815,20 +1961,20 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1815
1961
|
inputTypes
|
|
1816
1962
|
);
|
|
1817
1963
|
stateMutability = modifiesState ? "nonpayable" : "view";
|
|
1818
|
-
|
|
1964
|
+
logger16.info(
|
|
1819
1965
|
"extractFunctionsFromSpec",
|
|
1820
1966
|
`Function ${functionName} state mutability determined:`,
|
|
1821
1967
|
{ modifiesState, stateMutability }
|
|
1822
1968
|
);
|
|
1823
1969
|
} catch (error) {
|
|
1824
|
-
|
|
1970
|
+
logger16.warn(
|
|
1825
1971
|
"extractFunctionsFromSpec",
|
|
1826
1972
|
`Failed to determine state mutability for ${functionName}, assuming it modifies state:`,
|
|
1827
1973
|
error
|
|
1828
1974
|
);
|
|
1829
1975
|
}
|
|
1830
1976
|
} else {
|
|
1831
|
-
|
|
1977
|
+
logger16.warn(
|
|
1832
1978
|
"extractFunctionsFromSpec",
|
|
1833
1979
|
`No network config provided for ${functionName}, assuming it modifies state`
|
|
1834
1980
|
);
|
|
@@ -1846,7 +1992,7 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1846
1992
|
stateMutability
|
|
1847
1993
|
};
|
|
1848
1994
|
} catch (error) {
|
|
1849
|
-
|
|
1995
|
+
logger16.error("extractFunctionsFromSpec", `Failed to process function ${index}:`, error);
|
|
1850
1996
|
return {
|
|
1851
1997
|
id: `function_${index}`,
|
|
1852
1998
|
name: `function_${index}`,
|
|
@@ -1862,7 +2008,7 @@ async function extractFunctionsFromSpec(spec, contractAddress, specEntries, netw
|
|
|
1862
2008
|
})
|
|
1863
2009
|
);
|
|
1864
2010
|
} catch (error) {
|
|
1865
|
-
|
|
2011
|
+
logger16.error("extractFunctionsFromSpec", "Failed to extract functions from spec:", error);
|
|
1866
2012
|
throw new Error(`Failed to extract functions: ${error.message}`);
|
|
1867
2013
|
}
|
|
1868
2014
|
}
|
|
@@ -2170,13 +2316,13 @@ import {
|
|
|
2170
2316
|
Configuration,
|
|
2171
2317
|
RelayersApi
|
|
2172
2318
|
} from "@openzeppelin/relayer-sdk";
|
|
2173
|
-
import { logger as
|
|
2319
|
+
import { logger as logger22 } from "@openzeppelin/ui-builder-utils";
|
|
2174
2320
|
|
|
2175
2321
|
// src/wallet/connection.ts
|
|
2176
|
-
import { logger as
|
|
2322
|
+
import { logger as logger21 } from "@openzeppelin/ui-builder-utils";
|
|
2177
2323
|
|
|
2178
2324
|
// src/wallet/utils/stellarWalletImplementationManager.ts
|
|
2179
|
-
import { appConfigService, logger as
|
|
2325
|
+
import { appConfigService as appConfigService2, logger as logger18 } from "@openzeppelin/ui-builder-utils";
|
|
2180
2326
|
|
|
2181
2327
|
// src/wallet/implementation/wallets-kit-implementation.ts
|
|
2182
2328
|
import {
|
|
@@ -2184,7 +2330,7 @@ import {
|
|
|
2184
2330
|
StellarWalletsKit,
|
|
2185
2331
|
WalletNetwork
|
|
2186
2332
|
} from "@creit.tech/stellar-wallets-kit";
|
|
2187
|
-
import { logger as
|
|
2333
|
+
import { logger as logger17 } from "@openzeppelin/ui-builder-utils";
|
|
2188
2334
|
var LOG_SYSTEM = "StellarWalletImplementation";
|
|
2189
2335
|
var WalletsKitImplementation = class {
|
|
2190
2336
|
/**
|
|
@@ -2205,7 +2351,7 @@ var WalletsKitImplementation = class {
|
|
|
2205
2351
|
__publicField(this, "currentWalletId", null);
|
|
2206
2352
|
__publicField(this, "connectionStatusListeners", /* @__PURE__ */ new Set());
|
|
2207
2353
|
this.networkConfig = networkConfig || null;
|
|
2208
|
-
|
|
2354
|
+
logger17.info(
|
|
2209
2355
|
LOG_SYSTEM,
|
|
2210
2356
|
"Constructor called. Initial anticipated kitName:",
|
|
2211
2357
|
initialUiKitConfig?.kitName,
|
|
@@ -2213,7 +2359,7 @@ var WalletsKitImplementation = class {
|
|
|
2213
2359
|
networkConfig?.name
|
|
2214
2360
|
);
|
|
2215
2361
|
this.initialized = true;
|
|
2216
|
-
|
|
2362
|
+
logger17.info(
|
|
2217
2363
|
LOG_SYSTEM,
|
|
2218
2364
|
"StellarWalletImplementation instance initialized (StellarWalletsKit config creation deferred)."
|
|
2219
2365
|
);
|
|
@@ -2223,10 +2369,10 @@ var WalletsKitImplementation = class {
|
|
|
2223
2369
|
* @param config - The Stellar network configuration
|
|
2224
2370
|
*/
|
|
2225
2371
|
setNetworkConfig(config) {
|
|
2226
|
-
|
|
2372
|
+
logger17.info(LOG_SYSTEM, "Network config updated:", config.name);
|
|
2227
2373
|
this.networkConfig = config;
|
|
2228
2374
|
if (this.activeStellarKit || this.defaultInstanceKit) {
|
|
2229
|
-
|
|
2375
|
+
logger17.info(LOG_SYSTEM, "Active kits detected - may need reconfiguration for new network");
|
|
2230
2376
|
}
|
|
2231
2377
|
}
|
|
2232
2378
|
/**
|
|
@@ -2236,14 +2382,14 @@ var WalletsKitImplementation = class {
|
|
|
2236
2382
|
* @param kit - The StellarWalletsKit object to set as active, or null to clear it.
|
|
2237
2383
|
*/
|
|
2238
2384
|
setActiveStellarKit(kit) {
|
|
2239
|
-
|
|
2385
|
+
logger17.info(
|
|
2240
2386
|
LOG_SYSTEM,
|
|
2241
2387
|
"setActiveStellarKit called with kit:",
|
|
2242
2388
|
kit ? "Valid StellarWalletsKit" : "Null"
|
|
2243
2389
|
);
|
|
2244
2390
|
this.activeStellarKit = kit;
|
|
2245
2391
|
if (this.unsubscribeFromStatusChanges) {
|
|
2246
|
-
|
|
2392
|
+
logger17.info(LOG_SYSTEM, "Re-establishing connection status monitoring with new kit");
|
|
2247
2393
|
}
|
|
2248
2394
|
}
|
|
2249
2395
|
/**
|
|
@@ -2252,14 +2398,14 @@ var WalletsKitImplementation = class {
|
|
|
2252
2398
|
* @returns A default StellarWalletsKit instance
|
|
2253
2399
|
*/
|
|
2254
2400
|
createDefaultKit() {
|
|
2255
|
-
|
|
2401
|
+
logger17.info(LOG_SYSTEM, "Creating default StellarWalletsKit instance");
|
|
2256
2402
|
const network = this.getWalletNetwork();
|
|
2257
2403
|
const kit = new StellarWalletsKit({
|
|
2258
2404
|
network,
|
|
2259
2405
|
selectedWalletId: void 0,
|
|
2260
2406
|
modules: allowAllModules()
|
|
2261
2407
|
});
|
|
2262
|
-
|
|
2408
|
+
logger17.info(LOG_SYSTEM, "Default StellarWalletsKit instance created");
|
|
2263
2409
|
return kit;
|
|
2264
2410
|
}
|
|
2265
2411
|
/**
|
|
@@ -2267,7 +2413,7 @@ var WalletsKitImplementation = class {
|
|
|
2267
2413
|
*/
|
|
2268
2414
|
getWalletNetwork() {
|
|
2269
2415
|
if (!this.networkConfig) {
|
|
2270
|
-
|
|
2416
|
+
logger17.warn(LOG_SYSTEM, "No network config available, defaulting to TESTNET");
|
|
2271
2417
|
return WalletNetwork.TESTNET;
|
|
2272
2418
|
}
|
|
2273
2419
|
return this.networkConfig.type === "mainnet" ? WalletNetwork.PUBLIC : WalletNetwork.TESTNET;
|
|
@@ -2285,7 +2431,7 @@ var WalletsKitImplementation = class {
|
|
|
2285
2431
|
*/
|
|
2286
2432
|
async getAvailableConnectors() {
|
|
2287
2433
|
if (!this.initialized) {
|
|
2288
|
-
|
|
2434
|
+
logger17.warn(LOG_SYSTEM, "getAvailableConnectors called before initialization");
|
|
2289
2435
|
return [];
|
|
2290
2436
|
}
|
|
2291
2437
|
try {
|
|
@@ -2298,10 +2444,10 @@ var WalletsKitImplementation = class {
|
|
|
2298
2444
|
installed: wallet.isAvailable,
|
|
2299
2445
|
type: wallet.type || "browser"
|
|
2300
2446
|
}));
|
|
2301
|
-
|
|
2447
|
+
logger17.info(LOG_SYSTEM, `Found ${connectors.length} available wallet connectors`);
|
|
2302
2448
|
return connectors;
|
|
2303
2449
|
} catch (error) {
|
|
2304
|
-
|
|
2450
|
+
logger17.error(LOG_SYSTEM, "Failed to get available connectors:", error);
|
|
2305
2451
|
return [];
|
|
2306
2452
|
}
|
|
2307
2453
|
}
|
|
@@ -2317,7 +2463,7 @@ var WalletsKitImplementation = class {
|
|
|
2317
2463
|
try {
|
|
2318
2464
|
const prevStatus = this.getWalletConnectionStatus();
|
|
2319
2465
|
const kit = this.getKitToUse();
|
|
2320
|
-
|
|
2466
|
+
logger17.info(LOG_SYSTEM, `Attempting to connect to wallet: ${connectorId}`);
|
|
2321
2467
|
kit.setWallet(connectorId);
|
|
2322
2468
|
const result = await kit.getAddress();
|
|
2323
2469
|
if (result.address) {
|
|
@@ -2325,7 +2471,7 @@ var WalletsKitImplementation = class {
|
|
|
2325
2471
|
this.currentWalletId = connectorId;
|
|
2326
2472
|
const newStatus = this.getWalletConnectionStatus();
|
|
2327
2473
|
this.notifyConnectionListeners(newStatus, prevStatus);
|
|
2328
|
-
|
|
2474
|
+
logger17.info(
|
|
2329
2475
|
LOG_SYSTEM,
|
|
2330
2476
|
`Successfully connected to wallet: ${connectorId}, address: ${result.address}`
|
|
2331
2477
|
);
|
|
@@ -2341,7 +2487,7 @@ var WalletsKitImplementation = class {
|
|
|
2341
2487
|
};
|
|
2342
2488
|
}
|
|
2343
2489
|
} catch (error) {
|
|
2344
|
-
|
|
2490
|
+
logger17.error(LOG_SYSTEM, `Failed to connect to wallet ${connectorId}:`, error);
|
|
2345
2491
|
return {
|
|
2346
2492
|
connected: false,
|
|
2347
2493
|
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2358,15 +2504,15 @@ var WalletsKitImplementation = class {
|
|
|
2358
2504
|
}
|
|
2359
2505
|
try {
|
|
2360
2506
|
const prevStatus = this.getWalletConnectionStatus();
|
|
2361
|
-
|
|
2507
|
+
logger17.info(LOG_SYSTEM, "Disconnecting wallet");
|
|
2362
2508
|
this.currentAddress = null;
|
|
2363
2509
|
this.currentWalletId = null;
|
|
2364
2510
|
const newStatus = this.getWalletConnectionStatus();
|
|
2365
2511
|
this.notifyConnectionListeners(newStatus, prevStatus);
|
|
2366
|
-
|
|
2512
|
+
logger17.info(LOG_SYSTEM, "Successfully disconnected wallet");
|
|
2367
2513
|
return { disconnected: true };
|
|
2368
2514
|
} catch (error) {
|
|
2369
|
-
|
|
2515
|
+
logger17.error(LOG_SYSTEM, "Failed to disconnect wallet:", error);
|
|
2370
2516
|
return {
|
|
2371
2517
|
disconnected: false,
|
|
2372
2518
|
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2399,15 +2545,15 @@ var WalletsKitImplementation = class {
|
|
|
2399
2545
|
*/
|
|
2400
2546
|
onWalletConnectionChange(callback) {
|
|
2401
2547
|
if (!this.initialized) {
|
|
2402
|
-
|
|
2548
|
+
logger17.warn(LOG_SYSTEM, "onWalletConnectionChange called before initialization. No-op.");
|
|
2403
2549
|
return () => {
|
|
2404
2550
|
};
|
|
2405
2551
|
}
|
|
2406
2552
|
this.connectionStatusListeners.add(callback);
|
|
2407
|
-
|
|
2553
|
+
logger17.info(LOG_SYSTEM, "Connection status listener added");
|
|
2408
2554
|
return () => {
|
|
2409
2555
|
this.connectionStatusListeners.delete(callback);
|
|
2410
|
-
|
|
2556
|
+
logger17.debug(LOG_SYSTEM, "Connection status listener removed");
|
|
2411
2557
|
};
|
|
2412
2558
|
}
|
|
2413
2559
|
/**
|
|
@@ -2442,7 +2588,7 @@ var WalletsKitImplementation = class {
|
|
|
2442
2588
|
}
|
|
2443
2589
|
const kit = this.getKitToUse();
|
|
2444
2590
|
const networkPassphrase = this.getWalletNetwork();
|
|
2445
|
-
|
|
2591
|
+
logger17.info(LOG_SYSTEM, "Signing transaction with wallet");
|
|
2446
2592
|
return await kit.signTransaction(xdr13, {
|
|
2447
2593
|
address,
|
|
2448
2594
|
networkPassphrase
|
|
@@ -2456,7 +2602,7 @@ var WalletsKitImplementation = class {
|
|
|
2456
2602
|
try {
|
|
2457
2603
|
listener(currentStatus, previousStatus);
|
|
2458
2604
|
} catch (error) {
|
|
2459
|
-
|
|
2605
|
+
logger17.error(LOG_SYSTEM, "Error in connection status listener:", String(error));
|
|
2460
2606
|
}
|
|
2461
2607
|
});
|
|
2462
2608
|
}
|
|
@@ -2469,7 +2615,7 @@ var WalletsKitImplementation = class {
|
|
|
2469
2615
|
this.unsubscribeFromStatusChanges = void 0;
|
|
2470
2616
|
}
|
|
2471
2617
|
this.connectionStatusListeners.clear();
|
|
2472
|
-
|
|
2618
|
+
logger17.info(LOG_SYSTEM, "Cleanup completed");
|
|
2473
2619
|
}
|
|
2474
2620
|
};
|
|
2475
2621
|
|
|
@@ -2493,17 +2639,17 @@ async function getStellarWalletImplementation(networkConfig) {
|
|
|
2493
2639
|
}
|
|
2494
2640
|
walletImplementationPromise = (async () => {
|
|
2495
2641
|
try {
|
|
2496
|
-
|
|
2497
|
-
const initialUiKitConfig =
|
|
2642
|
+
logger18.info(LOG_SYSTEM2, "Initializing StellarWalletImplementation singleton (async)...");
|
|
2643
|
+
const initialUiKitConfig = appConfigService2.getTypedNestedConfig(
|
|
2498
2644
|
"walletui",
|
|
2499
2645
|
"config"
|
|
2500
2646
|
);
|
|
2501
2647
|
const instance = new WalletsKitImplementation(networkConfig, initialUiKitConfig);
|
|
2502
|
-
|
|
2648
|
+
logger18.info(LOG_SYSTEM2, "WalletsKitImplementation singleton created (async).");
|
|
2503
2649
|
walletImplementationInstance = instance;
|
|
2504
2650
|
return instance;
|
|
2505
2651
|
} catch (error) {
|
|
2506
|
-
|
|
2652
|
+
logger18.error(LOG_SYSTEM2, "Failed to initialize WalletsKitImplementation (async):", error);
|
|
2507
2653
|
const fallbackInstance = new WalletsKitImplementation(networkConfig);
|
|
2508
2654
|
walletImplementationInstance = fallbackInstance;
|
|
2509
2655
|
return fallbackInstance;
|
|
@@ -2513,7 +2659,7 @@ async function getStellarWalletImplementation(networkConfig) {
|
|
|
2513
2659
|
}
|
|
2514
2660
|
function getInitializedStellarWalletImplementation() {
|
|
2515
2661
|
if (!walletImplementationInstance) {
|
|
2516
|
-
|
|
2662
|
+
logger18.warn(
|
|
2517
2663
|
LOG_SYSTEM2,
|
|
2518
2664
|
"getInitializedStellarWalletImplementation called before instance was ready."
|
|
2519
2665
|
);
|
|
@@ -2523,7 +2669,7 @@ function getInitializedStellarWalletImplementation() {
|
|
|
2523
2669
|
|
|
2524
2670
|
// src/wallet/stellar-wallets-kit/stellarUiKitManager.ts
|
|
2525
2671
|
import { allowAllModules as allowAllModules2, StellarWalletsKit as StellarWalletsKit2, WalletNetwork as WalletNetwork2 } from "@creit.tech/stellar-wallets-kit";
|
|
2526
|
-
import { logger as
|
|
2672
|
+
import { logger as logger19 } from "@openzeppelin/ui-builder-utils";
|
|
2527
2673
|
var getInitialState = () => ({
|
|
2528
2674
|
isConfigured: false,
|
|
2529
2675
|
isInitializing: false,
|
|
@@ -2560,13 +2706,13 @@ function setNetworkConfig(config) {
|
|
|
2560
2706
|
}
|
|
2561
2707
|
function getWalletNetwork(networkConfig) {
|
|
2562
2708
|
if (!networkConfig) {
|
|
2563
|
-
|
|
2709
|
+
logger19.warn("StellarUiKitManager", "No network config available, defaulting to TESTNET");
|
|
2564
2710
|
return WalletNetwork2.TESTNET;
|
|
2565
2711
|
}
|
|
2566
2712
|
return networkConfig.type === "mainnet" ? WalletNetwork2.PUBLIC : WalletNetwork2.TESTNET;
|
|
2567
2713
|
}
|
|
2568
2714
|
async function configure(newFullUiKitConfig) {
|
|
2569
|
-
|
|
2715
|
+
logger19.info(
|
|
2570
2716
|
"StellarUiKitManager:configure",
|
|
2571
2717
|
"Configuring UI kit. New config:",
|
|
2572
2718
|
newFullUiKitConfig
|
|
@@ -2596,7 +2742,23 @@ async function configure(newFullUiKitConfig) {
|
|
|
2596
2742
|
state.kitProviderComponent = null;
|
|
2597
2743
|
state.isKitAssetsLoaded = true;
|
|
2598
2744
|
state.error = null;
|
|
2599
|
-
|
|
2745
|
+
if (state.networkConfig) {
|
|
2746
|
+
try {
|
|
2747
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
2748
|
+
impl.setActiveStellarKit(kit);
|
|
2749
|
+
logger19.debug(
|
|
2750
|
+
"StellarUiKitManager:configure",
|
|
2751
|
+
"Active kit wired into wallet implementation for stellar-wallets-kit"
|
|
2752
|
+
);
|
|
2753
|
+
} catch (error) {
|
|
2754
|
+
logger19.warn(
|
|
2755
|
+
"StellarUiKitManager:configure",
|
|
2756
|
+
"Failed to attach active kit to wallet implementation:",
|
|
2757
|
+
error
|
|
2758
|
+
);
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
logger19.info(
|
|
2600
2762
|
"StellarUiKitManager:configure",
|
|
2601
2763
|
"Stellar Wallets Kit configured with built-in UI and all wallet modules"
|
|
2602
2764
|
);
|
|
@@ -2610,7 +2772,23 @@ async function configure(newFullUiKitConfig) {
|
|
|
2610
2772
|
state.kitProviderComponent = null;
|
|
2611
2773
|
state.isKitAssetsLoaded = true;
|
|
2612
2774
|
state.error = null;
|
|
2613
|
-
|
|
2775
|
+
if (state.networkConfig) {
|
|
2776
|
+
try {
|
|
2777
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
2778
|
+
impl.setActiveStellarKit(kit);
|
|
2779
|
+
logger19.debug(
|
|
2780
|
+
"StellarUiKitManager:configure",
|
|
2781
|
+
"Active kit wired into wallet implementation for custom"
|
|
2782
|
+
);
|
|
2783
|
+
} catch (error) {
|
|
2784
|
+
logger19.warn(
|
|
2785
|
+
"StellarUiKitManager:configure",
|
|
2786
|
+
"Failed to attach active kit to wallet implementation:",
|
|
2787
|
+
error
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
logger19.info(
|
|
2614
2792
|
"StellarUiKitManager:configure",
|
|
2615
2793
|
"Stellar Wallets Kit configured for custom UI components"
|
|
2616
2794
|
);
|
|
@@ -2619,7 +2797,23 @@ async function configure(newFullUiKitConfig) {
|
|
|
2619
2797
|
state.kitProviderComponent = null;
|
|
2620
2798
|
state.isKitAssetsLoaded = false;
|
|
2621
2799
|
state.error = null;
|
|
2622
|
-
|
|
2800
|
+
if (state.networkConfig) {
|
|
2801
|
+
try {
|
|
2802
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
2803
|
+
impl.setActiveStellarKit(null);
|
|
2804
|
+
logger19.debug(
|
|
2805
|
+
"StellarUiKitManager:configure",
|
|
2806
|
+
"Active kit cleared from wallet implementation for none"
|
|
2807
|
+
);
|
|
2808
|
+
} catch (error) {
|
|
2809
|
+
logger19.warn(
|
|
2810
|
+
"StellarUiKitManager:configure",
|
|
2811
|
+
"Failed to clear active kit from wallet implementation:",
|
|
2812
|
+
error
|
|
2813
|
+
);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
logger19.info("StellarUiKitManager:configure", 'UI kit set to "none", no wallet UI provided');
|
|
2623
2817
|
} else {
|
|
2624
2818
|
throw new Error(`Unknown UI kit name: ${newKitName}`);
|
|
2625
2819
|
}
|
|
@@ -2632,7 +2826,7 @@ async function configure(newFullUiKitConfig) {
|
|
|
2632
2826
|
};
|
|
2633
2827
|
notifyListeners();
|
|
2634
2828
|
} catch (error) {
|
|
2635
|
-
|
|
2829
|
+
logger19.error("StellarUiKitManager:configure", "Failed to configure UI kit:", error);
|
|
2636
2830
|
state = {
|
|
2637
2831
|
...state,
|
|
2638
2832
|
isInitializing: false,
|
|
@@ -2666,9 +2860,7 @@ function generateStellarWalletsKitConfigFile(userConfig) {
|
|
|
2666
2860
|
import {
|
|
2667
2861
|
StellarWalletsKit,
|
|
2668
2862
|
WalletNetwork,
|
|
2669
|
-
allowAllModules
|
|
2670
|
-
WalletConnectModule,
|
|
2671
|
-
WalletConnectAllowedMethods
|
|
2863
|
+
allowAllModules
|
|
2672
2864
|
} from '@creit.tech/stellar-wallets-kit';
|
|
2673
2865
|
|
|
2674
2866
|
/**
|
|
@@ -2703,18 +2895,7 @@ export const stellarWalletsKitConfig = {
|
|
|
2703
2895
|
*/
|
|
2704
2896
|
export function createStellarWalletsKit(): StellarWalletsKit {
|
|
2705
2897
|
const modules = [
|
|
2706
|
-
...allowAllModules()
|
|
2707
|
-
${walletConnectProjectId ? `
|
|
2708
|
-
// WalletConnect module with custom configuration
|
|
2709
|
-
new WalletConnectModule({
|
|
2710
|
-
url: window.location.origin,
|
|
2711
|
-
projectId: stellarWalletsKitConfig.walletConnectProjectId,
|
|
2712
|
-
method: WalletConnectAllowedMethods.SIGN,
|
|
2713
|
-
description: stellarWalletsKitConfig.appName,
|
|
2714
|
-
name: stellarWalletsKitConfig.appName,
|
|
2715
|
-
icons: [],
|
|
2716
|
-
network: stellarWalletsKitConfig.network,
|
|
2717
|
-
}),` : ""}
|
|
2898
|
+
...allowAllModules()
|
|
2718
2899
|
];
|
|
2719
2900
|
|
|
2720
2901
|
return new StellarWalletsKit({
|
|
@@ -2736,7 +2917,7 @@ function generateStellarWalletsKitExportables(uiKitConfig) {
|
|
|
2736
2917
|
|
|
2737
2918
|
// src/wallet/stellar-wallets-kit/StellarWalletsKitConnectButton.tsx
|
|
2738
2919
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
2739
|
-
import { logger as
|
|
2920
|
+
import { logger as logger20 } from "@openzeppelin/ui-builder-utils";
|
|
2740
2921
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2741
2922
|
function StellarWalletsKitConnectButton() {
|
|
2742
2923
|
const containerRef = useRef2(null);
|
|
@@ -2744,7 +2925,7 @@ function StellarWalletsKitConnectButton() {
|
|
|
2744
2925
|
const state2 = stellarUiKitManager.getState();
|
|
2745
2926
|
const kit = state2.stellarKitProvider;
|
|
2746
2927
|
if (!kit || !containerRef.current) {
|
|
2747
|
-
|
|
2928
|
+
logger20.error(
|
|
2748
2929
|
"StellarWalletsKitConnectButton",
|
|
2749
2930
|
"Kit not initialized or container not available"
|
|
2750
2931
|
);
|
|
@@ -2753,10 +2934,28 @@ function StellarWalletsKitConnectButton() {
|
|
|
2753
2934
|
kit.createButton({
|
|
2754
2935
|
container: containerRef.current,
|
|
2755
2936
|
onConnect: ({ address }) => {
|
|
2756
|
-
|
|
2937
|
+
logger20.info("StellarWalletsKitConnectButton", `Connected to address: ${address}`);
|
|
2938
|
+
try {
|
|
2939
|
+
setStellarConnectedAddress(address ?? null);
|
|
2940
|
+
} catch (error) {
|
|
2941
|
+
logger20.warn(
|
|
2942
|
+
"StellarWalletsKitConnectButton",
|
|
2943
|
+
"Failed to set connected address in adapter implementation:",
|
|
2944
|
+
error
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2757
2947
|
},
|
|
2758
2948
|
onDisconnect: () => {
|
|
2759
|
-
|
|
2949
|
+
logger20.info("StellarWalletsKitConnectButton", "Disconnected");
|
|
2950
|
+
try {
|
|
2951
|
+
setStellarConnectedAddress(null);
|
|
2952
|
+
} catch (error) {
|
|
2953
|
+
logger20.warn(
|
|
2954
|
+
"StellarWalletsKitConnectButton",
|
|
2955
|
+
"Failed to clear connected address in adapter implementation:",
|
|
2956
|
+
error
|
|
2957
|
+
);
|
|
2958
|
+
}
|
|
2760
2959
|
},
|
|
2761
2960
|
buttonText: "Connect Wallet"
|
|
2762
2961
|
});
|
|
@@ -2765,10 +2964,10 @@ function StellarWalletsKitConnectButton() {
|
|
|
2765
2964
|
try {
|
|
2766
2965
|
kit.removeButton();
|
|
2767
2966
|
} catch (error) {
|
|
2768
|
-
|
|
2967
|
+
logger20.warn("StellarWalletsKitConnectButton", "Error removing button:", error);
|
|
2769
2968
|
}
|
|
2770
2969
|
} else {
|
|
2771
|
-
|
|
2970
|
+
logger20.warn(
|
|
2772
2971
|
"StellarWalletsKitConnectButton",
|
|
2773
2972
|
"removeButton method not available on kit instance"
|
|
2774
2973
|
);
|
|
@@ -2797,7 +2996,7 @@ async function disconnectStellarWallet() {
|
|
|
2797
2996
|
function getStellarWalletConnectionStatus() {
|
|
2798
2997
|
const impl = getInitializedStellarWalletImplementation();
|
|
2799
2998
|
if (!impl) {
|
|
2800
|
-
|
|
2999
|
+
logger21.warn(
|
|
2801
3000
|
"getStellarWalletConnectionStatus",
|
|
2802
3001
|
"Wallet implementation not ready. Returning default disconnected state."
|
|
2803
3002
|
);
|
|
@@ -2816,10 +3015,21 @@ function getStellarWalletConnectionStatus() {
|
|
|
2816
3015
|
walletId: status.walletId
|
|
2817
3016
|
};
|
|
2818
3017
|
}
|
|
3018
|
+
function setStellarConnectedAddress(address, walletId) {
|
|
3019
|
+
const impl = getInitializedStellarWalletImplementation();
|
|
3020
|
+
if (impl) {
|
|
3021
|
+
impl.updateConnectionStatus(address, walletId);
|
|
3022
|
+
} else {
|
|
3023
|
+
logger21.warn(
|
|
3024
|
+
"setStellarConnectedAddress",
|
|
3025
|
+
"Wallet implementation not ready. Cannot update connection status."
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
2819
3029
|
function onStellarWalletConnectionChange(callback) {
|
|
2820
3030
|
const impl = getInitializedStellarWalletImplementation();
|
|
2821
3031
|
if (!impl) {
|
|
2822
|
-
|
|
3032
|
+
logger21.warn(
|
|
2823
3033
|
"onStellarWalletConnectionChange",
|
|
2824
3034
|
"Wallet implementation not ready. Returning no-op."
|
|
2825
3035
|
);
|
|
@@ -2842,7 +3052,7 @@ function onStellarWalletConnectionChange(callback) {
|
|
|
2842
3052
|
try {
|
|
2843
3053
|
callback(currentStatus, previousStatus);
|
|
2844
3054
|
} catch (error) {
|
|
2845
|
-
|
|
3055
|
+
logger21.error("Error in Stellar connection status listener:", String(error));
|
|
2846
3056
|
}
|
|
2847
3057
|
});
|
|
2848
3058
|
}
|
|
@@ -2887,7 +3097,7 @@ var RelayerExecutionStrategy = class {
|
|
|
2887
3097
|
* @throws If the API call fails or returns an unsuccessful response.
|
|
2888
3098
|
*/
|
|
2889
3099
|
async getStellarRelayers(serviceUrl, accessToken, networkConfig) {
|
|
2890
|
-
|
|
3100
|
+
logger22.info(
|
|
2891
3101
|
"[StellarRelayer] Getting relayers with access token",
|
|
2892
3102
|
accessToken.slice(0, 5).padEnd(accessToken.length, "*")
|
|
2893
3103
|
);
|
|
@@ -2935,7 +3145,7 @@ var RelayerExecutionStrategy = class {
|
|
|
2935
3145
|
* @throws If any API call fails or returns an unsuccessful response.
|
|
2936
3146
|
*/
|
|
2937
3147
|
async getStellarRelayer(serviceUrl, accessToken, relayerId, _networkConfig) {
|
|
2938
|
-
|
|
3148
|
+
logger22.info("[StellarRelayer] Getting detailed relayer info", relayerId);
|
|
2939
3149
|
const sdkConfig = new Configuration({
|
|
2940
3150
|
basePath: serviceUrl,
|
|
2941
3151
|
accessToken
|
|
@@ -2945,11 +3155,11 @@ var RelayerExecutionStrategy = class {
|
|
|
2945
3155
|
const [relayerResponse, balanceResponse, statusResponse] = await Promise.all([
|
|
2946
3156
|
relayersApi.getRelayer(relayerId),
|
|
2947
3157
|
relayersApi.getRelayerBalance(relayerId).catch((err) => {
|
|
2948
|
-
|
|
3158
|
+
logger22.warn("[StellarRelayer] Failed to fetch balance", err);
|
|
2949
3159
|
return null;
|
|
2950
3160
|
}),
|
|
2951
3161
|
relayersApi.getRelayerStatus(relayerId).catch((err) => {
|
|
2952
|
-
|
|
3162
|
+
logger22.warn("[StellarRelayer] Failed to fetch status", err);
|
|
2953
3163
|
return null;
|
|
2954
3164
|
})
|
|
2955
3165
|
]);
|
|
@@ -2971,7 +3181,7 @@ var RelayerExecutionStrategy = class {
|
|
|
2971
3181
|
const balanceInXlm = balanceInStroops / 1e7;
|
|
2972
3182
|
enhancedDetails.balance = `${balanceInXlm.toFixed(7)} XLM`;
|
|
2973
3183
|
} catch (error) {
|
|
2974
|
-
|
|
3184
|
+
logger22.warn("[StellarRelayer] Failed to format balance, using raw value", String(error));
|
|
2975
3185
|
enhancedDetails.balance = String(balanceResponse.data.data.balance);
|
|
2976
3186
|
}
|
|
2977
3187
|
}
|
|
@@ -2990,13 +3200,13 @@ var RelayerExecutionStrategy = class {
|
|
|
2990
3200
|
}
|
|
2991
3201
|
}
|
|
2992
3202
|
}
|
|
2993
|
-
|
|
3203
|
+
logger22.info(
|
|
2994
3204
|
"[StellarRelayer] Retrieved enhanced relayer details",
|
|
2995
3205
|
JSON.stringify(enhancedDetails)
|
|
2996
3206
|
);
|
|
2997
3207
|
return enhancedDetails;
|
|
2998
3208
|
} catch (error) {
|
|
2999
|
-
|
|
3209
|
+
logger22.error(
|
|
3000
3210
|
"[StellarRelayer] Failed to get relayer details",
|
|
3001
3211
|
error instanceof Error ? error.message : String(error)
|
|
3002
3212
|
);
|
|
@@ -3252,10 +3462,10 @@ var RelayerExecutionStrategy = class {
|
|
|
3252
3462
|
};
|
|
3253
3463
|
|
|
3254
3464
|
// src/configuration/execution.ts
|
|
3255
|
-
import { logger as
|
|
3465
|
+
import { logger as logger23 } from "@openzeppelin/ui-builder-utils";
|
|
3256
3466
|
var SYSTEM_LOG_TAG7 = "adapter-stellar-execution-config";
|
|
3257
3467
|
async function getStellarSupportedExecutionMethods() {
|
|
3258
|
-
|
|
3468
|
+
logger23.warn(
|
|
3259
3469
|
"adapter-stellar-execution-config",
|
|
3260
3470
|
"getStellarSupportedExecutionMethods is using placeholder implementation."
|
|
3261
3471
|
);
|
|
@@ -3281,11 +3491,11 @@ async function getStellarSupportedExecutionMethods() {
|
|
|
3281
3491
|
]);
|
|
3282
3492
|
}
|
|
3283
3493
|
async function _validateMultisigConfig(_config, _walletStatus) {
|
|
3284
|
-
|
|
3494
|
+
logger23.info(SYSTEM_LOG_TAG7, "Multisig execution config validation: Not yet fully implemented.");
|
|
3285
3495
|
return true;
|
|
3286
3496
|
}
|
|
3287
3497
|
async function validateStellarExecutionConfig(config, walletStatus) {
|
|
3288
|
-
|
|
3498
|
+
logger23.info(SYSTEM_LOG_TAG7, "Validating Stellar execution config:", { config, walletStatus });
|
|
3289
3499
|
switch (config.method) {
|
|
3290
3500
|
case "eoa":
|
|
3291
3501
|
return validateEoaConfig(config, walletStatus);
|
|
@@ -3295,7 +3505,7 @@ async function validateStellarExecutionConfig(config, walletStatus) {
|
|
|
3295
3505
|
return _validateMultisigConfig(config, walletStatus);
|
|
3296
3506
|
default: {
|
|
3297
3507
|
const unknownMethod = config.method;
|
|
3298
|
-
|
|
3508
|
+
logger23.warn(
|
|
3299
3509
|
SYSTEM_LOG_TAG7,
|
|
3300
3510
|
`Unsupported execution method type encountered: ${unknownMethod}`
|
|
3301
3511
|
);
|
|
@@ -3304,121 +3514,6 @@ async function validateStellarExecutionConfig(config, walletStatus) {
|
|
|
3304
3514
|
}
|
|
3305
3515
|
}
|
|
3306
3516
|
|
|
3307
|
-
// src/configuration/rpc.ts
|
|
3308
|
-
import {
|
|
3309
|
-
appConfigService as appConfigService2,
|
|
3310
|
-
isValidUrl,
|
|
3311
|
-
logger as logger23,
|
|
3312
|
-
userRpcConfigService as userRpcConfigService3
|
|
3313
|
-
} from "@openzeppelin/ui-builder-utils";
|
|
3314
|
-
function validateStellarRpcEndpoint(rpcConfig) {
|
|
3315
|
-
try {
|
|
3316
|
-
if (!isValidUrl(rpcConfig.url)) {
|
|
3317
|
-
logger23.error("validateStellarRpcEndpoint", `Invalid RPC URL format: ${rpcConfig.url}`);
|
|
3318
|
-
return false;
|
|
3319
|
-
}
|
|
3320
|
-
return true;
|
|
3321
|
-
} catch (error) {
|
|
3322
|
-
logger23.error("validateStellarRpcEndpoint", "Error validating RPC endpoint:", error);
|
|
3323
|
-
return false;
|
|
3324
|
-
}
|
|
3325
|
-
}
|
|
3326
|
-
async function testStellarRpcConnection(rpcConfig, timeoutMs = 5e3) {
|
|
3327
|
-
if (!rpcConfig.url) {
|
|
3328
|
-
return { success: false, error: "Soroban RPC URL is required" };
|
|
3329
|
-
}
|
|
3330
|
-
const controller = new AbortController();
|
|
3331
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
3332
|
-
try {
|
|
3333
|
-
const startTime = Date.now();
|
|
3334
|
-
const response = await fetch(rpcConfig.url, {
|
|
3335
|
-
method: "POST",
|
|
3336
|
-
headers: {
|
|
3337
|
-
"Content-Type": "application/json"
|
|
3338
|
-
},
|
|
3339
|
-
body: JSON.stringify({
|
|
3340
|
-
jsonrpc: "2.0",
|
|
3341
|
-
id: 1,
|
|
3342
|
-
method: "getHealth"
|
|
3343
|
-
}),
|
|
3344
|
-
signal: controller.signal
|
|
3345
|
-
});
|
|
3346
|
-
if (!response.ok) {
|
|
3347
|
-
return { success: false, error: `HTTP error: ${response.status}` };
|
|
3348
|
-
}
|
|
3349
|
-
const data = await response.json();
|
|
3350
|
-
const latency = Date.now() - startTime;
|
|
3351
|
-
if (data.error) {
|
|
3352
|
-
return {
|
|
3353
|
-
success: false,
|
|
3354
|
-
error: `Soroban RPC error: ${data.error.message || "Unknown RPC error"}`
|
|
3355
|
-
};
|
|
3356
|
-
}
|
|
3357
|
-
if (!data.result) {
|
|
3358
|
-
return await testWithFallbackMethod(rpcConfig, controller.signal, startTime);
|
|
3359
|
-
}
|
|
3360
|
-
const healthStatus = data.result.status;
|
|
3361
|
-
if (healthStatus && healthStatus !== "healthy") {
|
|
3362
|
-
return {
|
|
3363
|
-
success: false,
|
|
3364
|
-
error: `Soroban RPC service unhealthy: ${healthStatus}`,
|
|
3365
|
-
latency
|
|
3366
|
-
};
|
|
3367
|
-
}
|
|
3368
|
-
return { success: true, latency };
|
|
3369
|
-
} catch (error) {
|
|
3370
|
-
logger23.error("testStellarRpcConnection", "Connection test failed:", error);
|
|
3371
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
3372
|
-
return {
|
|
3373
|
-
success: false,
|
|
3374
|
-
error: `Connection timeout after ${timeoutMs}ms`
|
|
3375
|
-
};
|
|
3376
|
-
}
|
|
3377
|
-
try {
|
|
3378
|
-
return await testWithFallbackMethod(rpcConfig, controller.signal, Date.now());
|
|
3379
|
-
} catch {
|
|
3380
|
-
return {
|
|
3381
|
-
success: false,
|
|
3382
|
-
error: error instanceof Error ? error.message : "Connection failed"
|
|
3383
|
-
};
|
|
3384
|
-
}
|
|
3385
|
-
} finally {
|
|
3386
|
-
clearTimeout(timeoutId);
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
async function testWithFallbackMethod(rpcConfig, signal, startTime) {
|
|
3390
|
-
const response = await fetch(rpcConfig.url, {
|
|
3391
|
-
method: "POST",
|
|
3392
|
-
headers: {
|
|
3393
|
-
"Content-Type": "application/json"
|
|
3394
|
-
},
|
|
3395
|
-
body: JSON.stringify({
|
|
3396
|
-
jsonrpc: "2.0",
|
|
3397
|
-
id: 1,
|
|
3398
|
-
method: "getLatestLedger"
|
|
3399
|
-
}),
|
|
3400
|
-
signal
|
|
3401
|
-
});
|
|
3402
|
-
if (!response.ok) {
|
|
3403
|
-
return { success: false, error: `HTTP error: ${response.status}` };
|
|
3404
|
-
}
|
|
3405
|
-
const data = await response.json();
|
|
3406
|
-
const latency = Date.now() - startTime;
|
|
3407
|
-
if (data.error) {
|
|
3408
|
-
return {
|
|
3409
|
-
success: false,
|
|
3410
|
-
error: `Soroban RPC error: ${data.error.message || "Unknown RPC error"}`
|
|
3411
|
-
};
|
|
3412
|
-
}
|
|
3413
|
-
if (data.result && data.result.sequence) {
|
|
3414
|
-
return { success: true, latency };
|
|
3415
|
-
}
|
|
3416
|
-
return {
|
|
3417
|
-
success: false,
|
|
3418
|
-
error: "Unexpected response format from Soroban RPC endpoint"
|
|
3419
|
-
};
|
|
3420
|
-
}
|
|
3421
|
-
|
|
3422
3517
|
// src/mapping/constants.ts
|
|
3423
3518
|
var STELLAR_TYPE_TO_FIELD_TYPE = {
|
|
3424
3519
|
// Address types
|
|
@@ -4686,7 +4781,24 @@ var StellarAdapter = class {
|
|
|
4686
4781
|
`Adapter initialized for network: ${networkConfig.name} (ID: ${networkConfig.id})`
|
|
4687
4782
|
);
|
|
4688
4783
|
}
|
|
4689
|
-
|
|
4784
|
+
/**
|
|
4785
|
+
* @inheritdoc
|
|
4786
|
+
*/
|
|
4787
|
+
getNetworkServiceForms() {
|
|
4788
|
+
return getStellarNetworkServiceForms();
|
|
4789
|
+
}
|
|
4790
|
+
/**
|
|
4791
|
+
* @inheritdoc
|
|
4792
|
+
*/
|
|
4793
|
+
async validateNetworkServiceConfig(serviceId, values) {
|
|
4794
|
+
return validateStellarNetworkServiceConfig(serviceId, values);
|
|
4795
|
+
}
|
|
4796
|
+
/**
|
|
4797
|
+
* @inheritdoc
|
|
4798
|
+
*/
|
|
4799
|
+
async testNetworkServiceConnection(serviceId, values) {
|
|
4800
|
+
return testStellarNetworkServiceConnection(serviceId, values);
|
|
4801
|
+
}
|
|
4690
4802
|
/**
|
|
4691
4803
|
* NOTE about artifact inputs (single input with auto-detection):
|
|
4692
4804
|
*
|
|
@@ -4711,6 +4823,9 @@ var StellarAdapter = class {
|
|
|
4711
4823
|
* manual contract definition exactly like the EVM/Midnight flows.
|
|
4712
4824
|
* - Provide clear UI hints about supported formats (JSON spec or Wasm binary).
|
|
4713
4825
|
*/
|
|
4826
|
+
/**
|
|
4827
|
+
* @inheritdoc
|
|
4828
|
+
*/
|
|
4714
4829
|
getContractDefinitionInputs() {
|
|
4715
4830
|
return [
|
|
4716
4831
|
{
|
|
@@ -4749,10 +4864,15 @@ var StellarAdapter = class {
|
|
|
4749
4864
|
throw error;
|
|
4750
4865
|
}
|
|
4751
4866
|
}
|
|
4867
|
+
/**
|
|
4868
|
+
* @inheritdoc
|
|
4869
|
+
*/
|
|
4752
4870
|
getWritableFunctions(contractSchema) {
|
|
4753
4871
|
return getStellarWritableFunctions(contractSchema);
|
|
4754
4872
|
}
|
|
4755
|
-
|
|
4873
|
+
/**
|
|
4874
|
+
* @inheritdoc
|
|
4875
|
+
*/
|
|
4756
4876
|
mapParameterTypeToFieldType(parameterType) {
|
|
4757
4877
|
return mapStellarParameterTypeToFieldType(parameterType);
|
|
4758
4878
|
}
|
|
@@ -4762,7 +4882,9 @@ var StellarAdapter = class {
|
|
|
4762
4882
|
generateDefaultField(parameter, contractSchema) {
|
|
4763
4883
|
return generateStellarDefaultField(parameter, contractSchema);
|
|
4764
4884
|
}
|
|
4765
|
-
|
|
4885
|
+
/**
|
|
4886
|
+
* @inheritdoc
|
|
4887
|
+
*/
|
|
4766
4888
|
formatTransactionData(contractSchema, functionId, submittedInputs, fields) {
|
|
4767
4889
|
return formatStellarTransactionData(contractSchema, functionId, submittedInputs, fields);
|
|
4768
4890
|
}
|
|
@@ -4775,15 +4897,15 @@ var StellarAdapter = class {
|
|
|
4775
4897
|
runtimeApiKey
|
|
4776
4898
|
);
|
|
4777
4899
|
}
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
// async waitForTransactionConfirmation?(...) { ... }
|
|
4782
|
-
// --- View Function Querying --- //
|
|
4900
|
+
/**
|
|
4901
|
+
* @inheritdoc
|
|
4902
|
+
*/
|
|
4783
4903
|
isViewFunction(functionDetails) {
|
|
4784
4904
|
return isStellarViewFunction(functionDetails);
|
|
4785
4905
|
}
|
|
4786
|
-
|
|
4906
|
+
/**
|
|
4907
|
+
* @inheritdoc
|
|
4908
|
+
*/
|
|
4787
4909
|
async queryViewFunction(contractAddress, functionId, params = [], contractSchema) {
|
|
4788
4910
|
return queryStellarViewFunction(
|
|
4789
4911
|
contractAddress,
|
|
@@ -4794,22 +4916,39 @@ var StellarAdapter = class {
|
|
|
4794
4916
|
(address) => this.loadContract({ contractAddress: address })
|
|
4795
4917
|
);
|
|
4796
4918
|
}
|
|
4919
|
+
/**
|
|
4920
|
+
* @inheritdoc
|
|
4921
|
+
*/
|
|
4797
4922
|
formatFunctionResult(decodedValue, functionDetails) {
|
|
4798
4923
|
return formatStellarFunctionResult(decodedValue, functionDetails);
|
|
4799
4924
|
}
|
|
4800
|
-
|
|
4925
|
+
/**
|
|
4926
|
+
* @inheritdoc
|
|
4927
|
+
*/
|
|
4801
4928
|
supportsWalletConnection() {
|
|
4802
4929
|
return supportsStellarWalletConnection();
|
|
4803
4930
|
}
|
|
4931
|
+
/**
|
|
4932
|
+
* @inheritdoc
|
|
4933
|
+
*/
|
|
4804
4934
|
async getAvailableConnectors() {
|
|
4805
4935
|
return getStellarAvailableConnectors();
|
|
4806
4936
|
}
|
|
4937
|
+
/**
|
|
4938
|
+
* @inheritdoc
|
|
4939
|
+
*/
|
|
4807
4940
|
async connectWallet(connectorId) {
|
|
4808
4941
|
return connectStellarWallet(connectorId);
|
|
4809
4942
|
}
|
|
4943
|
+
/**
|
|
4944
|
+
* @inheritdoc
|
|
4945
|
+
*/
|
|
4810
4946
|
async disconnectWallet() {
|
|
4811
4947
|
return disconnectStellarWallet();
|
|
4812
4948
|
}
|
|
4949
|
+
/**
|
|
4950
|
+
* @inheritdoc
|
|
4951
|
+
*/
|
|
4813
4952
|
getWalletConnectionStatus() {
|
|
4814
4953
|
const impl = getInitializedStellarWalletImplementation();
|
|
4815
4954
|
if (!impl) {
|
|
@@ -4841,29 +4980,43 @@ var StellarAdapter = class {
|
|
|
4841
4980
|
}
|
|
4842
4981
|
);
|
|
4843
4982
|
}
|
|
4844
|
-
|
|
4983
|
+
/**
|
|
4984
|
+
* @inheritdoc
|
|
4985
|
+
*/
|
|
4845
4986
|
async getSupportedExecutionMethods() {
|
|
4846
4987
|
return getStellarSupportedExecutionMethods();
|
|
4847
4988
|
}
|
|
4989
|
+
/**
|
|
4990
|
+
* @inheritdoc
|
|
4991
|
+
*/
|
|
4848
4992
|
async validateExecutionConfig(config) {
|
|
4849
4993
|
const walletStatus = this.getWalletConnectionStatus();
|
|
4850
4994
|
return validateStellarExecutionConfig(config, walletStatus);
|
|
4851
4995
|
}
|
|
4852
|
-
|
|
4996
|
+
/**
|
|
4997
|
+
* @inheritdoc
|
|
4998
|
+
*/
|
|
4853
4999
|
getExplorerUrl(address) {
|
|
4854
5000
|
return getStellarExplorerAddressUrl(address, this.networkConfig);
|
|
4855
5001
|
}
|
|
4856
|
-
|
|
5002
|
+
/**
|
|
5003
|
+
* @inheritdoc
|
|
5004
|
+
*/
|
|
4857
5005
|
getExplorerTxUrl(txHash) {
|
|
4858
5006
|
if (getStellarExplorerTxUrl) {
|
|
4859
5007
|
return getStellarExplorerTxUrl(txHash, this.networkConfig);
|
|
4860
5008
|
}
|
|
4861
5009
|
return null;
|
|
4862
5010
|
}
|
|
4863
|
-
|
|
5011
|
+
/**
|
|
5012
|
+
* @inheritdoc
|
|
5013
|
+
*/
|
|
4864
5014
|
isValidAddress(address, addressType) {
|
|
4865
5015
|
return isValidAddress(address, addressType);
|
|
4866
5016
|
}
|
|
5017
|
+
/**
|
|
5018
|
+
* @inheritdoc
|
|
5019
|
+
*/
|
|
4867
5020
|
async getAvailableUiKits() {
|
|
4868
5021
|
return [
|
|
4869
5022
|
{
|
|
@@ -4936,6 +5089,9 @@ var StellarAdapter = class {
|
|
|
4936
5089
|
getEcosystemReactHooks() {
|
|
4937
5090
|
return stellarFacadeHooks;
|
|
4938
5091
|
}
|
|
5092
|
+
/**
|
|
5093
|
+
* @inheritdoc
|
|
5094
|
+
*/
|
|
4939
5095
|
async getRelayers(serviceUrl, accessToken) {
|
|
4940
5096
|
const relayerStrategy = new RelayerExecutionStrategy();
|
|
4941
5097
|
try {
|
|
@@ -4945,6 +5101,9 @@ var StellarAdapter = class {
|
|
|
4945
5101
|
return Promise.resolve([]);
|
|
4946
5102
|
}
|
|
4947
5103
|
}
|
|
5104
|
+
/**
|
|
5105
|
+
* @inheritdoc
|
|
5106
|
+
*/
|
|
4948
5107
|
async getRelayer(serviceUrl, accessToken, relayerId) {
|
|
4949
5108
|
const relayerStrategy = new RelayerExecutionStrategy();
|
|
4950
5109
|
try {
|
|
@@ -4960,8 +5119,7 @@ var StellarAdapter = class {
|
|
|
4960
5119
|
}
|
|
4961
5120
|
}
|
|
4962
5121
|
/**
|
|
4963
|
-
*
|
|
4964
|
-
* @returns The Stellar relayer options component
|
|
5122
|
+
* @inheritdoc
|
|
4965
5123
|
*/
|
|
4966
5124
|
getRelayerOptionsComponent() {
|
|
4967
5125
|
return StellarRelayerOptions;
|