@burnt-labs/abstraxion 1.0.0-alpha.75 → 1.0.0-alpha.77
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +74 -0
- package/dist/index.d.ts +935 -16
- package/dist/index.js +1793 -158
- package/dist/index.mjs +1785 -167
- package/package.json +5 -5
- package/src/AbstraxionProvider.tsx +102 -7
- package/src/components/AbstraxionEmbed.tsx +370 -0
- package/src/controllers/IframeController.ts +775 -0
- package/src/controllers/IframeSigningClient.ts +57 -0
- package/src/controllers/PopupController.ts +498 -0
- package/src/controllers/PopupSigningClient.ts +50 -0
- package/src/controllers/RedirectController.ts +234 -28
- package/src/controllers/RedirectSigningClient.ts +51 -0
- package/src/controllers/SignerController.ts +92 -11
- package/src/controllers/__tests__/IframeController.connect.test.ts +382 -0
- package/src/controllers/__tests__/IframeController.test.ts +144 -0
- package/src/controllers/__tests__/PopupController.connect.test.ts +450 -0
- package/src/controllers/__tests__/PopupController.test.ts +178 -0
- package/src/controllers/__tests__/RedirectController.callback.test.ts +374 -0
- package/src/controllers/__tests__/RedirectController.test.ts +153 -0
- package/src/controllers/__tests__/SignerController.test.ts +333 -0
- package/src/controllers/__tests__/SigningClients.test.ts +202 -0
- package/src/controllers/factory.ts +18 -2
- package/src/controllers/index.ts +4 -0
- package/src/controllers/types.ts +11 -3
- package/src/hooks/index.ts +5 -1
- package/src/hooks/useAbstraxionAccount.ts +5 -1
- package/src/hooks/useAbstraxionSigningClient.ts +349 -7
- package/src/index.ts +39 -1
- package/src/types.ts +138 -6
- package/src/utils/__tests__/resolveAutoAuth.test.ts +201 -0
- package/src/utils/normalizeAbstraxionConfig.ts +33 -11
- package/src/utils/resolveAutoAuth.ts +62 -0
- package/tests/integration/auth-flows/session-management.integration.test.ts +6 -6
- package/tests/integration/auth-flows/signer-auth.integration.test.ts +2 -2
- package/tests/integration/message-contract.integration.test.ts +304 -0
- package/tests/integration/react/AbstraxionEmbed.integration.test.tsx +316 -0
- package/tests/integration/react/AbstraxionProvider-popup-no-grants.integration.test.tsx +250 -0
- package/tests/integration/response-shapes.integration.test.ts +255 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @burnt-labs/abstraxion@1.0.0-alpha.
|
|
2
|
+
> @burnt-labs/abstraxion@1.0.0-alpha.77 build /home/runner/work/xion.js/xion.js/packages/abstraxion
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -10,10 +10,10 @@ CLI Target: esnext
|
|
|
10
10
|
CLI Cleaning output folder
|
|
11
11
|
ESM Build start
|
|
12
12
|
CJS Build start
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
CJS dist/index.js 79.85 KB
|
|
14
|
+
CJS ⚡️ Build success in 320ms
|
|
15
|
+
ESM dist/index.mjs 78.41 KB
|
|
16
|
+
ESM ⚡️ Build success in 321ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
19
|
-
DTS dist/index.d.ts
|
|
18
|
+
DTS ⚡️ Build success in 2165ms
|
|
19
|
+
DTS dist/index.d.ts 42.25 KB
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# @burnt-labs/abstraxion
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.77
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#340](https://github.com/burnt-labs/xion.js/pull/340) [`1a387ca`](https://github.com/burnt-labs/xion.js/commit/1a387cabe46a20c6a88fc32e51c8f88f99ccddf1) Thanks [@ertemann](https://github.com/ertemann)! - Add embedded wallets with popup, auto, and embedded authentication modes. Also add direct signing (`requireAuth`) for transactions that need meta-account authorization instead of session keys.
|
|
8
|
+
|
|
9
|
+
## What's new
|
|
10
|
+
- **Popup mode** — opens auth app in a popup window; user stays on the dApp page, popup closes on success
|
|
11
|
+
- **Auto mode** — automatically picks popup (desktop) or redirect (mobile/PWA) based on device detection
|
|
12
|
+
- **Embedded mode** (`type: "embedded"`) — embeds dashboard inside your page via `MessageChannel`-based communication. New `<AbstraxionEmbed>` drop-in component handles all wiring — just place it in your layout and use hooks like any other mode
|
|
13
|
+
- **Direct signing (`requireAuth: true`)** — meta-account signs transactions directly instead of using session keys; user pays gas from their XION balance. For txs that won't be secure using session keys, like big transfers, smart account management etc.
|
|
14
|
+
- **`isDisconnected` flag** — `useAbstraxionAccount` now returns `isDisconnected: boolean`, true only after an explicit user logout. Prevents `<AbstraxionEmbed autoConnect>` from silently re-authenticating after logout
|
|
15
|
+
- **`isAwaitingApproval` flag** — context exposes `isAwaitingApproval: boolean`, true while a `requireAuth` signing request is pending and the iframe needs to be visible
|
|
16
|
+
|
|
17
|
+
Non user facing:
|
|
18
|
+
- **Signing clients per auth mode** — `PopupSigningClient`, `RedirectSigningClient`, `IframeSigningClient` for direct signing in each mode
|
|
19
|
+
- **`resolveAutoAuth` utility** — mobile/standalone detection heuristic (user-agent, touch, viewport, orientation, PWA)
|
|
20
|
+
- **Wrong-wallet signing guard** — prevents signing from a wallet that doesn't match the connected account
|
|
21
|
+
- **UTF-8-safe base64 encoding** — `toBase64`/`fromBase64` in `@burnt-labs/signers` for safe encoding of Unicode payloads (emoji, non-Latin scripts)
|
|
22
|
+
- **Treasury grant restoration fix** — handles ABCI REST format change that broke session restoration (`decodeRestFormatAuthorization` in abstraxion-core)
|
|
23
|
+
- **Embedded URL constants** — `getIframeUrl(chainId)` added to `@burnt-labs/constants` for per-chain dashboard URLs
|
|
24
|
+
- **New core exports** — `MessageChannelManager`, `TypedEventEmitter`, `IframeMessageType`, `MessageTarget` from abstraxion-core; `AAClient`, `IframeController` from abstraxion
|
|
25
|
+
- **`disconnected` state in account state machine** — new `AccountState` status distinct from `idle`, set only after an explicit logout. New `EXPLICITLY_DISCONNECTED` action and `AccountStateGuards.isDisconnected()` type guard. All four controllers dispatch this instead of `RESET` on disconnect
|
|
26
|
+
- **`authMode` derived from controller instance** — `AbstraxionProvider` now derives `authMode` from the live controller type instead of re-running `resolveAutoAuth` on every render, preventing SSR/client hydration mismatches and viewport-resize flips
|
|
27
|
+
|
|
28
|
+
## AbstraxionEmbed redesign
|
|
29
|
+
|
|
30
|
+
`<AbstraxionEmbed>` has been redesigned with full lifecycle control props replacing the single `autoConnect` boolean:
|
|
31
|
+
- **`idleView`** (`"button" | "fullview" | "hidden"`, default `"button"`) — what to show before the user logs in
|
|
32
|
+
- **`disconnectedView`** (same options, default: same as `idleView`) — what to show after an explicit logout
|
|
33
|
+
- **`connectedView`** (`"hidden" | "visible"`, default `"hidden"`) — whether to keep the iframe visible after connecting
|
|
34
|
+
- **`approvalView`** (`"modal" | "inline"`, default `"modal"`) — how to display the iframe when a `requireAuth` signing request is pending
|
|
35
|
+
- **`loginLabel`**, **`loginButtonClassName`**, **`loginButtonStyle`** — customise the login button
|
|
36
|
+
- **`modalClassName`**, **`modalStyle`** — customise the approval modal wrapper
|
|
37
|
+
|
|
38
|
+
## Dashboard changes (xion-dashboard-app `feat/embedded-wallets`)
|
|
39
|
+
|
|
40
|
+
These dashboard changes are required for the new SDK modes to work:
|
|
41
|
+
- **Popup mode support** — dashboard can now run inside a popup window opened by the SDK, communicating auth results back via `postMessage` and closing automatically on success
|
|
42
|
+
- **Redirect-within-popup for OAuth** — when using popup mode, OAuth providers (Stytch) redirect inside the popup instead of opening yet another popup
|
|
43
|
+
- **SignTransactionView** — new view for approving individual transactions sent via `requireAuth` / direct signing (popup, redirect, and embedded modes)
|
|
44
|
+
- **Embedded mode** — dashboard renders inside an iframe with transparent background; old `IframeApp/` components removed in favor of the main app with `?iframe=true` search param
|
|
45
|
+
- **LoginConnectConfirm** — new approval screen for no-grant-config flows (empty treasury or direct-signing-only grantee); shows app branding and "Connect / Deny / Use a different account"
|
|
46
|
+
- **Empty treasury support** — treasury address present but no grant configs no longer throws; dashboard routes to `LoginConnectConfirm` instead of `LoginGrantApproval`
|
|
47
|
+
- **SDK-only disconnect** — disconnect from the SDK side sends `HARD_DISCONNECT` and tears down the iframe; "Use a different account" stays within the iframe (no parent notification) so the user can re-login without a white-screen flash
|
|
48
|
+
- **`switchAccount()`** hook function — new export from `useXionDisconnect`; clears session locally without notifying parent, used by "Use a different account" buttons
|
|
49
|
+
- **Origin validation on callbacks** — `postMessage` origin checks upgraded for security in embedded/popup communication
|
|
50
|
+
- **Wrong-address signing guard** — dashboard rejects signing requests if the requested signer doesn't match the logged-in account
|
|
51
|
+
|
|
52
|
+
## Packages changed
|
|
53
|
+
- **`@burnt-labs/abstraxion`** — new `<AbstraxionEmbed>` component (redesigned), new controllers (`PopupController`, `IframeController`), signing clients, auto mode resolution, expanded `useAbstraxionSigningClient` with `requireAuth` support, `isDisconnected`/`isAwaitingApproval` context values, `authMode` derived from controller instance, new type exports (`EmbeddedAuthentication`, `PopupAuthentication`, `AutoAuthentication`, `SignResult`, `SigningClient`)
|
|
54
|
+
- **`@burnt-labs/abstraxion-core`** — `MessageChannelManager`, `TypedEventEmitter`, iframe message types, `decodeRestFormatAuthorization` grant decoding, treasury grant restoration fix
|
|
55
|
+
- **`@burnt-labs/account-management`** — `disconnected` account state, `EXPLICITLY_DISCONNECTED` action, `AccountStateGuards.isDisconnected()` type guard
|
|
56
|
+
- **`@burnt-labs/constants`** — `getIframeUrl(chainId)`, per-chain dashboard URL constants for mainnet/testnet
|
|
57
|
+
- **`@burnt-labs/signers`** — `toBase64`/`fromBase64` encoding utils, `ZKEmail` authenticator type support
|
|
58
|
+
- **`demo-app`** — new demos: `popup-demo/`, `embedded-dynamic/`, `embedded-inline/`, `direct-signing-demo/` (with MetaMask via `useMetamask` hook); removed old `inline-demo/`
|
|
59
|
+
|
|
60
|
+
For full details, usage examples, and migration guide see [`LATEST_VERSION_OVERVIEW.md`](../LATEST_VERSION_OVERVIEW.md) and the demo apps in [`apps/demo-app/`](../apps/demo-app/).
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [[`1a387ca`](https://github.com/burnt-labs/xion.js/commit/1a387cabe46a20c6a88fc32e51c8f88f99ccddf1)]:
|
|
65
|
+
- @burnt-labs/abstraxion-core@1.0.0-alpha.68
|
|
66
|
+
- @burnt-labs/account-management@1.0.0-alpha.9
|
|
67
|
+
- @burnt-labs/constants@0.1.0-alpha.23
|
|
68
|
+
- @burnt-labs/signers@1.0.0-alpha.7
|
|
69
|
+
|
|
70
|
+
## 1.0.0-alpha.76
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [[`00ac279`](https://github.com/burnt-labs/xion.js/commit/00ac279a15f1845f62d63507ceb02ec70e5c5dc1)]:
|
|
75
|
+
- @burnt-labs/account-management@1.0.0-alpha.8
|
|
76
|
+
|
|
3
77
|
## 1.0.0-alpha.75
|
|
4
78
|
|
|
5
79
|
### Patch Changes
|