Fixes to users who has old accounts
This commit is contained in:
@@ -294,6 +294,7 @@ const Accounts: FC<AccountProps> = (props) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
const responses = await Promise.all(requests);
|
const responses = await Promise.all(requests);
|
||||||
|
console.log(responses);
|
||||||
responses.forEach((res: any) => {
|
responses.forEach((res: any) => {
|
||||||
const address = res?.account_data?.Account as string;
|
const address = res?.account_data?.Account as string;
|
||||||
const balance = res?.account_data?.Balance as string;
|
const balance = res?.account_data?.Balance as string;
|
||||||
@@ -304,6 +305,18 @@ const Accounts: FC<AccountProps> = (props) => {
|
|||||||
if (accountToUpdate) {
|
if (accountToUpdate) {
|
||||||
accountToUpdate.xrp = balance;
|
accountToUpdate.xrp = balance;
|
||||||
accountToUpdate.sequence = sequence;
|
accountToUpdate.sequence = sequence;
|
||||||
|
accountToUpdate.error = null;
|
||||||
|
} else {
|
||||||
|
const oldAccount = state.accounts.find(
|
||||||
|
(acc) => acc.address === res?.account
|
||||||
|
);
|
||||||
|
if (oldAccount) {
|
||||||
|
oldAccount.xrp = "0";
|
||||||
|
oldAccount.error = {
|
||||||
|
code: res?.error,
|
||||||
|
message: res?.error_message,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const objectRequests = snap.accounts.map((acc) => {
|
const objectRequests = snap.accounts.map((acc) => {
|
||||||
@@ -431,18 +444,23 @@ const Accounts: FC<AccountProps> = (props) => {
|
|||||||
wordBreak: "break-word",
|
wordBreak: "break-word",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{account.address} (
|
{account.address}{" "}
|
||||||
{Dinero({
|
{!account?.error ? (
|
||||||
amount: Number(account?.xrp || "0"),
|
`(${Dinero({
|
||||||
precision: 6,
|
amount: Number(account?.xrp || "0"),
|
||||||
})
|
precision: 6,
|
||||||
.toUnit()
|
})
|
||||||
.toLocaleString(undefined, {
|
.toUnit()
|
||||||
style: "currency",
|
.toLocaleString(undefined, {
|
||||||
currency: "XRP",
|
style: "currency",
|
||||||
currencyDisplay: "name",
|
currency: "XRP",
|
||||||
})}
|
currencyDisplay: "name",
|
||||||
)
|
})})`
|
||||||
|
) : (
|
||||||
|
<Box css={{ color: "$red11" }}>
|
||||||
|
(Account not found, request funds to activate account)
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
{!props.hideDeployBtn && (
|
{!props.hideDeployBtn && (
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ export interface IAccount {
|
|||||||
hooks: string[];
|
hooks: string[];
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
version?: string;
|
version?: string;
|
||||||
|
error?: {
|
||||||
|
message: string;
|
||||||
|
code: string;
|
||||||
|
} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILog {
|
export interface ILog {
|
||||||
|
|||||||
Reference in New Issue
Block a user