@openzeppelin/ui-builder-adapter-stellar 0.13.0 → 0.15.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.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AdapterConfig } from '@openzeppelin/ui-builder-types';
|
|
2
|
+
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AdapterConfig } from '@openzeppelin/ui-builder-types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Stellar-specific wallet connection status extending the base interface.
|
|
@@ -13,13 +13,27 @@ interface StellarWalletConnectionStatus extends WalletConnectionStatus {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Stellar-specific adapter implementation using explicit method delegation.
|
|
16
|
-
*
|
|
17
|
-
* NOTE: Contains placeholder implementations for most functionalities.
|
|
18
16
|
*/
|
|
19
17
|
declare class StellarAdapter implements ContractAdapter {
|
|
20
18
|
readonly networkConfig: StellarNetworkConfig;
|
|
21
19
|
readonly initialAppServiceKitName: UiKitConfiguration['kitName'];
|
|
22
20
|
constructor(networkConfig: StellarNetworkConfig);
|
|
21
|
+
/**
|
|
22
|
+
* @inheritdoc
|
|
23
|
+
*/
|
|
24
|
+
getNetworkServiceForms(): NetworkServiceForm[];
|
|
25
|
+
/**
|
|
26
|
+
* @inheritdoc
|
|
27
|
+
*/
|
|
28
|
+
validateNetworkServiceConfig(serviceId: string, values: Record<string, unknown>): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritdoc
|
|
31
|
+
*/
|
|
32
|
+
testNetworkServiceConnection(serviceId: string, values: Record<string, unknown>): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
latency?: number;
|
|
35
|
+
error?: string;
|
|
36
|
+
}>;
|
|
23
37
|
/**
|
|
24
38
|
* NOTE about artifact inputs (single input with auto-detection):
|
|
25
39
|
*
|
|
@@ -44,6 +58,9 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
44
58
|
* manual contract definition exactly like the EVM/Midnight flows.
|
|
45
59
|
* - Provide clear UI hints about supported formats (JSON spec or Wasm binary).
|
|
46
60
|
*/
|
|
61
|
+
/**
|
|
62
|
+
* @inheritdoc
|
|
63
|
+
*/
|
|
47
64
|
getContractDefinitionInputs(): FormFieldType[];
|
|
48
65
|
/**
|
|
49
66
|
* @inheritdoc
|
|
@@ -63,38 +80,89 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
63
80
|
definitionHash?: string;
|
|
64
81
|
};
|
|
65
82
|
}>;
|
|
83
|
+
/**
|
|
84
|
+
* @inheritdoc
|
|
85
|
+
*/
|
|
66
86
|
getWritableFunctions(contractSchema: ContractSchema): ContractSchema['functions'];
|
|
87
|
+
/**
|
|
88
|
+
* @inheritdoc
|
|
89
|
+
*/
|
|
67
90
|
mapParameterTypeToFieldType(parameterType: string): FieldType;
|
|
68
91
|
getCompatibleFieldTypes(parameterType: string): FieldType[];
|
|
69
92
|
generateDefaultField<T extends FieldType = FieldType>(parameter: FunctionParameter, contractSchema?: ContractSchema): FormFieldType<T>;
|
|
93
|
+
/**
|
|
94
|
+
* @inheritdoc
|
|
95
|
+
*/
|
|
70
96
|
formatTransactionData(contractSchema: ContractSchema, functionId: string, submittedInputs: Record<string, unknown>, fields: FormFieldType[]): unknown;
|
|
71
97
|
signAndBroadcast(transactionData: unknown, executionConfig: ExecutionConfig, onStatusChange: (status: TxStatus, details: TransactionStatusUpdate) => void, runtimeApiKey?: string): Promise<{
|
|
72
98
|
txHash: string;
|
|
73
99
|
}>;
|
|
100
|
+
/**
|
|
101
|
+
* @inheritdoc
|
|
102
|
+
*/
|
|
74
103
|
isViewFunction(functionDetails: ContractFunction): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* @inheritdoc
|
|
106
|
+
*/
|
|
75
107
|
queryViewFunction(contractAddress: string, functionId: string, params?: unknown[], contractSchema?: ContractSchema): Promise<unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* @inheritdoc
|
|
110
|
+
*/
|
|
76
111
|
formatFunctionResult(decodedValue: unknown, functionDetails: ContractFunction): string;
|
|
112
|
+
/**
|
|
113
|
+
* @inheritdoc
|
|
114
|
+
*/
|
|
77
115
|
supportsWalletConnection(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* @inheritdoc
|
|
118
|
+
*/
|
|
78
119
|
getAvailableConnectors(): Promise<Connector[]>;
|
|
120
|
+
/**
|
|
121
|
+
* @inheritdoc
|
|
122
|
+
*/
|
|
79
123
|
connectWallet(connectorId: string): Promise<{
|
|
80
124
|
connected: boolean;
|
|
81
125
|
address?: string;
|
|
82
126
|
error?: string;
|
|
83
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* @inheritdoc
|
|
130
|
+
*/
|
|
84
131
|
disconnectWallet(): Promise<{
|
|
85
132
|
disconnected: boolean;
|
|
86
133
|
error?: string;
|
|
87
134
|
}>;
|
|
135
|
+
/**
|
|
136
|
+
* @inheritdoc
|
|
137
|
+
*/
|
|
88
138
|
getWalletConnectionStatus(): StellarWalletConnectionStatus;
|
|
89
139
|
/**
|
|
90
140
|
* @inheritdoc
|
|
91
141
|
*/
|
|
92
142
|
onWalletConnectionChange(callback: (currentStatus: WalletConnectionStatus, previousStatus: WalletConnectionStatus) => void): () => void;
|
|
143
|
+
/**
|
|
144
|
+
* @inheritdoc
|
|
145
|
+
*/
|
|
93
146
|
getSupportedExecutionMethods(): Promise<ExecutionMethodDetail[]>;
|
|
147
|
+
/**
|
|
148
|
+
* @inheritdoc
|
|
149
|
+
*/
|
|
94
150
|
validateExecutionConfig(config: ExecutionConfig): Promise<true | string>;
|
|
151
|
+
/**
|
|
152
|
+
* @inheritdoc
|
|
153
|
+
*/
|
|
95
154
|
getExplorerUrl(address: string): string | null;
|
|
155
|
+
/**
|
|
156
|
+
* @inheritdoc
|
|
157
|
+
*/
|
|
96
158
|
getExplorerTxUrl?(txHash: string): string | null;
|
|
159
|
+
/**
|
|
160
|
+
* @inheritdoc
|
|
161
|
+
*/
|
|
97
162
|
isValidAddress(address: string, addressType?: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* @inheritdoc
|
|
165
|
+
*/
|
|
98
166
|
getAvailableUiKits(): Promise<AvailableUiKit[]>;
|
|
99
167
|
/**
|
|
100
168
|
* @inheritdoc
|
|
@@ -118,11 +186,16 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
118
186
|
* @inheritdoc
|
|
119
187
|
*/
|
|
120
188
|
getEcosystemReactHooks(): EcosystemSpecificReactHooks | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* @inheritdoc
|
|
191
|
+
*/
|
|
121
192
|
getRelayers(serviceUrl: string, accessToken: string): Promise<RelayerDetails[]>;
|
|
193
|
+
/**
|
|
194
|
+
* @inheritdoc
|
|
195
|
+
*/
|
|
122
196
|
getRelayer(serviceUrl: string, accessToken: string, relayerId: string): Promise<RelayerDetailsRich>;
|
|
123
197
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @returns The Stellar relayer options component
|
|
198
|
+
* @inheritdoc
|
|
126
199
|
*/
|
|
127
200
|
getRelayerOptionsComponent(): React.ComponentType<{
|
|
128
201
|
options: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AdapterConfig } from '@openzeppelin/ui-builder-types';
|
|
2
|
+
import { WalletConnectionStatus, ContractAdapter, StellarNetworkConfig, UiKitConfiguration, NetworkServiceForm, FormFieldType, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, TxStatus, TransactionStatusUpdate, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, NativeConfigLoader, EcosystemWalletComponents, EcosystemReactUiProviderProps, EcosystemSpecificReactHooks, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig, AdapterConfig } from '@openzeppelin/ui-builder-types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Stellar-specific wallet connection status extending the base interface.
|
|
@@ -13,13 +13,27 @@ interface StellarWalletConnectionStatus extends WalletConnectionStatus {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Stellar-specific adapter implementation using explicit method delegation.
|
|
16
|
-
*
|
|
17
|
-
* NOTE: Contains placeholder implementations for most functionalities.
|
|
18
16
|
*/
|
|
19
17
|
declare class StellarAdapter implements ContractAdapter {
|
|
20
18
|
readonly networkConfig: StellarNetworkConfig;
|
|
21
19
|
readonly initialAppServiceKitName: UiKitConfiguration['kitName'];
|
|
22
20
|
constructor(networkConfig: StellarNetworkConfig);
|
|
21
|
+
/**
|
|
22
|
+
* @inheritdoc
|
|
23
|
+
*/
|
|
24
|
+
getNetworkServiceForms(): NetworkServiceForm[];
|
|
25
|
+
/**
|
|
26
|
+
* @inheritdoc
|
|
27
|
+
*/
|
|
28
|
+
validateNetworkServiceConfig(serviceId: string, values: Record<string, unknown>): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritdoc
|
|
31
|
+
*/
|
|
32
|
+
testNetworkServiceConnection(serviceId: string, values: Record<string, unknown>): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
latency?: number;
|
|
35
|
+
error?: string;
|
|
36
|
+
}>;
|
|
23
37
|
/**
|
|
24
38
|
* NOTE about artifact inputs (single input with auto-detection):
|
|
25
39
|
*
|
|
@@ -44,6 +58,9 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
44
58
|
* manual contract definition exactly like the EVM/Midnight flows.
|
|
45
59
|
* - Provide clear UI hints about supported formats (JSON spec or Wasm binary).
|
|
46
60
|
*/
|
|
61
|
+
/**
|
|
62
|
+
* @inheritdoc
|
|
63
|
+
*/
|
|
47
64
|
getContractDefinitionInputs(): FormFieldType[];
|
|
48
65
|
/**
|
|
49
66
|
* @inheritdoc
|
|
@@ -63,38 +80,89 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
63
80
|
definitionHash?: string;
|
|
64
81
|
};
|
|
65
82
|
}>;
|
|
83
|
+
/**
|
|
84
|
+
* @inheritdoc
|
|
85
|
+
*/
|
|
66
86
|
getWritableFunctions(contractSchema: ContractSchema): ContractSchema['functions'];
|
|
87
|
+
/**
|
|
88
|
+
* @inheritdoc
|
|
89
|
+
*/
|
|
67
90
|
mapParameterTypeToFieldType(parameterType: string): FieldType;
|
|
68
91
|
getCompatibleFieldTypes(parameterType: string): FieldType[];
|
|
69
92
|
generateDefaultField<T extends FieldType = FieldType>(parameter: FunctionParameter, contractSchema?: ContractSchema): FormFieldType<T>;
|
|
93
|
+
/**
|
|
94
|
+
* @inheritdoc
|
|
95
|
+
*/
|
|
70
96
|
formatTransactionData(contractSchema: ContractSchema, functionId: string, submittedInputs: Record<string, unknown>, fields: FormFieldType[]): unknown;
|
|
71
97
|
signAndBroadcast(transactionData: unknown, executionConfig: ExecutionConfig, onStatusChange: (status: TxStatus, details: TransactionStatusUpdate) => void, runtimeApiKey?: string): Promise<{
|
|
72
98
|
txHash: string;
|
|
73
99
|
}>;
|
|
100
|
+
/**
|
|
101
|
+
* @inheritdoc
|
|
102
|
+
*/
|
|
74
103
|
isViewFunction(functionDetails: ContractFunction): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* @inheritdoc
|
|
106
|
+
*/
|
|
75
107
|
queryViewFunction(contractAddress: string, functionId: string, params?: unknown[], contractSchema?: ContractSchema): Promise<unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* @inheritdoc
|
|
110
|
+
*/
|
|
76
111
|
formatFunctionResult(decodedValue: unknown, functionDetails: ContractFunction): string;
|
|
112
|
+
/**
|
|
113
|
+
* @inheritdoc
|
|
114
|
+
*/
|
|
77
115
|
supportsWalletConnection(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* @inheritdoc
|
|
118
|
+
*/
|
|
78
119
|
getAvailableConnectors(): Promise<Connector[]>;
|
|
120
|
+
/**
|
|
121
|
+
* @inheritdoc
|
|
122
|
+
*/
|
|
79
123
|
connectWallet(connectorId: string): Promise<{
|
|
80
124
|
connected: boolean;
|
|
81
125
|
address?: string;
|
|
82
126
|
error?: string;
|
|
83
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* @inheritdoc
|
|
130
|
+
*/
|
|
84
131
|
disconnectWallet(): Promise<{
|
|
85
132
|
disconnected: boolean;
|
|
86
133
|
error?: string;
|
|
87
134
|
}>;
|
|
135
|
+
/**
|
|
136
|
+
* @inheritdoc
|
|
137
|
+
*/
|
|
88
138
|
getWalletConnectionStatus(): StellarWalletConnectionStatus;
|
|
89
139
|
/**
|
|
90
140
|
* @inheritdoc
|
|
91
141
|
*/
|
|
92
142
|
onWalletConnectionChange(callback: (currentStatus: WalletConnectionStatus, previousStatus: WalletConnectionStatus) => void): () => void;
|
|
143
|
+
/**
|
|
144
|
+
* @inheritdoc
|
|
145
|
+
*/
|
|
93
146
|
getSupportedExecutionMethods(): Promise<ExecutionMethodDetail[]>;
|
|
147
|
+
/**
|
|
148
|
+
* @inheritdoc
|
|
149
|
+
*/
|
|
94
150
|
validateExecutionConfig(config: ExecutionConfig): Promise<true | string>;
|
|
151
|
+
/**
|
|
152
|
+
* @inheritdoc
|
|
153
|
+
*/
|
|
95
154
|
getExplorerUrl(address: string): string | null;
|
|
155
|
+
/**
|
|
156
|
+
* @inheritdoc
|
|
157
|
+
*/
|
|
96
158
|
getExplorerTxUrl?(txHash: string): string | null;
|
|
159
|
+
/**
|
|
160
|
+
* @inheritdoc
|
|
161
|
+
*/
|
|
97
162
|
isValidAddress(address: string, addressType?: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* @inheritdoc
|
|
165
|
+
*/
|
|
98
166
|
getAvailableUiKits(): Promise<AvailableUiKit[]>;
|
|
99
167
|
/**
|
|
100
168
|
* @inheritdoc
|
|
@@ -118,11 +186,16 @@ declare class StellarAdapter implements ContractAdapter {
|
|
|
118
186
|
* @inheritdoc
|
|
119
187
|
*/
|
|
120
188
|
getEcosystemReactHooks(): EcosystemSpecificReactHooks | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* @inheritdoc
|
|
191
|
+
*/
|
|
121
192
|
getRelayers(serviceUrl: string, accessToken: string): Promise<RelayerDetails[]>;
|
|
193
|
+
/**
|
|
194
|
+
* @inheritdoc
|
|
195
|
+
*/
|
|
122
196
|
getRelayer(serviceUrl: string, accessToken: string, relayerId: string): Promise<RelayerDetailsRich>;
|
|
123
197
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @returns The Stellar relayer options component
|
|
198
|
+
* @inheritdoc
|
|
126
199
|
*/
|
|
127
200
|
getRelayerOptionsComponent(): React.ComponentType<{
|
|
128
201
|
options: Record<string, unknown>;
|