Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
Fixed the TRX OP contents for updating an asset
Change card title to indicate create/edit mode
  • Loading branch information
grctest committed Sep 16, 2024
1 parent ca077ff commit bdd9ae3
Showing 1 changed file with 46 additions and 38 deletions.
84 changes: 46 additions & 38 deletions src/components/UIA.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,48 +230,55 @@ export default function UIA(properties) {
_extensions.taker_fee_percent = takerFee ? takerFee * 100 : 0;
}

return {
let _trxContents = {
issuer: usr.id,
symbol: symbol,
precision: precision,
common_options: {
// user configured
description,
max_supply: blockchainFloat(maxSupply, precision),
market_fee_percent: commission ? commission * 100 : 0,
max_market_fee: blockchainFloat(maxCommission, precision),
issuer_permissions,
flags,
// static
core_exchange_rate: {
base: {
amount: blockchainFloat(cerBaseAmount, 5),
asset_id: "1.3.0"
},
quote: {
amount: blockchainFloat(cerQuoteAmount, precision),
asset_id: existingAssetID ?? "1.3.1"
}
},
whitelist_authorities: flagWhiteList && whitelistAuthorities && whitelistAuthorities.length
? whitelistAuthorities.map((x) => x.id)
: [],
blacklist_authorities: flagWhiteList && blacklistAuthorities && blacklistAuthorities.length
? blacklistAuthorities.map((x) => x.id)
: [],
whitelist_markets: allowedMarkets.map((x) => {
const asset = assets.find((y) => y.id === x);
return asset ? asset.id : null;
}).filter((x) => x),
blacklist_markets: bannedMarkets.map((x) => {
const asset = assets.find((y) => y.id === x);
return asset ? asset.id : null;
}).filter((x) => x),
extensions: _extensions
},
is_prediction_market: false,
extensions: {}
};

_trxContents[editing ? "new_options" : "common_options"] = {
// user configured
description,
max_supply: blockchainFloat(maxSupply, precision),
market_fee_percent: commission ? commission * 100 : 0,
max_market_fee: blockchainFloat(maxCommission, precision),
issuer_permissions,
flags,
// static
core_exchange_rate: {
base: {
amount: blockchainFloat(cerBaseAmount, 5),
asset_id: "1.3.0"
},
quote: {
amount: blockchainFloat(cerQuoteAmount, precision),
asset_id: existingAssetID ?? "1.3.1"
}
},
whitelist_authorities: flagWhiteList && whitelistAuthorities && whitelistAuthorities.length
? whitelistAuthorities.map((x) => x.id)
: [],
blacklist_authorities: flagWhiteList && blacklistAuthorities && blacklistAuthorities.length
? blacklistAuthorities.map((x) => x.id)
: [],
whitelist_markets: allowedMarkets.map((x) => {
const asset = assets.find((y) => y.id === x);
return asset ? asset.id : null;
}).filter((x) => x),
blacklist_markets: bannedMarkets.map((x) => {
const asset = assets.find((y) => y.id === x);
return asset ? asset.id : null;
}).filter((x) => x),
extensions: _extensions
};

if (editing) {
_trxContents["asset_to_update"] = existingAssetID;
}

return _trxContents;
}, [
usr,
assets,
Expand All @@ -296,7 +303,8 @@ export default function UIA(properties) {
referrerReward,
feeSharingWhitelist,
takerFee,
existingAssetID
existingAssetID,
editing
]);

const debouncedMax = useCallback(
Expand Down Expand Up @@ -707,7 +715,7 @@ export default function UIA(properties) {
<div className="grid grid-cols-1 gap-3">
<Card>
<CardHeader className="pb-1">
<CardTitle>🍬 {t("CreateUIA:card.title_create")}</CardTitle>
<CardTitle>🍬 {t(!editing ? "CreateUIA:card.title_create" : "CreateUIA:card.title_edit")}</CardTitle>
<CardDescription>{t("CreateUIA:card.description")}</CardDescription>
</CardHeader>
<CardContent>
Expand Down

0 comments on commit bdd9ae3

Please sign in to comment.