@openzeppelin/contracts-ui-builder-adapter-stellar
Version:
Stellar Adapter for Contracts UI Builder
99 lines (92 loc) • 4.29 kB
TypeScript
import { ContractAdapter, StellarNetworkConfig, UiKitConfiguration, FormFieldType, FormValues, ContractSchema, FieldType, FunctionParameter, ExecutionConfig, ContractFunction, Connector, ExecutionMethodDetail, AvailableUiKit, RelayerDetails, RelayerDetailsRich, UserRpcProviderConfig } from '@openzeppelin/contracts-ui-builder-types';
/**
* Stellar-specific adapter implementation using explicit method delegation.
*
* NOTE: Contains placeholder implementations for most functionalities.
*/
declare class StellarAdapter implements ContractAdapter {
readonly networkConfig: StellarNetworkConfig;
readonly initialAppServiceKitName: UiKitConfiguration['kitName'];
constructor(networkConfig: StellarNetworkConfig);
getContractDefinitionInputs(): FormFieldType[];
loadContract(artifacts: FormValues): Promise<ContractSchema>;
getWritableFunctions(contractSchema: ContractSchema): ContractSchema['functions'];
mapParameterTypeToFieldType(parameterType: string): FieldType;
getCompatibleFieldTypes(parameterType: string): FieldType[];
generateDefaultField<T extends FieldType = FieldType>(parameter: FunctionParameter): FormFieldType<T>;
formatTransactionData(contractSchema: ContractSchema, functionId: string, submittedInputs: Record<string, unknown>, fields: FormFieldType[]): unknown;
signAndBroadcast(transactionData: unknown, executionConfig?: ExecutionConfig): Promise<{
txHash: string;
}>;
isViewFunction(functionDetails: ContractFunction): boolean;
queryViewFunction(contractAddress: string, functionId: string, params?: unknown[], contractSchema?: ContractSchema): Promise<unknown>;
formatFunctionResult(decodedValue: unknown, functionDetails: ContractFunction): string;
supportsWalletConnection(): boolean;
getAvailableConnectors(): Promise<Connector[]>;
connectWallet(connectorId: string): Promise<{
connected: boolean;
address?: string;
error?: string;
}>;
disconnectWallet(): Promise<{
disconnected: boolean;
error?: string;
}>;
getWalletConnectionStatus(): {
isConnected: boolean;
address?: string;
chainId?: string;
};
getSupportedExecutionMethods(): Promise<ExecutionMethodDetail[]>;
validateExecutionConfig(config: ExecutionConfig): Promise<true | string>;
getExplorerUrl(address: string): string | null;
getExplorerTxUrl?(txHash: string): string | null;
isValidAddress(address: string): boolean;
getAvailableUiKits(): Promise<AvailableUiKit[]>;
getRelayers(_serviceUrl: string, _accessToken: string): Promise<RelayerDetails[]>;
getRelayer(_serviceUrl: string, _accessToken: string, _relayerId: string): Promise<RelayerDetailsRich>;
/**
* @inheritdoc
*/
validateRpcEndpoint(rpcConfig: UserRpcProviderConfig): Promise<boolean>;
/**
* @inheritdoc
*/
testRpcConnection(rpcConfig: UserRpcProviderConfig): Promise<{
success: boolean;
latency?: number;
error?: string;
}>;
}
declare const stellarPublic: StellarNetworkConfig;
declare const stellarTestnet: StellarNetworkConfig;
declare const stellarMainnetNetworks: StellarNetworkConfig[];
declare const stellarTestnetNetworks: StellarNetworkConfig[];
declare const stellarNetworks: StellarNetworkConfig[];
/**
* Configuration for the Stellar adapter
*
* This file defines the dependencies required by the Stellar adapter
* when generating exported projects. It follows the AdapterConfig
* interface to provide a structured approach to dependency management.
*/
declare const stellarAdapterConfig: {
/**
* Dependencies required by the Stellar adapter
* These will be included in exported projects that use this adapter
*/
dependencies: {
runtime: {
'stellar-sdk': string;
'@stellar/freighter-api': string;
'@stellar/design-system': string;
'@stellar/wallet-sdk': string;
'bignumber.js': string;
'js-xdr': string;
};
dev: {
'@stellar/typescript-wallet-sdk': string;
};
};
};
export { StellarAdapter, stellarAdapterConfig, stellarMainnetNetworks, stellarNetworks, stellarPublic, stellarTestnet, stellarTestnetNetworks };