@hot-labs/kit 1.2.0-alpha.2 → 1.2.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 +2 -9
- package/build/HotConnector.d.ts +8 -7
- package/build/HotConnector.js +21 -24
- package/build/HotConnector.js.map +1 -1
- package/build/OmniConnector.d.ts +5 -0
- package/build/OmniConnector.js +5 -5
- package/build/OmniConnector.js.map +1 -1
- package/build/OmniWallet.d.ts +10 -17
- package/build/OmniWallet.js +14 -19
- package/build/OmniWallet.js.map +1 -1
- package/build/core/Intents.d.ts +53 -43
- package/build/core/Intents.js +207 -133
- package/build/core/Intents.js.map +1 -1
- package/build/core/api.d.ts +30 -2
- package/build/core/api.js +43 -10
- package/build/core/api.js.map +1 -1
- package/build/core/bridge.js +1 -1
- package/build/core/bridge.js.map +1 -1
- package/build/core/index.d.ts +1 -1
- package/build/core/index.js +1 -1
- package/build/core/index.js.map +1 -1
- package/build/core/telemetry.d.ts +13 -0
- package/build/core/telemetry.js +27 -0
- package/build/core/telemetry.js.map +1 -0
- package/build/core/token.d.ts +1 -0
- package/build/core/token.js +3 -0
- package/build/core/token.js.map +1 -1
- package/build/core/tokens.js +0 -8
- package/build/core/tokens.js.map +1 -1
- package/build/core/types.d.ts +17 -0
- package/build/core/utils.d.ts +1 -0
- package/build/core/utils.js +21 -1
- package/build/core/utils.js.map +1 -1
- package/build/cosmos/connector.d.ts +2 -2
- package/build/cosmos/connector.js +17 -21
- package/build/cosmos/connector.js.map +1 -1
- package/build/cosmos/wallet.d.ts +2 -4
- package/build/cosmos/wallet.js +3 -8
- package/build/cosmos/wallet.js.map +1 -1
- package/build/evm/connector.d.ts +1 -0
- package/build/evm/connector.js +4 -0
- package/build/evm/connector.js.map +1 -1
- package/build/evm/wallet.d.ts +2 -1
- package/build/evm/wallet.js +7 -5
- package/build/evm/wallet.js.map +1 -1
- package/build/exchange.d.ts +4 -1
- package/build/exchange.js +24 -30
- package/build/exchange.js.map +1 -1
- package/build/hot-wallet/google.js +10 -5
- package/build/hot-wallet/google.js.map +1 -1
- package/build/hot-wallet/proxy.js +2 -2
- package/build/hot-wallet/proxy.js.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/near/connector.js +2 -2
- package/build/near/connector.js.map +1 -1
- package/build/{core/nearRpc.d.ts → near/rpc.d.ts} +0 -1
- package/build/{core/nearRpc.js → near/rpc.js} +8 -22
- package/build/near/rpc.js.map +1 -0
- package/build/near/wallet.d.ts +4 -4
- package/build/near/wallet.js +36 -30
- package/build/near/wallet.js.map +1 -1
- package/build/solana/{protocol.d.ts → WalletStandard.d.ts} +1 -1
- package/build/solana/{protocol.js → WalletStandard.js} +1 -1
- package/build/solana/WalletStandard.js.map +1 -0
- package/build/solana/connector.d.ts +1 -1
- package/build/solana/connector.js +9 -8
- package/build/solana/connector.js.map +1 -1
- package/build/solana/injected/solana-wallet.js.map +1 -1
- package/build/solana/wallet.d.ts +5 -7
- package/build/solana/wallet.js +8 -17
- package/build/solana/wallet.js.map +1 -1
- package/build/solana/{wallets.js → walletStandartList.js} +1 -1
- package/build/solana/walletStandartList.js.map +1 -0
- package/build/stellar/connector.d.ts +0 -2
- package/build/stellar/connector.js +1 -4
- package/build/stellar/connector.js.map +1 -1
- package/build/stellar/wallet.d.ts +10 -8
- package/build/stellar/wallet.js +12 -16
- package/build/stellar/wallet.js.map +1 -1
- package/build/ton/connector.d.ts +0 -1
- package/build/ton/connector.js +1 -4
- package/build/ton/connector.js.map +1 -1
- package/build/ton/wallet.d.ts +2 -3
- package/build/ton/wallet.js +3 -4
- package/build/ton/wallet.js.map +1 -1
- package/build/tron/connector.d.ts +51 -0
- package/build/tron/connector.js +65 -0
- package/build/tron/connector.js.map +1 -0
- package/build/tron/index.d.ts +6 -0
- package/build/tron/index.js +5 -0
- package/build/tron/index.js.map +1 -0
- package/build/tron/wallet.d.ts +52 -0
- package/build/tron/wallet.js +122 -0
- package/build/tron/wallet.js.map +1 -0
- package/build/ui/Popup.d.ts +2 -2
- package/build/ui/Popup.js +5 -1
- package/build/ui/Popup.js.map +1 -1
- package/build/ui/bridge/Bridge.js +389 -0
- package/build/ui/bridge/Bridge.js.map +1 -0
- package/build/ui/{payment → bridge}/SelectRecipient.js +3 -3
- package/build/ui/bridge/SelectRecipient.js.map +1 -0
- package/build/ui/{payment → bridge}/SelectSender.js +2 -2
- package/build/ui/bridge/SelectSender.js.map +1 -0
- package/build/ui/{payment → bridge}/SelectToken.js +4 -3
- package/build/ui/bridge/SelectToken.js.map +1 -0
- package/build/ui/{payment → bridge}/TokenCard.d.ts +7 -9
- package/build/ui/bridge/TokenCard.js +65 -0
- package/build/ui/bridge/TokenCard.js.map +1 -0
- package/build/ui/connect/AuthPopup.js +1 -1
- package/build/ui/connect/AuthPopup.js.map +1 -1
- package/build/ui/connect/ConnectWallet.d.ts +7 -2
- package/build/ui/connect/ConnectWallet.js +7 -7
- package/build/ui/connect/ConnectWallet.js.map +1 -1
- package/build/ui/connect/PrimaryWallet.d.ts +6 -0
- package/build/ui/connect/PrimaryWallet.js +18 -0
- package/build/ui/connect/PrimaryWallet.js.map +1 -0
- package/build/ui/connect/WCRequest.js +1 -1
- package/build/ui/connect/WCRequest.js.map +1 -1
- package/build/ui/connect/WalletPicker.js +1 -1
- package/build/ui/connect/WalletPicker.js.map +1 -1
- package/build/ui/icons/arrow-right.d.ts +3 -1
- package/build/ui/icons/arrow-right.js +3 -3
- package/build/ui/icons/arrow-right.js.map +1 -1
- package/build/ui/icons/close.js +1 -1
- package/build/ui/icons/close.js.map +1 -1
- package/build/ui/icons/exchange.d.ts +3 -4
- package/build/ui/icons/exchange.js +2 -2
- package/build/ui/icons/exchange.js.map +1 -1
- package/build/ui/icons/logout.js +1 -1
- package/build/ui/icons/logout.js.map +1 -1
- package/build/ui/icons/pending.js +1 -1
- package/build/ui/icons/pending.js.map +1 -1
- package/build/ui/icons/plus.d.ts +2 -0
- package/build/ui/icons/plus.js +6 -0
- package/build/ui/icons/plus.js.map +1 -0
- package/build/ui/icons/qr.js +1 -1
- package/build/ui/icons/qr.js.map +1 -1
- package/build/ui/icons/refresh.d.ts +2 -0
- package/build/ui/icons/refresh.js +6 -0
- package/build/ui/icons/refresh.js.map +1 -0
- package/build/ui/icons/search.js +1 -1
- package/build/ui/icons/search.js.map +1 -1
- package/build/ui/icons/switch.js +1 -1
- package/build/ui/icons/switch.js.map +1 -1
- package/build/ui/icons/wallet.js +1 -1
- package/build/ui/icons/wallet.js.map +1 -1
- package/build/ui/{payment → profile}/DepositQR.js.map +1 -1
- package/build/ui/profile/Payment.d.ts +23 -0
- package/build/ui/profile/Payment.js +150 -0
- package/build/ui/profile/Payment.js.map +1 -0
- package/build/ui/profile/Profile.d.ts +7 -0
- package/build/ui/profile/Profile.js +135 -0
- package/build/ui/profile/Profile.js.map +1 -0
- package/build/ui/router.d.ts +19 -5
- package/build/ui/router.js +21 -9
- package/build/ui/router.js.map +1 -1
- package/build/ui/styles.js +4 -11
- package/build/ui/styles.js.map +1 -1
- package/build/ui/uikit/Stepper.d.ts +13 -0
- package/build/ui/uikit/Stepper.js +22 -0
- package/build/ui/uikit/Stepper.js.map +1 -0
- package/build/ui/uikit/Toast.d.ts +4 -0
- package/build/ui/uikit/Toast.js +33 -0
- package/build/ui/uikit/Toast.js.map +1 -0
- package/build/ui/uikit/button.d.ts +2 -0
- package/build/ui/uikit/button.js +52 -0
- package/build/ui/uikit/button.js.map +1 -0
- package/build/ui/uikit/image.d.ts +6 -0
- package/build/ui/uikit/image.js +38 -0
- package/build/ui/uikit/image.js.map +1 -0
- package/build/ui/uikit/loader.d.ts +2 -0
- package/build/ui/uikit/loader.js +50 -0
- package/build/ui/uikit/loader.js.map +1 -0
- package/build/ui/uikit/tabs.d.ts +12 -0
- package/build/ui/uikit/tabs.js +35 -0
- package/build/ui/uikit/tabs.js.map +1 -0
- package/build/ui/uikit/text.d.ts +6 -0
- package/build/ui/uikit/text.js +59 -0
- package/build/ui/uikit/text.js.map +1 -0
- package/build/ui/utils.d.ts +1 -0
- package/build/ui/utils.js +20 -0
- package/build/ui/utils.js.map +1 -0
- package/package.json +8 -4
- package/src/HotConnector.ts +24 -31
- package/src/OmniConnector.ts +10 -9
- package/src/OmniWallet.ts +24 -25
- package/src/core/Intents.ts +222 -151
- package/src/core/api.ts +56 -10
- package/src/core/bridge.ts +3 -2
- package/src/core/index.ts +1 -1
- package/src/core/telemetry.ts +28 -0
- package/src/core/token.ts +4 -0
- package/src/core/tokens.ts +0 -9
- package/src/core/types.ts +21 -0
- package/src/core/utils.ts +17 -1
- package/src/cosmos/connector.ts +22 -26
- package/src/cosmos/wallet.ts +3 -8
- package/src/evm/connector.ts +5 -0
- package/src/evm/wallet.ts +9 -6
- package/src/exchange.ts +24 -30
- package/src/hot-wallet/google.ts +12 -5
- package/src/hot-wallet/proxy.ts +2 -2
- package/src/index.ts +3 -1
- package/src/near/connector.ts +2 -2
- package/src/{core/nearRpc.ts → near/rpc.ts} +9 -23
- package/src/near/wallet.ts +39 -31
- package/src/solana/{protocol.ts → WalletStandard.ts} +2 -4
- package/src/solana/connector.ts +9 -8
- package/src/solana/injected/solana-wallet.ts +6 -6
- package/src/solana/wallet.ts +11 -20
- package/src/stellar/connector.ts +1 -6
- package/src/stellar/wallet.ts +17 -17
- package/src/ton/connector.ts +1 -5
- package/src/ton/wallet.ts +3 -3
- package/src/tron/connector.ts +89 -0
- package/src/tron/index.ts +7 -0
- package/src/tron/wallet.ts +146 -0
- package/src/ui/Popup.tsx +12 -4
- package/src/ui/{payment → bridge}/Bridge.tsx +266 -212
- package/src/ui/{payment → bridge}/SelectRecipient.tsx +5 -4
- package/src/ui/{payment → bridge}/SelectSender.tsx +5 -5
- package/src/ui/{payment → bridge}/SelectToken.tsx +6 -4
- package/src/ui/bridge/TokenCard.tsx +99 -0
- package/src/ui/connect/AuthPopup.tsx +1 -1
- package/src/ui/connect/ConnectWallet.tsx +16 -10
- package/src/ui/connect/PrimaryWallet.tsx +65 -0
- package/src/ui/connect/WCRequest.tsx +1 -1
- package/src/ui/connect/WalletPicker.tsx +1 -1
- package/src/ui/icons/arrow-right.tsx +3 -4
- package/src/ui/icons/close.tsx +1 -1
- package/src/ui/icons/exchange.tsx +4 -11
- package/src/ui/icons/logout.tsx +4 -13
- package/src/ui/icons/pending.tsx +2 -4
- package/src/ui/icons/plus.tsx +12 -0
- package/src/ui/icons/qr.tsx +1 -2
- package/src/ui/icons/refresh.tsx +20 -0
- package/src/ui/icons/search.tsx +4 -4
- package/src/ui/icons/switch.tsx +4 -4
- package/src/ui/icons/wallet.tsx +2 -4
- package/src/ui/profile/Payment.tsx +309 -0
- package/src/ui/{payment → profile}/Profile.tsx +110 -70
- package/src/ui/router.tsx +57 -17
- package/src/ui/styles.ts +4 -11
- package/src/ui/uikit/Stepper.tsx +50 -0
- package/src/ui/uikit/Toast.tsx +45 -0
- package/src/ui/uikit/button.tsx +53 -0
- package/src/ui/uikit/image.tsx +45 -0
- package/src/ui/uikit/loader.tsx +52 -0
- package/src/ui/uikit/tabs.tsx +56 -0
- package/src/ui/uikit/text.tsx +64 -0
- package/src/ui/utils.ts +14 -0
- package/build/core/nearRpc.js.map +0 -1
- package/build/solana/protocol.js.map +0 -1
- package/build/solana/wallets.js.map +0 -1
- package/build/ui/payment/Bridge.js +0 -358
- package/build/ui/payment/Bridge.js.map +0 -1
- package/build/ui/payment/Payment.d.ts +0 -16
- package/build/ui/payment/Payment.js +0 -50
- package/build/ui/payment/Payment.js.map +0 -1
- package/build/ui/payment/Profile.d.ts +0 -8
- package/build/ui/payment/Profile.js +0 -110
- package/build/ui/payment/Profile.js.map +0 -1
- package/build/ui/payment/SelectRecipient.js.map +0 -1
- package/build/ui/payment/SelectSender.js.map +0 -1
- package/build/ui/payment/SelectToken.js.map +0 -1
- package/build/ui/payment/TokenCard.js +0 -63
- package/build/ui/payment/TokenCard.js.map +0 -1
- package/src/ui/payment/Payment.tsx +0 -79
- package/src/ui/payment/TokenCard.tsx +0 -98
- package/build/solana/{wallets.d.ts → walletStandartList.d.ts} +0 -0
- package/build/ui/{payment → bridge}/Bridge.d.ts +3 -3
- package/build/ui/{payment → bridge}/SelectRecipient.d.ts +0 -0
- package/build/ui/{payment → bridge}/SelectSender.d.ts +2 -2
- package/build/ui/{payment → bridge}/SelectToken.d.ts +1 -1
- /package/build/ui/{payment → profile}/DepositQR.d.ts +0 -0
- /package/build/ui/{payment → profile}/DepositQR.js +0 -0
- /package/src/solana/{wallets.ts → walletStandartList.ts} +0 -0
- /package/src/ui/{payment → profile}/DepositQR.tsx +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
export const ActionButton = styled.button `
|
|
3
|
+
display: flex;
|
|
4
|
+
padding: 0 24px;
|
|
5
|
+
border-radius: 12px;
|
|
6
|
+
background: #e7e7e7;
|
|
7
|
+
border: none;
|
|
8
|
+
outline: none;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
transition: background 0.2s ease-in-out;
|
|
11
|
+
height: 48px;
|
|
12
|
+
min-height: 48px;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
flex: 1;
|
|
18
|
+
width: 100%;
|
|
19
|
+
|
|
20
|
+
color: #121212;
|
|
21
|
+
text-align: center;
|
|
22
|
+
font-family: "Golos Text";
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
line-height: 22px;
|
|
27
|
+
letter-spacing: -0.16px;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
background: #d2d2d2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:disabled {
|
|
34
|
+
background: #3e3e3e;
|
|
35
|
+
color: #828282;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
export const Button = styled.button `
|
|
40
|
+
padding: 0;
|
|
41
|
+
margin: 0;
|
|
42
|
+
border: none;
|
|
43
|
+
background: transparent;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
outline: none;
|
|
46
|
+
transition: 0.2s opacity;
|
|
47
|
+
|
|
48
|
+
&:hover {
|
|
49
|
+
opacity: 0.8;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/ui/uikit/button.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCxC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;CAYlC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
const images = {
|
|
4
|
+
cached: new Map(),
|
|
5
|
+
cache(url) {
|
|
6
|
+
if (this.cached.has(url))
|
|
7
|
+
return this.cached.get(url);
|
|
8
|
+
const promise = new Promise((resolve, reject) => {
|
|
9
|
+
const img = new Image();
|
|
10
|
+
img.src = url;
|
|
11
|
+
img.onload = () => resolve();
|
|
12
|
+
img.onerror = () => reject(new Error("Failed to load image"));
|
|
13
|
+
});
|
|
14
|
+
this.cached.set(url, promise);
|
|
15
|
+
return promise;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
var ImageState;
|
|
19
|
+
(function (ImageState) {
|
|
20
|
+
ImageState["Loading"] = "loading";
|
|
21
|
+
ImageState["Loaded"] = "loaded";
|
|
22
|
+
ImageState["Error"] = "error";
|
|
23
|
+
})(ImageState || (ImageState = {}));
|
|
24
|
+
export const ImageView = ({ src, size = 40, alt, style }) => {
|
|
25
|
+
const [icon, setIcon] = useState(ImageState.Loading);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setIcon(ImageState.Loading);
|
|
28
|
+
images
|
|
29
|
+
.cache(src)
|
|
30
|
+
.then(() => setIcon(ImageState.Loaded))
|
|
31
|
+
.catch(() => setIcon(ImageState.Error));
|
|
32
|
+
}, [src]);
|
|
33
|
+
if (icon === ImageState.Loaded) {
|
|
34
|
+
return _jsx("img", { src: src, alt: alt, style: { objectFit: "contain", width: size, height: size, borderRadius: "50%", ...style } });
|
|
35
|
+
}
|
|
36
|
+
return (_jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: size, height: size, borderRadius: "50%", backgroundColor: "#0e0e0e", ...style }, children: _jsx("p", { style: { fontWeight: "bold", fontSize: size / 2, color: "#ffffff" }, children: alt.charAt(0)?.toUpperCase() }) }));
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/ui/uikit/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,IAAI,GAAG,EAAyB;IACxC,KAAK,CAAC,GAAW;QACf,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpD,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;YACd,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;YAC7B,GAAG,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;AACjB,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAA4E,EAAE,EAAE;IACpI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAa,UAAU,CAAC,OAAO,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC5B,MAAM;aACH,KAAK,CAAC,GAAG,CAAC;aACV,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aACtC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,IAAI,IAAI,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;QAC/B,OAAO,cAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAI,CAAC;IAChI,CAAC;IAED,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,YACnK,YAAG,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,YAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAK,GACtG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const Loader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const Skeleton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import styled, { keyframes } from "styled-components";
|
|
2
|
+
export const Loader = styled.div `
|
|
3
|
+
border: 4px solid #2a2a2a;
|
|
4
|
+
border-top: 4px solid #fff;
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
width: 24px;
|
|
7
|
+
height: 24px;
|
|
8
|
+
animation: spin 0.9s linear infinite;
|
|
9
|
+
margin: 0 auto;
|
|
10
|
+
|
|
11
|
+
@keyframes spin {
|
|
12
|
+
0% {
|
|
13
|
+
transform: rotate(0deg);
|
|
14
|
+
}
|
|
15
|
+
100% {
|
|
16
|
+
transform: rotate(360deg);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const shine = keyframes `
|
|
21
|
+
0% {
|
|
22
|
+
background-position: -200px 0;
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
background-position: calc(200px + 100%) 0;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
export const Skeleton = styled.div `
|
|
29
|
+
display: inline-block;
|
|
30
|
+
width: 100px;
|
|
31
|
+
height: 40px;
|
|
32
|
+
border-radius: 8px;
|
|
33
|
+
background: #2e2e2e;
|
|
34
|
+
position: relative;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
|
|
37
|
+
&:after {
|
|
38
|
+
content: "";
|
|
39
|
+
display: block;
|
|
40
|
+
height: 100%;
|
|
41
|
+
width: 100%;
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
background: linear-gradient(90deg, rgba(34, 34, 34, 0) 0%, rgba(255, 255, 255, 0.06) 40%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.06) 60%, rgba(34, 34, 34, 0) 100%);
|
|
46
|
+
background-size: 200px 100%;
|
|
47
|
+
animation: ${shine} 1.4s infinite linear;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/ui/uikit/loader.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiB/B,CAAC;AAEF,MAAM,KAAK,GAAG,SAAS,CAAA;;;;;;;CAOtB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;iBAmBjB,KAAK;;CAErB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface SegmentedControlProps {
|
|
2
|
+
options: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
background?: string;
|
|
7
|
+
}[];
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const SegmentedControl: ({ options, value, onChange }: SegmentedControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
const SegmentedControl = ({ options, value, onChange }) => {
|
|
4
|
+
return (_jsx(Tabs, { children: options.map((option) => (_jsx(Tab, { onClick: () => onChange(option.value), "$active": option.value === value, style: {
|
|
5
|
+
background: option.value === value ? option.background || "#1D1F20" : "transparent",
|
|
6
|
+
color: option.value === value ? option.color : "#6b6661",
|
|
7
|
+
}, children: option.label }, option.value))) }));
|
|
8
|
+
};
|
|
9
|
+
const Tabs = styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
border-radius: 16px;
|
|
12
|
+
border: 1px solid var(--border-lowest-solid, #242627);
|
|
13
|
+
padding: 0;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
height: 40px;
|
|
16
|
+
padding: 2px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
`;
|
|
19
|
+
const Tab = styled.button `
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
border-radius: 14px;
|
|
25
|
+
height: 100%;
|
|
26
|
+
border: none;
|
|
27
|
+
outline: none;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
transition: 0.2s background-color;
|
|
30
|
+
flex: 1;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
`;
|
|
34
|
+
export default SegmentedControl;
|
|
35
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/ui/uikit/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAQvC,MAAM,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAyB,EAAE,EAAE;IAC/E,OAAO,CACL,KAAC,IAAI,cACF,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,KAAC,GAAG,IAEF,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,aAC5B,MAAM,CAAC,KAAK,KAAK,KAAK,EAC/B,KAAK,EAAE;gBACL,UAAU,EAAE,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,aAAa;gBACnF,KAAK,EAAE,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACzD,YAEA,MAAM,CAAC,KAAK,IARR,MAAM,CAAC,KAAK,CASb,CACP,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CAStB,CAAC;AAEF,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAuB;;;;;;;;;;;;;;CAc/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PSmall: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
2
|
+
export declare const PMedium: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
3
|
+
export declare const PLarge: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
4
|
+
export declare const PTiny: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
5
|
+
export declare const H5: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
6
|
+
export declare const H4: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
export const PSmall = styled.p `
|
|
3
|
+
color: var(--text-text-secondary, #bfbfbf);
|
|
4
|
+
font-family: var(--font-family-text, "Golos Text");
|
|
5
|
+
font-size: var(--P-Small-font-size, 14px);
|
|
6
|
+
line-height: var(--P-Small-line-height, 20px); /* 142.857% */
|
|
7
|
+
letter-spacing: -0.14px;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
margin: 0;
|
|
11
|
+
`;
|
|
12
|
+
export const PMedium = styled.p `
|
|
13
|
+
color: var(--text-text-primary, #fff);
|
|
14
|
+
font-family: var(--font-family-text, "Golos Text");
|
|
15
|
+
font-size: var(--P-Default-font-size, 16px);
|
|
16
|
+
line-height: var(--P-Default-line-height, 22px); /* 137.5% */
|
|
17
|
+
letter-spacing: -0.16px;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
margin: 0;
|
|
20
|
+
`;
|
|
21
|
+
export const PLarge = styled.p `
|
|
22
|
+
color: var(--text-text-primary, #fff);
|
|
23
|
+
font-family: var(--font-family-text, "Golos Text");
|
|
24
|
+
font-size: var(--P-Large-font-size, 18px);
|
|
25
|
+
line-height: var(--P-Large-line-height, 24px); /* 133.333% */
|
|
26
|
+
font-style: normal;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
letter-spacing: -0.18px;
|
|
29
|
+
margin: 0;
|
|
30
|
+
`;
|
|
31
|
+
export const PTiny = styled.p `
|
|
32
|
+
color: var(--text-text-primary, #fff);
|
|
33
|
+
font-family: var(--font-family-text, "Golos Text");
|
|
34
|
+
font-size: var(--P-Tiny-font-size, 12px);
|
|
35
|
+
line-height: var(--P-Tiny-line-height, 16px);
|
|
36
|
+
letter-spacing: -0.12px;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: 400;
|
|
39
|
+
margin: 0;
|
|
40
|
+
`;
|
|
41
|
+
export const H5 = styled.h5 `
|
|
42
|
+
color: var(--text-text-tertiary, #fff);
|
|
43
|
+
font-family: var(--font-family-headings, "Golos Text");
|
|
44
|
+
font-size: var(--h5-font-size, 24px);
|
|
45
|
+
line-height: var(--h5-line-height, 32px);
|
|
46
|
+
font-style: normal;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
margin: 0;
|
|
49
|
+
`;
|
|
50
|
+
export const H4 = styled.h4 `
|
|
51
|
+
color: var(--text-text-primary, #fff);
|
|
52
|
+
font-family: var(--font-family-headings, "Golos Text");
|
|
53
|
+
font-size: var(--h4-font-size, 32px);
|
|
54
|
+
line-height: var(--h4-line-height, 44px);
|
|
55
|
+
font-style: normal;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
margin: 0;
|
|
58
|
+
`;
|
|
59
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/ui/uikit/text.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;;CAS7B,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;CAQ9B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;;CAS7B,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;;CAS5B,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;CAQ1B,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;CAQ1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const serializeError: (error: any) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NetworkError, TimeoutNetworkError } from "../core/api";
|
|
2
|
+
export const serializeError = (error) => {
|
|
3
|
+
try {
|
|
4
|
+
if (error instanceof Error)
|
|
5
|
+
return error.message;
|
|
6
|
+
if (error instanceof NetworkError)
|
|
7
|
+
return error.toString();
|
|
8
|
+
if (error instanceof TimeoutNetworkError)
|
|
9
|
+
return error.toString();
|
|
10
|
+
if (typeof error === "object" && Object.keys(error).length > 0)
|
|
11
|
+
return JSON.stringify(error);
|
|
12
|
+
if (typeof error === "string" || typeof error === "number")
|
|
13
|
+
return error.toString();
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return "Unknown error";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ui/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAU,EAAU,EAAE;IACnD,IAAI,CAAC;QACH,IAAI,KAAK,YAAY,KAAK;YAAE,OAAO,KAAK,CAAC,OAAO,CAAC;QACjD,IAAI,KAAK,YAAY,YAAY;YAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3D,IAAI,KAAK,YAAY,mBAAmB;YAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QAClE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpF,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,eAAe,CAAC;IACzB,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-labs/kit",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "HOT Labs Kit is chain agnostic connector with omni payments",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"./solana": "./build/solana/index.js",
|
|
18
18
|
"./stellar": "./build/stellar/index.js",
|
|
19
19
|
"./ton": "./build/ton/index.js",
|
|
20
|
+
"./tron": "./build/tron/index.js",
|
|
20
21
|
"./core": "./build/core/index.js"
|
|
21
22
|
},
|
|
22
23
|
"directories": {
|
|
@@ -31,28 +32,31 @@
|
|
|
31
32
|
"@cosmjs/stargate": "^0.37.0",
|
|
32
33
|
"@defuse-protocol/one-click-sdk-typescript": "^0.1.13",
|
|
33
34
|
"@hot-labs/near-connect": "^0.8.1",
|
|
34
|
-
"@hot-labs/omni-sdk": "^2.24.
|
|
35
|
+
"@hot-labs/omni-sdk": "^2.24.6",
|
|
35
36
|
"@keplr-wallet/proto-types": "^0.12.291",
|
|
36
37
|
"@keplr-wallet/provider-extension": "^0.12.291",
|
|
37
|
-
"@
|
|
38
|
+
"@lottiefiles/dotlottie-wc": "^0.8.11",
|
|
38
39
|
"@near-js/crypto": "^2.3.3",
|
|
39
40
|
"@near-js/providers": "^2.5.1",
|
|
40
41
|
"@near-js/utils": "^2.2.4",
|
|
41
42
|
"@noble/hashes": "^2.0.1",
|
|
42
43
|
"@scure/base": "^2.0.0",
|
|
43
44
|
"@solana/spl-token": "^0.4.14",
|
|
45
|
+
"@solana/wallet-standard-features": "^1.3.0",
|
|
44
46
|
"@stellar/freighter-api": "^6.0.1",
|
|
45
47
|
"@ton-api/client": "^0.4.0",
|
|
46
48
|
"@ton/core": "^0.62.0",
|
|
47
49
|
"@ton/crypto": "^3.3.0",
|
|
48
50
|
"@tonconnect/ui": "^2.2.0",
|
|
49
51
|
"@wallet-standard/base": "^1.1.0",
|
|
52
|
+
"@wallet-standard/features": "^1.1.0",
|
|
50
53
|
"@walletconnect/universal-provider": "^2.23.0",
|
|
51
54
|
"ethers": "^6.15.0",
|
|
52
55
|
"mobx": "^6.15.0",
|
|
53
56
|
"mobx-react-lite": "^4.1.1",
|
|
54
57
|
"qr-code-styling": "^1.9.2",
|
|
55
|
-
"styled-components": "^6.1.19"
|
|
58
|
+
"styled-components": "^6.1.19",
|
|
59
|
+
"uuid4": "^2.0.3"
|
|
56
60
|
},
|
|
57
61
|
"scripts": {
|
|
58
62
|
"build": "rm -rf build && yarn tsc",
|
package/src/HotConnector.ts
CHANGED
|
@@ -8,10 +8,12 @@ import { OmniToken } from "./core/chains";
|
|
|
8
8
|
import { formatter } from "./core/utils";
|
|
9
9
|
import { Intents } from "./core/Intents";
|
|
10
10
|
import { tokens } from "./core/tokens";
|
|
11
|
-
import {
|
|
11
|
+
import { Telemetry } from "./core/telemetry";
|
|
12
12
|
import { Token } from "./core/token";
|
|
13
13
|
import { api } from "./core/api";
|
|
14
|
+
import { rpc } from "./near/rpc";
|
|
14
15
|
|
|
16
|
+
import { defaultConnectors } from "./defaults";
|
|
15
17
|
import type CosmosWallet from "./cosmos/wallet";
|
|
16
18
|
import type NearWallet from "./near/wallet";
|
|
17
19
|
import type EvmWallet from "./evm/wallet";
|
|
@@ -19,7 +21,7 @@ import type SolanaWallet from "./solana/wallet";
|
|
|
19
21
|
import type StellarWallet from "./stellar/wallet";
|
|
20
22
|
import type TonWallet from "./ton/wallet";
|
|
21
23
|
|
|
22
|
-
import { openBridge, openConnector,
|
|
24
|
+
import { openBridge, openConnector, openProfile, openWalletPicker } from "./ui/router";
|
|
23
25
|
import { ConnectorType, OmniConnector } from "./OmniConnector";
|
|
24
26
|
import { OmniWallet } from "./OmniWallet";
|
|
25
27
|
import { Exchange } from "./exchange";
|
|
@@ -43,16 +45,15 @@ interface HotConnectorOptions {
|
|
|
43
45
|
export class HotConnector {
|
|
44
46
|
public connectors: OmniConnector[] = [];
|
|
45
47
|
public balances: Record<string, Record<string, bigint>> = {};
|
|
48
|
+
public telemetry: Telemetry;
|
|
46
49
|
|
|
47
50
|
public activity: Activity;
|
|
48
51
|
public hotBridge: HotBridge;
|
|
49
52
|
public exchange: Exchange;
|
|
50
53
|
|
|
51
|
-
readonly version = "1.0.58";
|
|
52
|
-
|
|
53
54
|
private events = new EventEmitter<{
|
|
54
|
-
connect: { wallet: OmniWallet };
|
|
55
|
-
disconnect: { wallet: OmniWallet };
|
|
55
|
+
connect: { wallet: OmniWallet; connector: OmniConnector };
|
|
56
|
+
disconnect: { wallet: OmniWallet; connector: OmniConnector };
|
|
56
57
|
tokensUpdate: { tokens: Token[] };
|
|
57
58
|
}>();
|
|
58
59
|
|
|
@@ -84,12 +85,14 @@ export class HotConnector {
|
|
|
84
85
|
this.settings.metadata = options?.walletConnect?.metadata ?? undefined;
|
|
85
86
|
Object.values(options?.chains ?? {}).forEach((chain) => chains.register(chain));
|
|
86
87
|
|
|
88
|
+
this.telemetry = new Telemetry(this);
|
|
87
89
|
this.hotBridge = createHotBridge();
|
|
88
90
|
this.exchange = new Exchange(this);
|
|
89
91
|
this.activity = new Activity(this);
|
|
90
92
|
|
|
91
93
|
const connectors: OmniConnector[] = [];
|
|
92
|
-
const
|
|
94
|
+
const configConnectors = options?.connectors || defaultConnectors;
|
|
95
|
+
const tasks = configConnectors.map(async (initConnector, index) => {
|
|
93
96
|
const connector = await initConnector(this);
|
|
94
97
|
connector.onConnect((payload) => this.events.emit("connect", payload));
|
|
95
98
|
connector.onDisconnect((payload) => this.events.emit("disconnect", payload));
|
|
@@ -296,36 +299,16 @@ export class HotConnector {
|
|
|
296
299
|
});
|
|
297
300
|
}
|
|
298
301
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const tokensList = await tokens.getTokens();
|
|
303
|
-
const ftToken = tokensList.find((t) => t.address === token)!;
|
|
304
|
-
const amountInt = typeof amount === "number" ? ftToken.int(amount) : amount;
|
|
305
|
-
const [existed] = this.walletsTokens.filter((t) => t.token.id === ftToken.id);
|
|
306
|
-
|
|
307
|
-
if (existed?.balance >= amountInt) return { token: ftToken, wallet: existed.wallet, amount: amountInt };
|
|
308
|
-
|
|
309
|
-
const needed = amountInt - (existed?.balance ?? 0n);
|
|
310
|
-
const result = await openPayment(this, ftToken, needed, Recipient.fromWallet(existed?.wallet));
|
|
311
|
-
|
|
312
|
-
const recipientWallet = this.wallets.find((w) => w.address === result.recipient.address);
|
|
313
|
-
if (!recipientWallet) throw new Error("Recipient not found");
|
|
314
|
-
const exist = await this.fetchToken(ftToken, recipientWallet);
|
|
315
|
-
|
|
316
|
-
return {
|
|
317
|
-
token: result.to,
|
|
318
|
-
wallet: recipientWallet,
|
|
319
|
-
amount: formatter.bigIntMin(exist, amountInt),
|
|
320
|
-
};
|
|
302
|
+
intentsBuilder(wallet?: OmniWallet) {
|
|
303
|
+
return new Intents(this).attachWallet(wallet);
|
|
321
304
|
}
|
|
322
305
|
|
|
323
|
-
onConnect(handler: (payload: { wallet: OmniWallet }) => void) {
|
|
306
|
+
onConnect(handler: (payload: { wallet: OmniWallet; connector: OmniConnector }) => void) {
|
|
324
307
|
this.events.on("connect", handler);
|
|
325
308
|
return () => this.events.off("connect", handler);
|
|
326
309
|
}
|
|
327
310
|
|
|
328
|
-
onDisconnect(handler: (payload: { wallet: OmniWallet }) => void) {
|
|
311
|
+
onDisconnect(handler: (payload: { wallet: OmniWallet; connector: OmniConnector }) => void) {
|
|
329
312
|
this.events.on("disconnect", handler);
|
|
330
313
|
return () => this.events.off("disconnect", handler);
|
|
331
314
|
}
|
|
@@ -386,4 +369,14 @@ export class HotConnector {
|
|
|
386
369
|
if (!connector) throw new Error("Connector not found");
|
|
387
370
|
return openWalletPicker(connector);
|
|
388
371
|
}
|
|
372
|
+
|
|
373
|
+
async disconnect(wallet: WalletType | OmniWallet) {
|
|
374
|
+
const connector = this.connectors.find((t) => {
|
|
375
|
+
if (wallet instanceof OmniWallet) return t.wallets.includes(wallet);
|
|
376
|
+
return t.walletTypes.includes(wallet);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
if (!connector) throw new Error("Connector not found");
|
|
380
|
+
await connector.disconnect();
|
|
381
|
+
}
|
|
389
382
|
}
|
package/src/OmniConnector.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface OmniConnectorOption {
|
|
|
19
19
|
icon: string;
|
|
20
20
|
id: string;
|
|
21
21
|
download?: string;
|
|
22
|
+
deeplink?: string;
|
|
22
23
|
type: "extension" | "external";
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -30,8 +31,8 @@ export abstract class OmniConnector<T extends OmniWallet = OmniWallet, O = {}> {
|
|
|
30
31
|
|
|
31
32
|
private storage = new LocalStorage();
|
|
32
33
|
protected events = new EventEmitter<{
|
|
33
|
-
connect: { wallet: T };
|
|
34
|
-
disconnect: { wallet: T };
|
|
34
|
+
connect: { wallet: T; connector: OmniConnector<T, O> };
|
|
35
|
+
disconnect: { wallet: T; connector: OmniConnector<T, O> };
|
|
35
36
|
}>();
|
|
36
37
|
|
|
37
38
|
protected wc: Promise<UniversalProvider> | null = null;
|
|
@@ -101,14 +102,14 @@ export abstract class OmniConnector<T extends OmniWallet = OmniWallet, O = {}> {
|
|
|
101
102
|
|
|
102
103
|
protected setWallet(wallet: T) {
|
|
103
104
|
runInAction(() => this.wallets.push(wallet));
|
|
104
|
-
this.events.emit("connect", { wallet });
|
|
105
|
+
this.events.emit("connect", { wallet, connector: this });
|
|
105
106
|
return wallet;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
protected removeWallet() {
|
|
109
110
|
runInAction(() => {
|
|
110
111
|
const wallet = this.wallets.pop();
|
|
111
|
-
if (wallet) this.events.emit("disconnect", { wallet });
|
|
112
|
+
if (wallet) this.events.emit("disconnect", { wallet, connector: this });
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -116,7 +117,7 @@ export abstract class OmniConnector<T extends OmniWallet = OmniWallet, O = {}> {
|
|
|
116
117
|
runInAction(() => {
|
|
117
118
|
const wallets = this.wallets;
|
|
118
119
|
this.wallets = [];
|
|
119
|
-
wallets.forEach((wallet) => this.events.emit("disconnect", { wallet }));
|
|
120
|
+
wallets.forEach((wallet) => this.events.emit("disconnect", { wallet, connector: this }));
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -130,7 +131,7 @@ export abstract class OmniConnector<T extends OmniWallet = OmniWallet, O = {}> {
|
|
|
130
131
|
|
|
131
132
|
async getStorage(): Promise<{ type?: string; id?: string; address?: string; publicKey?: string }> {
|
|
132
133
|
const data = await this.storage.get(`wibe3:${this.id}`);
|
|
133
|
-
if (!data)
|
|
134
|
+
if (!data) return {};
|
|
134
135
|
return JSON.parse(data);
|
|
135
136
|
}
|
|
136
137
|
|
|
@@ -138,19 +139,19 @@ export abstract class OmniConnector<T extends OmniWallet = OmniWallet, O = {}> {
|
|
|
138
139
|
this.events.removeAllListeners();
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
onConnect(handler: (payload: { wallet: T }) => void) {
|
|
142
|
+
onConnect(handler: (payload: { wallet: T; connector: OmniConnector<T, O> }) => void) {
|
|
142
143
|
this.events.on("connect", handler);
|
|
143
144
|
return () => this.events.off("connect", handler);
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
onDisconnect(handler: (payload: { wallet: T }) => void) {
|
|
147
|
+
onDisconnect(handler: (payload: { wallet: T; connector: OmniConnector<T, O> }) => void) {
|
|
147
148
|
this.events.on("disconnect", handler);
|
|
148
149
|
return () => this.events.off("disconnect", handler);
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
async disconnect() {
|
|
152
153
|
this.disconnectWalletConnect();
|
|
154
|
+
this.removeAllWallets();
|
|
153
155
|
this.removeStorage();
|
|
154
|
-
this.removeWallet();
|
|
155
156
|
}
|
|
156
157
|
}
|
package/src/OmniWallet.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { sha256 } from "@noble/hashes/sha2.js";
|
|
2
1
|
import { hex } from "@scure/base";
|
|
3
2
|
|
|
4
3
|
import { openAuthPopup } from "./ui/connect/AuthPopup";
|
|
5
|
-
import {
|
|
6
|
-
import { OmniConnector } from "./OmniConnector";
|
|
4
|
+
import { WalletType } from "./core/chains";
|
|
7
5
|
import { Intents } from "./core/Intents";
|
|
8
6
|
import { ReviewFee } from "./core/bridge";
|
|
9
7
|
import { Token } from "./core/token";
|
|
@@ -11,38 +9,44 @@ import { Commitment } from "./core";
|
|
|
11
9
|
import { api } from "./core/api";
|
|
12
10
|
|
|
13
11
|
export abstract class OmniWallet {
|
|
14
|
-
constructor(readonly connector: OmniConnector) {}
|
|
15
|
-
|
|
16
12
|
abstract address: string;
|
|
17
13
|
abstract publicKey?: string;
|
|
18
14
|
abstract omniAddress: string;
|
|
19
15
|
abstract type: WalletType;
|
|
16
|
+
abstract icon: string;
|
|
20
17
|
|
|
21
|
-
async
|
|
22
|
-
|
|
23
|
-
await this.connector.disconnect();
|
|
18
|
+
async depositNfts(nftIds: string[], receiver: string) {
|
|
19
|
+
// TODO
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
async withdrawNfts(nftIds: string[], receiver: string) {
|
|
23
|
+
// TODO
|
|
24
|
+
}
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
async getDepositNftsFee(nfts: string[]) {
|
|
27
|
+
return new ReviewFee({ chain: -4 });
|
|
28
|
+
}
|
|
32
29
|
|
|
33
|
-
async
|
|
34
|
-
|
|
35
|
-
return await Intents.publishSignedIntents([signed], hashes);
|
|
30
|
+
async transferNft(nftId: string, receiver: string) {
|
|
31
|
+
// TODO
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
return
|
|
34
|
+
async getTranferNftFee(nftId: string, receiver: string) {
|
|
35
|
+
return new ReviewFee({ chain: -4 });
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
async getNfts(onLoad: (nfts: string[]) => void) {
|
|
39
|
+
// TODO
|
|
44
40
|
}
|
|
45
41
|
|
|
42
|
+
abstract transferFee(token: Token, receiver: string, amount: bigint): Promise<ReviewFee>;
|
|
43
|
+
abstract transfer(args: { token: Token; receiver: string; amount: bigint; comment?: string; gasFee?: ReviewFee }): Promise<string>;
|
|
44
|
+
|
|
45
|
+
abstract fetchBalance(chain: number, address: string): Promise<bigint>;
|
|
46
|
+
abstract fetchBalances(chain?: number, whitelist?: string[]): Promise<Record<string, bigint>>;
|
|
47
|
+
|
|
48
|
+
abstract signIntents(intents: Record<string, any>[], options?: { nonce?: Uint8Array; deadline?: number }): Promise<Commitment>;
|
|
49
|
+
|
|
46
50
|
async auth(intents?: Record<string, any>[]): Promise<string> {
|
|
47
51
|
return openAuthPopup(this, async () => {
|
|
48
52
|
const seed = hex.encode(new Uint8Array(window.crypto.getRandomValues(new Uint8Array(32))));
|
|
@@ -53,11 +57,6 @@ export abstract class OmniWallet {
|
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
async pay({ token, amount, recipient, paymentId }: { token: OmniToken; amount: number; recipient: string; paymentId: string }) {
|
|
57
|
-
const nonce = new Uint8Array(sha256(new TextEncoder().encode(paymentId))).slice(0, 32);
|
|
58
|
-
return this.intents.attachNonce(nonce).transfer({ recipient, token, amount }).execute();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
60
|
async waitUntilBalance(need: Record<string, bigint>, receiver: string, attempts = 0) {
|
|
62
61
|
if (attempts > 120) throw "Balance is not enough";
|
|
63
62
|
const assets = Object.keys(need) as string[];
|