Compare commits

..

4 Commits

Author SHA1 Message Date
Valtteri Karesto
5aeed7c246 Few more changes to deleteHook function 2022-03-29 15:23:30 +03:00
Valtteri Karesto
8d03edc299 Fixes issue #148 2022-03-29 14:03:06 +03:00
Valtteri Karesto
4519906b78 hotfix/remove-console-log 2022-03-28 15:35:27 +03:00
Valtteri Karesto
88a47c49a4 Merge pull request #149 from eqlabs/fix/fix-hook-params
Convert hook params to hex blobs
2022-03-28 15:33:23 +03:00
2 changed files with 11 additions and 6 deletions

View File

@@ -249,6 +249,7 @@ export const AccountDialog = ({
<Button <Button
size="xs" size="xs"
outline outline
disabled={activeAccount.isLoading}
css={{ mt: "$3", mr: "$1", ml: "auto" }} css={{ mt: "$3", mr: "$1", ml: "auto" }}
onClick={() => { onClick={() => {
deleteHook(activeAccount); deleteHook(activeAccount);

View File

@@ -81,7 +81,7 @@ export const deployHook = async (account: IAccount & { name?: string }, data: Se
// } // }
// } // }
// }); // });
console.log(filteredHookParameters)
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
const tx = { const tx = {
Account: account.address, Account: account.address,
@@ -153,13 +153,18 @@ export const deleteHook = async (account: IAccount & { name?: string }) => {
if (!state.client) { if (!state.client) {
return; return;
} }
const currentAccount = state.accounts.find(
(acc) => acc.address === account.address
);
if (currentAccount?.isLoading || !currentAccount?.hooks.length) {
return
}
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
const tx = { const tx = {
Account: account.address, Account: account.address,
TransactionType: "SetHook", TransactionType: "SetHook",
Sequence: account.sequence, Sequence: account.sequence,
Fee: "1000000", Fee: "100000",
Hooks: [ Hooks: [
{ {
Hook: { Hook: {
@@ -172,9 +177,7 @@ export const deleteHook = async (account: IAccount & { name?: string }) => {
const keypair = derive.familySeed(account.secret); const keypair = derive.familySeed(account.secret);
const { signedTransaction } = sign(tx, keypair); const { signedTransaction } = sign(tx, keypair);
const currentAccount = state.accounts.find(
(acc) => acc.address === account.address
);
if (currentAccount) { if (currentAccount) {
currentAccount.isLoading = true; currentAccount.isLoading = true;
} }
@@ -196,6 +199,7 @@ export const deleteHook = async (account: IAccount & { name?: string }) => {
type: "success", type: "success",
message: `[${submitRes.engine_result}] ${submitRes.engine_result_message} Validated ledger index: ${submitRes.validated_ledger_index}`, message: `[${submitRes.engine_result}] ${submitRes.engine_result_message} Validated ledger index: ${submitRes.validated_ledger_index}`,
}); });
currentAccount.hooks = [];
} else { } else {
toast.error(`${submitRes.engine_result_message || submitRes.error_exception}`, { id: toastId }) toast.error(`${submitRes.engine_result_message || submitRes.error_exception}`, { id: toastId })
state.deployLogs.push({ state.deployLogs.push({