@shadow-corp/nearconnect 1.0.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/README.md +546 -0
- package/build/InjectedWallet.d.ts +22 -0
- package/build/InjectedWallet.js +58 -0
- package/build/InjectedWallet.js.map +1 -0
- package/build/NearConnector.d.ts +151 -0
- package/build/NearConnector.js +536 -0
- package/build/NearConnector.js.map +1 -0
- package/build/ParentFrameWallet.d.ts +22 -0
- package/build/ParentFrameWallet.js +66 -0
- package/build/ParentFrameWallet.js.map +1 -0
- package/build/SandboxedWallet/code.d.ts +7 -0
- package/build/SandboxedWallet/code.js +324 -0
- package/build/SandboxedWallet/code.js.map +1 -0
- package/build/SandboxedWallet/executor.d.ts +23 -0
- package/build/SandboxedWallet/executor.js +338 -0
- package/build/SandboxedWallet/executor.js.map +1 -0
- package/build/SandboxedWallet/iframe.d.ts +18 -0
- package/build/SandboxedWallet/iframe.js +78 -0
- package/build/SandboxedWallet/iframe.js.map +1 -0
- package/build/SandboxedWallet/index.d.ts +24 -0
- package/build/SandboxedWallet/index.js +54 -0
- package/build/SandboxedWallet/index.js.map +1 -0
- package/build/actions/index.d.ts +3 -0
- package/build/actions/index.js +105 -0
- package/build/actions/index.js.map +1 -0
- package/build/actions/types.d.ts +76 -0
- package/build/actions/types.js +3 -0
- package/build/actions/types.js.map +1 -0
- package/build/connection/health.d.ts +213 -0
- package/build/connection/health.js +391 -0
- package/build/connection/health.js.map +1 -0
- package/build/connection/index.d.ts +4 -0
- package/build/connection/index.js +48 -0
- package/build/connection/index.js.map +1 -0
- package/build/connection/reconnect.d.ts +261 -0
- package/build/connection/reconnect.js +454 -0
- package/build/connection/reconnect.js.map +1 -0
- package/build/connection/retry.d.ts +187 -0
- package/build/connection/retry.js +427 -0
- package/build/connection/retry.js.map +1 -0
- package/build/connection/state.d.ts +222 -0
- package/build/connection/state.js +431 -0
- package/build/connection/state.js.map +1 -0
- package/build/errors.d.ts +177 -0
- package/build/errors.js +546 -0
- package/build/errors.js.map +1 -0
- package/build/hardware/errors.d.ts +36 -0
- package/build/hardware/errors.js +127 -0
- package/build/hardware/errors.js.map +1 -0
- package/build/hardware/index.d.ts +7 -0
- package/build/hardware/index.js +39 -0
- package/build/hardware/index.js.map +1 -0
- package/build/hardware/near-app.d.ts +95 -0
- package/build/hardware/near-app.js +291 -0
- package/build/hardware/near-app.js.map +1 -0
- package/build/hardware/transport.d.ts +94 -0
- package/build/hardware/transport.js +267 -0
- package/build/hardware/transport.js.map +1 -0
- package/build/hardware/types.d.ts +98 -0
- package/build/hardware/types.js +72 -0
- package/build/hardware/types.js.map +1 -0
- package/build/helpers/analytics.d.ts +191 -0
- package/build/helpers/analytics.js +304 -0
- package/build/helpers/analytics.js.map +1 -0
- package/build/helpers/base58.d.ts +6 -0
- package/build/helpers/base58.js +47 -0
- package/build/helpers/base58.js.map +1 -0
- package/build/helpers/events.d.ts +42 -0
- package/build/helpers/events.js +68 -0
- package/build/helpers/events.js.map +1 -0
- package/build/helpers/html.d.ts +8 -0
- package/build/helpers/html.js +30 -0
- package/build/helpers/html.js.map +1 -0
- package/build/helpers/indexdb.d.ts +14 -0
- package/build/helpers/indexdb.js +166 -0
- package/build/helpers/indexdb.js.map +1 -0
- package/build/helpers/manifest.d.ts +147 -0
- package/build/helpers/manifest.js +329 -0
- package/build/helpers/manifest.js.map +1 -0
- package/build/helpers/queue.d.ts +11 -0
- package/build/helpers/queue.js +48 -0
- package/build/helpers/queue.js.map +1 -0
- package/build/helpers/session.d.ts +119 -0
- package/build/helpers/session.js +289 -0
- package/build/helpers/session.js.map +1 -0
- package/build/helpers/simulation.d.ts +128 -0
- package/build/helpers/simulation.js +441 -0
- package/build/helpers/simulation.js.map +1 -0
- package/build/helpers/storage.d.ts +58 -0
- package/build/helpers/storage.js +190 -0
- package/build/helpers/storage.js.map +1 -0
- package/build/helpers/trust.d.ts +157 -0
- package/build/helpers/trust.js +340 -0
- package/build/helpers/trust.js.map +1 -0
- package/build/helpers/url.d.ts +1 -0
- package/build/helpers/url.js +13 -0
- package/build/helpers/url.js.map +1 -0
- package/build/helpers/uuid.d.ts +1 -0
- package/build/helpers/uuid.js +14 -0
- package/build/helpers/uuid.js.map +1 -0
- package/build/index.d.ts +21 -0
- package/build/index.js +167 -0
- package/build/index.js.map +1 -0
- package/build/popups/IframeWalletPopup.d.ts +16 -0
- package/build/popups/IframeWalletPopup.js +38 -0
- package/build/popups/IframeWalletPopup.js.map +1 -0
- package/build/popups/NearWalletsPopup.d.ts +25 -0
- package/build/popups/NearWalletsPopup.js +153 -0
- package/build/popups/NearWalletsPopup.js.map +1 -0
- package/build/popups/Popup.d.ts +22 -0
- package/build/popups/Popup.js +94 -0
- package/build/popups/Popup.js.map +1 -0
- package/build/popups/styles.d.ts +1 -0
- package/build/popups/styles.js +257 -0
- package/build/popups/styles.js.map +1 -0
- package/build/security/audit-log.d.ts +123 -0
- package/build/security/audit-log.js +268 -0
- package/build/security/audit-log.js.map +1 -0
- package/build/security/csp.d.ts +68 -0
- package/build/security/csp.js +328 -0
- package/build/security/csp.js.map +1 -0
- package/build/security/index.d.ts +10 -0
- package/build/security/index.js +42 -0
- package/build/security/index.js.map +1 -0
- package/build/security/origin-guard.d.ts +90 -0
- package/build/security/origin-guard.js +244 -0
- package/build/security/origin-guard.js.map +1 -0
- package/build/security/rate-limiter.d.ts +84 -0
- package/build/security/rate-limiter.js +212 -0
- package/build/security/rate-limiter.js.map +1 -0
- package/build/security/secure-storage.d.ts +77 -0
- package/build/security/secure-storage.js +242 -0
- package/build/security/secure-storage.js.map +1 -0
- package/build/security/transaction-guard.d.ts +71 -0
- package/build/security/transaction-guard.js +239 -0
- package/build/security/transaction-guard.js.map +1 -0
- package/build/types.d.ts +508 -0
- package/build/types.js +3 -0
- package/build/types.js.map +1 -0
- package/build/ui/AccountSwitcherModal.d.ts +53 -0
- package/build/ui/AccountSwitcherModal.js +239 -0
- package/build/ui/AccountSwitcherModal.js.map +1 -0
- package/build/ui/Modal.d.ts +84 -0
- package/build/ui/Modal.js +278 -0
- package/build/ui/Modal.js.map +1 -0
- package/build/ui/TransactionModal.d.ts +84 -0
- package/build/ui/TransactionModal.js +406 -0
- package/build/ui/TransactionModal.js.map +1 -0
- package/build/ui/WalletSelectorModal.d.ts +97 -0
- package/build/ui/WalletSelectorModal.js +481 -0
- package/build/ui/WalletSelectorModal.js.map +1 -0
- package/build/ui/icons.d.ts +19 -0
- package/build/ui/icons.js +65 -0
- package/build/ui/icons.js.map +1 -0
- package/build/ui/index.d.ts +10 -0
- package/build/ui/index.js +31 -0
- package/build/ui/index.js.map +1 -0
- package/build/ui/styles.d.ts +5 -0
- package/build/ui/styles.js +973 -0
- package/build/ui/styles.js.map +1 -0
- package/build/ui/theme.d.ts +133 -0
- package/build/ui/theme.js +204 -0
- package/build/ui/theme.js.map +1 -0
- package/build/wallets/external/index.d.ts +4 -0
- package/build/wallets/external/index.js +9 -0
- package/build/wallets/external/index.js.map +1 -0
- package/build/wallets/external/manager.d.ts +152 -0
- package/build/wallets/external/manager.js +586 -0
- package/build/wallets/external/manager.js.map +1 -0
- package/build/wallets/privileged/index.d.ts +5 -0
- package/build/wallets/privileged/index.js +12 -0
- package/build/wallets/privileged/index.js.map +1 -0
- package/build/wallets/privileged/ledger.d.ts +132 -0
- package/build/wallets/privileged/ledger.js +563 -0
- package/build/wallets/privileged/ledger.js.map +1 -0
- package/build/wallets/privileged/manager.d.ts +54 -0
- package/build/wallets/privileged/manager.js +174 -0
- package/build/wallets/privileged/manager.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Popup = void 0;
|
|
4
|
+
const styles_1 = require("./styles");
|
|
5
|
+
const html_1 = require("../helpers/html");
|
|
6
|
+
const ID = `n${Math.random().toString(36).substring(2, 15)}`;
|
|
7
|
+
if (typeof document !== "undefined") {
|
|
8
|
+
const style = document.createElement("style");
|
|
9
|
+
style.textContent = (0, styles_1.css)(`.${ID}`);
|
|
10
|
+
document.head.append(style);
|
|
11
|
+
}
|
|
12
|
+
class Popup {
|
|
13
|
+
delegate;
|
|
14
|
+
isClosed = false;
|
|
15
|
+
root = document.createElement("div");
|
|
16
|
+
state = {};
|
|
17
|
+
constructor(delegate) {
|
|
18
|
+
this.delegate = delegate;
|
|
19
|
+
}
|
|
20
|
+
get dom() {
|
|
21
|
+
return (0, html_1.html) ``;
|
|
22
|
+
}
|
|
23
|
+
disposables = [];
|
|
24
|
+
addListener(querySelector, event, callback) {
|
|
25
|
+
const element = typeof querySelector === "string" ? this.root.querySelector(querySelector) : querySelector;
|
|
26
|
+
if (!element)
|
|
27
|
+
return;
|
|
28
|
+
element.addEventListener(event, callback);
|
|
29
|
+
this.disposables.push(() => element.removeEventListener(event, callback));
|
|
30
|
+
}
|
|
31
|
+
handlers() {
|
|
32
|
+
this.disposables.forEach((dispose) => dispose());
|
|
33
|
+
this.disposables = [];
|
|
34
|
+
const modalContainer = this.root.querySelector(".modal-container");
|
|
35
|
+
const modalContent = this.root.querySelector(".modal-content");
|
|
36
|
+
const getWalletLink = this.root.querySelector(".get-wallet-link");
|
|
37
|
+
modalContent.onclick = (e) => e.stopPropagation();
|
|
38
|
+
getWalletLink.onclick = () => window.open("https://download.hot-labs.org?hotconnector", "_blank");
|
|
39
|
+
modalContainer.onclick = () => {
|
|
40
|
+
this.delegate.onReject();
|
|
41
|
+
this.destroy();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
update(state) {
|
|
45
|
+
this.state = { ...this.state, ...state };
|
|
46
|
+
this.root.innerHTML = this.dom.html;
|
|
47
|
+
this.handlers();
|
|
48
|
+
}
|
|
49
|
+
create({ show = true }) {
|
|
50
|
+
this.root.className = `${ID} hot-connector-popup`;
|
|
51
|
+
this.root.innerHTML = this.dom.html;
|
|
52
|
+
document.body.append(this.root);
|
|
53
|
+
this.handlers();
|
|
54
|
+
const modalContainer = this.root.querySelector(".modal-container");
|
|
55
|
+
const modalContent = this.root.querySelector(".modal-content");
|
|
56
|
+
modalContent.style.transform = "translateY(50px)";
|
|
57
|
+
modalContainer.style.opacity = "0";
|
|
58
|
+
this.root.style.display = "none";
|
|
59
|
+
if (show) {
|
|
60
|
+
setTimeout(() => this.show(), 10);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
show() {
|
|
64
|
+
const modalContainer = this.root.querySelector(".modal-container");
|
|
65
|
+
const modalContent = this.root.querySelector(".modal-content");
|
|
66
|
+
modalContent.style.transform = "translateY(50px)";
|
|
67
|
+
modalContainer.style.opacity = "0";
|
|
68
|
+
this.root.style.display = "block";
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
modalContent.style.transform = "translateY(0)";
|
|
71
|
+
modalContainer.style.opacity = "1";
|
|
72
|
+
}, 100);
|
|
73
|
+
}
|
|
74
|
+
hide() {
|
|
75
|
+
const modalContainer = this.root.querySelector(".modal-container");
|
|
76
|
+
const modalContent = this.root.querySelector(".modal-content");
|
|
77
|
+
modalContent.style.transform = "translateY(50px)";
|
|
78
|
+
modalContainer.style.opacity = "0";
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
this.root.style.display = "none";
|
|
81
|
+
}, 200);
|
|
82
|
+
}
|
|
83
|
+
destroy() {
|
|
84
|
+
if (this.isClosed)
|
|
85
|
+
return;
|
|
86
|
+
this.isClosed = true;
|
|
87
|
+
this.hide();
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
this.root.remove();
|
|
90
|
+
}, 200);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.Popup = Popup;
|
|
94
|
+
//# sourceMappingURL=Popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../src/popups/Popup.ts"],"names":[],"mappings":";;;AAAA,qCAA+B;AAC/B,0CAAuC;AAEvC,MAAM,EAAE,GAAG,IAAI,IAAI,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KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QAEnC,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QACnC,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;CACF;AA1FD,sBA0FC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const css: (id: string) => string;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.css = void 0;
|
|
4
|
+
const css = (id) => /*css*/ `
|
|
5
|
+
${id} * {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
8
|
+
-ms-overflow-style: none;
|
|
9
|
+
scrollbar-width: none;
|
|
10
|
+
color: #fff;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
${id} *::-webkit-scrollbar {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
${id} p, h1, h2, h3, h4, h5, h6 {
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${id} .modal-container {
|
|
22
|
+
position: fixed;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
z-index: 100000000;
|
|
28
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
transition: opacity 0.2s ease-in-out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (max-width: 600px) {
|
|
37
|
+
${id} .modal-container {
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${id} .modal-content {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
|
|
47
|
+
max-width: 420px;
|
|
48
|
+
max-height: 615px;
|
|
49
|
+
width: 100%;
|
|
50
|
+
border-radius: 24px;
|
|
51
|
+
background: #0d0d0d;
|
|
52
|
+
border: 1.5px solid rgba(255, 255, 255, 0.1);
|
|
53
|
+
transition: transform 0.2s ease-in-out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (max-width: 600px) {
|
|
57
|
+
${id} .modal-content {
|
|
58
|
+
max-width: 100%;
|
|
59
|
+
width: 100%;
|
|
60
|
+
max-height: 80%;
|
|
61
|
+
border-bottom-left-radius: 0;
|
|
62
|
+
border-bottom-right-radius: 0;
|
|
63
|
+
border: none;
|
|
64
|
+
border-top: 1.5px solid rgba(255, 255, 255, 0.1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
${id} .modal-header {
|
|
70
|
+
display: flex;
|
|
71
|
+
padding: 16px;
|
|
72
|
+
gap: 16px;
|
|
73
|
+
align-self: stretch;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
${id} .modal-header button {
|
|
80
|
+
position: absolute;
|
|
81
|
+
right: 16px;
|
|
82
|
+
top: 16px;
|
|
83
|
+
width: 32px;
|
|
84
|
+
height: 32px;
|
|
85
|
+
border-radius: 12px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
transition: background 0.2s ease-in-out;
|
|
88
|
+
border: none;
|
|
89
|
+
background: none;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
${id} .modal-header button:hover {
|
|
96
|
+
background: rgba(255, 255, 255, 0.04);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
${id} .modal-header p {
|
|
100
|
+
color: #fff;
|
|
101
|
+
text-align: center;
|
|
102
|
+
font-size: 24px;
|
|
103
|
+
font-style: normal;
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
line-height: normal;
|
|
106
|
+
margin: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
${id} .modal-body {
|
|
111
|
+
display: flex;
|
|
112
|
+
padding: 16px;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
align-items: flex-start;
|
|
115
|
+
text-align: center;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
overflow: auto;
|
|
118
|
+
|
|
119
|
+
border-radius: 24px;
|
|
120
|
+
background: rgba(255, 255, 255, 0.08);
|
|
121
|
+
width: 100%;
|
|
122
|
+
flex: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
${id} .modal-body textarea {
|
|
126
|
+
width: 100%;
|
|
127
|
+
padding: 12px;
|
|
128
|
+
border-radius: 12px;
|
|
129
|
+
background: #0d0d0d;
|
|
130
|
+
color: #fff;
|
|
131
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
132
|
+
outline: none;
|
|
133
|
+
font-size: 16px;
|
|
134
|
+
transition: background 0.2s ease-in-out;
|
|
135
|
+
font-family: monospace;
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
${id} .modal-body button {
|
|
140
|
+
width: 100%;
|
|
141
|
+
padding: 12px;
|
|
142
|
+
border-radius: 12px;
|
|
143
|
+
background: #fff;
|
|
144
|
+
color: #000;
|
|
145
|
+
border: none;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
font-size: 16px;
|
|
148
|
+
transition: background 0.2s ease-in-out;
|
|
149
|
+
margin-top: 16px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
${id} .footer {
|
|
153
|
+
width: 100%;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: flex-start;
|
|
157
|
+
padding: 16px 24px;
|
|
158
|
+
color: #fff;
|
|
159
|
+
gap: 12px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
${id} .modal-body p {
|
|
163
|
+
color: rgba(255, 255, 255, 0.9);
|
|
164
|
+
text-align: center;
|
|
165
|
+
font-size: 16px;
|
|
166
|
+
font-style: normal;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
line-height: normal;
|
|
169
|
+
letter-spacing: -0.8px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
${id} .footer img {
|
|
173
|
+
width: 24px;
|
|
174
|
+
height: 24px;
|
|
175
|
+
border-radius: 50%;
|
|
176
|
+
object-fit: cover;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
${id} .get-wallet-link {
|
|
180
|
+
color: rgba(255, 255, 255, 0.5);
|
|
181
|
+
text-align: center;
|
|
182
|
+
font-size: 16px;
|
|
183
|
+
font-style: normal;
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
margin-left: auto;
|
|
186
|
+
text-decoration: none;
|
|
187
|
+
transition: color 0.2s ease-in-out;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
${id} .get-wallet-link:hover {
|
|
192
|
+
color: rgba(255, 255, 255, 1);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
${id} .connect-item {
|
|
197
|
+
display: flex;
|
|
198
|
+
padding: 8px;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: 12px;
|
|
201
|
+
align-self: stretch;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
|
|
204
|
+
transition: background 0.2s ease-in-out;
|
|
205
|
+
border-radius: 24px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
${id} .connect-item img {
|
|
209
|
+
width: 48px;
|
|
210
|
+
height: 48px;
|
|
211
|
+
border-radius: 16px;
|
|
212
|
+
object-fit: cover;
|
|
213
|
+
flex-shrink: 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
${id} .connect-item-info {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
align-items: flex-start;
|
|
220
|
+
gap: 4px;
|
|
221
|
+
text-align: left;
|
|
222
|
+
flex: 1;
|
|
223
|
+
margin-top: -2px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
${id} .connect-item-info .wallet-address {
|
|
227
|
+
color: rgba(255, 255, 255, 0.5);
|
|
228
|
+
font-size: 14px;
|
|
229
|
+
font-style: normal;
|
|
230
|
+
font-weight: 400;
|
|
231
|
+
line-height: normal;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
${id} .connect-item:hover {
|
|
235
|
+
background: rgba(255, 255, 255, 0.04);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
${id} .connect-item img {
|
|
239
|
+
width: 48px;
|
|
240
|
+
height: 48px;
|
|
241
|
+
border-radius: 16px;
|
|
242
|
+
object-fit: cover;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
${id} .connect-item p {
|
|
246
|
+
color: rgba(255, 255, 255, 0.9);
|
|
247
|
+
text-align: center;
|
|
248
|
+
font-size: 18px;
|
|
249
|
+
font-style: normal;
|
|
250
|
+
font-weight: 600;
|
|
251
|
+
line-height: normal;
|
|
252
|
+
letter-spacing: -0.36px;
|
|
253
|
+
margin: 0;
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
256
|
+
exports.css = css;
|
|
257
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/popups/styles.ts"],"names":[],"mappings":";;;AAAO,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC;EACzC,EAAE;;;;;;;;EAQF,EAAE;;;;EAIF,EAAE;;;;EAIF,EAAE;;;;;;;;;;;;;;;;IAgBA,EAAE;;;;;EAKJ,EAAE;;;;;;;;;;;;;;;IAeA,EAAE;;;;;;;;;;;;EAYJ,EAAE;;;;;;;;;;EAUF,EAAE;;;;;;;;;;;;;;;;EAgBF,EAAE;;;;EAIF,EAAE;;;;;;;;;;;EAWF,EAAE;;;;;;;;;;;;;;;EAeF,EAAE;;;;;;;;;;;;;;EAcF,EAAE;;;;;;;;;;;;;EAaF,EAAE;;;;;;;;;;EAUF,EAAE;;;;;;;;;;EAUF,EAAE;;;;;;;EAOF,EAAE;;;;;;;;;;;;EAYF,EAAE;;;;;EAKF,EAAE;;;;;;;;;;;;EAYF,EAAE;;;;;;;;EAQF,EAAE;;;;;;;;;;EAUF,EAAE;;;;;;;;EAQF,EAAE;;;;EAIF,EAAE;;;;;;;EAOF,EAAE;;;;;;;;;;CAUH,CAAC;AA3PW,QAAA,GAAG,OA2Pd"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Logging Layer
|
|
3
|
+
* Tracks all wallet actions for investigation and compliance
|
|
4
|
+
*/
|
|
5
|
+
export type AuditEventType = 'wallet:connect' | 'wallet:disconnect' | 'wallet:switch' | 'tx:sign' | 'tx:broadcast' | 'tx:blocked' | 'tx:failed' | 'message:sign' | 'security:violation' | 'security:warning' | 'rate:limited' | 'session:create' | 'session:restore' | 'session:expire' | 'hardware:connect' | 'hardware:disconnect' | 'hardware:error';
|
|
6
|
+
export interface AuditEvent {
|
|
7
|
+
/** Unique event ID */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Event timestamp */
|
|
10
|
+
timestamp: number;
|
|
11
|
+
/** Event type */
|
|
12
|
+
type: AuditEventType;
|
|
13
|
+
/** Wallet ID involved */
|
|
14
|
+
walletId?: string;
|
|
15
|
+
/** Account ID involved */
|
|
16
|
+
accountId?: string;
|
|
17
|
+
/** Additional event data */
|
|
18
|
+
data?: Record<string, unknown>;
|
|
19
|
+
/** Risk level if applicable */
|
|
20
|
+
risk?: 'low' | 'medium' | 'high' | 'critical';
|
|
21
|
+
/** User agent string */
|
|
22
|
+
userAgent?: string;
|
|
23
|
+
/** Session ID */
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface AuditLogConfig {
|
|
27
|
+
/** Enable/disable audit logging */
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
/** Maximum events to keep in memory */
|
|
30
|
+
maxEvents?: number;
|
|
31
|
+
/** Remote endpoint to send events */
|
|
32
|
+
remoteEndpoint?: string;
|
|
33
|
+
/** Headers for remote endpoint */
|
|
34
|
+
remoteHeaders?: Record<string, string>;
|
|
35
|
+
/** Callback for each event */
|
|
36
|
+
onEvent?: (event: AuditEvent) => void;
|
|
37
|
+
/** Whether to log to console */
|
|
38
|
+
consoleLog?: boolean;
|
|
39
|
+
/** Event types to log (all if not specified) */
|
|
40
|
+
eventTypes?: AuditEventType[];
|
|
41
|
+
/** Whether to persist to localStorage */
|
|
42
|
+
persist?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare class AuditLog {
|
|
45
|
+
private events;
|
|
46
|
+
private config;
|
|
47
|
+
private sessionId;
|
|
48
|
+
private remoteQueue;
|
|
49
|
+
private flushTimeout;
|
|
50
|
+
constructor(config?: AuditLogConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Log an audit event
|
|
53
|
+
*/
|
|
54
|
+
log(type: AuditEventType, data?: Partial<Omit<AuditEvent, 'id' | 'timestamp' | 'type'>>): AuditEvent | null;
|
|
55
|
+
/**
|
|
56
|
+
* Log a security violation
|
|
57
|
+
*/
|
|
58
|
+
logSecurityViolation(message: string, data?: Record<string, unknown>, risk?: AuditEvent['risk']): AuditEvent | null;
|
|
59
|
+
/**
|
|
60
|
+
* Log a security warning
|
|
61
|
+
*/
|
|
62
|
+
logSecurityWarning(message: string, data?: Record<string, unknown>): AuditEvent | null;
|
|
63
|
+
/**
|
|
64
|
+
* Log a transaction
|
|
65
|
+
*/
|
|
66
|
+
logTransaction(type: 'tx:sign' | 'tx:broadcast' | 'tx:blocked' | 'tx:failed', txData: {
|
|
67
|
+
walletId?: string;
|
|
68
|
+
accountId?: string;
|
|
69
|
+
receiverId?: string;
|
|
70
|
+
hash?: string;
|
|
71
|
+
error?: string;
|
|
72
|
+
risk?: AuditEvent['risk'];
|
|
73
|
+
}): AuditEvent | null;
|
|
74
|
+
/**
|
|
75
|
+
* Get events with optional filtering
|
|
76
|
+
*/
|
|
77
|
+
getEvents(filter?: {
|
|
78
|
+
type?: AuditEventType | AuditEventType[];
|
|
79
|
+
since?: number;
|
|
80
|
+
until?: number;
|
|
81
|
+
walletId?: string;
|
|
82
|
+
accountId?: string;
|
|
83
|
+
risk?: AuditEvent['risk'] | AuditEvent['risk'][];
|
|
84
|
+
limit?: number;
|
|
85
|
+
}): AuditEvent[];
|
|
86
|
+
/**
|
|
87
|
+
* Get security-related events
|
|
88
|
+
*/
|
|
89
|
+
getSecurityEvents(): AuditEvent[];
|
|
90
|
+
/**
|
|
91
|
+
* Get events for a specific session
|
|
92
|
+
*/
|
|
93
|
+
getSessionEvents(sessionId?: string): AuditEvent[];
|
|
94
|
+
/**
|
|
95
|
+
* Export events as JSON
|
|
96
|
+
*/
|
|
97
|
+
export(filter?: Parameters<typeof this.getEvents>[0]): string;
|
|
98
|
+
/**
|
|
99
|
+
* Export events as CSV
|
|
100
|
+
*/
|
|
101
|
+
exportCsv(filter?: Parameters<typeof this.getEvents>[0]): string;
|
|
102
|
+
/**
|
|
103
|
+
* Clear all events
|
|
104
|
+
*/
|
|
105
|
+
clear(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Get current session ID
|
|
108
|
+
*/
|
|
109
|
+
getSessionId(): string;
|
|
110
|
+
/**
|
|
111
|
+
* Flush remote queue immediately
|
|
112
|
+
*/
|
|
113
|
+
flushRemote(): Promise<void>;
|
|
114
|
+
private isSecurityEvent;
|
|
115
|
+
private consoleLogEvent;
|
|
116
|
+
private queueRemote;
|
|
117
|
+
private persistEvents;
|
|
118
|
+
private loadPersistedEvents;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create an audit log with default configuration
|
|
122
|
+
*/
|
|
123
|
+
export declare function createAuditLog(config?: Partial<AuditLogConfig>): AuditLog;
|