@seams/wallet 0.15.2 → 0.15.6
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 +36 -16
- package/dist/.build-inputs.sha256 +1 -1
- package/dist/esm/SeamsWeb/walletIframe/host/auth-menu/domain.js +13 -1
- package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.js +8 -7
- package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodRow.js +1 -1
- package/dist/esm/react/components/AccountMenuButton/MenuItem.js +2 -11
- package/dist/esm/react/components/AccountMenuButton/ProfileDropdown.css +30 -4
- package/dist/esm/react/components/AccountMenuButton/Web3AuthProfileButton.css +4 -39
- package/dist/esm/react/components/AccountMenuButton/icons/HoverArrowIcon.css +45 -0
- package/dist/esm/react/components/AccountMenuButton/icons/HoverArrowIcon.js +3 -2
- package/dist/esm/react/styles/styles.css +80 -43
- package/dist/esm/react/styles.css +1 -0
- package/dist/esm/sdk/{host-z-JJRWQe.js → host-DfWylEiw.js} +1 -1
- package/dist/esm/sdk/registration-yoF0o52H.js +1 -0
- package/dist/esm/sdk/runtime-auth--i_j8PP7.js +1 -0
- package/dist/{public/sdk/runtime-device-link-Dq8g_UNb.js → esm/sdk/runtime-device-link-fpvaxYyR.js} +1 -1
- package/dist/esm/sdk/{runtime-ecdsa-tempo-AGjT7Xpa.js → runtime-ecdsa-tempo-AE5QTaXu.js} +1 -1
- package/dist/esm/sdk/{runtime-email-otp-BpBOuSsT.js → runtime-email-otp-Dl03QI-O.js} +1 -1
- package/dist/esm/sdk/{runtime-export-CBsacCPY.js → runtime-export-F9s12UcT.js} +1 -1
- package/dist/esm/sdk/{runtime-near-J3hKjC7G.js → runtime-near-Bjrz1KYf.js} +1 -1
- package/dist/esm/sdk/{runtime-preferences-CVt5sLvm.js → runtime-preferences-oLRSEqmz.js} +1 -1
- package/dist/esm/sdk/{runtime-recovery-BzewdcoT.js → runtime-recovery-DBBKvIIg.js} +1 -1
- package/dist/esm/sdk/{shared-BywEqTsd.js → shared-D893jckQ.js} +1 -1
- package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/public/headers.manifest.json +1 -1
- package/dist/public/sdk/{host-z-JJRWQe.js → host-DfWylEiw.js} +1 -1
- package/dist/public/sdk/registration-yoF0o52H.js +1 -0
- package/dist/public/sdk/runtime-auth--i_j8PP7.js +1 -0
- package/dist/{esm/sdk/runtime-device-link-Dq8g_UNb.js → public/sdk/runtime-device-link-fpvaxYyR.js} +1 -1
- package/dist/public/sdk/{runtime-ecdsa-tempo-AGjT7Xpa.js → runtime-ecdsa-tempo-AE5QTaXu.js} +1 -1
- package/dist/public/sdk/{runtime-email-otp-BpBOuSsT.js → runtime-email-otp-Dl03QI-O.js} +1 -1
- package/dist/public/sdk/{runtime-export-CBsacCPY.js → runtime-export-F9s12UcT.js} +1 -1
- package/dist/public/sdk/{runtime-near-J3hKjC7G.js → runtime-near-Bjrz1KYf.js} +1 -1
- package/dist/public/sdk/{runtime-preferences-CVt5sLvm.js → runtime-preferences-oLRSEqmz.js} +1 -1
- package/dist/public/sdk/{runtime-recovery-BzewdcoT.js → runtime-recovery-DBBKvIIg.js} +1 -1
- package/dist/public/sdk/{shared-BywEqTsd.js → shared-D893jckQ.js} +1 -1
- package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/public/sdk/workers/email-otp.worker.js +7 -1
- package/dist/public/sdk/workers/passkey-mpc-export.worker.js +7 -1
- package/dist/public/sdk/workers/wallet-custody-ceremony.worker.js +2 -0
- package/dist/public/wallet-assets.manifest.json +26 -26
- package/dist/public/wallet-service/index.html +4 -4
- package/dist/types/wallet/src/SeamsWeb/walletIframe/host/auth-menu/domain.d.ts +15 -2
- package/dist/types/wallet/src/react/components/AccountMenuButton/icons/HoverArrowIcon.d.ts +3 -2
- package/dist/workers/email-otp.worker.js +7 -1
- package/dist/workers/passkey-mpc-export.worker.js +7 -1
- package/dist/workers/wallet-custody-ceremony.worker.js +2 -0
- package/package.json +1 -1
- package/dist/esm/sdk/registration-DEGZR8kA.js +0 -1
- package/dist/esm/sdk/runtime-auth-ZcxkQ-XF.js +0 -1
- package/dist/public/sdk/registration-DEGZR8kA.js +0 -1
- package/dist/public/sdk/runtime-auth-ZcxkQ-XF.js +0 -1
package/README.md
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
# Seams Wallet SDK
|
|
2
2
|
|
|
3
|
-
`@seams/wallet` **0.
|
|
3
|
+
`@seams/wallet` **0.15.4** provides browser wallet lifecycle, NEAR and EVM-family
|
|
4
4
|
threshold signing, React components, and hosted wallet runtime assets.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
pnpm add @seams/wallet@0.
|
|
9
|
+
pnpm add @seams/wallet@0.15.4
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
React integrations support React 18 and 19. Import the provider and UI from
|
|
13
13
|
`@seams/wallet/react` and its stylesheet from `@seams/wallet/react/styles`.
|
|
14
14
|
Keep the application package, wallet-origin assets, and
|
|
15
|
-
`@seams/wallet-server@0.
|
|
15
|
+
`@seams/wallet-server@0.15.4` on the matching release. The wallet iframe protocol
|
|
16
|
+
is `16.0.0`. A 0.13 application and a 0.14-or-later wallet host reject each other
|
|
17
|
+
with a protocol version mismatch.
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## Current API
|
|
18
20
|
|
|
19
|
-
The
|
|
21
|
+
The public API groups calls under `auth`, `connection`, `config`, `events`,
|
|
20
22
|
`registration`, and the chain namespaces. See the
|
|
21
|
-
[
|
|
23
|
+
[browser reference](https://wallet.seams.sh/docs/reference/core).
|
|
22
24
|
Use `auth.lock()` to end the session while retaining valid durable presignatures.
|
|
23
25
|
|
|
24
26
|
Custom email unlock uses a host-owned challenge:
|
|
@@ -42,9 +44,8 @@ For an existing local email method, request with
|
|
|
42
44
|
`cancel()`. Use the replacement challenge returned by a successful resend.
|
|
43
45
|
The SDK selects signers and completes pending activation internally.
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
and
|
|
47
|
-
assets on the matching release. The 0.8.0 release does not contain them.
|
|
47
|
+
Request email codes only after a user chooses that method. The wallet host owns
|
|
48
|
+
the challenge and its expiry. The application receives the typed challenge handle.
|
|
48
49
|
|
|
49
50
|
## React quick start
|
|
50
51
|
|
|
@@ -95,7 +96,7 @@ recovery material out of app configuration and logs.
|
|
|
95
96
|
`useSeams()` exposes the SDK client and authentication state. `useWallet()`
|
|
96
97
|
provides `near`, `evm`, and `tempo` signers bound to the authenticated wallet.
|
|
97
98
|
`near` is null until a NEAR account is ready. Check registration's pending
|
|
98
|
-
branches and use `registration.
|
|
99
|
+
branches and use `registration.waitForNearAccount` before signing NEAR.
|
|
99
100
|
|
|
100
101
|
The framework-neutral `SeamsWeb` client groups operations under `registration`,
|
|
101
102
|
`auth`, `near`, `evm`, `tempo`, `recovery`, `devices`, and `keys`. Signing can
|
|
@@ -103,7 +104,7 @@ use fresh authorization for one operation; `unlock` provisions a bounded
|
|
|
103
104
|
reusable Wallet Session. An EVM-family signing or export call requires a
|
|
104
105
|
`chainTarget` naming a configured chain.
|
|
105
106
|
|
|
106
|
-
`keys.
|
|
107
|
+
`keys.exportKey` opens a wallet-origin viewer and returns `{ kind: 'exported' }`.
|
|
107
108
|
It does not return a private key to the application. `recovery.syncAccount`
|
|
108
109
|
synchronizes a known wallet's account state; the hosted menu handles recovery
|
|
109
110
|
codes and new-factor verification.
|
|
@@ -151,10 +152,29 @@ wallet use the same home. Travel does not change it. The owner can move a wallet
|
|
|
151
152
|
to another region with the wallet region setting. Automatic region relocation is
|
|
152
153
|
a future capability.
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
For APAC, registration and relocation request Southeast Asia placement through
|
|
156
|
+
`apac-se`. The hint does not guarantee a city or move existing objects. Operators
|
|
157
|
+
must verify the actual object locations and database primaries.
|
|
158
|
+
|
|
159
|
+
Follow the [upgrade guide](https://wallet.seams.sh/docs/deploy-and-operate/hosted-integration)
|
|
160
|
+
before changing the application, wallet assets, or backend. An incompatible open
|
|
161
|
+
client must reload matching assets before retrying.
|
|
162
|
+
|
|
163
|
+
## Initial loading and registration
|
|
164
|
+
|
|
165
|
+
When the wallet origin stores no wallet, the host answers connection reads from
|
|
166
|
+
its boot code. It loads the runtime when an operation needs it. Call
|
|
167
|
+
`seams.authMenu.prepare()` on sign-in intent to download the sign-in code earlier.
|
|
168
|
+
Mounting `HostedSeamsAuthMenu` starts that download without an additional call.
|
|
169
|
+
|
|
170
|
+
Opening the hosted registration view prepares its wallet and passkey challenge.
|
|
171
|
+
`authMenu.prepare()` only downloads code. A direct `registerWallet()` call starts
|
|
172
|
+
registration setup within that call. See the
|
|
173
|
+
[compiled hosted-menu examples](https://wallet.seams.sh/docs/examples/wallet-setup-and-authentication).
|
|
174
|
+
|
|
175
|
+
Registration can sign before its completion appears in the Console directory.
|
|
176
|
+
The Gateway retries pending directory publications. Until acknowledgment, the
|
|
177
|
+
wallet can be absent from the Console list and unavailable for region moves.
|
|
158
178
|
|
|
159
179
|
## Public entrypoints
|
|
160
180
|
|
|
@@ -166,7 +186,7 @@ show it and reload the current assets. See the
|
|
|
166
186
|
- `@seams/wallet/runtime` — explicit platform ports and custom signing runtime.
|
|
167
187
|
|
|
168
188
|
Use the documented package exports. Agent-lane issuance and VoiceID
|
|
169
|
-
authentication are planned and have no public
|
|
189
|
+
authentication are planned and have no public API in this release.
|
|
170
190
|
|
|
171
191
|
## Develop from source
|
|
172
192
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
90f4566ad3565bd0828de2eb38436e06b68bdee5db1618aaef8161d28694be5c
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
//#region src/SeamsWeb/walletIframe/host/auth-menu/domain.ts
|
|
2
|
+
/** A wait on a prompt outside the menu shares one look: the ring, then the
|
|
3
|
+
* headline, then what to do in that prompt. */
|
|
4
|
+
const AUTH_MENU_WAITING_PROMPTS = {
|
|
5
|
+
passkey: {
|
|
6
|
+
label: "Passkey authentication",
|
|
7
|
+
instruction: "Complete the prompt on your device."
|
|
8
|
+
},
|
|
9
|
+
google: {
|
|
10
|
+
label: "Google sign-in",
|
|
11
|
+
instruction: "Choose your Google account."
|
|
12
|
+
}
|
|
13
|
+
};
|
|
2
14
|
function resolveAuthMenuLoginAccount(accountOptions, selectedAccount) {
|
|
3
15
|
const exactSelection = selectedAccount ? accountOptions.find((account) => account.walletId === selectedAccount.walletId && account.authMethod === selectedAccount.authMethod) : null;
|
|
4
16
|
const sameWalletSelection = selectedAccount ? accountOptions.find((account) => account.walletId === selectedAccount.walletId) : null;
|
|
@@ -82,6 +94,6 @@ function isAuthMenuGoogleActionReady(viewModel) {
|
|
|
82
94
|
return authMenuLoginAllowsEmailOtp(resolveAuthMenuLoginAccount(viewModel.accountOptions, viewModel.selectedAccount));
|
|
83
95
|
}
|
|
84
96
|
//#endregion
|
|
85
|
-
export { isAuthMenuActionReady, isAuthMenuGoogleActionReady, isAuthMenuLoadingStatus, isAuthMenuReady, resolveAuthMenuLoginAccount };
|
|
97
|
+
export { AUTH_MENU_WAITING_PROMPTS, isAuthMenuActionReady, isAuthMenuGoogleActionReady, isAuthMenuLoadingStatus, isAuthMenuReady, resolveAuthMenuLoginAccount };
|
|
86
98
|
|
|
87
99
|
//# sourceMappingURL=domain.js.map
|
|
@@ -2,7 +2,7 @@ import { isLinkedDeviceTargetEmailAddressV1 } from "../../../../../core/types/li
|
|
|
2
2
|
import { EMAIL_OTP_RECOVERY_KEY_ALPHABET } from "../../../../../shared-ts/src/utils/emailOtpRecoveryKey.js";
|
|
3
3
|
import "../../../../../shared-ts/src/wallet-recovery/recoveryCodes.js";
|
|
4
4
|
import { demoEmailOtpCodeFromDelivery } from "../../../../../core/signingEngine/session/emailOtp/challengeDelivery.js";
|
|
5
|
-
import { isAuthMenuActionReady, isAuthMenuGoogleActionReady, isAuthMenuLoadingStatus, isAuthMenuReady, resolveAuthMenuLoginAccount } from "../../auth-menu/domain.js";
|
|
5
|
+
import { AUTH_MENU_WAITING_PROMPTS, isAuthMenuActionReady, isAuthMenuGoogleActionReady, isAuthMenuLoadingStatus, isAuthMenuReady, resolveAuthMenuLoginAccount } from "../../auth-menu/domain.js";
|
|
6
6
|
import { PadlockIcon } from "../../../../../core/signingEngine/uiConfirm/ui/preact/PadlockIcon.js";
|
|
7
7
|
import { blinkMenuItem } from "../../../../../utils/menuItemBlink.js";
|
|
8
8
|
import { accountDropdownIcon, backIcon, chevronIcon, fingerprintIcon, googleIcon, linkDeviceIcon, linkFailedIcon, mailIcon, passkeyRingIcon, recoveryIcon, rerollIcon } from "./icons.js";
|
|
@@ -1130,15 +1130,16 @@ var AuthMenuSurface = class extends Component {
|
|
|
1130
1130
|
const status = viewModel.status;
|
|
1131
1131
|
if (status.kind !== "busy") return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
1132
1132
|
const waitingText = status.headline;
|
|
1133
|
+
const prompt = status.illustration ? AUTH_MENU_WAITING_PROMPTS[status.illustration] : null;
|
|
1133
1134
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("div", {
|
|
1134
1135
|
class: "seams-waiting",
|
|
1135
1136
|
role: "status",
|
|
1136
1137
|
"aria-live": "polite",
|
|
1137
1138
|
children: [
|
|
1138
|
-
|
|
1139
|
+
prompt ? /* @__PURE__ */ jsx("span", {
|
|
1139
1140
|
class: "seams-passkey-prompt",
|
|
1140
1141
|
role: "img",
|
|
1141
|
-
"aria-label":
|
|
1142
|
+
"aria-label": prompt.label,
|
|
1142
1143
|
children: passkeyRingIcon()
|
|
1143
1144
|
}) : null,
|
|
1144
1145
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -1148,9 +1149,9 @@ var AuthMenuSurface = class extends Component {
|
|
|
1148
1149
|
class: "seams-waiting-text",
|
|
1149
1150
|
children: waitingText
|
|
1150
1151
|
}),
|
|
1151
|
-
|
|
1152
|
+
prompt ? /* @__PURE__ */ jsx("span", {
|
|
1152
1153
|
class: "seams-passkey-instruction",
|
|
1153
|
-
children:
|
|
1154
|
+
children: prompt.instruction
|
|
1154
1155
|
}) : null,
|
|
1155
1156
|
viewModel.showProgress && status.detail && status.detail !== waitingText ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("span", {
|
|
1156
1157
|
class: "seams-waiting-sdk-events",
|
|
@@ -1158,10 +1159,10 @@ var AuthMenuSurface = class extends Component {
|
|
|
1158
1159
|
}) }) : null
|
|
1159
1160
|
]
|
|
1160
1161
|
}),
|
|
1161
|
-
|
|
1162
|
+
prompt ? null : /* @__PURE__ */ jsx("div", {
|
|
1162
1163
|
"aria-label": "Loading",
|
|
1163
1164
|
class: "seams-spinner"
|
|
1164
|
-
})
|
|
1165
|
+
})
|
|
1165
1166
|
]
|
|
1166
1167
|
}) });
|
|
1167
1168
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TouchIcon from "./icons/TouchIcon.js";
|
|
2
|
-
import { MailIcon } from "./icons/MailIcon.js";
|
|
3
2
|
import { HoverArrowIcon } from "./icons/HoverArrowIcon.js";
|
|
3
|
+
import { MailIcon } from "./icons/MailIcon.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/components/AccountMenuButton/AuthenticationMethodRow.tsx
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HoverArrowIcon } from "./icons/HoverArrowIcon.js";
|
|
1
2
|
import { forwardRef, memo } from "react";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/react/components/AccountMenuButton/MenuItem.tsx
|
|
@@ -35,17 +36,7 @@ const MenuItem = memo(forwardRef(({ item, onClose, className, style, isHighlight
|
|
|
35
36
|
children: item.description
|
|
36
37
|
})]
|
|
37
38
|
}),
|
|
38
|
-
!item.disabled ? /* @__PURE__ */ jsx(
|
|
39
|
-
className: "seams-account-menu-chevron",
|
|
40
|
-
width: "16",
|
|
41
|
-
height: "16",
|
|
42
|
-
viewBox: "0 0 24 24",
|
|
43
|
-
fill: "none",
|
|
44
|
-
stroke: "currentColor",
|
|
45
|
-
strokeWidth: "1.5",
|
|
46
|
-
"aria-hidden": "true",
|
|
47
|
-
children: /* @__PURE__ */ jsx("path", { d: "m9 6 6 6-6 6" })
|
|
48
|
-
}) : null
|
|
39
|
+
!item.disabled ? /* @__PURE__ */ jsx(HoverArrowIcon, {}) : null
|
|
49
40
|
]
|
|
50
41
|
});
|
|
51
42
|
}));
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
--seams-expander-surface: var(--seams-colors-surface2);
|
|
19
19
|
}
|
|
20
20
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item {
|
|
21
|
+
position: relative;
|
|
22
|
+
isolation: isolate;
|
|
21
23
|
min-height: 40px;
|
|
22
24
|
padding: 6px 0;
|
|
23
25
|
gap: 10px;
|
|
@@ -57,9 +59,23 @@
|
|
|
57
59
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item-content {
|
|
58
60
|
flex: 1;
|
|
59
61
|
}
|
|
60
|
-
.seams-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item > .seams-hover-arrow {
|
|
63
|
+
margin-inline-end: 4px;
|
|
64
|
+
}
|
|
65
|
+
/* The hover shade bleeds past the row edges so the icons and labels stay
|
|
66
|
+
aligned with the group headings. */
|
|
67
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(.seams-lock-menu-item)::before {
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
z-index: -1;
|
|
71
|
+
inset: 1px -10px;
|
|
72
|
+
border-radius: var(--seams-shape-item, 10px);
|
|
73
|
+
background: var(--seams-colors-surface2);
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transition: opacity 150ms ease;
|
|
76
|
+
}
|
|
77
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:focus-visible::before {
|
|
78
|
+
opacity: 1;
|
|
63
79
|
}
|
|
64
80
|
.seams-profile-dropdown-menu .seams-lock-menu-item {
|
|
65
81
|
border: 1px solid var(--seams-colors-borderPrimary);
|
|
@@ -72,9 +88,19 @@
|
|
|
72
88
|
}
|
|
73
89
|
@media (hover: hover) {
|
|
74
90
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(:disabled):hover {
|
|
75
|
-
color: var(--seams-colors-textSecondary);
|
|
76
91
|
background: transparent;
|
|
77
92
|
}
|
|
93
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(:disabled):hover::before {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
}
|
|
96
|
+
.seams-profile-dropdown-menu .seams-lock-menu-item:not(:disabled):hover {
|
|
97
|
+
background: var(--seams-colors-surface2);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
@media (prefers-reduced-motion: reduce) {
|
|
101
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item::before {
|
|
102
|
+
transition: none;
|
|
103
|
+
}
|
|
78
104
|
}
|
|
79
105
|
|
|
80
106
|
@media (pointer: coarse) {
|
|
@@ -284,6 +284,9 @@
|
|
|
284
284
|
.seams-account-method-button > div {
|
|
285
285
|
flex: 1;
|
|
286
286
|
}
|
|
287
|
+
.seams-account-method-button > .seams-hover-arrow {
|
|
288
|
+
margin-inline-end: 2px;
|
|
289
|
+
}
|
|
287
290
|
.seams-account-method-button strong {
|
|
288
291
|
font-size: 15px;
|
|
289
292
|
font-weight: 500;
|
|
@@ -294,47 +297,9 @@
|
|
|
294
297
|
color: var(--seams-colors-textSecondary);
|
|
295
298
|
font-size: 12px;
|
|
296
299
|
}
|
|
297
|
-
.seams-account-method-button > .seams-hover-arrow {
|
|
298
|
-
flex: 0 0 auto;
|
|
299
|
-
margin-inline-end: 2px;
|
|
300
|
-
fill: none;
|
|
301
|
-
stroke: currentColor;
|
|
302
|
-
stroke-width: 1.5;
|
|
303
|
-
color: var(--seams-colors-textSecondary);
|
|
304
|
-
transition: color 140ms ease;
|
|
305
|
-
}
|
|
306
|
-
.seams-hover-arrow-line {
|
|
307
|
-
opacity: 0;
|
|
308
|
-
filter: blur(2px);
|
|
309
|
-
transform: scaleX(0.45);
|
|
310
|
-
transform-origin: right center;
|
|
311
|
-
transition:
|
|
312
|
-
opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
313
|
-
filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
314
|
-
transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
315
|
-
}
|
|
316
|
-
.seams-hover-arrow-tip {
|
|
317
|
-
transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
318
|
-
}
|
|
319
|
-
.seams-account-method-button:hover > .seams-hover-arrow,
|
|
320
|
-
.seams-account-method-button:focus-visible > .seams-hover-arrow {
|
|
321
|
-
color: var(--seams-colors-textPrimary);
|
|
322
|
-
}
|
|
323
|
-
.seams-account-method-button:hover .seams-hover-arrow-line,
|
|
324
|
-
.seams-account-method-button:focus-visible .seams-hover-arrow-line {
|
|
325
|
-
opacity: 1;
|
|
326
|
-
filter: blur(0);
|
|
327
|
-
transform: scaleX(1);
|
|
328
|
-
}
|
|
329
|
-
.seams-account-method-button:hover .seams-hover-arrow-tip,
|
|
330
|
-
.seams-account-method-button:focus-visible .seams-hover-arrow-tip {
|
|
331
|
-
transform: translateX(3px);
|
|
332
|
-
}
|
|
333
300
|
@media (prefers-reduced-motion: reduce) {
|
|
334
301
|
.seams-account-method-button::before,
|
|
335
|
-
.seams-account-method-button .seams-account-avatar
|
|
336
|
-
.seams-hover-arrow-line,
|
|
337
|
-
.seams-hover-arrow-tip {
|
|
302
|
+
.seams-account-method-button .seams-account-avatar {
|
|
338
303
|
transition: none;
|
|
339
304
|
}
|
|
340
305
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* HoverArrowIcon: a chevron that grows a shaft (">" to "->") when its
|
|
2
|
+
direct parent is hovered or focused from the keyboard. */
|
|
3
|
+
|
|
4
|
+
.seams-hover-arrow {
|
|
5
|
+
flex: 0 0 auto;
|
|
6
|
+
fill: none;
|
|
7
|
+
stroke: currentColor;
|
|
8
|
+
stroke-width: 1.5;
|
|
9
|
+
color: var(--seams-colors-textSecondary);
|
|
10
|
+
transition: color 140ms ease;
|
|
11
|
+
}
|
|
12
|
+
.seams-hover-arrow-line {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
filter: blur(2px);
|
|
15
|
+
transform: scaleX(0.45);
|
|
16
|
+
transform-origin: right center;
|
|
17
|
+
transition:
|
|
18
|
+
opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
19
|
+
filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
20
|
+
transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
21
|
+
}
|
|
22
|
+
.seams-hover-arrow-tip {
|
|
23
|
+
transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
24
|
+
}
|
|
25
|
+
:hover > .seams-hover-arrow,
|
|
26
|
+
:focus-visible > .seams-hover-arrow {
|
|
27
|
+
color: var(--seams-colors-textPrimary);
|
|
28
|
+
}
|
|
29
|
+
:hover > .seams-hover-arrow .seams-hover-arrow-line,
|
|
30
|
+
:focus-visible > .seams-hover-arrow .seams-hover-arrow-line {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
filter: blur(0);
|
|
33
|
+
transform: scaleX(1);
|
|
34
|
+
}
|
|
35
|
+
:hover > .seams-hover-arrow .seams-hover-arrow-tip,
|
|
36
|
+
:focus-visible > .seams-hover-arrow .seams-hover-arrow-tip {
|
|
37
|
+
transform: translateX(3px);
|
|
38
|
+
}
|
|
39
|
+
@media (prefers-reduced-motion: reduce) {
|
|
40
|
+
.seams-hover-arrow,
|
|
41
|
+
.seams-hover-arrow-line,
|
|
42
|
+
.seams-hover-arrow-tip {
|
|
43
|
+
transition: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "./HoverArrowIcon.css";
|
|
3
4
|
//#region src/react/components/AccountMenuButton/icons/HoverArrowIcon.tsx
|
|
4
|
-
/** A chevron that grows a shaft on its parent's hover (">" to "->").
|
|
5
|
-
*
|
|
5
|
+
/** A chevron that grows a shaft on its parent's hover (">" to "->"). Place it
|
|
6
|
+
* as a direct child of the row that triggers it (HoverArrowIcon.css). */
|
|
6
7
|
function HoverArrowIcon({ size = 12 }) {
|
|
7
8
|
return /* @__PURE__ */ jsxs("svg", {
|
|
8
9
|
className: "seams-hover-arrow",
|
|
@@ -323,6 +323,8 @@
|
|
|
323
323
|
--seams-expander-surface: var(--seams-colors-surface2);
|
|
324
324
|
}
|
|
325
325
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item {
|
|
326
|
+
position: relative;
|
|
327
|
+
isolation: isolate;
|
|
326
328
|
min-height: 40px;
|
|
327
329
|
padding: 6px 0;
|
|
328
330
|
gap: 10px;
|
|
@@ -362,9 +364,23 @@
|
|
|
362
364
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item-content {
|
|
363
365
|
flex: 1;
|
|
364
366
|
}
|
|
365
|
-
.seams-
|
|
366
|
-
|
|
367
|
-
|
|
367
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item > .seams-hover-arrow {
|
|
368
|
+
margin-inline-end: 4px;
|
|
369
|
+
}
|
|
370
|
+
/* The hover shade bleeds past the row edges so the icons and labels stay
|
|
371
|
+
aligned with the group headings. */
|
|
372
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(.seams-lock-menu-item)::before {
|
|
373
|
+
content: '';
|
|
374
|
+
position: absolute;
|
|
375
|
+
z-index: -1;
|
|
376
|
+
inset: 1px -10px;
|
|
377
|
+
border-radius: var(--seams-shape-item, 10px);
|
|
378
|
+
background: var(--seams-colors-surface2);
|
|
379
|
+
opacity: 0;
|
|
380
|
+
transition: opacity 150ms ease;
|
|
381
|
+
}
|
|
382
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:focus-visible::before {
|
|
383
|
+
opacity: 1;
|
|
368
384
|
}
|
|
369
385
|
.seams-profile-dropdown-menu .seams-lock-menu-item {
|
|
370
386
|
border: 1px solid var(--seams-colors-borderPrimary);
|
|
@@ -377,9 +393,19 @@
|
|
|
377
393
|
}
|
|
378
394
|
@media (hover: hover) {
|
|
379
395
|
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(:disabled):hover {
|
|
380
|
-
color: var(--seams-colors-textSecondary);
|
|
381
396
|
background: transparent;
|
|
382
397
|
}
|
|
398
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item:not(:disabled):hover::before {
|
|
399
|
+
opacity: 1;
|
|
400
|
+
}
|
|
401
|
+
.seams-profile-dropdown-menu .seams-lock-menu-item:not(:disabled):hover {
|
|
402
|
+
background: var(--seams-colors-surface2);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
@media (prefers-reduced-motion: reduce) {
|
|
406
|
+
.seams-profile-dropdown-menu .seams-dropdown-menu-item::before {
|
|
407
|
+
transition: none;
|
|
408
|
+
}
|
|
383
409
|
}
|
|
384
410
|
|
|
385
411
|
@media (pointer: coarse) {
|
|
@@ -388,6 +414,52 @@
|
|
|
388
414
|
}
|
|
389
415
|
}
|
|
390
416
|
|
|
417
|
+
/* HoverArrowIcon: a chevron that grows a shaft (">" to "->") when its
|
|
418
|
+
direct parent is hovered or focused from the keyboard. */
|
|
419
|
+
|
|
420
|
+
.seams-hover-arrow {
|
|
421
|
+
flex: 0 0 auto;
|
|
422
|
+
fill: none;
|
|
423
|
+
stroke: currentColor;
|
|
424
|
+
stroke-width: 1.5;
|
|
425
|
+
color: var(--seams-colors-textSecondary);
|
|
426
|
+
transition: color 140ms ease;
|
|
427
|
+
}
|
|
428
|
+
.seams-hover-arrow-line {
|
|
429
|
+
opacity: 0;
|
|
430
|
+
filter: blur(2px);
|
|
431
|
+
transform: scaleX(0.45);
|
|
432
|
+
transform-origin: right center;
|
|
433
|
+
transition:
|
|
434
|
+
opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
435
|
+
filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
436
|
+
transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
437
|
+
}
|
|
438
|
+
.seams-hover-arrow-tip {
|
|
439
|
+
transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
440
|
+
}
|
|
441
|
+
:hover > .seams-hover-arrow,
|
|
442
|
+
:focus-visible > .seams-hover-arrow {
|
|
443
|
+
color: var(--seams-colors-textPrimary);
|
|
444
|
+
}
|
|
445
|
+
:hover > .seams-hover-arrow .seams-hover-arrow-line,
|
|
446
|
+
:focus-visible > .seams-hover-arrow .seams-hover-arrow-line {
|
|
447
|
+
opacity: 1;
|
|
448
|
+
filter: blur(0);
|
|
449
|
+
transform: scaleX(1);
|
|
450
|
+
}
|
|
451
|
+
:hover > .seams-hover-arrow .seams-hover-arrow-tip,
|
|
452
|
+
:focus-visible > .seams-hover-arrow .seams-hover-arrow-tip {
|
|
453
|
+
transform: translateX(3px);
|
|
454
|
+
}
|
|
455
|
+
@media (prefers-reduced-motion: reduce) {
|
|
456
|
+
.seams-hover-arrow,
|
|
457
|
+
.seams-hover-arrow-line,
|
|
458
|
+
.seams-hover-arrow-tip {
|
|
459
|
+
transition: none;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
391
463
|
/* TouchIcon specific styles and animations */
|
|
392
464
|
|
|
393
465
|
.seams-fingerprint-icon path {
|
|
@@ -1001,6 +1073,9 @@
|
|
|
1001
1073
|
.seams-account-method-button > div {
|
|
1002
1074
|
flex: 1;
|
|
1003
1075
|
}
|
|
1076
|
+
.seams-account-method-button > .seams-hover-arrow {
|
|
1077
|
+
margin-inline-end: 2px;
|
|
1078
|
+
}
|
|
1004
1079
|
.seams-account-method-button strong {
|
|
1005
1080
|
font-size: 15px;
|
|
1006
1081
|
font-weight: 500;
|
|
@@ -1011,47 +1086,9 @@
|
|
|
1011
1086
|
color: var(--seams-colors-textSecondary);
|
|
1012
1087
|
font-size: 12px;
|
|
1013
1088
|
}
|
|
1014
|
-
.seams-account-method-button > .seams-hover-arrow {
|
|
1015
|
-
flex: 0 0 auto;
|
|
1016
|
-
margin-inline-end: 2px;
|
|
1017
|
-
fill: none;
|
|
1018
|
-
stroke: currentColor;
|
|
1019
|
-
stroke-width: 1.5;
|
|
1020
|
-
color: var(--seams-colors-textSecondary);
|
|
1021
|
-
transition: color 140ms ease;
|
|
1022
|
-
}
|
|
1023
|
-
.seams-hover-arrow-line {
|
|
1024
|
-
opacity: 0;
|
|
1025
|
-
filter: blur(2px);
|
|
1026
|
-
transform: scaleX(0.45);
|
|
1027
|
-
transform-origin: right center;
|
|
1028
|
-
transition:
|
|
1029
|
-
opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
1030
|
-
filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
|
|
1031
|
-
transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
1032
|
-
}
|
|
1033
|
-
.seams-hover-arrow-tip {
|
|
1034
|
-
transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
1035
|
-
}
|
|
1036
|
-
.seams-account-method-button:hover > .seams-hover-arrow,
|
|
1037
|
-
.seams-account-method-button:focus-visible > .seams-hover-arrow {
|
|
1038
|
-
color: var(--seams-colors-textPrimary);
|
|
1039
|
-
}
|
|
1040
|
-
.seams-account-method-button:hover .seams-hover-arrow-line,
|
|
1041
|
-
.seams-account-method-button:focus-visible .seams-hover-arrow-line {
|
|
1042
|
-
opacity: 1;
|
|
1043
|
-
filter: blur(0);
|
|
1044
|
-
transform: scaleX(1);
|
|
1045
|
-
}
|
|
1046
|
-
.seams-account-method-button:hover .seams-hover-arrow-tip,
|
|
1047
|
-
.seams-account-method-button:focus-visible .seams-hover-arrow-tip {
|
|
1048
|
-
transform: translateX(3px);
|
|
1049
|
-
}
|
|
1050
1089
|
@media (prefers-reduced-motion: reduce) {
|
|
1051
1090
|
.seams-account-method-button::before,
|
|
1052
|
-
.seams-account-method-button .seams-account-avatar
|
|
1053
|
-
.seams-hover-arrow-line,
|
|
1054
|
-
.seams-hover-arrow-tip {
|
|
1091
|
+
.seams-account-method-button .seams-account-avatar {
|
|
1055
1092
|
transition: none;
|
|
1056
1093
|
}
|
|
1057
1094
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@import './components/AccountMenuButton/ExportKeysSection.css';
|
|
5
5
|
@import './components/AccountMenuButton/MenuItem.css';
|
|
6
6
|
@import './components/AccountMenuButton/ProfileDropdown.css';
|
|
7
|
+
@import './components/AccountMenuButton/icons/HoverArrowIcon.css';
|
|
7
8
|
@import './components/AccountMenuButton/icons/TouchIcon.css';
|
|
8
9
|
@import './components/AccountMenuButton/TransactionSettingsSection.css';
|
|
9
10
|
@import './components/AccountMenuButton/UserAccountButton.css';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t}from"./chains-C_X_fNuS.js";import{n}from"./walletRegistrationSetupPrewarm-B9kpnrbK.js";import{t as r}from"./walletDbName-DtRewci9.js";import{_ as i,b as a,c as o,d as s,g as c,i as l,m as u,n as d,r as f,t as p,u as m,v as ee,y as te}from"./sessionObservationRevision-CnEOLDbl.js";import{a as h,c as g,i as _,l as ne,n as v,o as re,s as y,t as ie,u as ae}from"./transactionReviewAdmission-CIvR4W5_.js";import{t as b}from"./events-1dzC4Ocx.js";import{t as x}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as S}from"./errors-DIWY1KR9.js";import{t as C}from"./signer-worker-DlK58rEA.js";function w(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function T(){w(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),oe(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&c(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;u()||i(r)}function oe(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const E={};let D=null,O=null;function se(e){return e.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?(D??=import(`./runtime-recovery-codes-GOytzExh.js`),D):k(e.kind)}function ce(){k(`auth`).catch(le)}function le(){}function k(e){let t=E[e];if(t)return t;let n=M(e);return E[e]=n,n.catch(A.bind(null,e,n)),n}function A(e,t){E[e]===t&&delete E[e]}async function j(){D??=import(`./runtime-recovery-codes-GOytzExh.js`),O??=Promise.all([D,import(`./mountRecoveryCodeBackupSurface-DlEb3uD7.js`)]).then(()=>void 0),await O}function M(e){switch(e){case`auth`:return import(`./runtime-auth-ZcxkQ-XF.js`);case`near`:return import(`./runtime-near-J3hKjC7G.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-AGjT7Xpa.js`);case`email_otp`:return import(`./runtime-email-otp-BpBOuSsT.js`);case`recovery`:return import(`./runtime-recovery-BzewdcoT.js`);case`export`:return import(`./runtime-export-CBsacCPY.js`);case`device_link`:return import(`./runtime-device-link-Dq8g_UNb.js`);case`preferences`:return import(`./runtime-preferences-CVt5sLvm.js`)}return N(e)}function N(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function P(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function F(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:p(),walletId:null,state:{kind:`wallet_locked`},session:d()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:C,revision:0}}}let I=null;function L(){return I??=z().finally(R),I}function R(){I=null}async function z(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(B)?await V():!0}catch{return!1}}function B(e){return e.name===r}function V(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),H(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function H(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function U(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return x(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function ue(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(s(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(o(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_UNLOCK`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return U(e)}function de(e){return e.kind!==`boot`}let K=!1;const fe=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function pe(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function J(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function Y(e){try{e.close()}catch{}}function me(e,t){if(t===`16.0.0`)return!1;let n={expectedProtocolVersion:l,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:f,message:`Wallet iframe protocol version mismatch: expected ${l}, received ${t??`missing`}`,details:n}})}catch{}return Y(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,T(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&j().catch(()=>void 0);let r=new Set,i=new Set,o=!1,s={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},c=e=>{try{s.port?.postMessage(e)}catch{}},u=e=>{e&&r.add(e)},d=e=>!!e&&(r.has(e)||_(e)?.cancelled===!0),f=e=>{e&&r.delete(e)},p=e=>{e&&c({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},m=e=>!e||!d(e)?!1:_(e)?.cancelled?!0:(p(e),f(e),!0),x=()=>{for(let e of fe){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(b.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},C=async r=>{let l=r.data;if(!l||!t(l))return;let b=l.requestId,C=s.executionGeneration,w=Z.bind(null,s,C,c),T=null;try{if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new h(`review_invalid_input`,`Review is unsupported for this request`);let e=g(l.transactionReview);if(e.requestId!==b)throw new h(`review_invalid_input`,`Review request identity mismatch`);let t=l.payload?.options?.confirmationConfig;if(t?.uiMode!==`modal`||t.behavior!==`requireClick`)throw new h(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);T=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>w({type:`TRANSACTION_REVIEW_STATE`,requestId:b,payload:e}),e=>w({type:`ERROR`,requestId:b,payload:{code:e instanceof h?e.code:`cancelled`,message:e.message}}))}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&v(new h(`review_identity_changed`,`The wallet session changed`));let t=ue(l);if(!de(t))switch(t.type){case`PING`:c({type:`PONG`,requestId:b});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&ce(),c({type:`PONG`,requestId:b});return;case`PM_SET_CONFIG`:{let e=ee(s.configuration,te(t.request.payload)),r=a(s.configuration.kind===`configured`?s.configuration.config:null)!==a(e.config);if(s.configuration=e,r){s.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of i)c({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});i.clear()}s.onConfigurationChanged?.(),r&&(v(new h(`review_identity_changed`,`Wallet execution configuration changed`)),x()),c({type:`PONG`,requestId:b});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=y(t.request.payload);e&&_(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=t.request.payload?.requestId,n=t.request.payload,r=n&&typeof n==`object`?Reflect.get(n,`transactionReview`):void 0;if(r!==void 0){let t=g(r),i=_(t.requestId);if(t.requestId===e&&i&&ne(t,i.metadata)){let e=new h(ae(n&&typeof n==`object`?Reflect.get(n,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{re(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}c({type:`PONG`,requestId:b});return}let i=e?_(e):void 0;if(i){i.cancel(new h(`cancelled`,`Request cancelled`)),c({type:`PONG`,requestId:b});return}u(e),x(),e&&p(e),c({type:`PONG`,requestId:b});return}case`PM_SET_TRANSACTION_VIEW`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,r=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof n==`string`&&(r===`toast`||r===`closed`)&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).setTransactionActivityView(n,r);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof n==`string`&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).transactionBroadcastStarted(n);return}}if(!X(t.kind,e.supportedRuntimeRouteKinds)){c({type:`ERROR`,requestId:b,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${t.type}`}});return}if(b&&i.add(b),!o&&P(t)&&await L()&&!o){if(C!==s.executionGeneration||m(b))return;w({type:`PM_RESULT`,requestId:b,payload:{ok:!0,result:F(t)}});return}o=!0;let r=await se(t);if(C!==s.executionGeneration)return;await r.handleWalletHostRuntimeRequest({transactionReview:T,state:s,executionGeneration:C,req:t.request,post:Z.bind(null,s,C,c),isCancelled:Q.bind(null,s,C,d),respondIfCancelled:Q.bind(null,s,C,m)})}catch(e){if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`||T?.cancelled)return;let t=await import(`./canonicalSignerErrorCode-Cz48v4oy.js`);if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=S(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);c({type:`ERROR`,requestId:b,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{b&&(i.delete(b),f(b)),T?.finish()}};window.addEventListener(`message`,e=>{let t=pe(e.data),n=e.ports[0];if(!(!t||!n||s.port)){if(e.source!==window.parent||!J(e.origin)){Y(n);return}if(!me(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(s.parentOrigin=e.origin),s.port=n;try{s.port.onmessage=C,s.port.start?.()}catch{}c({type:`READY`,payload:{protocolVersion:l}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};
|
|
1
|
+
import{C as e,S as t}from"./chains-C_X_fNuS.js";import{n}from"./walletRegistrationSetupPrewarm-B9kpnrbK.js";import{t as r}from"./walletDbName-DtRewci9.js";import{_ as i,b as a,c as o,d as s,g as c,i as l,m as u,n as d,r as f,t as p,u as m,v as ee,y as te}from"./sessionObservationRevision-CnEOLDbl.js";import{a as h,c as g,i as _,l as ne,n as v,o as re,s as y,t as ie,u as ae}from"./transactionReviewAdmission-CIvR4W5_.js";import{t as b}from"./events-1dzC4Ocx.js";import{t as x}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as S}from"./errors-DIWY1KR9.js";import{t as C}from"./signer-worker-DlK58rEA.js";function w(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function T(){w(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),oe(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&c(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;u()||i(r)}function oe(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const E={};let D=null,O=null;function se(e){return e.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?(D??=import(`./runtime-recovery-codes-GOytzExh.js`),D):k(e.kind)}function ce(){k(`auth`).catch(le)}function le(){}function k(e){let t=E[e];if(t)return t;let n=M(e);return E[e]=n,n.catch(A.bind(null,e,n)),n}function A(e,t){E[e]===t&&delete E[e]}async function j(){D??=import(`./runtime-recovery-codes-GOytzExh.js`),O??=Promise.all([D,import(`./mountRecoveryCodeBackupSurface-DlEb3uD7.js`)]).then(()=>void 0),await O}function M(e){switch(e){case`auth`:return import(`./runtime-auth--i_j8PP7.js`);case`near`:return import(`./runtime-near-Bjrz1KYf.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-AE5QTaXu.js`);case`email_otp`:return import(`./runtime-email-otp-Dl03QI-O.js`);case`recovery`:return import(`./runtime-recovery-DBBKvIIg.js`);case`export`:return import(`./runtime-export-F9s12UcT.js`);case`device_link`:return import(`./runtime-device-link-fpvaxYyR.js`);case`preferences`:return import(`./runtime-preferences-oLRSEqmz.js`)}return N(e)}function N(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function P(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function F(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:p(),walletId:null,state:{kind:`wallet_locked`},session:d()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:C,revision:0}}}let I=null;function L(){return I??=z().finally(R),I}function R(){I=null}async function z(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(B)?await V():!0}catch{return!1}}function B(e){return e.name===r}function V(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),H(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function H(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function U(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return x(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function ue(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(s(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(o(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_UNLOCK`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return U(e)}function de(e){return e.kind!==`boot`}let K=!1;const fe=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function pe(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function J(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function Y(e){try{e.close()}catch{}}function me(e,t){if(t===`16.0.0`)return!1;let n={expectedProtocolVersion:l,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:f,message:`Wallet iframe protocol version mismatch: expected ${l}, received ${t??`missing`}`,details:n}})}catch{}return Y(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,T(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&j().catch(()=>void 0);let r=new Set,i=new Set,o=!1,s={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},c=e=>{try{s.port?.postMessage(e)}catch{}},u=e=>{e&&r.add(e)},d=e=>!!e&&(r.has(e)||_(e)?.cancelled===!0),f=e=>{e&&r.delete(e)},p=e=>{e&&c({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},m=e=>!e||!d(e)?!1:_(e)?.cancelled?!0:(p(e),f(e),!0),x=()=>{for(let e of fe){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(b.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},C=async r=>{let l=r.data;if(!l||!t(l))return;let b=l.requestId,C=s.executionGeneration,w=Z.bind(null,s,C,c),T=null;try{if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new h(`review_invalid_input`,`Review is unsupported for this request`);let e=g(l.transactionReview);if(e.requestId!==b)throw new h(`review_invalid_input`,`Review request identity mismatch`);let t=l.payload?.options?.confirmationConfig;if(t?.uiMode!==`modal`||t.behavior!==`requireClick`)throw new h(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);T=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>w({type:`TRANSACTION_REVIEW_STATE`,requestId:b,payload:e}),e=>w({type:`ERROR`,requestId:b,payload:{code:e instanceof h?e.code:`cancelled`,message:e.message}}))}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&v(new h(`review_identity_changed`,`The wallet session changed`));let t=ue(l);if(!de(t))switch(t.type){case`PING`:c({type:`PONG`,requestId:b});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&ce(),c({type:`PONG`,requestId:b});return;case`PM_SET_CONFIG`:{let e=ee(s.configuration,te(t.request.payload)),r=a(s.configuration.kind===`configured`?s.configuration.config:null)!==a(e.config);if(s.configuration=e,r){s.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of i)c({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});i.clear()}s.onConfigurationChanged?.(),r&&(v(new h(`review_identity_changed`,`Wallet execution configuration changed`)),x()),c({type:`PONG`,requestId:b});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=y(t.request.payload);e&&_(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=t.request.payload?.requestId,n=t.request.payload,r=n&&typeof n==`object`?Reflect.get(n,`transactionReview`):void 0;if(r!==void 0){let t=g(r),i=_(t.requestId);if(t.requestId===e&&i&&ne(t,i.metadata)){let e=new h(ae(n&&typeof n==`object`?Reflect.get(n,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{re(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}c({type:`PONG`,requestId:b});return}let i=e?_(e):void 0;if(i){i.cancel(new h(`cancelled`,`Request cancelled`)),c({type:`PONG`,requestId:b});return}u(e),x(),e&&p(e),c({type:`PONG`,requestId:b});return}case`PM_SET_TRANSACTION_VIEW`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,r=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof n==`string`&&(r===`toast`||r===`closed`)&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).setTransactionActivityView(n,r);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof n==`string`&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).transactionBroadcastStarted(n);return}}if(!X(t.kind,e.supportedRuntimeRouteKinds)){c({type:`ERROR`,requestId:b,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${t.type}`}});return}if(b&&i.add(b),!o&&P(t)&&await L()&&!o){if(C!==s.executionGeneration||m(b))return;w({type:`PM_RESULT`,requestId:b,payload:{ok:!0,result:F(t)}});return}o=!0;let r=await se(t);if(C!==s.executionGeneration)return;await r.handleWalletHostRuntimeRequest({transactionReview:T,state:s,executionGeneration:C,req:t.request,post:Z.bind(null,s,C,c),isCancelled:Q.bind(null,s,C,d),respondIfCancelled:Q.bind(null,s,C,m)})}catch(e){if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`||T?.cancelled)return;let t=await import(`./canonicalSignerErrorCode-Cz48v4oy.js`);if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=S(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);c({type:`ERROR`,requestId:b,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{b&&(i.delete(b),f(b)),T?.finish()}};window.addEventListener(`message`,e=>{let t=pe(e.data),n=e.ports[0];if(!(!t||!n||s.port)){if(e.source!==window.parent||!J(e.origin)){Y(n);return}if(!me(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(s.parentOrigin=e.origin),s.port=n;try{s.port.onmessage=C,s.port.start?.()}catch{}c({type:`READY`,payload:{protocolVersion:l}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};
|