SHA256
Изолировать страницу DEVNET пополнения от mainnet
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { renderHeader } from '../components/header.js';
|
||||
import { formatSol, getBalanceSol, transferSol, createSolanaWalletFromPrivateBase58 } from '../services/solana-wallet-service.js';
|
||||
import { state } from '../state.js';
|
||||
|
||||
export const pageMeta = { id: 'devnet-topup-view', title: 'Пополнение DEVNET', showAppChrome: false };
|
||||
|
||||
const DEVNET_ENDPOINT = 'https://api.devnet.solana.com';
|
||||
const SENDER_PRIVATE_32_BASE58 = '6xqAuKYvA8qrCdAkcw7Y8aMgvBnYk8JLxWLma5BzbAvu';
|
||||
const TRANSFER_AMOUNT_SOL = 0.02;
|
||||
|
||||
@@ -49,7 +49,7 @@ export function render() {
|
||||
status.style.overflowWrap = 'anywhere';
|
||||
status.style.wordBreak = 'break-word';
|
||||
status.style.whiteSpace = 'pre-wrap';
|
||||
status.textContent = 'Готово к пополнению.';
|
||||
status.textContent = `Готово к пополнению.\nСеть: DEVNET (${DEVNET_ENDPOINT})`;
|
||||
|
||||
const amountHint = document.createElement('p');
|
||||
amountHint.style.width = 'min(100%, 320px)';
|
||||
@@ -99,16 +99,14 @@ export function render() {
|
||||
|
||||
const updateSenderBalance = async () => {
|
||||
if (!senderAddress) return;
|
||||
const endpoint = state.entrySettings.solanaServer;
|
||||
const balance = await getBalanceSol({ endpoint, address: senderAddress });
|
||||
const balance = await getBalanceSol({ endpoint: DEVNET_ENDPOINT, address: senderAddress });
|
||||
const senderBalanceEl = senderBox.querySelector('#devnet-topup-sender-balance');
|
||||
if (senderBalanceEl) senderBalanceEl.textContent = `Баланс: ${formatSol(balance.sol, 6)} SOL`;
|
||||
};
|
||||
|
||||
const updateTargetBalance = async () => {
|
||||
if (!targetWallet) return null;
|
||||
const endpoint = state.entrySettings.solanaServer;
|
||||
const balance = await getBalanceSol({ endpoint, address: targetWallet });
|
||||
const balance = await getBalanceSol({ endpoint: DEVNET_ENDPOINT, address: targetWallet });
|
||||
const targetBalanceEl = targetBox.querySelector('#devnet-topup-target-balance');
|
||||
if (targetBalanceEl) targetBalanceEl.textContent = `Баланс: ${formatSol(balance.sol, 6)} SOL`;
|
||||
return balance.sol;
|
||||
@@ -131,9 +129,8 @@ export function render() {
|
||||
closeHint.style.display = 'none';
|
||||
|
||||
try {
|
||||
const endpoint = state.entrySettings.solanaServer;
|
||||
const tx = await transferSol({
|
||||
endpoint,
|
||||
endpoint: DEVNET_ENDPOINT,
|
||||
fromKeypair: senderKeypair,
|
||||
toAddress: targetWallet,
|
||||
amountSol: TRANSFER_AMOUNT_SOL,
|
||||
|
||||
Reference in New Issue
Block a user