@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
|
@@ -3,6 +3,8 @@ import { allowAllModules, StellarWalletsKit, WalletNetwork } from '@creit.tech/s
|
|
|
3
3
|
import type { StellarNetworkConfig, UiKitConfiguration } from '@openzeppelin/ui-builder-types';
|
|
4
4
|
import { logger } from '@openzeppelin/ui-builder-utils';
|
|
5
5
|
|
|
6
|
+
import { getStellarWalletImplementation } from '../utils/stellarWalletImplementationManager';
|
|
7
|
+
|
|
6
8
|
export interface StellarUiKitManagerState {
|
|
7
9
|
isConfigured: boolean;
|
|
8
10
|
isInitializing: boolean;
|
|
@@ -112,6 +114,26 @@ async function configure(newFullUiKitConfig: UiKitConfiguration): Promise<void>
|
|
|
112
114
|
state.kitProviderComponent = null;
|
|
113
115
|
state.isKitAssetsLoaded = true;
|
|
114
116
|
state.error = null;
|
|
117
|
+
|
|
118
|
+
// Wire the active kit into the wallet implementation
|
|
119
|
+
// This ensures signing and other operations use the correct kit instance
|
|
120
|
+
if (state.networkConfig) {
|
|
121
|
+
try {
|
|
122
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
123
|
+
impl.setActiveStellarKit(kit);
|
|
124
|
+
logger.debug(
|
|
125
|
+
'StellarUiKitManager:configure',
|
|
126
|
+
'Active kit wired into wallet implementation for stellar-wallets-kit'
|
|
127
|
+
);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
logger.warn(
|
|
130
|
+
'StellarUiKitManager:configure',
|
|
131
|
+
'Failed to attach active kit to wallet implementation:',
|
|
132
|
+
error
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
115
137
|
logger.info(
|
|
116
138
|
'StellarUiKitManager:configure',
|
|
117
139
|
'Stellar Wallets Kit configured with built-in UI and all wallet modules'
|
|
@@ -128,6 +150,26 @@ async function configure(newFullUiKitConfig: UiKitConfiguration): Promise<void>
|
|
|
128
150
|
state.kitProviderComponent = null;
|
|
129
151
|
state.isKitAssetsLoaded = true;
|
|
130
152
|
state.error = null;
|
|
153
|
+
|
|
154
|
+
// Wire the active kit into the wallet implementation
|
|
155
|
+
// This ensures signing and other operations use the correct kit instance
|
|
156
|
+
if (state.networkConfig) {
|
|
157
|
+
try {
|
|
158
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
159
|
+
impl.setActiveStellarKit(kit);
|
|
160
|
+
logger.debug(
|
|
161
|
+
'StellarUiKitManager:configure',
|
|
162
|
+
'Active kit wired into wallet implementation for custom'
|
|
163
|
+
);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
logger.warn(
|
|
166
|
+
'StellarUiKitManager:configure',
|
|
167
|
+
'Failed to attach active kit to wallet implementation:',
|
|
168
|
+
error
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
131
173
|
logger.info(
|
|
132
174
|
'StellarUiKitManager:configure',
|
|
133
175
|
'Stellar Wallets Kit configured for custom UI components'
|
|
@@ -138,6 +180,25 @@ async function configure(newFullUiKitConfig: UiKitConfiguration): Promise<void>
|
|
|
138
180
|
state.kitProviderComponent = null;
|
|
139
181
|
state.isKitAssetsLoaded = false;
|
|
140
182
|
state.error = null;
|
|
183
|
+
|
|
184
|
+
// Clear the active kit from the wallet implementation
|
|
185
|
+
if (state.networkConfig) {
|
|
186
|
+
try {
|
|
187
|
+
const impl = await getStellarWalletImplementation(state.networkConfig);
|
|
188
|
+
impl.setActiveStellarKit(null);
|
|
189
|
+
logger.debug(
|
|
190
|
+
'StellarUiKitManager:configure',
|
|
191
|
+
'Active kit cleared from wallet implementation for none'
|
|
192
|
+
);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
logger.warn(
|
|
195
|
+
'StellarUiKitManager:configure',
|
|
196
|
+
'Failed to clear active kit from wallet implementation:',
|
|
197
|
+
error
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
141
202
|
logger.info('StellarUiKitManager:configure', 'UI kit set to "none", no wallet UI provided');
|
|
142
203
|
} else {
|
|
143
204
|
throw new Error(`Unknown UI kit name: ${newKitName}`);
|