@tuwaio/orbit-core 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/README.md +20 -24
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,16 +3,16 @@
3
3
  [![NPM Version](https://img.shields.io/npm/v/@tuwaio/orbit-core.svg)](https://www.npmjs.com/package/@tuwaio/orbit-core)
4
4
  [![License](https://img.shields.io/npm/l/@tuwaio/orbit-core.svg)](./LICENSE)
5
5
 
6
- `@tuwaio/orbit-core` serves as the core logic and connector layer for the Orbit Utils ecosystem. It is completely **headless** and **framework-agnostic**, ensuring compatibility across React, Vue, Svelte, or vanilla JS applications. It abstracts the underlying blockchain architectures into a unified interface, simplifying state handling in complex multi-chain UIs.
6
+ `@tuwaio/orbit-core` is the Tier 1 core logic and foundational state wrapper layer of the TUWA Orbit multi-chain framework. It is completely **headless** and **framework-agnostic**, engineered to decouple raw blockchain connection interfaces from visual frontend layers. By establishing a unified type-safe interface, it enables consistent cross-chain connection management and persistent user account tracking.
7
7
 
8
8
  ---
9
9
 
10
10
  ## 🏛️ Core Capabilities
11
11
 
12
- - **Unified Multi-Chain Adapters:** Establishes the standard `BaseAdapter` interface and the `OrbitAdapter` enum (EVM, Solana, Starknet) to enable cross-chain UI layers.
13
- - **Connection State Persistence:** Includes SSR-safe storage helpers (`lastConnectedConnectorHelpers`, `recentConnectedConnectorHelpers`) to track and resume wallet connection history.
14
- - **autonomy-focused Utilities:** Native handlers for formatting chain IDs, parsing connector names, and managing async task execution (`waitFor`, `delay`).
15
- - **Impersonation Engine:** Built-in `impersonatedHelpers` to support testing and debugging in different account contexts.
12
+ - **Unified Multi-Chain Primitives:** Establishes the structural `BaseAdapter` interface and the `OrbitAdapter` enum (EVM, Solana, Starknet) to serve as the abstract layer for multi-chain communication.
13
+ - **Connection State Persistence:** Implements SSR-safe storage helpers (`lastConnectedConnectorHelpers`, `recentConnectedConnectorHelpers`) to track and resume wallet connection history via `localStorage`.
14
+ - **Autonomy-Focused Utilities:** Technical utility helpers for formatting chain IDs, parsing connector names, and executing asynchronous operations (`waitFor`, `delay`).
15
+ - **Account Impersonation Engine:** Built-in `impersonatedHelpers` for sandboxed testing and account auditing.
16
16
 
17
17
  ---
18
18
 
@@ -24,16 +24,16 @@ pnpm add @tuwaio/orbit-core
24
24
 
25
25
  ---
26
26
 
27
- ## 🚀 Quick Start
27
+ ## 🚀 Architectural Integration
28
28
 
29
- ### Runtime Adapter Selection
29
+ ### Runtime Adapter Resolution
30
30
 
31
- Configure chain adapters dynamically and retrieve them at runtime using standard selectors:
31
+ Register and resolve chain-specific primitive adapters dynamically:
32
32
 
33
33
  ```typescript
34
34
  import { OrbitAdapter, selectAdapterByKey, BaseAdapter } from '@tuwaio/orbit-core';
35
35
 
36
- // Configure adapters (mocked here, use @tuwaio/orbit-evm / @tuwaio/orbit-solana in production)
36
+ // Configure primitive adapter mapping
37
37
  const adapters: BaseAdapter[] = [
38
38
  {
39
39
  key: OrbitAdapter.EVM,
@@ -45,32 +45,32 @@ const adapters: BaseAdapter[] = [
45
45
  },
46
46
  ];
47
47
 
48
- // Select adapter dynamically
48
+ // Dynamically select target execution adapter
49
49
  const activeAdapter = selectAdapterByKey({
50
50
  adapterKey: OrbitAdapter.SOLANA,
51
51
  adapter: adapters,
52
52
  });
53
53
 
54
54
  if (activeAdapter) {
55
- console.log('Selected:', activeAdapter.getExplorerUrl('tx/0x...', 'mainnet-beta'));
55
+ console.log(activeAdapter.getExplorerUrl('tx/0x...', 'mainnet-beta'));
56
56
  }
57
57
  ```
58
58
 
59
- ### Connection State Persistence
59
+ ### Connection State Storage
60
60
 
61
- Persist last connected connector state in localStorage safely:
61
+ Read and write connected connector metadata securely with `localStorage` fallback checks:
62
62
 
63
63
  ```typescript
64
64
  import { lastConnectedConnectorHelpers } from '@tuwaio/orbit-core';
65
65
 
66
- // Save connection metadata
66
+ // Persist metadata
67
67
  lastConnectedConnectorHelpers.setLastConnectedConnector({
68
68
  connectorType: 'evm:metamask',
69
69
  chainId: 1,
70
70
  address: '0x123...',
71
71
  });
72
72
 
73
- // Retrieve connection metadata (returns null in SSR environment)
73
+ // Retrieve connection metadata safely during client-side hydration
74
74
  const lastConnected = lastConnectedConnectorHelpers.getLastConnectedConnector();
75
75
  console.log(lastConnected?.address); // "0x123..."
76
76
  ```
@@ -79,20 +79,16 @@ console.log(lastConnected?.address); // "0x123..."
79
79
 
80
80
  ## 🔧 API & Module Architecture
81
81
 
82
- `@tuwaio/orbit-core` exports the following structures:
82
+ `@tuwaio/orbit-core` exposes the following modules:
83
83
 
84
- - **Core Types:** `OrbitAdapter`, `BaseAdapter`, `ConnectorType`, `RecentlyConnectedConnectorData`.
85
- - **Registry Utilities:** `selectAdapterByKey`, `getAdapterFromConnectorType`, `getConnectorTypeFromName`.
84
+ - **Core Primitives:** `OrbitAdapter`, `BaseAdapter`, `ConnectorType`, `RecentlyConnectedConnectorData`.
85
+ - **Registry Resolvers:** `selectAdapterByKey`, `getAdapterFromConnectorType`, `getConnectorTypeFromName`.
86
86
  - **Formatters:** `formatConnectorName`, `formatConnectorChainId`.
87
- - **Storage Persisters:** `lastConnectedConnectorHelpers`, `recentConnectedConnectorHelpers`, `impersonatedHelpers`.
88
- - **General Utilities:** `isSafeApp`, `delay`, `waitFor`, `filterUniqueByKey`.
87
+ - **Storage Helpers:** `lastConnectedConnectorHelpers`, `recentConnectedConnectorHelpers`, `impersonatedHelpers`.
88
+ - **Core Primitives:** `isSafeApp`, `delay`, `waitFor`, `filterUniqueByKey`.
89
89
 
90
90
  ---
91
91
 
92
- ## 🤝 Contributing
93
-
94
- Please read our main **[Contribution Guidelines](https://github.com/TuwaIO/workflows/blob/main/CONTRIBUTING.md)** before submitting pull requests.
95
-
96
92
  ## 📄 License
97
93
 
98
94
  Licensed under the **Apache-2.0 License**. See the [LICENSE](./LICENSE) file for details.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@tuwaio/orbit-core",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
7
- "description": "The core, with web3 utilities and helpers for TUWA projects.",
7
+ "description": "Tier 1 of the TUWA Ecosystem. Framework-agnostic library for abstracting core multi-chain types, errors, and localStorage helper utilities.",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
10
10
  "types": "./dist/index.d.ts",