Skip to content

Commit 14e62e5

Browse files
authored
Merge pull request #392 from Hahfyeex/fix/issues-206-212-223-225
fix: resolve issues #206, #212, #223, #225
2 parents 1f74126 + 61dd0a7 commit 14e62e5

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

backend/src/config/assets.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ const ASSETS = {
99
},
1010
};
1111

12-
const isTestnet = process.env.STELLAR_NETWORK === 'testnet';
13-
const network = isTestnet ? 'testnet' : 'mainnet';
12+
import { getConfig } from './env.js';
1413

1514
/**
1615
* Returns the issuer public key for a supported non-native asset.
1716
* Falls back to ASSET_ISSUER env var for custom assets.
1817
*/
1918
export function getIssuer(assetCode) {
20-
return ASSETS[network][assetCode] ?? process.env.ASSET_ISSUER ?? null;
19+
const network = getConfig().stellar.network;
20+
return ASSETS[network]?.[assetCode] ?? process.env.ASSET_ISSUER ?? null;
2121
}
2222

2323
/** Returns the list of supported asset codes (including XLM). */
24-
export const SUPPORTED_ASSETS = ['XLM', ...Object.keys(ASSETS[network])];
24+
export function getSupportedAssets() {
25+
const network = getConfig().stellar.network;
26+
return ['XLM', ...Object.keys(ASSETS[network] ?? {})];
27+
}

backend/src/services/stellar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ export function wrapWithFeeBump(innerTx, feeAccountSecret) {
2626
? StellarSDK.Networks.TESTNET
2727
: StellarSDK.Networks.PUBLIC;
2828

29+
const multiplier = parseInt(process.env.FEE_BUMP_MULTIPLIER ?? '10', 10);
2930
const feeBumpTx = StellarSDK.TransactionBuilder.buildFeeBumpTransaction(
3031
feeKeypair,
31-
StellarSDK.BASE_FEE * 10, // fee bump pays 10x base fee
32+
StellarSDK.BASE_FEE * multiplier,
3233
innerTx,
3334
networkPassphrase
3435
);
@@ -161,15 +162,14 @@ export async function sendPayment(sourceSecret, destination, amount, assetCode =
161162
});
162163
// Track stats for cost monitoring
163164
feeBumpStats.total += 1;
164-
feeBumpStats.totalFeeStroops += StellarSDK.BASE_FEE * 10;
165+
feeBumpStats.totalFeeStroops += StellarSDK.BASE_FEE * parseInt(process.env.FEE_BUMP_MULTIPLIER ?? '10', 10);
165166
feeBumpStats.accounts.add(sourcePublicKey);
166167
}
167168
}
168169

169170
let result;
170171
try {
171172
result = await getHorizonServer().submitTransaction(txToSubmit);
172-
result = await getHorizonServer().submitTransaction(transaction);
173173
} catch (err) {
174174
logger.error('stellar.sendPayment.failed', { source: sourcePublicKey, destination, amount, assetCode, error: err.message });
175175
throw err;

frontend/src/App.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function App() {
4141
const [recipient, setRecipient] = useState('');
4242
const [amount, setAmount] = useState('');
4343
const [memo, setMemo] = useState('');
44-
const [loading, setLoading] = useState('');
4544
const [showQR, setShowQR] = useState(false);
4645
const [showShortcuts, setShowShortcuts] = useState(false);
4746
const [showImportForm, setShowImportForm] = useState(false);

0 commit comments

Comments
 (0)