@0xio/sdk 2.7.0 → 2.8.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/CHANGELOG.md +92 -33
- package/README.md +105 -250
- package/dist/index.d.ts +279 -188
- package/dist/index.esm.js +524 -325
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +533 -324
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +533 -324
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,23 +2,82 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.8.0] - 2026-06-09
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Generic provider passthrough**: `wallet.request(method, params)` sends any method through the bridge, so dapps can reach wallet primitives without an SDK upgrade.
|
|
10
|
+
- **Typed RFP private primitives** (thin helpers over the bridge; the wallet keeps all private/FHE secret material internal and returns only ciphertexts/proofs/tx-hashes):
|
|
11
|
+
- `getPrivateCapabilities()`: feature-detect supported private capabilities so a dapp renders the right UI or fails closed.
|
|
12
|
+
- `callContractView()`, `getPrivateBalance()`
|
|
13
|
+
- `encryptValue()`, `decryptValue()`
|
|
14
|
+
- `makeZeroProof()`: returns `{ proof, commitment, blinding, encoding }` (the Octra bound-proof scheme needs the commitment+blinding alongside the proof).
|
|
15
|
+
- `makeRangeProof()`: returns `{ proof, encoding }` (self-contained).
|
|
16
|
+
- `registerPrivateViewKey()`, `sendContractTransactionSequence()`
|
|
17
|
+
- Internal bridge method names: `get_private_capabilities`, `encrypt_value`, `decrypt_value`, `make_zero_proof`, `make_range_proof`, `get_private_balance`, `register_private_view_key`, `send_contract_transaction_sequence`.
|
|
18
|
+
- **0xio Signed Message standard + verification**: `wallet.signMessage` is domain-separated: the wallet signs `"Octra Signed Message:\n<byteLength>\n<message>"` so a signed message can never be a transaction pre-image. New `verifyMessage(message, signature, publicKey)` (Web Crypto Ed25519, zero-dep), `getSignedMessageBytes(message)` to verify with any Ed25519 library, and `buildAuthMessage(service, nonce, origin)` for `signAuthMessage`. Note: verifiers of raw-message signatures must adopt the framing.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Amounts are documented the way the wallet counts them.** `sendTransaction`, `signTransaction` and `callContract` have always passed `amount` to the wallet unchanged, and the wallet reads it as raw micro-OCT (1 OCT = 1000000), not OCT as the docs said. Nothing on the wire changes: whatever a dapp sends today still goes through as is. A new `amountOct` field takes OCT and converts it exactly; `sendPrivateTransfer` gains `amountRaw` for the same reason in the other direction. Pass one or the other.
|
|
23
|
+
- **Permission names match the wallet.** The wallet enforces `accounts`, `public_transactions`, `contract_calls`, `contract_views`, `private_balance_read`, `private_proofs`, `private_transfers` and `private_claims`, and dropped every other name, so dapps asking for `view_private_balance` or `stealth_claim` never received the private scopes. The SDK now translates the older names when it connects and returns them as aliases next to the granted scopes, so existing checks keep working. `WALLET_PERMISSIONS`, `LEGACY_PERMISSION_MAP`, `toWalletPermissions` and `withLegacyAliases` are exported.
|
|
24
|
+
- `sendPrivateTransfer` waits up to 10 minutes: the wallet builds proofs after the approval.
|
|
25
|
+
- `switchNetwork` and everything that signs or submits need a connected page; the wallet now refuses them otherwise with `NOT_CONNECTED`.
|
|
26
|
+
- The RFC-O-1 adapter maps the 2.8.0 primitives to their `octra_*` names, so they work over `window.octra` too.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- `getPublicKey()` exists. The docs and the signing example called it, but the wallet class had no such method.
|
|
31
|
+
- `rpcCall(method, params)` wraps the wallet's read-only node RPC allow-list; a bare `request('octra_balance')` is not a wallet method.
|
|
32
|
+
- `transactionFailed` events reach the dapp; they were filtered out.
|
|
33
|
+
- `ErrorCode` includes the codes the wallet actually returns (`NOT_CONNECTED`, `INVALID_PARAMS`, `NOT_AVAILABLE`, `PRIVATE_PROOF_FAILED` and the rest).
|
|
34
|
+
- `encryptValue` and `makeZeroProof` result types include the `commitment` (and `blinding`) the wallet returns.
|
|
35
|
+
- `encryptBalance` and `decryptBalance` are marked deprecated: the 0xio extension answers `NOT_AVAILABLE`.
|
|
36
|
+
- The built-in devnet entry points at `https://devnet.octrascan.io`; the old direct IP is dead.
|
|
37
|
+
- `PendingPrivateTransfer` documents what the wallet really returns (`id` and a raw `amount`).
|
|
38
|
+
|
|
39
|
+
## [2.7.1] - 2026-05-27
|
|
40
|
+
|
|
41
|
+
### Security
|
|
42
|
+
|
|
43
|
+
- **LOW (re-assessed from HIGH):** Removed `this.config.networkId` silent fallback in `connect()` and `getConnectionStatus()`. If neither `networkInfo` nor `networkId` can be resolved from the response, `connect()` now throws `NETWORK_ERROR` and `getConnectionStatus()` returns cached state. The current extension always returns valid `networkInfo`; this hardens against malformed responses from custom or future adapters.
|
|
44
|
+
- Added `SDKConfig.trustedParentOrigins`: when set, only listed origins (+ `tauri://`) are trusted as parent iframe bridges; implicit localhost trust is disabled. Omitting the field keeps existing dev-friendly behavior.
|
|
45
|
+
- `validateNetworkInfo()` now rejects `http://` `rpcUrl` values on non-testnet networks. Testnet networks (`isTestnet: true`) and localhost are unaffected. Prevents a malicious bridge from injecting an insecure RPC endpoint.
|
|
46
|
+
- `encryptBalance()`, `decryptBalance()`, `sendPrivateTransfer()`, and `callContract()` now throw `INVALID_AMOUNT` when a numeric amount cannot be represented exactly in micro-OCT (6 decimal places). Pass a string (e.g. `"0.300000"`) for exact control.
|
|
47
|
+
- **Docs:** `ContractCallData.amount` JSDoc corrected: field is OCT, not micro-units. No behavior change.
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
|
|
51
|
+
- **`OctraProviderAdapter`** (`src/supports/octra-provider.ts`): RFC-O-1 compliant transport adapter that uses `window.octra.request()` instead of the postMessage bridge. Detects any wallet exposing `window.octra.isOctra === true`. Translates SDK method names to RFC-O-1 method names (`send_transaction` to `octra_sendTransaction`, etc.) and maps events back to SDK vocabulary. Registered second in the adapter registry: existing DApps using the postMessage bridge are unaffected.
|
|
52
|
+
- **`listenForReady`** in `OctraProviderAdapter` now also listens for `octra#initialized` CustomEvent (dispatched by 0xio extension v2.4.3+) in addition to `octraWalletReady`, ensuring the provider is detected immediately on page load.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- Mainnet RPC URL in docs updated to `https://octra.network` (was stale `http://46.101.86.250:8080`)
|
|
57
|
+
|
|
58
|
+
### Compatibility
|
|
59
|
+
|
|
60
|
+
- No breaking changes: `ZeroXIOAdapter` (postMessage bridge) remains the default and takes priority when `window.wallet0xio` is present
|
|
61
|
+
- Old DApps work unchanged; new DApps can opt into `OctraProviderAdapter` explicitly or via `detectWalletAdapter()`
|
|
62
|
+
- Requires 0xio Wallet Extension v2.4.3+ for `octra#initialized` event; falls back to `octraWalletReady` on older versions
|
|
63
|
+
|
|
5
64
|
## [2.7.0] - 2026-05-16
|
|
6
65
|
|
|
7
66
|
### Security (post-audit remediation)
|
|
8
67
|
|
|
9
68
|
**Transport hardening:**
|
|
10
|
-
- Session nonce validation on all bridge responses
|
|
11
|
-
- Removed wildcard `'*'` postMessage fallback
|
|
12
|
-
- Removed `Math.random()` fallback for request IDs
|
|
69
|
+
- Session nonce validation on all bridge responses: blocks same-origin impersonation
|
|
70
|
+
- Removed wildcard `'*'` postMessage fallback: parent only addressed once origin established
|
|
71
|
+
- Removed `Math.random()` fallback for request IDs: throws if `crypto` unavailable
|
|
13
72
|
- `requestTimestamps` capped to prevent unbounded growth in idle tabs
|
|
14
73
|
- Removed legacy `octraWalletReady` listeners and `createOctraWallet` alias
|
|
15
74
|
|
|
16
75
|
### Added
|
|
17
76
|
|
|
18
77
|
- **Pluggable wallet adapter system** (`src/adapter.ts`, `src/supports/`):
|
|
19
|
-
- `WalletTransportAdapter` interface
|
|
20
|
-
- `src/supports/0xio.ts
|
|
21
|
-
- `src/supports/template.ts
|
|
78
|
+
- `WalletTransportAdapter` interface: add support for any wallet without touching core SDK
|
|
79
|
+
- `src/supports/0xio.ts`: built-in adapter with session nonce + iframe bridge support
|
|
80
|
+
- `src/supports/template.ts`: starter template for new adapters
|
|
22
81
|
- `detectWalletAdapter()` auto-detect helper
|
|
23
82
|
- Exported: `WalletTransportAdapter`, `AdapterRequest`, `AdapterIncomingMessage`, `ZeroXIOAdapter`, `createZeroXIOAdapter`, `detectWalletAdapter`, `getAllAdapters`
|
|
24
83
|
|
|
@@ -30,24 +89,24 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
30
89
|
- No breaking changes to `ZeroXIOWallet` public API
|
|
31
90
|
|
|
32
91
|
**SDK fixes:**
|
|
33
|
-
- Session versioning
|
|
34
|
-
- Debug log scrubbing
|
|
92
|
+
- Session versioning: `_sessionVersion` counter prevents stale writes from in-flight requests after disconnect/account switch
|
|
93
|
+
- Debug log scrubbing: only non-sensitive fields logged (`{ to }`, `{ contract, method }`, `{ public }`)
|
|
35
94
|
- Removed `retry()` and `withTimeout()` from public API export
|
|
36
|
-
- Per-method payload size limits
|
|
95
|
+
- Per-method payload size limits: method names ≤ 200 chars, params ≤ 64 KB, memos ≤ 1,000 chars
|
|
37
96
|
- Input validation at all mutating method entry points (`isValidAddress()`, `isValidAmount()`)
|
|
38
|
-
- Added `signAuthMessage(service, nonce)
|
|
39
|
-
- Amount types accept `string | number
|
|
40
|
-
- Added `deriveOctraAddress(publicKeyBase64)
|
|
97
|
+
- Added `signAuthMessage(service, nonce)`: domain-separated auth signing with origin binding
|
|
98
|
+
- Amount types accept `string | number`: eliminates JS precision loss for large values
|
|
99
|
+
- Added `deriveOctraAddress(publicKeyBase64)`: `connect()` and `getConnectionStatus()` verify pubkey to addr binding
|
|
41
100
|
- `encrypt/decryptBalance()` return full `TransactionResult` (was boolean)
|
|
42
101
|
- `contractCallView` no longer leaks connected address as default caller
|
|
43
102
|
- `balanceChanged` emits on public/private split change (not just total)
|
|
44
|
-
- `once()` removes listener before invoke
|
|
103
|
+
- `once()` removes listener before invoke: throwing listeners no longer re-fire
|
|
45
104
|
- `extensionLocked`/`extensionUnlocked` events emitted (were suppressed)
|
|
46
105
|
- Permissions stored in `ConnectionInfo` and survive session restore
|
|
47
106
|
- `connectedAt` preserved across `getConnectionStatus()` polls
|
|
48
|
-
- `connect` event only emits on disconnected
|
|
107
|
+
- `connect` event only emits on disconnected to connected transition
|
|
49
108
|
- `NETWORKS` frozen + `getNetworkConfig()` returns frozen copies
|
|
50
|
-
- `validateBalance()` uses `Number()` not `parseFloat()
|
|
109
|
+
- `validateBalance()` uses `Number()` not `parseFloat()`: rejects partial numerics
|
|
51
110
|
- `validateNetworkInfo()` rejects empty rpcUrl (except custom network)
|
|
52
111
|
- `switchNetwork()` requires active connection
|
|
53
112
|
- `checkSDKCompatibility()` no longer falsely flags non-Chrome transports
|
|
@@ -60,7 +119,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
60
119
|
- **`claimPrivateTransfer(transferId)`**: Claim a pending private transfer, adding it to the wallet's encrypted balance.
|
|
61
120
|
|
|
62
121
|
### Changed
|
|
63
|
-
- Privacy transfer methods no longer return NOT_AVAILABLE
|
|
122
|
+
- Privacy transfer methods no longer return NOT_AVAILABLE: fully wired to extension v2.4.0+
|
|
64
123
|
- Updated JSDoc for all privacy methods with PVAC flow description
|
|
65
124
|
|
|
66
125
|
### Compatibility
|
|
@@ -71,7 +130,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
71
130
|
## [2.5.0] - 2026-05-10
|
|
72
131
|
|
|
73
132
|
### Added
|
|
74
|
-
- **`switchNetwork(networkId)`**: Silently switch the extension's active network without opening the popup. Works like Rabby's `wallet_switchEthereumChain
|
|
133
|
+
- **`switchNetwork(networkId)`**: Silently switch the extension's active network without opening the popup. Works like Rabby's `wallet_switchEthereumChain`: DApps can detect network mismatch and offer one-click switch.
|
|
75
134
|
- **`getNetworkId()`**: Returns the extension's current network ID ('mainnet' or 'devnet').
|
|
76
135
|
- DApps can now detect + switch network programmatically, enabling network-aware UIs.
|
|
77
136
|
|
|
@@ -91,7 +150,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
91
150
|
### Changed
|
|
92
151
|
- **Connect response enriched**: Extension now returns `networkInfo` (id, name, rpcUrl, color, isTestnet) and `permissions` array in both fresh connect and reconnect responses.
|
|
93
152
|
- **Network info complete**: `getNetworkInfo` response now includes `explorerUrl`, `explorerAddressUrl`, `indexerUrl`, `supportsPrivacy`, `isTestnet` fields.
|
|
94
|
-
- **networkInfo fallback chain**: SDK tries `result.networkInfo
|
|
153
|
+
- **networkInfo fallback chain**: SDK tries `result.networkInfo`, then `getNetworkConfig(result.networkId)`, then `getNetworkConfig(this.config.networkId)`.
|
|
95
154
|
|
|
96
155
|
### Compatibility
|
|
97
156
|
- Requires 0xio Wallet Extension v2.3.5+ for full alignment
|
|
@@ -167,7 +226,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
167
226
|
- Extension content script messages continue to use strict origin validation
|
|
168
227
|
|
|
169
228
|
### Compatibility
|
|
170
|
-
- Fully backward compatible
|
|
229
|
+
- Fully backward compatible: extension-based DApps work unchanged
|
|
171
230
|
- Desktop (0xio Desktop): DApps loaded in BrowserScreen iframe now auto-connect
|
|
172
231
|
- Mobile (0xio App): DApps loaded in WebView browser now auto-connect via existing bridge
|
|
173
232
|
- Mainnet Alpha: Extension v2.0.1+
|
|
@@ -178,7 +237,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
178
237
|
## [2.3.0] - 2026-03-10
|
|
179
238
|
|
|
180
239
|
### Added
|
|
181
|
-
- **Smart Contract Interaction**: New `callContract()` method for state-changing contract calls. The extension builds, signs, and submits via `octra_submit
|
|
240
|
+
- **Smart Contract Interaction**: New `callContract()` method for state-changing contract calls. The extension builds, signs, and submits via `octra_submit`: works on both mainnet and devnet.
|
|
182
241
|
- **Contract View Calls**: New `contractCallView()` method for read-only contract queries. No wallet unlock or approval popup required.
|
|
183
242
|
- **Contract Storage**: New `getContractStorage()` method to read contract storage by key directly from the chain.
|
|
184
243
|
- **New Types**: `ContractCallData`, `ContractViewCallData`, and `ContractParams` for type-safe contract interaction.
|
|
@@ -231,13 +290,13 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
231
290
|
### Added
|
|
232
291
|
- **Transaction Finality**: New `TransactionFinality` type (`'pending' | 'confirmed' | 'rejected'`) and `finality` field on `TransactionResult` and `Transaction` interfaces.
|
|
233
292
|
- **RPC Error Codes**: 7 new `ErrorCode` entries for RPC-level transaction errors from `octra_submit` and `octra_submitBatch`:
|
|
234
|
-
- `MALFORMED_TRANSACTION
|
|
235
|
-
- `SELF_TRANSFER
|
|
236
|
-
- `SENDER_NOT_FOUND
|
|
237
|
-
- `INVALID_SIGNATURE
|
|
238
|
-
- `DUPLICATE_TRANSACTION
|
|
239
|
-
- `NONCE_TOO_FAR
|
|
240
|
-
- `INTERNAL_ERROR
|
|
293
|
+
- `MALFORMED_TRANSACTION`: Transaction is malformed
|
|
294
|
+
- `SELF_TRANSFER`: Cannot transfer to yourself
|
|
295
|
+
- `SENDER_NOT_FOUND`: Sender address not found
|
|
296
|
+
- `INVALID_SIGNATURE`: Invalid transaction signature
|
|
297
|
+
- `DUPLICATE_TRANSACTION`: Duplicate transaction detected
|
|
298
|
+
- `NONCE_TOO_FAR`: Transaction nonce is too far ahead
|
|
299
|
+
- `INTERNAL_ERROR`: Internal server error
|
|
241
300
|
- **Error Messages**: All new error codes have corresponding human-readable messages in `createErrorMessage()`.
|
|
242
301
|
|
|
243
302
|
### Fixed
|
|
@@ -315,8 +374,8 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
315
374
|
|
|
316
375
|
### Breaking Changes
|
|
317
376
|
- **Rebranded message sources**: Changed from `octra-sdk-*` to `0xio-sdk-*` for consistency with 0xio branding
|
|
318
|
-
- `octra-sdk-request`
|
|
319
|
-
- `octra-sdk-bridge`
|
|
377
|
+
- `octra-sdk-request` to `0xio-sdk-request`
|
|
378
|
+
- `octra-sdk-bridge` to `0xio-sdk-bridge`
|
|
320
379
|
- This is a breaking change that requires wallet extension v2.0+ for compatibility
|
|
321
380
|
|
|
322
381
|
### Changed
|
|
@@ -324,7 +383,7 @@ All notable changes to the 0xio Wallet SDK will be documented in this file.
|
|
|
324
383
|
- Changed author from "NullxGery" to "0xio Team"
|
|
325
384
|
- Updated author email from "0xgery@proton.me" to "team@0xio.xyz"
|
|
326
385
|
- Updated repository URL from `0xGery/0xio-sdk` to `0xio-xyz/0xio-sdk`
|
|
327
|
-
- Updated keywords: "0xio"
|
|
386
|
+
- Updated keywords: "0xio" to "0xio wallet", added "octra wallet"
|
|
328
387
|
- Author URL changed to organization: `https://github.com/0xio-xyz`
|
|
329
388
|
|
|
330
389
|
### Migration Guide
|
|
@@ -383,8 +442,8 @@ This is the first stable release of the 0xio Wallet SDK, a comprehensive bridge
|
|
|
383
442
|
- **Professional code refactoring**: All files now include comprehensive JSDoc documentation
|
|
384
443
|
|
|
385
444
|
### Package Changes
|
|
386
|
-
- **Package renamed**: `@0xgery/wallet-sdk`
|
|
387
|
-
- **Version bump**: 0.2.1
|
|
445
|
+
- **Package renamed**: `@0xgery/wallet-sdk` to `@0xio/sdk`
|
|
446
|
+
- **Version bump**: 0.2.1 to 1.0.0 (production-ready)
|
|
388
447
|
- **Repository**: Published to https://github.com/0xGery/0xio-sdk
|
|
389
448
|
- **Homepage**: https://0xio.xyz
|
|
390
449
|
|
|
@@ -400,7 +459,7 @@ This is the first stable release of the 0xio Wallet SDK, a comprehensive bridge
|
|
|
400
459
|
- Complete integration examples (React, Vue, Vanilla JS)
|
|
401
460
|
|
|
402
461
|
### Technical Improvements
|
|
403
|
-
- **JSDoc coverage**: 0%
|
|
462
|
+
- **JSDoc coverage**: 0% to 95%
|
|
404
463
|
- **Code quality**: Refactored all functions to <30 lines
|
|
405
464
|
- **Error handling**: Enhanced with detailed context and diagnostics
|
|
406
465
|
- **TypeScript**: Full type safety with comprehensive type definitions
|