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);
|
||||
console.log(responses);
|
||||
responses.forEach((res: any) => {
|
||||
const address = res?.account_data?.Account as string;
|
||||
const balance = res?.account_data?.Balance as string;
|
||||
@@ -304,6 +305,18 @@ const Accounts: FC<AccountProps> = (props) => {
|
||||
if (accountToUpdate) {
|
||||
accountToUpdate.xrp = balance;
|
||||
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) => {
|
||||
@@ -431,8 +444,9 @@ const Accounts: FC<AccountProps> = (props) => {
|
||||
wordBreak: "break-word",
|
||||
}}
|
||||
>
|
||||
{account.address} (
|
||||
{Dinero({
|
||||
{account.address}{" "}
|
||||
{!account?.error ? (
|
||||
`(${Dinero({
|
||||
amount: Number(account?.xrp || "0"),
|
||||
precision: 6,
|
||||
})
|
||||
@@ -441,8 +455,12 @@ const Accounts: FC<AccountProps> = (props) => {
|
||||
style: "currency",
|
||||
currency: "XRP",
|
||||
currencyDisplay: "name",
|
||||
})}
|
||||
)
|
||||
})})`
|
||||
) : (
|
||||
<Box css={{ color: "$red11" }}>
|
||||
(Account not found, request funds to activate account)
|
||||
</Box>
|
||||
)}
|
||||
</Text>
|
||||
</Box>
|
||||
{!props.hideDeployBtn && (
|
||||
|
||||
@@ -35,6 +35,10 @@ export interface IAccount {
|
||||
hooks: string[];
|
||||
isLoading: boolean;
|
||||
version?: string;
|
||||
error?: {
|
||||
message: string;
|
||||
code: string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ILog {
|
||||
|
||||
Reference in New Issue
Block a user