@hot-labs/kit 1.2.0-alpha.2 → 1.2.1
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 +6 -1
- package/build/exchange.js +34 -33
- 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 +154 -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 +23 -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 +7 -0
- package/build/ui/uikit/text.js +68 -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 +36 -33
- 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 +329 -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 +51 -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 +74 -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
package/src/core/api.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { Commitment } from "./types";
|
|
2
2
|
|
|
3
|
-
export class
|
|
4
|
-
name = "
|
|
5
|
-
constructor(readonly status: number, message: string) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.status = status;
|
|
3
|
+
export class NetworkError extends Error {
|
|
4
|
+
name = "NetworkError";
|
|
5
|
+
constructor(readonly status: number, readonly url: string, readonly message: string) {
|
|
6
|
+
super(`${status} ${url}: ${message}`);
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
|
|
10
|
+
export class TimeoutNetworkError extends NetworkError {
|
|
11
|
+
name = "TimeoutNetworkError";
|
|
12
|
+
constructor(url: string) {
|
|
13
|
+
super(0, url, "Timeout error");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface PaymentStatus {
|
|
18
|
+
payment_id: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
amount: string;
|
|
21
|
+
token_id: string;
|
|
22
|
+
sender_id: string;
|
|
23
|
+
near_trx: string;
|
|
24
|
+
status: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
export interface TokenType {
|
|
12
28
|
icon: string;
|
|
13
29
|
symbol: string;
|
|
@@ -34,7 +50,7 @@ export class Api {
|
|
|
34
50
|
};
|
|
35
51
|
|
|
36
52
|
const response = await fetch(`${this.baseUrl}${url}`, options);
|
|
37
|
-
if (!response.ok) throw new
|
|
53
|
+
if (!response.ok) throw new NetworkError(response.status, url, await response.text());
|
|
38
54
|
return await response.json();
|
|
39
55
|
}
|
|
40
56
|
|
|
@@ -69,9 +85,29 @@ export class Api {
|
|
|
69
85
|
return result.balances?.[chain] || [];
|
|
70
86
|
}
|
|
71
87
|
|
|
88
|
+
async yieldIntentCall(args: { commitment: Commitment; depositAddress?: string; payload?: Record<string, any> }) {
|
|
89
|
+
return await this.request(`/api/v1/wibe3/yield_intent_call`, {
|
|
90
|
+
method: "POST",
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
commitment: args.commitment,
|
|
93
|
+
deposit_address: args.depositAddress,
|
|
94
|
+
...args.payload,
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async paymentStatus(memo: string): Promise<PaymentStatus> {
|
|
100
|
+
const result = await this.request(`/partners/processed_payments?memo=${memo}`, { method: "GET" });
|
|
101
|
+
return result.payments[0];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async getPayments(merchantId: string): Promise<PaymentStatus[]> {
|
|
105
|
+
const result = await this.request(`/partners/processed_payments?merchant_id=${merchantId}`, { method: "GET" });
|
|
106
|
+
return result.payments;
|
|
107
|
+
}
|
|
108
|
+
|
|
72
109
|
async publishIntents(signed: Record<string, any>[], hashes: string[]) {
|
|
73
|
-
|
|
74
|
-
headers: { "Content-Type": "application/json" },
|
|
110
|
+
const result = await this.request(`/api/v1/wibe3/solver-bus`, {
|
|
75
111
|
method: "POST",
|
|
76
112
|
body: JSON.stringify({
|
|
77
113
|
params: [{ signed_datas: signed, quote_hashes: hashes }],
|
|
@@ -80,11 +116,19 @@ export class Api {
|
|
|
80
116
|
jsonrpc: "2.0",
|
|
81
117
|
}),
|
|
82
118
|
});
|
|
119
|
+
|
|
120
|
+
return result.result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async publishTelemetry(events: { event: string; value_str?: string; value_float?: number; ts: number }[], accountId: string) {
|
|
124
|
+
await this.request(`/api/v1/wibe3/telemetry`, {
|
|
125
|
+
body: JSON.stringify({ events, account_id: accountId || "" }),
|
|
126
|
+
method: "POST",
|
|
127
|
+
});
|
|
83
128
|
}
|
|
84
129
|
|
|
85
130
|
async getIntentsStatus(intentHash: string) {
|
|
86
|
-
|
|
87
|
-
headers: { "Content-Type": "application/json" },
|
|
131
|
+
const result = await this.request(`/api/v1/wibe3/solver-bus`, {
|
|
88
132
|
method: "POST",
|
|
89
133
|
body: JSON.stringify({
|
|
90
134
|
params: [{ intent_hash: intentHash }],
|
|
@@ -93,6 +137,8 @@ export class Api {
|
|
|
93
137
|
jsonrpc: "2.0",
|
|
94
138
|
}),
|
|
95
139
|
});
|
|
140
|
+
|
|
141
|
+
return result.result;
|
|
96
142
|
}
|
|
97
143
|
}
|
|
98
144
|
|
package/src/core/bridge.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CosmosConfig, HotBridge, ReviewFee } from "@hot-labs/omni-sdk";
|
|
2
2
|
import { chains, Network, WalletType } from "./chains";
|
|
3
3
|
import { Intents } from "./Intents";
|
|
4
|
+
import { Commitment } from "./types";
|
|
4
5
|
|
|
5
6
|
export { ReviewFee, HotBridge };
|
|
6
7
|
|
|
7
8
|
export const createHotBridge = () => {
|
|
8
9
|
return new HotBridge({
|
|
9
|
-
publishIntents: async (signed:
|
|
10
|
-
const hash = await Intents.
|
|
10
|
+
publishIntents: async (signed: Commitment[], hashes: string[] = []) => {
|
|
11
|
+
const hash = await Intents.publish(signed, hashes);
|
|
11
12
|
return { sender: "intents.near", hash };
|
|
12
13
|
},
|
|
13
14
|
|
package/src/core/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { OmniToken, WalletType, Network, chains } from "./chains";
|
|
2
2
|
export { createHotBridge, HotBridge, ReviewFee } from "./bridge";
|
|
3
|
-
export { rpc as nearRpc, TGAS } from "
|
|
3
|
+
export { rpc as nearRpc, TGAS } from "../near/rpc";
|
|
4
4
|
export { EventEmitter } from "./events";
|
|
5
5
|
export { Recipient } from "./recipient";
|
|
6
6
|
export { formatter } from "./utils";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { api } from "./api";
|
|
2
|
+
import { HotConnector } from "../HotConnector";
|
|
3
|
+
import { formatter } from "./utils";
|
|
4
|
+
|
|
5
|
+
export class Telemetry {
|
|
6
|
+
events: { event: string; value_str?: string; value_float?: number; ts: number }[] = [];
|
|
7
|
+
constructor(readonly wibe3: HotConnector) {
|
|
8
|
+
this.flush();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async flush() {
|
|
12
|
+
await formatter.wait(5000);
|
|
13
|
+
|
|
14
|
+
if (this.events.length > 0) {
|
|
15
|
+
await api
|
|
16
|
+
.publishTelemetry(this.events, this.wibe3.priorityWallet?.address ?? "")
|
|
17
|
+
.then(() => (this.events = []))
|
|
18
|
+
.catch(() => {});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
await this.flush();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
log(event: string, value: string | number) {
|
|
25
|
+
if (typeof value === "string") this.events.push({ event, value_str: value, ts: Date.now() });
|
|
26
|
+
else this.events.push({ event, value_float: value, ts: Date.now() });
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/core/token.ts
CHANGED
|
@@ -77,6 +77,10 @@ export class Token {
|
|
|
77
77
|
return chains.get(this.chain)?.type || WalletType.unknown;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
get originalType() {
|
|
81
|
+
return chains.get(this.originalChain)?.type || WalletType.unknown;
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
get reserve() {
|
|
81
85
|
if (this.chain === Network.Gonka) return 0.01;
|
|
82
86
|
if (this.chain === Network.Juno) return 0.01;
|
package/src/core/tokens.ts
CHANGED
|
@@ -42,15 +42,6 @@ class TokensStorage {
|
|
|
42
42
|
price: 0,
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
list.unshift({
|
|
46
|
-
blockchain: "adi" as any,
|
|
47
|
-
priceUpdatedAt: "2025-11-23T18:01:00.349Z",
|
|
48
|
-
assetId: OmniToken.ADI,
|
|
49
|
-
symbol: "ADI",
|
|
50
|
-
decimals: 18,
|
|
51
|
-
price: 0,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
45
|
runInAction(() => {
|
|
55
46
|
this.list = list.flatMap((t) => {
|
|
56
47
|
if (!chains.getByKey(t.blockchain)) return [];
|
package/src/core/types.ts
CHANGED
|
@@ -40,9 +40,30 @@ export interface AuthCallIntent {
|
|
|
40
40
|
intent: "auth_call";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export interface AddPublicKeyIntent {
|
|
44
|
+
intent: "add_public_key";
|
|
45
|
+
public_key: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface RemovePublicKeyIntent {
|
|
49
|
+
intent: "remove_public_key";
|
|
50
|
+
public_key: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface NftWithdrawIntent {
|
|
54
|
+
intent: "nft_withdraw";
|
|
55
|
+
token_id: string;
|
|
56
|
+
receiver_id: string;
|
|
57
|
+
memo?: string;
|
|
58
|
+
msg?: string;
|
|
59
|
+
min_gas?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
43
62
|
export interface Commitment {
|
|
44
63
|
signature: string;
|
|
45
64
|
public_key?: string;
|
|
46
65
|
payload: Record<string, any> | string;
|
|
47
66
|
standard: string;
|
|
48
67
|
}
|
|
68
|
+
|
|
69
|
+
export type Intent = TransferIntent | MtWithdrawIntent | FtWithdrawIntent | TokenDiffIntent | AuthCallIntent | AddPublicKeyIntent | RemovePublicKeyIntent | NftWithdrawIntent;
|
package/src/core/utils.ts
CHANGED
|
@@ -148,7 +148,12 @@ export const formatter = {
|
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
amount(value: Value, decimals = 24) {
|
|
151
|
-
|
|
151
|
+
if (+formatter.num(value) > 1_000_000_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000_000_000, 2)}Q`;
|
|
152
|
+
if (+formatter.num(value) > 1_000_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000_000, 2)}T`;
|
|
153
|
+
if (+formatter.num(value) > 1_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000, 2)}B`;
|
|
154
|
+
if (+formatter.num(value) > 1_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000, 2)}M`;
|
|
155
|
+
const num = formatter.num(value).toFixed(decimals);
|
|
156
|
+
if (+num === 0) return "0";
|
|
152
157
|
return formatter.formatNumberWithSubscriptZeros(num, 3, 0.0001);
|
|
153
158
|
},
|
|
154
159
|
|
|
@@ -160,4 +165,15 @@ export const formatter = {
|
|
|
160
165
|
wait(ms: number) {
|
|
161
166
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
162
167
|
},
|
|
168
|
+
|
|
169
|
+
chunk(array: any[], size: number) {
|
|
170
|
+
return array.reduce((acc, item, index) => {
|
|
171
|
+
const chunkIndex = Math.floor(index / size);
|
|
172
|
+
if (!acc[chunkIndex]) {
|
|
173
|
+
acc[chunkIndex] = [];
|
|
174
|
+
}
|
|
175
|
+
acc[chunkIndex].push(item);
|
|
176
|
+
return acc;
|
|
177
|
+
}, []);
|
|
178
|
+
},
|
|
163
179
|
};
|
package/src/cosmos/connector.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { hex } from "@scure/base";
|
|
|
6
6
|
|
|
7
7
|
import { api } from "../core/api";
|
|
8
8
|
import { chains, WalletType } from "../core/chains";
|
|
9
|
-
import { ConnectorType, OmniConnector, WC_ICON } from "../OmniConnector";
|
|
9
|
+
import { ConnectorType, OmniConnector, OmniConnectorOption, WC_ICON } from "../OmniConnector";
|
|
10
10
|
import { HotConnector } from "../HotConnector";
|
|
11
11
|
import { OmniWallet } from "../OmniWallet";
|
|
12
12
|
|
|
@@ -20,9 +20,9 @@ declare global {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const wallets = {
|
|
23
|
+
const wallets: Record<string, OmniConnectorOption> = {
|
|
24
24
|
keplr: {
|
|
25
|
-
name: "Keplr",
|
|
25
|
+
name: "Keplr Wallet",
|
|
26
26
|
icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
|
|
27
27
|
download: "https://www.keplr.app/get",
|
|
28
28
|
deeplink: "keplrwallet://wcV2?",
|
|
@@ -30,13 +30,21 @@ const wallets = {
|
|
|
30
30
|
id: "keplr",
|
|
31
31
|
},
|
|
32
32
|
leap: {
|
|
33
|
-
name: "Leap",
|
|
33
|
+
name: "Leap Wallet",
|
|
34
34
|
icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
|
|
35
35
|
download: "https://www.leapwallet.io/download",
|
|
36
36
|
deeplink: "leapcosmos://wcV2?",
|
|
37
37
|
type: "extension",
|
|
38
38
|
id: "leap",
|
|
39
39
|
},
|
|
40
|
+
gonkaWallet: {
|
|
41
|
+
name: "Gonka Wallet",
|
|
42
|
+
icon: "https://gonka-wallet.startonus.com/images/logo.png",
|
|
43
|
+
download: "https://t.me/gonka_wallet",
|
|
44
|
+
deeplink: "https://gonka-wallet.startonus.com/wc?wc=",
|
|
45
|
+
type: "external",
|
|
46
|
+
id: "gonkaWallet",
|
|
47
|
+
},
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
@@ -50,28 +58,12 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
50
58
|
constructor(wibe3: HotConnector) {
|
|
51
59
|
super(wibe3);
|
|
52
60
|
|
|
53
|
-
this.options =
|
|
54
|
-
{
|
|
55
|
-
name: "Keplr",
|
|
56
|
-
download: "https://www.keplr.app/get",
|
|
57
|
-
icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
|
|
58
|
-
type: "keplr" in window ? "extension" : "external",
|
|
59
|
-
id: "keplr",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "leap" in window ? "Leap" : "Leap Mobile",
|
|
63
|
-
download: "https://www.leapwallet.io/download",
|
|
64
|
-
icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
|
|
65
|
-
type: "leap" in window ? "extension" : "external",
|
|
66
|
-
id: "leap",
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
61
|
+
this.options = Object.values(wallets);
|
|
70
62
|
Keplr.getKeplr().then((keplr) => {
|
|
71
63
|
const option = this.options.find((option) => option.id === "keplr")!;
|
|
72
64
|
runInAction(() => {
|
|
73
65
|
option.type = keplr ? "extension" : "external";
|
|
74
|
-
option.name = keplr ? "Keplr" : "Keplr Mobile";
|
|
66
|
+
option.name = keplr ? "Keplr Wallet" : "Keplr Mobile";
|
|
75
67
|
});
|
|
76
68
|
});
|
|
77
69
|
|
|
@@ -113,7 +105,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
113
105
|
return chains.getByType(WalletType.COSMOS).map((t) => t.key);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
|
-
async setupWalletConnect(id?: "keplr" | "leap"): Promise<CosmosWallet> {
|
|
108
|
+
async setupWalletConnect(id?: "keplr" | "leap" | "gonkaWallet"): Promise<CosmosWallet> {
|
|
117
109
|
const wc = await this.wc;
|
|
118
110
|
if (!wc) throw new Error("WalletConnect not found");
|
|
119
111
|
|
|
@@ -125,7 +117,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
125
117
|
const address = account.bech32Address;
|
|
126
118
|
|
|
127
119
|
this.setStorage({ type: "walletconnect", id });
|
|
128
|
-
const wallet = new CosmosWallet(
|
|
120
|
+
const wallet = new CosmosWallet({
|
|
129
121
|
address: address,
|
|
130
122
|
publicKeyHex: publicKey,
|
|
131
123
|
disconnect: () => this.disconnectWalletConnect(),
|
|
@@ -170,7 +162,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
170
162
|
|
|
171
163
|
async setKeplrWallet(keplr: Keplr, address: string, publicKey: string) {
|
|
172
164
|
return this.setWallet(
|
|
173
|
-
new CosmosWallet(
|
|
165
|
+
new CosmosWallet({
|
|
174
166
|
address: address,
|
|
175
167
|
publicKeyHex: publicKey,
|
|
176
168
|
disconnect: () => keplr.disable(),
|
|
@@ -183,7 +175,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
183
175
|
);
|
|
184
176
|
}
|
|
185
177
|
|
|
186
|
-
async connectKeplr(type: "keplr" | "leap", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
|
|
178
|
+
async connectKeplr(type: "keplr" | "leap" | "gonkaWallet", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
|
|
187
179
|
if (!extension) {
|
|
188
180
|
return await this.connectWalletConnect({
|
|
189
181
|
onConnect: () => this.setupWalletConnect(type),
|
|
@@ -232,6 +224,10 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
232
224
|
});
|
|
233
225
|
}
|
|
234
226
|
|
|
227
|
+
if (id === "gonkaWallet") {
|
|
228
|
+
return await this.connectKeplr("gonkaWallet");
|
|
229
|
+
}
|
|
230
|
+
|
|
235
231
|
if (id === "keplr") {
|
|
236
232
|
const keplr = await Keplr.getKeplr();
|
|
237
233
|
return await this.connectKeplr("keplr", keplr);
|
package/src/cosmos/wallet.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { StargateClient } from "@cosmjs/stargate";
|
|
|
2
2
|
import { OmniWallet } from "../OmniWallet";
|
|
3
3
|
import { chains, WalletType } from "../core/chains";
|
|
4
4
|
import { ReviewFee } from "../core/bridge";
|
|
5
|
-
import CosmosConnector from "./connector";
|
|
6
5
|
import { Commitment } from "../core";
|
|
7
6
|
|
|
8
7
|
interface ProtocolWallet {
|
|
@@ -13,10 +12,11 @@ interface ProtocolWallet {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export default class CosmosWallet extends OmniWallet {
|
|
15
|
+
readonly icon = "https://legacy.cosmos.network/presskit/cosmos-brandmark-dynamic-dark.svg";
|
|
16
16
|
readonly type = WalletType.COSMOS;
|
|
17
17
|
|
|
18
|
-
constructor(readonly
|
|
19
|
-
super(
|
|
18
|
+
constructor(readonly wallet: ProtocolWallet) {
|
|
19
|
+
super();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
get address() {
|
|
@@ -31,11 +31,6 @@ export default class CosmosWallet extends OmniWallet {
|
|
|
31
31
|
return "";
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
async disconnect() {
|
|
35
|
-
super.disconnect();
|
|
36
|
-
this.wallet.disconnect?.();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
sendTransaction(signDoc: any): Promise<string> {
|
|
40
35
|
if (!this.wallet.sendTransaction) throw "Not impl";
|
|
41
36
|
return this.wallet.sendTransaction(signDoc);
|
package/src/evm/connector.ts
CHANGED
|
@@ -121,6 +121,11 @@ class EvmConnector extends OmniConnector<EvmWallet, { provider: EvmProvider }> {
|
|
|
121
121
|
|
|
122
122
|
return await this.connectWallet(id, wallet.provider);
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
async disconnect() {
|
|
126
|
+
this.wallets.forEach((w) => w.disconnect());
|
|
127
|
+
super.disconnect();
|
|
128
|
+
}
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
export default EvmConnector;
|
package/src/evm/wallet.ts
CHANGED
|
@@ -22,7 +22,15 @@ class EvmWallet extends OmniWallet {
|
|
|
22
22
|
readonly type = WalletType.EVM;
|
|
23
23
|
|
|
24
24
|
constructor(readonly connector: OmniConnector, readonly address: string, readonly provider: EvmProvider) {
|
|
25
|
-
super(
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async disconnect() {
|
|
29
|
+
await this.provider.request?.({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get icon() {
|
|
33
|
+
return this.connector.icon;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
private rpcs: Record<number, JsonRpcProvider> = {};
|
|
@@ -42,11 +50,6 @@ class EvmWallet extends OmniWallet {
|
|
|
42
50
|
return this.address.toLowerCase();
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
async disconnect() {
|
|
46
|
-
this.provider.request?.({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
|
|
47
|
-
await super.disconnect();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
53
|
async fetchBalances(chain: number, whitelist: string[]): Promise<Record<string, bigint>> {
|
|
51
54
|
const native = await this.fetchBalance(chain, "native");
|
|
52
55
|
try {
|
package/src/exchange.ts
CHANGED
|
@@ -176,6 +176,16 @@ export class Exchange {
|
|
|
176
176
|
return BigInt(swap.amount_in);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
isDirectDeposit(from: Token, to: Token) {
|
|
180
|
+
const directChains = [Network.Near, Network.Juno, Network.Gonka, Network.ADI];
|
|
181
|
+
return directChains.includes(from.chain) && to.chain === Network.Hot && from.omniAddress === to.omniAddress;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
isDirectWithdraw(from: Token, to: Token) {
|
|
185
|
+
const directChains = [Network.Near, Network.Juno, Network.Gonka, Network.ADI];
|
|
186
|
+
return directChains.includes(to.chain) && from.chain === Network.Hot && from.omniAddress === to.omniAddress;
|
|
187
|
+
}
|
|
188
|
+
|
|
179
189
|
async reviewSwap(request: BridgeRequest): Promise<BridgeReview> {
|
|
180
190
|
const { sender, refund, from, to, amount, recipient, slippage, type } = request;
|
|
181
191
|
const intentFrom = await this.getToken(from.chain, from.address);
|
|
@@ -184,12 +194,11 @@ export class Exchange {
|
|
|
184
194
|
if (!intentFrom) throw new Error("Unsupported token");
|
|
185
195
|
if (!intentTo) throw new Error("Unsupported token");
|
|
186
196
|
|
|
187
|
-
const deadlineTime =
|
|
188
|
-
const directChains = [Network.Near, Network.Juno, Network.Gonka, Network.ADI];
|
|
197
|
+
const deadlineTime = 5 * 60 * 1000;
|
|
189
198
|
const deadline = new Date(Date.now() + deadlineTime).toISOString();
|
|
190
199
|
const noFee = from.symbol === to.symbol || (from.symbol.toLowerCase().includes("usd") && to.symbol.toLowerCase().includes("usd"));
|
|
191
200
|
|
|
192
|
-
if (sender !== "qr" &&
|
|
201
|
+
if (sender !== "qr" && this.isDirectDeposit(from, to)) {
|
|
193
202
|
const fee = await this.wibe3.hotBridge.getDepositFee({
|
|
194
203
|
intentAccount: sender.omniAddress,
|
|
195
204
|
sender: sender.address,
|
|
@@ -213,7 +222,7 @@ export class Exchange {
|
|
|
213
222
|
};
|
|
214
223
|
}
|
|
215
224
|
|
|
216
|
-
if (sender !== "qr" &&
|
|
225
|
+
if (sender !== "qr" && this.isDirectWithdraw(from, to)) {
|
|
217
226
|
const fee = await this.withdrawFee(request);
|
|
218
227
|
if (fee >= amount) throw "Withdraw fee is greater than amount";
|
|
219
228
|
return {
|
|
@@ -282,10 +291,7 @@ export class Exchange {
|
|
|
282
291
|
if (request.from.chain !== Network.Hot && sender !== "qr") {
|
|
283
292
|
const amount = BigInt(qoute.quote.amountIn);
|
|
284
293
|
const depositAddress = qoute.quote.depositAddress!;
|
|
285
|
-
fee = await sender.transferFee(request.from, depositAddress, amount).catch((
|
|
286
|
-
console.error("Failed to calculate transfer fee", e);
|
|
287
|
-
return null;
|
|
288
|
-
});
|
|
294
|
+
fee = await sender.transferFee(request.from, depositAddress, amount).catch(() => null);
|
|
289
295
|
}
|
|
290
296
|
|
|
291
297
|
return {
|
|
@@ -303,7 +309,7 @@ export class Exchange {
|
|
|
303
309
|
};
|
|
304
310
|
}
|
|
305
311
|
|
|
306
|
-
async makeSwap(review: BridgeReview, pending: { log: (message: string) => void }) {
|
|
312
|
+
async makeSwap(review: BridgeReview, pending: { log: (message: string) => void }): Promise<{ review: BridgeReview; processing?: () => Promise<BridgeReview> }> {
|
|
307
313
|
const { sender, recipient } = review;
|
|
308
314
|
|
|
309
315
|
if (review.qoute === "withdraw") {
|
|
@@ -312,7 +318,7 @@ export class Exchange {
|
|
|
312
318
|
const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
|
|
313
319
|
if (recipientWallet) this.wibe3.fetchToken(review.to, recipientWallet);
|
|
314
320
|
this.wibe3.fetchToken(review.from, sender);
|
|
315
|
-
return review;
|
|
321
|
+
return { review };
|
|
316
322
|
}
|
|
317
323
|
|
|
318
324
|
if (review.qoute === "deposit") {
|
|
@@ -322,7 +328,7 @@ export class Exchange {
|
|
|
322
328
|
|
|
323
329
|
const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
|
|
324
330
|
if (recipientWallet) this.wibe3.fetchToken(review.to, recipientWallet);
|
|
325
|
-
return review;
|
|
331
|
+
return { review };
|
|
326
332
|
}
|
|
327
333
|
|
|
328
334
|
if (sender !== "qr") {
|
|
@@ -337,44 +343,41 @@ export class Exchange {
|
|
|
337
343
|
|
|
338
344
|
const depositAddress = review.qoute.depositAddress!;
|
|
339
345
|
let hash = "";
|
|
346
|
+
|
|
340
347
|
if (review.from.chain === Network.Hot) {
|
|
341
|
-
hash = await
|
|
342
|
-
.
|
|
343
|
-
|
|
344
|
-
token: review.from.address as OmniToken,
|
|
345
|
-
recipient: depositAddress,
|
|
346
|
-
})
|
|
348
|
+
hash = await this.wibe3
|
|
349
|
+
.intentsBuilder(sender)
|
|
350
|
+
.transfer({ amount: review.amountIn, token: review.from.address as OmniToken, recipient: depositAddress })
|
|
347
351
|
.execute();
|
|
348
352
|
} else {
|
|
349
353
|
hash = await sender.transfer({
|
|
350
354
|
receiver: depositAddress,
|
|
351
355
|
amount: review.amountIn,
|
|
352
356
|
comment: review.qoute.depositMemo,
|
|
353
|
-
token: review.from,
|
|
354
357
|
gasFee: review.fee ?? undefined,
|
|
358
|
+
token: review.from,
|
|
355
359
|
});
|
|
356
360
|
}
|
|
357
361
|
|
|
358
|
-
pending.log("Submitting tx");
|
|
359
362
|
this.wibe3.fetchToken(review.from, sender);
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (sender !== "qr") {
|
|
364
|
-
wait(1000).then(() => this.wibe3.fetchToken(review.to, sender));
|
|
363
|
+
OneClickService.submitDepositTx({ txHash: hash, depositAddress }).catch(() => {});
|
|
365
364
|
}
|
|
366
365
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
return {
|
|
367
|
+
review,
|
|
368
|
+
processing: async () => {
|
|
369
|
+
const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
|
|
370
|
+
if (!recipientWallet) return await this.processing(review);
|
|
370
371
|
|
|
371
|
-
|
|
372
|
-
|
|
372
|
+
const beforeBalance = await this.wibe3.fetchToken(review.to, recipientWallet).catch(() => null);
|
|
373
|
+
if (!beforeBalance) return await this.processing(review);
|
|
373
374
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
return await Promise.race([
|
|
376
|
+
this.waitBalance(review.to, recipientWallet, beforeBalance, review),
|
|
377
|
+
this.processing(review), //
|
|
378
|
+
]);
|
|
379
|
+
},
|
|
380
|
+
};
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
async waitBalance(to: Token, wallet: OmniWallet, beforeBalance: bigint, review: BridgeReview): Promise<BridgeReview> {
|
package/src/hot-wallet/google.ts
CHANGED
|
@@ -50,12 +50,19 @@ class GoogleConnector extends OmniConnector<OmniWallet> {
|
|
|
50
50
|
if (account.type === WalletType.STELLAR) {
|
|
51
51
|
const signMessage = async (message: string) => request("stellar:signMessage", { message });
|
|
52
52
|
const signTransaction = async (transaction: Transaction) => request("stellar:signTransaction", { transaction: transaction.toXDR() });
|
|
53
|
-
this.wallets.push(
|
|
53
|
+
this.wallets.push(
|
|
54
|
+
new StellarWallet({
|
|
55
|
+
rpc: this.wibe3.hotBridge.stellar,
|
|
56
|
+
address: account.address,
|
|
57
|
+
signMessage,
|
|
58
|
+
signTransaction,
|
|
59
|
+
})
|
|
60
|
+
);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
if (account.type === WalletType.TON) {
|
|
57
64
|
this.setWallet(
|
|
58
|
-
new TonWallet(
|
|
65
|
+
new TonWallet({
|
|
59
66
|
sendTransaction: (params) => request("ton:sendTransaction", params),
|
|
60
67
|
signData: (params) => request("ton:signData", params),
|
|
61
68
|
account: { address: account.address, publicKey: account.publicKey },
|
|
@@ -65,21 +72,21 @@ class GoogleConnector extends OmniConnector<OmniWallet> {
|
|
|
65
72
|
|
|
66
73
|
if (account.type === WalletType.NEAR) {
|
|
67
74
|
this.setWallet(
|
|
68
|
-
new NearWallet(
|
|
75
|
+
new NearWallet(account.address, account.publicKey, {
|
|
69
76
|
signAndSendTransaction: (params: SignAndSendTransactionParams) => request("near:signAndSendTransaction", params),
|
|
70
77
|
signAndSendTransactions: (params: SignAndSendTransactionsParams) => request("near:signAndSendTransactions", params),
|
|
71
78
|
signMessage: (params: SignMessageParams) => request("near:signMessage", params),
|
|
72
79
|
getAccounts: async () => [{ accountId: account.address, publicKey: account.publicKey }],
|
|
73
80
|
signIn: () => request("near:signIn", {}),
|
|
74
|
-
signOut: async () => {},
|
|
75
81
|
manifest: {} as unknown as WalletManifest,
|
|
82
|
+
signOut: async () => {},
|
|
76
83
|
}) as NearWallet
|
|
77
84
|
);
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
if (account.type === WalletType.SOLANA) {
|
|
81
88
|
this.setWallet(
|
|
82
|
-
new SolanaWallet(
|
|
89
|
+
new SolanaWallet({
|
|
83
90
|
sendTransaction: async (transaction: unknown, _: unknown, options?: unknown) => await request("solana:sendTransaction", { transaction, options }),
|
|
84
91
|
signMessage: async (message: string) => await request("solana:signMessage", { message }),
|
|
85
92
|
disconnect: async () => {},
|
package/src/hot-wallet/proxy.ts
CHANGED
|
@@ -30,8 +30,8 @@ export const deleteRequest = async (id: string) => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const computeRequestId = async (request: object) => {
|
|
33
|
-
const query = base58.encode(
|
|
34
|
-
const hashsum = sha1(
|
|
33
|
+
const query = base58.encode(new TextEncoder().encode(JSON.stringify({ ...request, _id: uuid4() })));
|
|
34
|
+
const hashsum = sha1(new TextEncoder().encode(query));
|
|
35
35
|
const id = Buffer.from(hashsum).toString("base64");
|
|
36
36
|
const requestId = id.replaceAll("/", "_").replaceAll("-", "+").slice(0, 13);
|
|
37
37
|
return { requestId, query };
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import "@lottiefiles/dotlottie-wc";
|
|
2
|
+
|
|
1
3
|
export { OmniWallet } from "./OmniWallet";
|
|
2
4
|
export { OmniConnector } from "./OmniConnector";
|
|
3
5
|
export { HotConnector } from "./HotConnector";
|
|
4
6
|
|
|
5
|
-
export { Bridge as BridgeWidget } from "./ui/
|
|
7
|
+
export { Bridge as BridgeWidget } from "./ui/bridge/Bridge";
|
|
6
8
|
|
|
7
9
|
export * from "./core";
|