@hot-labs/kit 1.0.33
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/.eslintrc.cjs +11 -0
- package/.github/workflows/deploy-example.yml +55 -0
- package/.github/workflows/release.yml +74 -0
- package/.prettierrc +4 -0
- package/.prototools +2 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +1 -0
- package/README.md +67 -0
- package/build/GoogleConnector.d.ts +20 -0
- package/build/GoogleConnector.js +76 -0
- package/build/GoogleConnector.js.map +1 -0
- package/build/HotConnector.d.ts +91 -0
- package/build/HotConnector.js +285 -0
- package/build/HotConnector.js.map +1 -0
- package/build/OmniConnector.d.ts +95 -0
- package/build/OmniConnector.js +123 -0
- package/build/OmniConnector.js.map +1 -0
- package/build/OmniWallet.d.ts +57 -0
- package/build/OmniWallet.js +56 -0
- package/build/OmniWallet.js.map +1 -0
- package/build/cosmos/connector.d.ts +53 -0
- package/build/cosmos/connector.js +207 -0
- package/build/cosmos/connector.js.map +1 -0
- package/build/cosmos/wallet.d.ts +28 -0
- package/build/cosmos/wallet.js +59 -0
- package/build/cosmos/wallet.js.map +1 -0
- package/build/events.d.ts +42 -0
- package/build/events.js +64 -0
- package/build/events.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 +35 -0
- package/build/evm/connector.js +124 -0
- package/build/evm/connector.js.map +1 -0
- package/build/evm/wallet.d.ts +47 -0
- package/build/evm/wallet.js +136 -0
- package/build/evm/wallet.js.map +1 -0
- package/build/exchange.d.ts +63 -0
- package/build/exchange.js +384 -0
- package/build/exchange.js.map +1 -0
- package/build/hot-wallet/evm.d.ts +1 -0
- package/build/hot-wallet/evm.js +33 -0
- package/build/hot-wallet/evm.js.map +1 -0
- package/build/hot-wallet/hot.d.ts +3 -0
- package/build/hot-wallet/hot.js +40 -0
- package/build/hot-wallet/hot.js.map +1 -0
- package/build/hot-wallet/index.d.ts +4 -0
- package/build/hot-wallet/index.js +5 -0
- package/build/hot-wallet/index.js.map +1 -0
- package/build/hot-wallet/solana/account.d.ts +11 -0
- package/build/hot-wallet/solana/account.js +42 -0
- package/build/hot-wallet/solana/account.js.map +1 -0
- package/build/hot-wallet/solana/index.d.ts +1 -0
- package/build/hot-wallet/solana/index.js +85 -0
- package/build/hot-wallet/solana/index.js.map +1 -0
- package/build/hot-wallet/solana/register.d.ts +2 -0
- package/build/hot-wallet/solana/register.js +41 -0
- package/build/hot-wallet/solana/register.js.map +1 -0
- package/build/hot-wallet/solana/solana-wallet.d.ts +34 -0
- package/build/hot-wallet/solana/solana-wallet.js +223 -0
- package/build/hot-wallet/solana/solana-wallet.js.map +1 -0
- package/build/hot-wallet/solana/utils.d.ts +32 -0
- package/build/hot-wallet/solana/utils.js +36 -0
- package/build/hot-wallet/solana/utils.js.map +1 -0
- package/build/hot-wallet/stellar.d.ts +38 -0
- package/build/hot-wallet/stellar.js +32 -0
- package/build/hot-wallet/stellar.js.map +1 -0
- package/build/hot-wallet/ton.d.ts +1 -0
- package/build/hot-wallet/ton.js +49 -0
- package/build/hot-wallet/ton.js.map +1 -0
- package/build/hot-wallet/wallet.d.ts +1 -0
- package/build/hot-wallet/wallet.js +40 -0
- package/build/hot-wallet/wallet.js.map +1 -0
- package/build/index.d.ts +24 -0
- package/build/index.js +25 -0
- package/build/index.js.map +1 -0
- package/build/near/connector.d.ts +28 -0
- package/build/near/connector.js +56 -0
- package/build/near/connector.js.map +1 -0
- package/build/near/wallet.d.ts +62 -0
- package/build/near/wallet.js +233 -0
- package/build/near/wallet.js.map +1 -0
- package/build/omni/Intents.d.ts +93 -0
- package/build/omni/Intents.js +395 -0
- package/build/omni/Intents.js.map +1 -0
- package/build/omni/bridge.d.ts +3 -0
- package/build/omni/bridge.js +34 -0
- package/build/omni/bridge.js.map +1 -0
- package/build/omni/config.d.ts +99 -0
- package/build/omni/config.js +126 -0
- package/build/omni/config.js.map +1 -0
- package/build/omni/defaultTokens.d.ts +17 -0
- package/build/omni/defaultTokens.js +1079 -0
- package/build/omni/defaultTokens.js.map +1 -0
- package/build/omni/index.d.ts +8 -0
- package/build/omni/index.js +9 -0
- package/build/omni/index.js.map +1 -0
- package/build/omni/nearRpc.d.ts +24 -0
- package/build/omni/nearRpc.js +167 -0
- package/build/omni/nearRpc.js.map +1 -0
- package/build/omni/recipient.d.ts +10 -0
- package/build/omni/recipient.js +40 -0
- package/build/omni/recipient.js.map +1 -0
- package/build/omni/token.d.ts +36 -0
- package/build/omni/token.js +136 -0
- package/build/omni/token.js.map +1 -0
- package/build/omni/tokens.d.ts +14 -0
- package/build/omni/tokens.js +57 -0
- package/build/omni/tokens.js.map +1 -0
- package/build/omni/types.d.ts +41 -0
- package/build/omni/types.js +2 -0
- package/build/omni/types.js.map +1 -0
- package/build/omni/utils.d.ts +24 -0
- package/build/omni/utils.js +150 -0
- package/build/omni/utils.js.map +1 -0
- package/build/settings.d.ts +5 -0
- package/build/settings.js +6 -0
- package/build/settings.js.map +1 -0
- package/build/solana/connector.d.ts +31 -0
- package/build/solana/connector.js +138 -0
- package/build/solana/connector.js.map +1 -0
- package/build/solana/protocol.d.ts +25 -0
- package/build/solana/protocol.js +56 -0
- package/build/solana/protocol.js.map +1 -0
- package/build/solana/wallet.d.ts +47 -0
- package/build/solana/wallet.js +188 -0
- package/build/solana/wallet.js.map +1 -0
- package/build/solana/wallets.d.ts +102 -0
- package/build/solana/wallets.js +150 -0
- package/build/solana/wallets.js.map +1 -0
- package/build/stellar/connector.d.ts +25 -0
- package/build/stellar/connector.js +56 -0
- package/build/stellar/connector.js.map +1 -0
- package/build/stellar/wallet.d.ts +70 -0
- package/build/stellar/wallet.js +225 -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 +25 -0
- package/build/ton/connector.js +119 -0
- package/build/ton/connector.js.map +1 -0
- package/build/ton/utils.d.ts +45 -0
- package/build/ton/utils.js +64 -0
- package/build/ton/utils.js.map +1 -0
- package/build/ton/wallet.d.ts +70 -0
- package/build/ton/wallet.js +154 -0
- package/build/ton/wallet.js.map +1 -0
- package/build/ui/Popup.d.ts +10 -0
- package/build/ui/Popup.js +38 -0
- package/build/ui/Popup.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 +9 -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/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 +1 -0
- package/build/ui/icons/arrow-right.js +5 -0
- package/build/ui/icons/arrow-right.js.map +1 -0
- package/build/ui/icons/exchange.d.ts +6 -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/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/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/payment/Bridge.d.ts +27 -0
- package/build/ui/payment/Bridge.js +340 -0
- package/build/ui/payment/Bridge.js.map +1 -0
- package/build/ui/payment/DepositQR.d.ts +9 -0
- package/build/ui/payment/DepositQR.js +56 -0
- package/build/ui/payment/DepositQR.js.map +1 -0
- package/build/ui/payment/Payment.d.ts +16 -0
- package/build/ui/payment/Payment.js +50 -0
- package/build/ui/payment/Payment.js.map +1 -0
- package/build/ui/payment/Profile.d.ts +7 -0
- package/build/ui/payment/Profile.js +88 -0
- package/build/ui/payment/Profile.js.map +1 -0
- package/build/ui/payment/SelectRecipient.d.ts +14 -0
- package/build/ui/payment/SelectRecipient.js +68 -0
- package/build/ui/payment/SelectRecipient.js.map +1 -0
- package/build/ui/payment/SelectSender.d.ts +13 -0
- package/build/ui/payment/SelectSender.js +23 -0
- package/build/ui/payment/SelectSender.js.map +1 -0
- package/build/ui/payment/SelectToken.d.ts +13 -0
- package/build/ui/payment/SelectToken.js +92 -0
- package/build/ui/payment/SelectToken.js.map +1 -0
- package/build/ui/payment/TokenCard.d.ts +23 -0
- package/build/ui/payment/TokenCard.js +50 -0
- package/build/ui/payment/TokenCard.js.map +1 -0
- package/build/ui/router.d.ts +37 -0
- package/build/ui/router.js +56 -0
- package/build/ui/router.js.map +1 -0
- package/build/ui/styles.d.ts +11 -0
- package/build/ui/styles.js +273 -0
- package/build/ui/styles.js.map +1 -0
- package/package.json +60 -0
- package/skill.md +989 -0
- package/src/GoogleConnector.ts +102 -0
- package/src/HotConnector.ts +344 -0
- package/src/OmniConnector.ts +161 -0
- package/src/OmniWallet.ts +94 -0
- package/src/cosmos/connector.ts +242 -0
- package/src/cosmos/wallet.ts +77 -0
- package/src/events.ts +66 -0
- package/src/evm/abi.ts +39 -0
- package/src/evm/connector.ts +139 -0
- package/src/evm/wallet.ts +156 -0
- package/src/exchange.ts +426 -0
- package/src/hot-wallet/evm.ts +38 -0
- package/src/hot-wallet/hot.ts +39 -0
- package/src/hot-wallet/index.ts +4 -0
- package/src/hot-wallet/solana/account.ts +52 -0
- package/src/hot-wallet/solana/index.ts +98 -0
- package/src/hot-wallet/solana/register.ts +48 -0
- package/src/hot-wallet/solana/solana-wallet.ts +280 -0
- package/src/hot-wallet/solana/utils.ts +56 -0
- package/src/hot-wallet/stellar.ts +39 -0
- package/src/hot-wallet/ton.ts +56 -0
- package/src/hot-wallet/wallet.ts +44 -0
- package/src/index.ts +30 -0
- package/src/near/connector.ts +71 -0
- package/src/near/wallet.ts +255 -0
- package/src/omni/Intents.ts +454 -0
- package/src/omni/bridge.ts +38 -0
- package/src/omni/config.ts +130 -0
- package/src/omni/defaultTokens.ts +1078 -0
- package/src/omni/index.ts +8 -0
- package/src/omni/nearRpc.ts +187 -0
- package/src/omni/recipient.ts +41 -0
- package/src/omni/token.ts +125 -0
- package/src/omni/tokens.ts +68 -0
- package/src/omni/types.ts +46 -0
- package/src/omni/utils.ts +163 -0
- package/src/settings.ts +5 -0
- package/src/solana/connector.ts +151 -0
- package/src/solana/protocol.ts +66 -0
- package/src/solana/wallet.ts +230 -0
- package/src/solana/wallets.ts +243 -0
- package/src/stellar/connector.ts +69 -0
- package/src/stellar/wallet.ts +267 -0
- package/src/storage.ts +19 -0
- package/src/ton/connector.ts +138 -0
- package/src/ton/utils.ts +73 -0
- package/src/ton/wallet.ts +178 -0
- package/src/ui/Popup.tsx +62 -0
- package/src/ui/connect/AuthPopup.tsx +78 -0
- package/src/ui/connect/ConnectWallet.tsx +63 -0
- package/src/ui/connect/LogoutPopup.tsx +20 -0
- package/src/ui/connect/WCPopup.tsx +122 -0
- package/src/ui/connect/WCRequest.tsx +28 -0
- package/src/ui/connect/WalletPicker.tsx +92 -0
- package/src/ui/icons/arrow-right.tsx +8 -0
- package/src/ui/icons/exchange.tsx +17 -0
- package/src/ui/icons/logout.tsx +18 -0
- package/src/ui/icons/pending.tsx +18 -0
- package/src/ui/icons/qr.tsx +12 -0
- package/src/ui/icons/search.tsx +18 -0
- package/src/ui/icons/switch.tsx +10 -0
- package/src/ui/icons/wallet.tsx +18 -0
- package/src/ui/payment/Bridge.tsx +582 -0
- package/src/ui/payment/DepositQR.tsx +88 -0
- package/src/ui/payment/Payment.tsx +78 -0
- package/src/ui/payment/Profile.tsx +140 -0
- package/src/ui/payment/SelectRecipient.tsx +111 -0
- package/src/ui/payment/SelectSender.tsx +60 -0
- package/src/ui/payment/SelectToken.tsx +134 -0
- package/src/ui/payment/TokenCard.tsx +83 -0
- package/src/ui/router.tsx +92 -0
- package/src/ui/styles.ts +284 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +17 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
2
|
+
import { ed25519 } from "@noble/curves/ed25519";
|
|
3
|
+
import { base58, base64, hex } from "@scure/base";
|
|
4
|
+
|
|
5
|
+
import type { HotConnector } from "../HotConnector";
|
|
6
|
+
import type { OmniWallet } from "../OmniWallet";
|
|
7
|
+
import type { TransferIntent, MtWithdrawIntent, FtWithdrawIntent, TokenDiffIntent, AuthCallIntent } from "./types";
|
|
8
|
+
|
|
9
|
+
import { OmniToken } from "./config";
|
|
10
|
+
import { tokens } from "./tokens";
|
|
11
|
+
import { rpc } from "./nearRpc";
|
|
12
|
+
|
|
13
|
+
export const TGAS = 1000000000000n;
|
|
14
|
+
|
|
15
|
+
export class Intents {
|
|
16
|
+
constructor(readonly wibe3?: HotConnector) {}
|
|
17
|
+
|
|
18
|
+
static get builder() {
|
|
19
|
+
return new Intents();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
hashes: string[] = [];
|
|
23
|
+
intents: (TransferIntent | MtWithdrawIntent | FtWithdrawIntent | TokenDiffIntent | AuthCallIntent)[] = [];
|
|
24
|
+
nonce?: Uint8Array;
|
|
25
|
+
deadline?: Date;
|
|
26
|
+
signer?: OmniWallet | { ed25519PrivateKey: Uint8Array; omniAddress?: string };
|
|
27
|
+
|
|
28
|
+
commitments: Record<string, any>[] = [];
|
|
29
|
+
need = new Map<OmniToken, bigint>();
|
|
30
|
+
|
|
31
|
+
addNeed(token: OmniToken, amount: bigint) {
|
|
32
|
+
if (!this.need.has(token)) this.need.set(token, 0n);
|
|
33
|
+
this.need.set(token, this.need.get(token)! + amount);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
authCall(args: { contractId: string; msg: string; attachNear: bigint; tgas: number }) {
|
|
38
|
+
this.addNeed(OmniToken.NEAR, args.attachNear);
|
|
39
|
+
this.intents.push({
|
|
40
|
+
min_gas: (BigInt(args.tgas) * TGAS).toString(),
|
|
41
|
+
attached_deposit: args.attachNear.toString(),
|
|
42
|
+
contract_id: args.contractId,
|
|
43
|
+
intent: "auth_call",
|
|
44
|
+
msg: args.msg,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
transfer(args: { recipient: string; token: OmniToken; amount: number | bigint; msg?: string; tgas?: number }) {
|
|
51
|
+
const omniToken = tokens.get(args.token);
|
|
52
|
+
const amount = (typeof args.amount === "number" ? omniToken.int(args.amount) : args.amount).toString();
|
|
53
|
+
const intent: TransferIntent = {
|
|
54
|
+
min_gas: args.tgas ? (BigInt(args.tgas) * TGAS).toString() : undefined,
|
|
55
|
+
tokens: { [omniToken.omniAddress]: amount },
|
|
56
|
+
receiver_id: args.recipient.toLowerCase(),
|
|
57
|
+
intent: "transfer",
|
|
58
|
+
msg: args.msg,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
this.addNeed(args.token, BigInt(amount));
|
|
62
|
+
this.intents.push(intent);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
batchTransfer(args: { recipient: string; tokens: Record<OmniToken, number | bigint>; msg?: string; tgas?: number }) {
|
|
67
|
+
const tokensList: Record<string, string> = {};
|
|
68
|
+
for (const [token, amount] of Object.entries(args.tokens)) {
|
|
69
|
+
const omniToken = tokens.get(token);
|
|
70
|
+
const amountStr = typeof amount === "number" ? omniToken.int(amount).toString() : amount.toString();
|
|
71
|
+
tokensList[omniToken.omniAddress] = amountStr;
|
|
72
|
+
this.addNeed(token as OmniToken, BigInt(amountStr));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const intent: TransferIntent = {
|
|
76
|
+
intent: "transfer",
|
|
77
|
+
receiver_id: args.recipient.toLowerCase(),
|
|
78
|
+
min_gas: args.tgas ? (BigInt(args.tgas) * TGAS).toString() : undefined,
|
|
79
|
+
tokens: tokensList,
|
|
80
|
+
msg: args.msg,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.intents.push(intent);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
tokenDiff(args: Record<OmniToken, bigint | number>) {
|
|
88
|
+
const parse = (token: OmniToken, amount: bigint | number): [string, string] => {
|
|
89
|
+
if (typeof amount === "number") return [token.toString(), tokens.get(token).int(amount).toString()];
|
|
90
|
+
return [token.toString(), amount.toString()];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const intent: TokenDiffIntent = {
|
|
94
|
+
diff: Object.fromEntries(Object.entries(args).map(([token, amount]) => parse(token as OmniToken, amount))),
|
|
95
|
+
intent: "token_diff",
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
for (const [token, amountStr] of Object.entries(intent.diff)) {
|
|
99
|
+
const amount = BigInt(amountStr);
|
|
100
|
+
if (amount < 0n) {
|
|
101
|
+
const tokenKey = token as OmniToken;
|
|
102
|
+
this.addNeed(tokenKey, -amount);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.intents.push(intent);
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
addRawIntent(rawIntent: Record<string, any>) {
|
|
111
|
+
if (!rawIntent.intent) throw new Error("Intent must have 'intent' field");
|
|
112
|
+
const intentType = rawIntent.intent;
|
|
113
|
+
|
|
114
|
+
if (intentType === "token_diff") {
|
|
115
|
+
const diff = rawIntent.diff || rawIntent.token_diff;
|
|
116
|
+
if (!diff) throw new Error("token_diff intent must have 'diff' or 'token_diff' field");
|
|
117
|
+
|
|
118
|
+
const tokenDiffArgs: Record<OmniToken, bigint> = {} as Record<OmniToken, bigint>;
|
|
119
|
+
for (const [token, amountStr] of Object.entries(diff)) {
|
|
120
|
+
tokenDiffArgs[token as OmniToken] = BigInt(amountStr as string);
|
|
121
|
+
}
|
|
122
|
+
return this.tokenDiff(tokenDiffArgs);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (intentType === "transfer") {
|
|
126
|
+
if (!rawIntent.tokens || !rawIntent.receiver_id) {
|
|
127
|
+
throw new Error("transfer intent must have 'tokens' and 'receiver_id' fields");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const tokens: Record<OmniToken, bigint> = {} as Record<OmniToken, bigint>;
|
|
131
|
+
for (const [token, amount] of Object.entries(rawIntent.tokens)) {
|
|
132
|
+
tokens[token as OmniToken] = BigInt(amount as string);
|
|
133
|
+
}
|
|
134
|
+
return this.batchTransfer({
|
|
135
|
+
recipient: rawIntent.receiver_id,
|
|
136
|
+
tokens,
|
|
137
|
+
msg: rawIntent.msg,
|
|
138
|
+
tgas: rawIntent.min_gas ? Number(BigInt(rawIntent.min_gas) / TGAS) : undefined,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (intentType === "mt_withdraw") {
|
|
143
|
+
const intent: MtWithdrawIntent = {
|
|
144
|
+
intent: "mt_withdraw",
|
|
145
|
+
amounts: rawIntent.amounts,
|
|
146
|
+
receiver_id: rawIntent.receiver_id,
|
|
147
|
+
token_ids: rawIntent.token_ids,
|
|
148
|
+
token: rawIntent.token,
|
|
149
|
+
memo: rawIntent.memo,
|
|
150
|
+
msg: rawIntent.msg,
|
|
151
|
+
min_gas: rawIntent.min_gas,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
for (let i = 0; i < rawIntent.amounts.length; i++) {
|
|
155
|
+
const token = `nep245:${rawIntent.token}:${rawIntent.token_ids[i]}` as OmniToken;
|
|
156
|
+
this.addNeed(token, BigInt(rawIntent.amounts[i]));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.intents.push(intent);
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (intentType === "ft_withdraw") {
|
|
164
|
+
if (!rawIntent.token || !rawIntent.receiver_id || !rawIntent.amount) {
|
|
165
|
+
throw new Error("ft_withdraw intent must have 'token', 'receiver_id', and 'amount' fields");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const token = `nep141:${rawIntent.token}` as OmniToken;
|
|
169
|
+
return this.withdraw({
|
|
170
|
+
amount: BigInt(rawIntent.amount),
|
|
171
|
+
receiver: rawIntent.receiver_id,
|
|
172
|
+
memo: rawIntent.memo,
|
|
173
|
+
msg: rawIntent.msg,
|
|
174
|
+
token,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (intentType === "auth_call") {
|
|
179
|
+
if (!rawIntent.contract_id || !rawIntent.msg || !rawIntent.attached_deposit || !rawIntent.min_gas) {
|
|
180
|
+
throw new Error("auth_call intent must have 'contract_id', 'msg', 'attached_deposit', and 'min_gas' fields");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return this.authCall({
|
|
184
|
+
contractId: rawIntent.contract_id,
|
|
185
|
+
msg: rawIntent.msg,
|
|
186
|
+
attachNear: BigInt(rawIntent.attached_deposit),
|
|
187
|
+
tgas: Number(BigInt(rawIntent.min_gas) / TGAS),
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
throw new Error(`Unsupported intent type: ${intentType}`);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
withdraw(args: { token: OmniToken; amount: number | bigint; receiver: string; memo?: string; msg?: string; tgas?: number }) {
|
|
195
|
+
const omniToken = tokens.get(args.token);
|
|
196
|
+
const amount = (typeof args.amount === "number" ? omniToken.int(args.amount) : args.amount).toString();
|
|
197
|
+
const [standart, ...tokenParts] = args.token.split(":");
|
|
198
|
+
this.addNeed(args.token, BigInt(amount));
|
|
199
|
+
|
|
200
|
+
if (standart === "nep245") {
|
|
201
|
+
const mtContract = tokenParts[0];
|
|
202
|
+
const tokenId = tokenParts.slice(1).join(":");
|
|
203
|
+
const intent: MtWithdrawIntent = {
|
|
204
|
+
intent: "mt_withdraw",
|
|
205
|
+
amounts: [amount],
|
|
206
|
+
receiver_id: args.receiver,
|
|
207
|
+
token_ids: [tokenId],
|
|
208
|
+
token: mtContract,
|
|
209
|
+
memo: args.memo,
|
|
210
|
+
msg: args.msg,
|
|
211
|
+
min_gas: args.tgas ? (BigInt(args.tgas) * TGAS).toString() : undefined,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
this.intents.push(intent);
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (standart === "nep141") {
|
|
219
|
+
const intent: FtWithdrawIntent = {
|
|
220
|
+
intent: "ft_withdraw",
|
|
221
|
+
receiver_id: args.receiver,
|
|
222
|
+
token: tokenParts.join(":"),
|
|
223
|
+
amount: amount,
|
|
224
|
+
memo: args.memo,
|
|
225
|
+
msg: args.msg,
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
this.intents.push(intent);
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
throw new Error(`Unsupported token: ${args.token}`);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
attachHashes(hashes: string[]) {
|
|
236
|
+
this.hashes.push(...hashes);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
attachWallet(wallet: OmniWallet) {
|
|
241
|
+
this.signer = wallet;
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
attachDeadline(deadline: Date) {
|
|
246
|
+
this.deadline = deadline;
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
attachNonce(nonce: Uint8Array) {
|
|
251
|
+
this.nonce = nonce;
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
attachTimeout(seconds: number) {
|
|
256
|
+
this.deadline = new Date(Date.now() + seconds * 1000);
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
attachSeed(seed: string) {
|
|
261
|
+
this.nonce = new Uint8Array(sha256(new TextEncoder().encode(seed))).slice(0, 32);
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
take(token: OmniToken, amount: number | bigint) {
|
|
266
|
+
const intAmount = typeof amount === "number" ? tokens.get(token).int(amount) : amount;
|
|
267
|
+
|
|
268
|
+
this.addNeed(token, intAmount);
|
|
269
|
+
const tokenDiff = this.intents.find((intent) => intent.intent === "token_diff");
|
|
270
|
+
|
|
271
|
+
if (tokenDiff) tokenDiff.diff[token.toString()] = intAmount.toString();
|
|
272
|
+
else this.intents.push({ intent: "token_diff", diff: { [token.toString()]: intAmount.toString() } });
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
give(token: OmniToken, amount: number | bigint) {
|
|
277
|
+
const intAmount = typeof amount === "number" ? tokens.get(token).int(amount) : amount;
|
|
278
|
+
|
|
279
|
+
this.addNeed(token, -intAmount);
|
|
280
|
+
const tokenDiff = this.intents.find((intent) => intent.intent === "token_diff");
|
|
281
|
+
|
|
282
|
+
if (tokenDiff) tokenDiff.diff[token.toString()] = (-intAmount).toString();
|
|
283
|
+
else this.intents.push({ intent: "token_diff", diff: { [token.toString()]: (-intAmount).toString() } });
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async signRaw({ ed25519PrivateKey, intentsAddress, checkTokens }: { ed25519PrivateKey: Uint8Array; intentsAddress?: string; checkTokens?: boolean }) {
|
|
288
|
+
if (checkTokens) {
|
|
289
|
+
await this.checkRequiredTokens();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const publicKey = ed25519.getPublicKey(ed25519PrivateKey);
|
|
293
|
+
const nonce = new Uint8Array(this.nonce || window.crypto.getRandomValues(new Uint8Array(32)));
|
|
294
|
+
|
|
295
|
+
const message = JSON.stringify({
|
|
296
|
+
deadline: this.deadline ? new Date(this.deadline).toISOString() : "2100-01-01T00:00:00.000Z",
|
|
297
|
+
nonce: base64.encode(nonce),
|
|
298
|
+
verifying_contract: "intents.near",
|
|
299
|
+
signer_id: intentsAddress || hex.encode(publicKey).toLowerCase(),
|
|
300
|
+
intents: this.intents,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
signature: `ed25519:${base58.encode(ed25519.sign(message, ed25519PrivateKey))}`,
|
|
305
|
+
public_key: `ed25519:${base58.encode(publicKey)}`,
|
|
306
|
+
standard: "raw_ed25519",
|
|
307
|
+
payload: message,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async attachCommitment(commitment: Record<string, any>) {
|
|
312
|
+
this.commitments.push(commitment);
|
|
313
|
+
return this;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async attachSigner(signer: OmniWallet | { ed25519PrivateKey: Uint8Array; omniAddress?: string }) {
|
|
317
|
+
this.signer = signer;
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async checkRequiredTokens() {
|
|
322
|
+
if (this.wibe3 == null) return;
|
|
323
|
+
for (const [token, needAmount] of this.need.entries()) {
|
|
324
|
+
if (needAmount <= 0n) continue;
|
|
325
|
+
await this.wibe3.requestToken(token, needAmount);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
async sign(params = { checkTokens: true }) {
|
|
330
|
+
const signer = this.signer;
|
|
331
|
+
if (!signer) throw new Error("No signer attached");
|
|
332
|
+
if (!signer.omniAddress) throw new Error("No omni address");
|
|
333
|
+
|
|
334
|
+
if ("ed25519PrivateKey" in signer) {
|
|
335
|
+
return await this.signRaw({
|
|
336
|
+
ed25519PrivateKey: signer.ed25519PrivateKey,
|
|
337
|
+
intentsAddress: signer.omniAddress,
|
|
338
|
+
checkTokens: params.checkTokens,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (params.checkTokens) {
|
|
343
|
+
await this.checkRequiredTokens();
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return await signer.signIntents(this.intents, {
|
|
347
|
+
deadline: this.deadline ? +this.deadline : undefined,
|
|
348
|
+
nonce: this.nonce,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async simulate(params = { checkTokens: true }) {
|
|
353
|
+
const signed = await this.sign(params);
|
|
354
|
+
return await Intents.simulateIntents([signed]);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
async execute(params = { checkTokens: true }) {
|
|
358
|
+
const signed = await this.sign(params);
|
|
359
|
+
const hash = await Intents.publishSignedIntents([...this.commitments, signed], this.hashes);
|
|
360
|
+
await rpc.waitTransactionResult(hash, "intents.near");
|
|
361
|
+
return hash;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
static async publishSignedIntents(signed: Record<string, any>[], hashes: string[] = []): Promise<string> {
|
|
365
|
+
const res = await fetch("https://api0.herewallet.app/api/v1/evm/intent-solver", {
|
|
366
|
+
headers: { "Content-Type": "application/json" },
|
|
367
|
+
method: "POST",
|
|
368
|
+
body: JSON.stringify({
|
|
369
|
+
params: [{ signed_datas: signed, quote_hashes: hashes }],
|
|
370
|
+
method: "publish_intents",
|
|
371
|
+
id: "dontcare",
|
|
372
|
+
jsonrpc: "2.0",
|
|
373
|
+
}),
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
const { result } = await res.json();
|
|
377
|
+
if (result.status === "FAILED") throw result.reason;
|
|
378
|
+
const intentResult = result.intent_hashes[0];
|
|
379
|
+
|
|
380
|
+
const getStatus = async () => {
|
|
381
|
+
const statusRes = await fetch("https://api0.herewallet.app/api/v1/evm/intent-solver", {
|
|
382
|
+
headers: { "Content-Type": "application/json" },
|
|
383
|
+
method: "POST",
|
|
384
|
+
body: JSON.stringify({
|
|
385
|
+
params: [{ intent_hash: intentResult }],
|
|
386
|
+
method: "get_status",
|
|
387
|
+
id: "dontcare",
|
|
388
|
+
jsonrpc: "2.0",
|
|
389
|
+
}),
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
const { result } = await statusRes.json();
|
|
393
|
+
return result;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const fetchResult = async () => {
|
|
397
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
398
|
+
const result = await getStatus().catch(() => null);
|
|
399
|
+
if (result == null) return await fetchResult();
|
|
400
|
+
if (result.status === "SETTLED") return result.data.hash;
|
|
401
|
+
if (result.status === "FAILED") throw result.reason || "Failed to publish intents";
|
|
402
|
+
return await fetchResult();
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const hash = await fetchResult();
|
|
406
|
+
return hash;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
static async hasPublicKey(accountId: string, publicKey: string): Promise<boolean> {
|
|
410
|
+
return await rpc.viewMethod({
|
|
411
|
+
args: { account_id: accountId, public_key: publicKey },
|
|
412
|
+
methodName: "has_public_key",
|
|
413
|
+
contractId: "intents.near",
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
static async simulateIntents(signed: Record<string, any>[]) {
|
|
418
|
+
return await rpc.viewMethod({
|
|
419
|
+
args: { signed: signed },
|
|
420
|
+
methodName: "simulate_intents",
|
|
421
|
+
contractId: "intents.near",
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
static async getIntentsBalances(assets: string[], accountId: string): Promise<Record<string, bigint>> {
|
|
426
|
+
const balances = await rpc.viewMethod({
|
|
427
|
+
args: { token_ids: assets, account_id: accountId },
|
|
428
|
+
methodName: "mt_batch_balance_of",
|
|
429
|
+
contractId: "intents.near",
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
return Object.fromEntries(assets.map((asset, index) => [asset, BigInt(balances[index] || 0n)]));
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
static async getIntentsAssets(accountId: string): Promise<string[]> {
|
|
436
|
+
const assets: string[] = [];
|
|
437
|
+
const limit = 250;
|
|
438
|
+
let fromIndex = 0n;
|
|
439
|
+
|
|
440
|
+
for (;;) {
|
|
441
|
+
const balances = await rpc.viewMethod({
|
|
442
|
+
args: { account_id: accountId, from_index: fromIndex.toString(), limit },
|
|
443
|
+
methodName: "mt_tokens_for_owner",
|
|
444
|
+
contractId: "intents.near",
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
assets.push(...balances.map((b: any) => b.token_id));
|
|
448
|
+
if (balances.length < limit) break;
|
|
449
|
+
fromIndex += BigInt(limit);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return assets;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HotBridge, Network, ReviewFee } from "@hot-labs/omni-sdk";
|
|
2
|
+
import { Intents } from "./Intents";
|
|
3
|
+
|
|
4
|
+
export { ReviewFee };
|
|
5
|
+
|
|
6
|
+
export const bridge = new HotBridge({
|
|
7
|
+
api: ["https://dev.herewallet.app"],
|
|
8
|
+
solanaRpc: ["https://api0.herewallet.app/api/v1/solana/rpc/1001"],
|
|
9
|
+
|
|
10
|
+
publishIntents: async (signed: Record<string, any>[], hashes: string[] = []) => {
|
|
11
|
+
const hash = await Intents.publishSignedIntents(signed, hashes);
|
|
12
|
+
return { sender: "intents.near", hash };
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
evmRpc: {
|
|
16
|
+
[Network.ADI]: ["https://dev.herewallet.app/api/v1/evm/rpc/36900"],
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
logger: console,
|
|
20
|
+
cosmos: {
|
|
21
|
+
[Network.Juno]: {
|
|
22
|
+
contract: "juno1va9q7gma6l62aqq988gghv4r7u4hnlgm85ssmsdf9ypw77qfwa0qaz7ea4",
|
|
23
|
+
rpc: "https://juno-rpc.publicnode.com",
|
|
24
|
+
gasLimit: 200000n,
|
|
25
|
+
nativeToken: "ujuno",
|
|
26
|
+
chainId: "juno-1",
|
|
27
|
+
prefix: "juno",
|
|
28
|
+
},
|
|
29
|
+
[Network.Gonka]: {
|
|
30
|
+
contract: "gonka15wng2302rhq5w8ddy3l3jslrhfcpufzfs6wc3zc6cxt8cpwrfp4qqgenkc",
|
|
31
|
+
rpc: "https://dev.herewallet.app/api/v1/evm/rpc/4444119",
|
|
32
|
+
gasLimit: 200000n,
|
|
33
|
+
nativeToken: "ngonka",
|
|
34
|
+
chainId: "gonka-mainnet",
|
|
35
|
+
prefix: "gonka",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export enum OmniToken {
|
|
2
|
+
USDT = "nep141:usdt.tether-token.near",
|
|
3
|
+
USDC = "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
|
|
4
|
+
GONKA = "nep245:v2_1.omni.hot.tg:4444119_wyixUKCL",
|
|
5
|
+
NEAR = "nep141:wrap.near",
|
|
6
|
+
ETH = "nep141:eth.bridge.near",
|
|
7
|
+
AURORA = "nep141:aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near",
|
|
8
|
+
SOL = "nep141:sol.omft.near",
|
|
9
|
+
BNB = "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
|
|
10
|
+
ADI = "nep245:v2_1.omni.hot.tg:36900_11111111111111111111",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum WalletType {
|
|
14
|
+
NEAR = 1010,
|
|
15
|
+
EVM = 1,
|
|
16
|
+
OMNI = -4,
|
|
17
|
+
SOLANA = 1001,
|
|
18
|
+
STELLAR = 1100,
|
|
19
|
+
TON = 1111,
|
|
20
|
+
COSMOS = 4444118,
|
|
21
|
+
Tron = 333,
|
|
22
|
+
|
|
23
|
+
Zcash = -5,
|
|
24
|
+
Btc = -6,
|
|
25
|
+
Xrp = -7,
|
|
26
|
+
Doge = -8,
|
|
27
|
+
Ada = -9,
|
|
28
|
+
Aptos = -10,
|
|
29
|
+
Sui = -11,
|
|
30
|
+
Cardano = -12,
|
|
31
|
+
Litecoin = -14,
|
|
32
|
+
unknown = -1000000,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum Network {
|
|
36
|
+
Omni_v1 = 0,
|
|
37
|
+
Hot = -4,
|
|
38
|
+
|
|
39
|
+
Zcash = -5,
|
|
40
|
+
Btc = -6,
|
|
41
|
+
Xrp = -7,
|
|
42
|
+
Doge = -8,
|
|
43
|
+
Ada = -9,
|
|
44
|
+
Aptos = -10,
|
|
45
|
+
Sui = -11,
|
|
46
|
+
Cardano = -12,
|
|
47
|
+
Litecoin = -14,
|
|
48
|
+
|
|
49
|
+
Juno = 4444118,
|
|
50
|
+
Gonka = 4444119,
|
|
51
|
+
OmniTon = 1117,
|
|
52
|
+
ADI = 36900,
|
|
53
|
+
|
|
54
|
+
Eth = 1,
|
|
55
|
+
Tron = 333,
|
|
56
|
+
Solana = 1001,
|
|
57
|
+
Stellar = 1100,
|
|
58
|
+
Near = 1010,
|
|
59
|
+
Polygon = 137,
|
|
60
|
+
Arbitrum = 42_161,
|
|
61
|
+
Aurora = 1_313_161_554,
|
|
62
|
+
Avalanche = 43_114,
|
|
63
|
+
Linea = 59_144,
|
|
64
|
+
Xlayer = 196,
|
|
65
|
+
Base = 8453,
|
|
66
|
+
Ton = 1111,
|
|
67
|
+
Bnb = 56,
|
|
68
|
+
OpBnb = 204,
|
|
69
|
+
BnbTestnet = 97,
|
|
70
|
+
Optimism = 10,
|
|
71
|
+
Scroll = 534_352,
|
|
72
|
+
EbiChain = 98_881,
|
|
73
|
+
Sei = 1329,
|
|
74
|
+
Blast = 81_457,
|
|
75
|
+
Taiko = 167_000,
|
|
76
|
+
Mantle = 5000,
|
|
77
|
+
Manta = 169,
|
|
78
|
+
Kava = 2222,
|
|
79
|
+
ZkSync = 324,
|
|
80
|
+
Monad = 10_143,
|
|
81
|
+
Metis = 1088,
|
|
82
|
+
Gnosis = 100,
|
|
83
|
+
Fantom = 250,
|
|
84
|
+
Cronos = 25,
|
|
85
|
+
Chiliz = 88_888,
|
|
86
|
+
Moonbeam = 1284,
|
|
87
|
+
Ronin = 2020,
|
|
88
|
+
Lisk = 1135,
|
|
89
|
+
Sonic = 146,
|
|
90
|
+
Zora = 7_777_777,
|
|
91
|
+
Mode = 34_443,
|
|
92
|
+
Berachain = 80_094,
|
|
93
|
+
Unichain = 130,
|
|
94
|
+
Soneium = 1868,
|
|
95
|
+
Ink = 57_073,
|
|
96
|
+
Apechain = 2741,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const chainsMap: Record<number, { id: string; name: string; logo?: string }> = {
|
|
100
|
+
[Network.Juno]: { id: "juno-1", name: "Juno", logo: "https://storage.herewallet.app/ft/4444118:ujuno.png" },
|
|
101
|
+
[Network.Gonka]: { id: "gonka-mainnet", name: "Gonka", logo: "https://storage.herewallet.app/ft/4444119:ngonka.png" },
|
|
102
|
+
[Network.Monad]: { id: "monad", name: "Monad", logo: "https://storage.herewallet.app/upload/8f6bdf0d04494dc7157704cf3a7e623aeba7188120d93535d3b9330fa82fc200.JPG" },
|
|
103
|
+
[Network.Near]: { id: "near", name: "NEAR", logo: "https://storage.herewallet.app/ft/1010:native.png" },
|
|
104
|
+
[Network.Eth]: { id: "eth", name: "Ethereum", logo: "https://storage.herewallet.app/upload/80978f3676fc2dfbd3d874a9421004fb7dea7616481bda53bf68f44e21c3ce0c.png" },
|
|
105
|
+
[Network.Solana]: { id: "sol", name: "Solana", logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png" },
|
|
106
|
+
[Network.Arbitrum]: { id: "arb", name: "Arbitrum", logo: "https://storage.herewallet.app/upload/1606b00068f729f48de00d2575940484f6a0dc83351702a9fb8b0139e41dc00b.jpeg" },
|
|
107
|
+
[Network.Base]: { id: "base", name: "Base", logo: "https://storage.herewallet.app/upload/c6cf6513fba97c22192d0b96ffd2be74608559017a4c41ebf4457b65224a7070.jpg" },
|
|
108
|
+
[Network.Bnb]: { id: "bsc", name: "BNB Chain", logo: "https://storage.herewallet.app/upload/b82ec85a318b8d8f1f12b25a0e21cd475208014f15952daf317b876812562530.png" },
|
|
109
|
+
[Network.Polygon]: { id: "pol", name: "Polygon", logo: "https://storage.herewallet.app/upload/e51b9ec8d0ed17792cca05be487f5dbc1d0a1b9113cf7e3465310de48c0acc2f.jpg" },
|
|
110
|
+
[Network.Avalanche]: { id: "avax", name: "Avalanche", logo: "https://storage.herewallet.app/upload/fa027e81ebb6957ebd8feada21b5374b15aa090e1747fae131a1e061d3d7e6da.jpg" },
|
|
111
|
+
[Network.Optimism]: { id: "op", name: "Optimism", logo: "https://storage.herewallet.app/upload/d183a3c76b584552888cb8b5a4dfb849572592d7c7f473fe43bcc5c2adae9a50.jpg" },
|
|
112
|
+
[Network.Gnosis]: { id: "gnosis", name: "Gnosis", logo: "https://storage.herewallet.app/upload/fc4945be03eec20c68ae19920f012afef7204b2c04d39b5cff6ab3a6d99b5981.jpg" },
|
|
113
|
+
[Network.Ton]: { id: "ton", name: "TON", logo: "https://tgapp.herewallet.app/images/chains/ton.svg" },
|
|
114
|
+
[Network.Stellar]: { id: "stellar", name: "Stellar", logo: "https://tgapp.herewallet.app/images/chains/xlm.svg" },
|
|
115
|
+
[Network.Btc]: { id: "btc", name: "Bitcoin", logo: "https://storage.herewallet.app/ft/-6:native.png" },
|
|
116
|
+
[Network.Berachain]: { id: "bera", name: "Berachain", logo: "https://storage.herewallet.app/upload/f5c15875b85ca57447ec031930dbdac1f85799a4ca83ae8ecc204142ff433d60.png" },
|
|
117
|
+
[Network.Tron]: { id: "tron", name: "TRON", logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png" },
|
|
118
|
+
[Network.Zcash]: { id: "zec", name: "Zcash", logo: "https://storage.herewallet.app/ft/-5:native.png" },
|
|
119
|
+
[Network.Xrp]: { id: "xrp", name: "XRP", logo: "https://cryptologos.cc/logos/xrp-xrp-logo.svg?v=040" },
|
|
120
|
+
[Network.Doge]: { id: "doge", name: "Doge", logo: "https://cryptologos.cc/logos/dogecoin-doge-logo.svg?v=040" },
|
|
121
|
+
[Network.Ada]: { id: "ada", name: "ADA", logo: "https://cryptologos.cc/logos/cardano-ada-logo.svg?v=040" },
|
|
122
|
+
[Network.Aptos]: { id: "aptos", name: "Aptos", logo: "https://cryptologos.cc/logos/aptos-apt-logo.svg?v=040" },
|
|
123
|
+
[Network.Sui]: { id: "sui", name: "SUI", logo: "https://cryptologos.cc/logos/sui-sui-logo.svg?v=040" },
|
|
124
|
+
[Network.Hot]: { id: "hot", name: "Omni", logo: "https://tgapp.herewallet.app/images/hot/hot-icon.png" },
|
|
125
|
+
[Network.Cardano]: { id: "cardano", name: "Cardano", logo: "https://cryptologos.cc/logos/cardano-ada-logo.svg?v=040" },
|
|
126
|
+
[Network.Litecoin]: { id: "ltc", name: "Litecoin", logo: "https://cryptologos.cc/logos/litecoin-ltc-logo.svg?v=040" },
|
|
127
|
+
[Network.ADI]: { id: "adi", name: "ADI" },
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const reverseChainsMap = Object.fromEntries(Object.entries(chainsMap).map(([key, value]) => [value.id, +key]));
|