@tuwaio/orbit-core 0.2.11 → 0.2.13
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/README.md +20 -24
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@tuwaio/orbit-core)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
|
|
6
|
-
`@tuwaio/orbit-core`
|
|
6
|
+
`@tuwaio/orbit-core` is the Layer 1 (L1) 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
|
|
13
|
-
- **Connection State Persistence:**
|
|
14
|
-
- **
|
|
15
|
-
- **Impersonation Engine:** Built-in `impersonatedHelpers`
|
|
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
|
-
## 🚀
|
|
27
|
+
## 🚀 Architectural Integration
|
|
28
28
|
|
|
29
|
-
### Runtime Adapter
|
|
29
|
+
### Runtime Adapter Resolution
|
|
30
30
|
|
|
31
|
-
|
|
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
|
|
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
|
-
//
|
|
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(
|
|
55
|
+
console.log(activeAdapter.getExplorerUrl('tx/0x...', 'mainnet-beta'));
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
### Connection State
|
|
59
|
+
### Connection State Storage
|
|
60
60
|
|
|
61
|
-
|
|
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
|
-
//
|
|
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
|
|
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`
|
|
82
|
+
`@tuwaio/orbit-core` exposes the following modules:
|
|
83
83
|
|
|
84
|
-
- **Core
|
|
85
|
-
- **Registry
|
|
84
|
+
- **Core Primitives:** `OrbitAdapter`, `BaseAdapter`, `ConnectorType`, `RecentlyConnectedConnectorData`.
|
|
85
|
+
- **Registry Resolvers:** `selectAdapterByKey`, `getAdapterFromConnectorType`, `getConnectorTypeFromName`.
|
|
86
86
|
- **Formatters:** `formatConnectorName`, `formatConnectorChainId`.
|
|
87
|
-
- **Storage
|
|
88
|
-
- **
|
|
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.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "Layer 1 (L1) 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",
|