@hot-labs/kit 1.2.0-alpha.1 → 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 +105 -0
- package/build/HotConnector.js +303 -0
- package/build/HotConnector.js.map +1 -0
- package/build/OmniConnector.d.ts +90 -0
- package/build/OmniConnector.js +121 -0
- package/build/OmniConnector.js.map +1 -0
- package/build/OmniWallet.d.ts +35 -0
- package/build/OmniWallet.js +56 -0
- package/build/OmniWallet.js.map +1 -0
- package/build/activity.d.ts +18 -0
- package/build/activity.js +87 -0
- package/build/activity.js.map +1 -0
- package/build/core/Intents.d.ts +100 -0
- package/build/core/Intents.js +472 -0
- package/build/core/Intents.js.map +1 -0
- package/build/core/api.d.ts +60 -0
- package/build/core/api.js +108 -0
- package/build/core/api.js.map +1 -0
- package/build/core/bridge.d.ts +3 -0
- package/build/core/bridge.js +36 -0
- package/build/core/bridge.js.map +1 -0
- package/build/core/chains.d.ts +115 -0
- package/build/core/chains.js +381 -0
- package/build/core/chains.js.map +1 -0
- package/build/core/defaultTokens.d.ts +17 -0
- package/build/core/defaultTokens.js +1079 -0
- package/build/core/defaultTokens.js.map +1 -0
- package/build/core/events.d.ts +42 -0
- package/build/core/events.js +64 -0
- package/build/core/events.js.map +1 -0
- package/build/core/index.d.ts +10 -0
- package/build/core/index.js +11 -0
- package/build/core/index.js.map +1 -0
- package/build/core/recipient.d.ts +10 -0
- package/build/core/recipient.js +40 -0
- package/build/core/recipient.js.map +1 -0
- 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 +37 -0
- package/build/core/token.js +106 -0
- package/build/core/token.js.map +1 -0
- package/build/core/tokens.d.ts +14 -0
- package/build/core/tokens.js +51 -0
- package/build/core/tokens.js.map +1 -0
- package/build/core/types.d.ts +60 -0
- package/build/core/types.js +2 -0
- package/build/core/types.js.map +1 -0
- package/build/core/utils.d.ts +25 -0
- package/build/core/utils.js +170 -0
- package/build/core/utils.js.map +1 -0
- package/build/cosmos/connector.d.ts +36 -0
- package/build/cosmos/connector.js +211 -0
- package/build/cosmos/connector.js.map +1 -0
- package/build/cosmos/helpers.d.ts +2 -0
- package/build/cosmos/helpers.js +29 -0
- package/build/cosmos/helpers.js.map +1 -0
- package/build/cosmos/index.d.ts +6 -0
- package/build/cosmos/index.js +5 -0
- package/build/cosmos/index.js.map +1 -0
- package/build/cosmos/wallet.d.ts +26 -0
- package/build/cosmos/wallet.js +51 -0
- package/build/cosmos/wallet.js.map +1 -0
- package/build/defaults.d.ts +1 -0
- package/build/defaults.js +7 -0
- package/build/defaults.js.map +1 -0
- package/build/evm/abi.d.ts +17 -0
- package/build/evm/abi.js +38 -0
- package/build/evm/abi.js.map +1 -0
- package/build/evm/connector.d.ts +29 -0
- package/build/evm/connector.js +118 -0
- package/build/evm/connector.js.map +1 -0
- package/build/evm/index.d.ts +6 -0
- package/build/evm/index.js +5 -0
- package/build/evm/index.js.map +1 -0
- package/build/evm/injected.d.ts +1 -0
- package/build/evm/injected.js +33 -0
- package/build/evm/injected.js.map +1 -0
- package/build/evm/wallet.d.ts +42 -0
- package/build/evm/wallet.js +130 -0
- package/build/evm/wallet.js.map +1 -0
- package/build/exchange.d.ts +68 -0
- package/build/exchange.js +384 -0
- package/build/exchange.js.map +1 -0
- package/build/hot-wallet/google.d.ts +25 -0
- package/build/hot-wallet/google.js +117 -0
- package/build/hot-wallet/google.js.map +1 -0
- package/build/hot-wallet/iframe.d.ts +36 -0
- package/build/hot-wallet/iframe.js +140 -0
- package/build/hot-wallet/iframe.js.map +1 -0
- package/build/hot-wallet/index.d.ts +5 -0
- package/build/hot-wallet/index.js +4 -0
- package/build/hot-wallet/index.js.map +1 -0
- package/build/hot-wallet/proxy.d.ts +8 -0
- package/build/hot-wallet/proxy.js +45 -0
- package/build/hot-wallet/proxy.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -0
- package/build/near/connector.d.ts +18 -0
- package/build/near/connector.js +58 -0
- package/build/near/connector.js.map +1 -0
- package/build/near/index.d.ts +7 -0
- package/build/near/index.js +5 -0
- package/build/near/index.js.map +1 -0
- package/build/near/rpc.d.ts +23 -0
- package/build/near/rpc.js +153 -0
- package/build/near/rpc.js.map +1 -0
- package/build/near/wallet.d.ts +55 -0
- package/build/near/wallet.js +201 -0
- package/build/near/wallet.js.map +1 -0
- package/build/solana/WalletStandard.d.ts +25 -0
- package/build/solana/WalletStandard.js +56 -0
- package/build/solana/WalletStandard.js.map +1 -0
- package/build/solana/connector.d.ts +30 -0
- package/build/solana/connector.js +139 -0
- package/build/solana/connector.js.map +1 -0
- package/build/solana/index.d.ts +6 -0
- package/build/solana/index.js +5 -0
- package/build/solana/index.js.map +1 -0
- package/build/solana/injected/account.d.ts +11 -0
- package/build/solana/injected/account.js +41 -0
- package/build/solana/injected/account.js.map +1 -0
- package/build/solana/injected/index.d.ts +1 -0
- package/build/solana/injected/index.js +82 -0
- package/build/solana/injected/index.js.map +1 -0
- package/build/solana/injected/register.d.ts +2 -0
- package/build/solana/injected/register.js +41 -0
- package/build/solana/injected/register.js.map +1 -0
- package/build/solana/injected/solana-wallet.d.ts +34 -0
- package/build/solana/injected/solana-wallet.js +223 -0
- package/build/solana/injected/solana-wallet.js.map +1 -0
- package/build/solana/injected/utils.d.ts +32 -0
- package/build/solana/injected/utils.js +36 -0
- package/build/solana/injected/utils.js.map +1 -0
- package/build/solana/wallet.d.ts +40 -0
- package/build/solana/wallet.js +181 -0
- package/build/solana/wallet.js.map +1 -0
- package/build/solana/walletStandartList.d.ts +102 -0
- package/build/solana/walletStandartList.js +150 -0
- package/build/solana/walletStandartList.js.map +1 -0
- package/build/stellar/connector.d.ts +29 -0
- package/build/stellar/connector.js +64 -0
- package/build/stellar/connector.js.map +1 -0
- package/build/stellar/freigher.d.ts +46 -0
- package/build/stellar/freigher.js +110 -0
- package/build/stellar/freigher.js.map +1 -0
- package/build/stellar/hotWallet.d.ts +33 -0
- package/build/stellar/hotWallet.js +28 -0
- package/build/stellar/hotWallet.js.map +1 -0
- package/build/stellar/index.d.ts +6 -0
- package/build/stellar/index.js +5 -0
- package/build/stellar/index.js.map +1 -0
- package/build/stellar/wallet.d.ts +67 -0
- package/build/stellar/wallet.js +212 -0
- package/build/stellar/wallet.js.map +1 -0
- package/build/storage.d.ts +10 -0
- package/build/storage.js +12 -0
- package/build/storage.js.map +1 -0
- package/build/ton/connector.d.ts +24 -0
- package/build/ton/connector.js +111 -0
- package/build/ton/connector.js.map +1 -0
- package/build/ton/index.d.ts +7 -0
- package/build/ton/index.js +5 -0
- package/build/ton/index.js.map +1 -0
- package/build/ton/injected.d.ts +1 -0
- package/build/ton/injected.js +49 -0
- package/build/ton/injected.js.map +1 -0
- package/build/ton/utils.d.ts +45 -0
- package/build/ton/utils.js +63 -0
- package/build/ton/utils.js.map +1 -0
- package/build/ton/wallet.d.ts +54 -0
- package/build/ton/wallet.js +138 -0
- package/build/ton/wallet.js.map +1 -0
- 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 +12 -0
- package/build/ui/Popup.js +43 -0
- package/build/ui/Popup.js.map +1 -0
- package/build/ui/bridge/Bridge.d.ts +29 -0
- package/build/ui/bridge/Bridge.js +389 -0
- package/build/ui/bridge/Bridge.js.map +1 -0
- package/build/ui/bridge/SelectRecipient.d.ts +14 -0
- package/build/ui/bridge/SelectRecipient.js +68 -0
- package/build/ui/bridge/SelectRecipient.js.map +1 -0
- package/build/ui/bridge/SelectSender.d.ts +13 -0
- package/build/ui/bridge/SelectSender.js +23 -0
- package/build/ui/bridge/SelectSender.js.map +1 -0
- package/build/ui/bridge/SelectToken.d.ts +13 -0
- package/build/ui/bridge/SelectToken.js +93 -0
- package/build/ui/bridge/SelectToken.js.map +1 -0
- package/build/ui/bridge/TokenCard.d.ts +21 -0
- package/build/ui/bridge/TokenCard.js +65 -0
- package/build/ui/bridge/TokenCard.js.map +1 -0
- package/build/ui/connect/AuthPopup.d.ts +2 -0
- package/build/ui/connect/AuthPopup.js +48 -0
- package/build/ui/connect/AuthPopup.js.map +1 -0
- package/build/ui/connect/ConnectWallet.d.ts +14 -0
- package/build/ui/connect/ConnectWallet.js +22 -0
- package/build/ui/connect/ConnectWallet.js.map +1 -0
- package/build/ui/connect/LogoutPopup.d.ts +10 -0
- package/build/ui/connect/LogoutPopup.js +8 -0
- package/build/ui/connect/LogoutPopup.js.map +1 -0
- 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/WCPopup.d.ts +13 -0
- package/build/ui/connect/WCPopup.js +81 -0
- package/build/ui/connect/WCPopup.js.map +1 -0
- package/build/ui/connect/WCRequest.d.ts +9 -0
- package/build/ui/connect/WCRequest.js +13 -0
- package/build/ui/connect/WCRequest.js.map +1 -0
- package/build/ui/connect/WalletPicker.d.ts +11 -0
- package/build/ui/connect/WalletPicker.js +48 -0
- package/build/ui/connect/WalletPicker.js.map +1 -0
- package/build/ui/icons/arrow-right.d.ts +3 -0
- package/build/ui/icons/arrow-right.js +5 -0
- package/build/ui/icons/arrow-right.js.map +1 -0
- package/build/ui/icons/close.d.ts +1 -0
- package/build/ui/icons/close.js +5 -0
- package/build/ui/icons/close.js.map +1 -0
- package/build/ui/icons/exchange.d.ts +5 -0
- package/build/ui/icons/exchange.js +6 -0
- package/build/ui/icons/exchange.js.map +1 -0
- package/build/ui/icons/logout.d.ts +1 -0
- package/build/ui/icons/logout.js +3 -0
- package/build/ui/icons/logout.js.map +1 -0
- package/build/ui/icons/pending.d.ts +1 -0
- package/build/ui/icons/pending.js +5 -0
- package/build/ui/icons/pending.js.map +1 -0
- 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.d.ts +1 -0
- package/build/ui/icons/qr.js +5 -0
- package/build/ui/icons/qr.js.map +1 -0
- 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.d.ts +1 -0
- package/build/ui/icons/search.js +5 -0
- package/build/ui/icons/search.js.map +1 -0
- package/build/ui/icons/switch.d.ts +1 -0
- package/build/ui/icons/switch.js +5 -0
- package/build/ui/icons/switch.js.map +1 -0
- package/build/ui/icons/wallet.d.ts +1 -0
- package/build/ui/icons/wallet.js +5 -0
- package/build/ui/icons/wallet.js.map +1 -0
- package/build/ui/profile/DepositQR.d.ts +9 -0
- package/build/ui/profile/DepositQR.js +56 -0
- package/build/ui/profile/DepositQR.js.map +1 -0
- 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 +51 -0
- package/build/ui/router.js +68 -0
- package/build/ui/router.js.map +1 -0
- package/build/ui/styles.d.ts +13 -0
- package/build/ui/styles.js +281 -0
- package/build/ui/styles.js.map +1 -0
- 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/src/ui/payment/Payment.tsx +0 -79
- package/src/ui/payment/TokenCard.tsx +0 -98
- /package/src/solana/{wallets.ts → walletStandartList.ts} +0 -0
- /package/src/ui/{payment → profile}/DepositQR.tsx +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WalletType } from "./core/chains";
|
|
2
|
+
import { ReviewFee } from "./core/bridge";
|
|
3
|
+
import { Token } from "./core/token";
|
|
4
|
+
import { Commitment } from "./core";
|
|
5
|
+
export declare abstract class OmniWallet {
|
|
6
|
+
abstract address: string;
|
|
7
|
+
abstract publicKey?: string;
|
|
8
|
+
abstract omniAddress: string;
|
|
9
|
+
abstract type: WalletType;
|
|
10
|
+
abstract icon: string;
|
|
11
|
+
depositNfts(nftIds: string[], receiver: string): Promise<void>;
|
|
12
|
+
withdrawNfts(nftIds: string[], receiver: string): Promise<void>;
|
|
13
|
+
getDepositNftsFee(nfts: string[]): Promise<ReviewFee>;
|
|
14
|
+
transferNft(nftId: string, receiver: string): Promise<void>;
|
|
15
|
+
getTranferNftFee(nftId: string, receiver: string): Promise<ReviewFee>;
|
|
16
|
+
getNfts(onLoad: (nfts: string[]) => void): Promise<void>;
|
|
17
|
+
abstract transferFee(token: Token, receiver: string, amount: bigint): Promise<ReviewFee>;
|
|
18
|
+
abstract transfer(args: {
|
|
19
|
+
token: Token;
|
|
20
|
+
receiver: string;
|
|
21
|
+
amount: bigint;
|
|
22
|
+
comment?: string;
|
|
23
|
+
gasFee?: ReviewFee;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
abstract fetchBalance(chain: number, address: string): Promise<bigint>;
|
|
26
|
+
abstract fetchBalances(chain?: number, whitelist?: string[]): Promise<Record<string, bigint>>;
|
|
27
|
+
abstract signIntents(intents: Record<string, any>[], options?: {
|
|
28
|
+
nonce?: Uint8Array;
|
|
29
|
+
deadline?: number;
|
|
30
|
+
}): Promise<Commitment>;
|
|
31
|
+
auth(intents?: Record<string, any>[]): Promise<string>;
|
|
32
|
+
waitUntilBalance(need: Record<string, bigint>, receiver: string, attempts?: number): Promise<void>;
|
|
33
|
+
getIntentsBalance(asset: string, receiver: string): Promise<bigint>;
|
|
34
|
+
getAssets(): Promise<Record<string, bigint>>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { hex } from "@scure/base";
|
|
2
|
+
import { openAuthPopup } from "./ui/connect/AuthPopup";
|
|
3
|
+
import { Intents } from "./core/Intents";
|
|
4
|
+
import { ReviewFee } from "./core/bridge";
|
|
5
|
+
import { api } from "./core/api";
|
|
6
|
+
export class OmniWallet {
|
|
7
|
+
async depositNfts(nftIds, receiver) {
|
|
8
|
+
// TODO
|
|
9
|
+
}
|
|
10
|
+
async withdrawNfts(nftIds, receiver) {
|
|
11
|
+
// TODO
|
|
12
|
+
}
|
|
13
|
+
async getDepositNftsFee(nfts) {
|
|
14
|
+
return new ReviewFee({ chain: -4 });
|
|
15
|
+
}
|
|
16
|
+
async transferNft(nftId, receiver) {
|
|
17
|
+
// TODO
|
|
18
|
+
}
|
|
19
|
+
async getTranferNftFee(nftId, receiver) {
|
|
20
|
+
return new ReviewFee({ chain: -4 });
|
|
21
|
+
}
|
|
22
|
+
async getNfts(onLoad) {
|
|
23
|
+
// TODO
|
|
24
|
+
}
|
|
25
|
+
async auth(intents) {
|
|
26
|
+
return openAuthPopup(this, async () => {
|
|
27
|
+
const seed = hex.encode(new Uint8Array(window.crypto.getRandomValues(new Uint8Array(32))));
|
|
28
|
+
const msgBuffer = new TextEncoder().encode(`${window.location.origin}_${seed}`);
|
|
29
|
+
const nonce = await window.crypto.subtle.digest("SHA-256", new Uint8Array(msgBuffer));
|
|
30
|
+
const signed = await this.signIntents(intents || [], { nonce: new Uint8Array(nonce) });
|
|
31
|
+
return await api.auth(signed, seed);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async waitUntilBalance(need, receiver, attempts = 0) {
|
|
35
|
+
if (attempts > 120)
|
|
36
|
+
throw "Balance is not enough";
|
|
37
|
+
const assets = Object.keys(need);
|
|
38
|
+
const balances = await Intents.getIntentsBalances(assets, receiver);
|
|
39
|
+
if (assets.every((asset) => (balances[asset] || 0n) >= (need[asset] || 0n)))
|
|
40
|
+
return;
|
|
41
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
42
|
+
await this.waitUntilBalance(need, receiver, attempts + 1);
|
|
43
|
+
}
|
|
44
|
+
async getIntentsBalance(asset, receiver) {
|
|
45
|
+
const balances = await Intents.getIntentsBalances([asset], receiver);
|
|
46
|
+
return balances[asset] || 0n;
|
|
47
|
+
}
|
|
48
|
+
async getAssets() {
|
|
49
|
+
if (!this.omniAddress)
|
|
50
|
+
return {};
|
|
51
|
+
const assets = await Intents.getIntentsAssets(this.omniAddress);
|
|
52
|
+
const balances = await Intents.getIntentsBalances(assets, this.omniAddress);
|
|
53
|
+
return balances;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=OmniWallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OmniWallet.js","sourceRoot":"","sources":["../src/OmniWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,OAAgB,UAAU;IAO9B,KAAK,CAAC,WAAW,CAAC,MAAgB,EAAE,QAAgB;QAClD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAgB,EAAE,QAAgB;QACnD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,IAAc;QACpC,OAAO,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,QAAgB;QAC/C,OAAO;IACT,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,KAAa,EAAE,QAAgB;QACpD,OAAO,IAAI,SAAS,CAAC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,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAAE,OAAO;QACpF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAa,EAAE,QAAgB;QACrD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC;QACrE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,SAAS;QACb,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5E,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WithdrawArgsWithPending } from "@hot-labs/omni-sdk";
|
|
2
|
+
import { HotConnector } from "./HotConnector";
|
|
3
|
+
import { OmniWallet } from "./OmniWallet";
|
|
4
|
+
export declare class Activity {
|
|
5
|
+
private readonly kit;
|
|
6
|
+
withdrawals: Record<number, (WithdrawArgsWithPending & {
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
})[]>;
|
|
9
|
+
constructor(kit: HotConnector);
|
|
10
|
+
get withdrawalsList(): (WithdrawArgsWithPending & {
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
})[];
|
|
13
|
+
finishWithdrawal(withdrawal: WithdrawArgsWithPending & {
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
fetchPendingWithdrawalsByWallet(wallet: OmniWallet): Promise<void>;
|
|
17
|
+
fetchPendingWithdrawalsByChain(chain: number, wallet: OmniWallet): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { computed, makeObservable, observable, runInAction } from "mobx";
|
|
2
|
+
import { hex } from "@scure/base";
|
|
3
|
+
import { chains, Network, WalletType } from "./core";
|
|
4
|
+
export class Activity {
|
|
5
|
+
kit;
|
|
6
|
+
withdrawals = {};
|
|
7
|
+
constructor(kit) {
|
|
8
|
+
this.kit = kit;
|
|
9
|
+
makeObservable(this, { withdrawals: observable, withdrawalsList: computed });
|
|
10
|
+
kit.onConnect(({ wallet }) => this.fetchPendingWithdrawalsByWallet(wallet));
|
|
11
|
+
}
|
|
12
|
+
get withdrawalsList() {
|
|
13
|
+
return Object.values(this.withdrawals).flat();
|
|
14
|
+
}
|
|
15
|
+
async finishWithdrawal(withdrawal) {
|
|
16
|
+
try {
|
|
17
|
+
if (withdrawal.loading)
|
|
18
|
+
return;
|
|
19
|
+
runInAction(() => (withdrawal.loading = true));
|
|
20
|
+
if (withdrawal.chain === Network.Stellar) {
|
|
21
|
+
if (!this.kit.stellar)
|
|
22
|
+
throw new Error("Stellar wallet not connected");
|
|
23
|
+
await this.kit.hotBridge.stellar.withdraw({
|
|
24
|
+
sendTransaction: (tx) => this.kit.stellar.sendTransaction(tx),
|
|
25
|
+
sender: this.kit.stellar.address,
|
|
26
|
+
...withdrawal,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (withdrawal.chain === Network.Solana) {
|
|
30
|
+
if (!this.kit.solana)
|
|
31
|
+
throw new Error("Solana wallet not connected");
|
|
32
|
+
const solana = await this.kit.hotBridge.solana();
|
|
33
|
+
await solana.withdraw({
|
|
34
|
+
sendTransaction: (tx) => this.kit.solana.sendTransaction(tx),
|
|
35
|
+
sender: this.kit.solana.address,
|
|
36
|
+
...withdrawal,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (withdrawal.chain === Network.Ton || withdrawal.chain === Network.OmniTon) {
|
|
40
|
+
if (!this.kit.ton)
|
|
41
|
+
throw new Error("Ton wallet not connected");
|
|
42
|
+
await this.kit.hotBridge.ton.withdraw({
|
|
43
|
+
sendTransaction: (tx) => this.kit.ton.sendTransaction(tx),
|
|
44
|
+
refundAddress: this.kit.ton.address,
|
|
45
|
+
...withdrawal,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (chains.get(withdrawal.chain).type === WalletType.EVM) {
|
|
49
|
+
if (!this.kit.evm)
|
|
50
|
+
throw new Error("EVM wallet not connected");
|
|
51
|
+
await this.kit.hotBridge.evm.withdraw({
|
|
52
|
+
sendTransaction: (tx) => this.kit.evm.sendTransaction(withdrawal.chain, tx),
|
|
53
|
+
...withdrawal,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (withdrawal.chain === Network.Gonka) {
|
|
57
|
+
if (!this.kit.cosmos)
|
|
58
|
+
throw new Error("Gonka wallet not connected");
|
|
59
|
+
const cosmos = await this.kit.hotBridge.cosmos();
|
|
60
|
+
await cosmos.withdraw({
|
|
61
|
+
sendTransaction: (tx) => this.kit.cosmos.sendTransaction(tx),
|
|
62
|
+
senderPublicKey: hex.decode(this.kit.cosmos.publicKey),
|
|
63
|
+
sender: this.kit.cosmos.address,
|
|
64
|
+
...withdrawal,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
await this.kit.hotBridge.clearPendingWithdrawals([withdrawal]).catch(() => { });
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
runInAction(() => (withdrawal.loading = false));
|
|
71
|
+
const wallet = this.kit.wallets.find((w) => w.type === chains.get(withdrawal.chain).type);
|
|
72
|
+
if (wallet)
|
|
73
|
+
this.fetchPendingWithdrawalsByChain(withdrawal.chain, wallet);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async fetchPendingWithdrawalsByWallet(wallet) {
|
|
77
|
+
if (wallet.type === WalletType.NEAR)
|
|
78
|
+
return;
|
|
79
|
+
const tasks = chains.getByType(wallet.type).map((t) => this.fetchPendingWithdrawalsByChain(t.id, wallet));
|
|
80
|
+
await Promise.all(tasks);
|
|
81
|
+
}
|
|
82
|
+
async fetchPendingWithdrawalsByChain(chain, wallet) {
|
|
83
|
+
const pendings = await this.kit.hotBridge.getPendingWithdrawalsWithStatus(chain, wallet.address);
|
|
84
|
+
runInAction(() => (this.withdrawals[chain] = pendings.filter((t) => !t.completed)));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIrD,MAAM,OAAO,QAAQ;IAGU;IAF7B,WAAW,GAAwE,EAAE,CAAC;IAEtF,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;QAC5C,cAAc,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,MAAM,CAAC,MAAM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AAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,8BAA8B,CAAC,KAAa,EAAE,MAAkB;QACpE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,+BAA+B,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACjG,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;CACF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { HotConnector } from "../HotConnector";
|
|
2
|
+
import type { OmniWallet } from "../OmniWallet";
|
|
3
|
+
import type { Intent, Commitment } from "./types";
|
|
4
|
+
import { OmniToken } from "./chains";
|
|
5
|
+
import { BridgeReview } from "../exchange";
|
|
6
|
+
export declare const TGAS = 1000000000000n;
|
|
7
|
+
export declare class Intents {
|
|
8
|
+
readonly wibe3?: HotConnector | undefined;
|
|
9
|
+
constructor(wibe3?: HotConnector | undefined);
|
|
10
|
+
static get builder(): Intents;
|
|
11
|
+
signedHashes: string[];
|
|
12
|
+
commitments: Commitment[];
|
|
13
|
+
need: Map<OmniToken, bigint>;
|
|
14
|
+
signer?: OmniWallet;
|
|
15
|
+
unsignedCommitment?: {
|
|
16
|
+
intents: Intent[];
|
|
17
|
+
nonce?: Uint8Array;
|
|
18
|
+
deadline?: Date;
|
|
19
|
+
};
|
|
20
|
+
addIntent(intent: Intent): this;
|
|
21
|
+
addNeed(token: OmniToken, amount: bigint): this;
|
|
22
|
+
authCall(args: {
|
|
23
|
+
contractId: string;
|
|
24
|
+
msg: string;
|
|
25
|
+
attachNear: bigint;
|
|
26
|
+
tgas: number;
|
|
27
|
+
}): this;
|
|
28
|
+
/**
|
|
29
|
+
* Use this method to pay for a merchant's item created in pay.hot-labs.org
|
|
30
|
+
*/
|
|
31
|
+
merchantPayment({ merchantId, token, itemId, email, amount, memo }: {
|
|
32
|
+
token: OmniToken;
|
|
33
|
+
merchantId: string;
|
|
34
|
+
itemId: string;
|
|
35
|
+
amount: number | bigint;
|
|
36
|
+
memo: string;
|
|
37
|
+
email: string;
|
|
38
|
+
}): Promise<string | undefined>;
|
|
39
|
+
transfer(args: {
|
|
40
|
+
recipient: string;
|
|
41
|
+
token: OmniToken;
|
|
42
|
+
amount: number | bigint;
|
|
43
|
+
memo?: string;
|
|
44
|
+
msg?: string;
|
|
45
|
+
tgas?: number;
|
|
46
|
+
}): this;
|
|
47
|
+
batchTransfer(args: {
|
|
48
|
+
recipient: string;
|
|
49
|
+
tokens: Record<OmniToken, number | bigint>;
|
|
50
|
+
memo?: string;
|
|
51
|
+
msg?: string;
|
|
52
|
+
tgas?: number;
|
|
53
|
+
}): this;
|
|
54
|
+
tokenDiff(args: Record<string, bigint | number>): this;
|
|
55
|
+
addRawIntent(rawIntent: Intent): this;
|
|
56
|
+
addPublicKey(publicKey: string): this;
|
|
57
|
+
removePublicKey(publicKey: string): this;
|
|
58
|
+
withdraw(args: {
|
|
59
|
+
token: string;
|
|
60
|
+
amount: number | bigint;
|
|
61
|
+
receiver: string;
|
|
62
|
+
memo?: string;
|
|
63
|
+
msg?: string;
|
|
64
|
+
tgas?: number;
|
|
65
|
+
}): this;
|
|
66
|
+
attachHashes(hashes: string[]): this;
|
|
67
|
+
attachWallet(wallet?: OmniWallet): this;
|
|
68
|
+
attachDeadline(deadline: Date): this;
|
|
69
|
+
attachNonce(nonce: Uint8Array): this;
|
|
70
|
+
attachTimeout(seconds: number): this;
|
|
71
|
+
attachSeed(seed: string): this;
|
|
72
|
+
attachCommitment(commitment: Commitment): this;
|
|
73
|
+
take(token: string, amount: number | bigint): this;
|
|
74
|
+
give(token: string, amount: number | bigint): this;
|
|
75
|
+
signSequence(): Promise<Commitment[]>;
|
|
76
|
+
sign(): Promise<this>;
|
|
77
|
+
simulate(): Promise<any>;
|
|
78
|
+
setupSigner(): Promise<OmniWallet>;
|
|
79
|
+
openSignFlow({ title, allowedTokens, onConfirm }: {
|
|
80
|
+
title?: string;
|
|
81
|
+
allowedTokens?: string[];
|
|
82
|
+
onConfirm: (args: {
|
|
83
|
+
depositQoute?: BridgeReview;
|
|
84
|
+
processing?: () => Promise<BridgeReview>;
|
|
85
|
+
}) => Promise<void>;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
depositAndExecute({ title, message, allowedTokens, serverSideProcessing, payload }?: {
|
|
88
|
+
title?: string;
|
|
89
|
+
message?: string;
|
|
90
|
+
allowedTokens?: string[];
|
|
91
|
+
serverSideProcessing?: boolean;
|
|
92
|
+
payload?: Record<string, any>;
|
|
93
|
+
}): Promise<string | undefined>;
|
|
94
|
+
execute(): Promise<string>;
|
|
95
|
+
static publish(signed: Commitment[], hashes?: string[]): Promise<string>;
|
|
96
|
+
static hasPublicKey(accountId: string, publicKey: string): Promise<boolean>;
|
|
97
|
+
static simulateIntents(signed: Commitment[]): Promise<any>;
|
|
98
|
+
static getIntentsBalances(assets: string[], accountId: string): Promise<Record<string, bigint>>;
|
|
99
|
+
static getIntentsAssets(accountId: string): Promise<string[]>;
|
|
100
|
+
}
|