
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@openzeppelin/contracts-ui-builder-storage
Advanced tools
Local storage services for the OpenZeppelin Contracts UI Builder ecosystem.
Local storage services for the OpenZeppelin Contracts UI Builder ecosystem.
This package provides a reusable storage infrastructure built on top of IndexedDB using Dexie.js. It includes a generic base class for creating type-safe storage services, along with specific implementations for Contract UI configurations.
DexieStorage
class for creating new storage servicesdexie-react-hooks
for automatic UI updatespnpm add @openzeppelin/contracts-ui-builder-storage
import { useContractUIStorage } from '@openzeppelin/contracts-ui-builder-storage';
function MyComponent() {
const {
contractUIs,
isLoading,
saveContractUI,
updateContractUI,
deleteContractUI,
exportContractUIs,
importContractUIs
} = useContractUIStorage();
// Save a new configuration
const handleSave = async () => {
const id = await saveContractUI({
title: 'My Contract UI',
ecosystem: 'evm',
networkId: '1',
contractAddress: '0x...',
functionId: 'transfer',
formConfig: { /* ... */ }
});
};
// Export configurations
const handleExport = async () => {
await exportContractUIs(); // Exports all
// or
await exportContractUIs(['id1', 'id2']); // Export specific
};
return (
<div>
{isLoading ? (
<p>Loading...</p>
) : (
<ul>
{contractUIs?.map(ui => (
<li key={ui.id}>{ui.title}</li>
))}
</ul>
)}
</div>
);
}
import { DexieStorage, db } from '@openzeppelin/contracts-ui-builder-storage';
interface TransactionRecord extends BaseRecord {
hash: string;
networkId: string;
status: 'pending' | 'confirmed' | 'failed';
timestamp: Date;
}
class TransactionStorage extends DexieStorage<TransactionRecord> {
constructor() {
super(db, 'transactions');
}
async getByHash(hash: string): Promise<TransactionRecord | undefined> {
return await this.table.where('hash').equals(hash).first();
}
async getPending(): Promise<TransactionRecord[]> {
return await this.table.where('status').equals('pending').toArray();
}
}
export const transactionStorage = new TransactionStorage();
DexieStorage<T>
Generic base class for creating storage services.
save(record: Omit<T, 'id' | 'createdAt' | 'updatedAt'>): Promise<string>
update(id: string, updates: Partial<T>): Promise<void>
delete(id: string): Promise<void>
get(id: string): Promise<T | undefined>
getAll(): Promise<T[]>
clear(): Promise<void>
useContractUIStorage()
React hook for Contract UI storage operations.
contractUIs: ContractUIRecord[] | undefined
- Array of saved configurationsisLoading: boolean
- Loading statesaveContractUI
- Save a new configurationupdateContractUI
- Update an existing configurationdeleteContractUI
- Delete a configurationdeleteAllContractUIs
- Delete all configurationsduplicateContractUI
- Duplicate a configurationexportContractUIs
- Export configurations as JSONimportContractUIs
- Import configurations from fileContractUIRecord
interface ContractUIRecord extends BaseRecord {
title: string;
ecosystem: string;
networkId: string;
contractAddress: string;
functionId: string;
formConfig: RenderFormSchema;
executionConfig?: ExecutionConfig;
uiKitConfig?: UiKitConfiguration;
metadata?: Record<string, unknown>;
}
BaseRecord
interface BaseRecord {
id: string;
createdAt: Date;
updatedAt: Date;
}
# Install dependencies
pnpm install
# Build the package
pnpm build
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Lint code
pnpm lint
# Format code
pnpm format
MIT
FAQs
Local storage services for the OpenZeppelin Contracts UI Builder ecosystem.
The npm package @openzeppelin/contracts-ui-builder-storage receives a total of 204 weekly downloads. As such, @openzeppelin/contracts-ui-builder-storage popularity was classified as not popular.
We found that @openzeppelin/contracts-ui-builder-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.