Skip to content

Commit

Permalink
fix(dcellar-web-ui): fix create temp account gas fee error and compat…
Browse files Browse the repository at this point in the history
…iable bucket list is empty (#198)
  • Loading branch information
devinxl authored Oct 7, 2023
1 parent ac73eb6 commit 42afcf3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions apps/dcellar-web-ui/src/facade/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ export const createTmpAccount = async ({
})
.then(resolve, simulateFault);

if (simulateError) return [null, simulateError];
if (simulateInfo === null || simulateError) return [null, simulateError];

const payload = {
denom: 'BNB',
gasLimit: Number(210000),
gasPrice: '5000000000',
gasLimit: Number(simulateInfo.gasLimit),
gasPrice: simulateInfo.gasPrice,
payer: address,
granter: '',
signTypedDataCallback: signTypedDataCallback(connector),
Expand Down
15 changes: 11 additions & 4 deletions apps/dcellar-web-ui/src/store/slices/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,23 @@ export const setupOAList = () => async (dispatch: AppDispatch, getState: GetStat

export const setupPaymentAccounts =
(forceLoading = false) =>
async (dispatch: any, getState: GetState) => {
async (dispatch: AppDispatch, getState: GetState) => {
const { loginAccount } = getState().persist;
const { paymentAccounts, isLoadingPaymentAccounts } = getState().accounts;
const loginPaymentAccounts = paymentAccounts[loginAccount] || [];
if (isLoadingPaymentAccounts) return;
if (!paymentAccounts.length || forceLoading) {
if (!(loginAccount in paymentAccounts) || forceLoading) {
dispatch(setLoadingPaymentAccounts(true));
}
const [data, error] = await getPaymentAccountsByOwner(loginAccount);
dispatch(setLoadingPaymentAccounts(false));
if (!data) return;
if (!data) {
// todo for empty 404 loading
if (!loginPaymentAccounts.length) {
dispatch(setPaymentAccounts({ loginAccount, paymentAccounts: [] }));
}
return;
}
const newData = data.paymentAccounts;
dispatch(setPaymentAccounts({ loginAccount, paymentAccounts: newData }));
dispatch(setPAInfos({ loginAccount }));
Expand Down Expand Up @@ -263,7 +270,7 @@ export const setupAccountDetail =
refundable: PARes?.paymentAccount?.refundable,
}
dispatch(
setAccountDetail({ ...accountDetail, bufferTime: CLIENT_FROZEN__ACCOUNT_BUFFER_TIME}),
setAccountDetail({ ...accountDetail, bufferTime: CLIENT_FROZEN__ACCOUNT_BUFFER_TIME }),
);
};

Expand Down
7 changes: 6 additions & 1 deletion apps/dcellar-web-ui/src/store/slices/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ export const setupBuckets =
const [res, error] = await getUserBuckets(address, sp.endpoint);
dispatch(setLoading(false));
if (error || !res || res.code !== 0) {
toast.error({ description: error || res?.message });
if (!res?.message?.includes('record not found')) {
toast.error({ description: error || res?.message });
}
if (!buckets[address]?.length) {
dispatch(setBucketList({ address, buckets: [] }));
}
return;
}
const bucketList =
Expand Down

0 comments on commit 42afcf3

Please sign in to comment.