From a478e8fa4c7becb4de54a9ae855599a4fbc6fa78 Mon Sep 17 00:00:00 2001
From: Ludovit Scholtz
Date: Mon, 14 Oct 2024 22:51:07 +0200
Subject: [PATCH] make account online from msig account
---
src/pages/Account/Assets.vue | 33 ----
src/pages/Account/Transactions.vue | 33 ----
src/pages/AccountOverview.vue | 247 ++++++++++++++++++++++++-
src/pages/Arc14.vue | 1 -
src/pages/Connect.vue | 1 -
src/pages/Sign.vue | 138 ++++++++++++--
src/pages/Swap.vue | 1 -
src/store/arc14.js | 55 +++---
src/store/index.js | 4 +-
src/store/{kmd.js => participation.js} | 145 ++++++++++++---
10 files changed, 523 insertions(+), 135 deletions(-)
rename src/store/{kmd.js => participation.js} (50%)
diff --git a/src/pages/Account/Assets.vue b/src/pages/Account/Assets.vue
index a291ce1e..7dc56ac3 100644
--- a/src/pages/Account/Assets.vue
+++ b/src/pages/Account/Assets.vue
@@ -258,8 +258,6 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
- setAccountOffline: "kmd/setAccountOffline",
openSuccess: "toast/openSuccess",
getAlgod: "algod/getAlgod",
getIndexer: "indexer/getIndexer",
@@ -401,37 +399,6 @@ export default {
sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
- async setAccountOnlineAtParticipationNode() {
- this.displayOnlineOfflineDialog = false;
- this.changeOnline = true;
- if (
- await this.setAccountOnline({
- account: this.$route.params.account,
- rounds: this.onlineRounds,
- })
- ) {
- await this.sleep(5000);
- this.changeOnline = false;
- await this.reloadAccount();
- this.openSuccess("You have set the account to online mode");
- } else {
- this.changeOnline = false;
- }
- },
- async setAccountOfflineAtParticipationNode() {
- this.displayOnlineOfflineDialog = false;
- this.changeOffline = true;
- if (
- await this.setAccountOffline({ account: this.$route.params.account })
- ) {
- await this.sleep(5000);
- this.changeOffline = false;
- await this.reloadAccount();
- this.openSuccess("You have set the account to offline mode");
- } else {
- this.changeOffline = false;
- }
- },
},
};
diff --git a/src/pages/Account/Transactions.vue b/src/pages/Account/Transactions.vue
index 30019efc..cf0220cc 100644
--- a/src/pages/Account/Transactions.vue
+++ b/src/pages/Account/Transactions.vue
@@ -316,8 +316,6 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
- setAccountOffline: "kmd/setAccountOffline",
openSuccess: "toast/openSuccess",
}),
async makeAssets() {
@@ -433,37 +431,6 @@ export default {
sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
- async setAccountOnlineAtParticipationNode() {
- this.displayOnlineOfflineDialog = false;
- this.changeOnline = true;
- if (
- await this.setAccountOnline({
- account: this.$route.params.account,
- rounds: this.onlineRounds,
- })
- ) {
- await this.sleep(5000);
- this.changeOnline = false;
- await this.reloadAccount();
- this.openSuccess("You have set the account to online mode");
- } else {
- this.changeOnline = false;
- }
- },
- async setAccountOfflineAtParticipationNode() {
- this.displayOnlineOfflineDialog = false;
- this.changeOffline = true;
- if (
- await this.setAccountOffline({ account: this.$route.params.account })
- ) {
- await this.sleep(5000);
- this.changeOffline = false;
- await this.reloadAccount();
- this.openSuccess("You have set the account to offline mode");
- } else {
- this.changeOffline = false;
- }
- },
},
};
diff --git a/src/pages/AccountOverview.vue b/src/pages/AccountOverview.vue
index 8e6b9c7b..6957cbd1 100644
--- a/src/pages/AccountOverview.vue
+++ b/src/pages/AccountOverview.vue
@@ -83,14 +83,94 @@
{{ $t("onlineofflinedialog.host") }}:
{{ $store.state.config.participation }}
+ Realm : {{ participationRealm }}
+
+ Please sign ARC14 authentication transaction and return back to
+ this form.
+
+ ARC14 auth has been loaded.
+
+ Generating participation keys.. Please be patient, the
+ participation node is performing CPU sensitive task.
+
@@ -488,6 +580,7 @@ import AccountType from "@/components/AccountType.vue";
import ProgressSpinner from "primevue/progressspinner";
import { VERIFY_FALLBACK_SERVER } from "@walletconnect/core";
import { JsonViewer } from "vue3-json-viewer";
+import algosdk from "algosdk";
export default {
components: {
@@ -510,6 +603,10 @@ export default {
changeOnline: false,
changeOffline: false,
onlineRounds: 500000,
+ participationRealm: "",
+ participationAuth: "",
+ participationData: {},
+ participationWizzard: false,
};
},
computed: {
@@ -560,6 +657,14 @@ export default {
if (!rekeyedInfo) return null;
return rekeyedInfo.params;
},
+ multisigParams() {
+ if (this.rekeyedToInfo) return this.rekeyedMultisigParams;
+ if (!this.account) return {};
+ return this.account.params;
+ },
+ isMultisig() {
+ return !!this.multisigParams;
+ },
},
watch: {
async selection() {
@@ -576,6 +681,10 @@ export default {
await this.reloadAccount();
await this.makeAssets();
this.prolong();
+ if (this.isMultisig) {
+ this.participationWizzard = true;
+ }
+ console.log("account", this.account);
},
methods: {
...mapActions({
@@ -587,9 +696,15 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
- setAccountOffline: "kmd/setAccountOffline",
+ setAccountOnline: "participation/setAccountOnline",
+ getParticipationData: "participation/getParticipationData",
+ setAccountOffline: "participation/setAccountOffline",
+ getAccountOfflineTx: "participation/getAccountOfflineTx",
+ getARC14ParticipationRealm: "participation/getARC14ParticipationRealm",
openSuccess: "toast/openSuccess",
+ signAuthTx: "arc14/signAuthTx",
+ getAuthTx: "arc14/getAuthTx",
+ returnTo: "signer/returnTo",
}),
async makeAssets() {
this.assets = [];
@@ -689,13 +804,122 @@ export default {
sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
+ _arrayBufferToBase64(buffer) {
+ var binary = "";
+ var bytes = new Uint8Array(buffer);
+ var len = bytes.byteLength;
+ for (var i = 0; i < len; i++) {
+ binary += String.fromCharCode(bytes[i]);
+ }
+ return btoa(binary);
+ },
+ base642base64url(input) {
+ return input
+ .replaceAll("+", "-")
+ .replaceAll("/", "_")
+ .replaceAll("=", "");
+ },
+ async clickFetchArc14Realm() {
+ await this.prolong();
+ this.participationRealm = await this.getARC14ParticipationRealm();
+ console.log("this.participationRealm", this.participationRealm);
+
+ // check if we did go through step 2
+
+ if (
+ this.$store.state.arc14.address2chain2realm2token[
+ this.$store.state.config.env
+ ] &&
+ this.$store.state.arc14.address2chain2realm2token[
+ this.$store.state.config.env
+ ][this.$route.params.account] &&
+ this.$store.state.arc14.address2chain2realm2token[
+ this.$store.state.config.env
+ ][this.$route.params.account][this.participationRealm]
+ ) {
+ this.participationAuth =
+ this.$store.state.arc14.address2chain2realm2token[
+ this.$store.state.config.env
+ ][this.$route.params.account][this.participationRealm];
+ }
+ console.log(
+ "this.participationAuth",
+ this.participationAuth,
+ this.$store.state.arc14.address2chain2realm2token
+ );
+ },
+ async clickSignArc14AuthTx() {
+ await this.prolong();
+ this.participationAuth = await this.signAuthTx({
+ account: this.$route.params.account,
+ realm: this.participationRealm,
+ });
+ console.log("this.participationAuth", this.participationAuth);
+ },
+ async clickSignArc14MsigAuthTx() {
+ await this.prolong();
+ const txn = await this.getAuthTx({
+ account: this.$route.params.account,
+ realm: this.participationRealm,
+ });
+ console.log("this.participationAuth", this.participationAuth);
+ const encodedtxn = algosdk.encodeUnsignedTransaction(txn);
+ const urldataB64 = this._arrayBufferToBase64(encodedtxn);
+ const urldataB64url = this.base642base64url(urldataB64);
+ const pushTo = `/multisig/${this.$route.params.account}/${urldataB64url}`;
+ await this.returnTo("Arc14Participation");
+
+ this.$router.push(pushTo);
+ },
+ async clickLoadParticipationData() {
+ await this.prolong();
+ this.changeOnline = true;
+ this.participationData = await this.getParticipationData({
+ account: this.$route.params.account,
+ rounds: this.onlineRounds,
+ participationAuth: this.participationAuth,
+ });
+ this.changeOnline = false;
+ console.log("this.participationData", this.participationData);
+ },
+ async clickSignParticipationTx() {
+ await this.prolong();
+ if (this.isMultisig) {
+ const txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject(
+ this.participationData
+ );
+
+ const encodedtxn = algosdk.encodeUnsignedTransaction(txn);
+ const urldataB64 = this._arrayBufferToBase64(encodedtxn);
+ const urldataB64url = this.base642base64url(urldataB64);
+ const pushTo = `/multisig/${this.$route.params.account}/${urldataB64url}`;
+ this.$router.push(pushTo);
+ } else {
+ const txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject(
+ this.participationData
+ );
+
+ const encodedtxn = algosdk.encodeUnsignedTransaction(txn);
+ const urldataB64 = this._arrayBufferToBase64(encodedtxn);
+ const urldataB64url = this.base642base64url(urldataB64);
+ const pushTo = `/sign/${this.$route.params.account}/${urldataB64url}`;
+ this.$router.push(pushTo);
+ }
+ },
async setAccountOnlineAtParticipationNode() {
+ await this.prolong();
this.displayOnlineOfflineDialog = false;
this.changeOnline = true;
+ this.participationRealm = await this.getARC14ParticipationRealm();
+ this.participationAuth = await this.signAuthTx({
+ account: this.$route.params.account,
+ realm: this.participationRealm,
+ });
if (
await this.setAccountOnline({
account: this.$route.params.account,
rounds: this.onlineRounds,
+ participationAuth: this.participationAuth,
})
) {
await this.sleep(5000);
@@ -707,6 +931,7 @@ export default {
}
},
async setAccountOfflineAtParticipationNode() {
+ await this.prolong();
this.displayOnlineOfflineDialog = false;
this.changeOffline = true;
if (
@@ -720,6 +945,18 @@ export default {
this.changeOffline = false;
}
},
+ async setAccountOfflineMsigAtParticipationNode() {
+ await this.prolong();
+ this.displayOnlineOfflineDialog = false;
+ const txn = await this.getAccountOfflineTx({
+ account: this.$route.params.account,
+ });
+ const encodedtxn = algosdk.encodeUnsignedTransaction(txn);
+ const urldataB64 = this._arrayBufferToBase64(encodedtxn);
+ const urldataB64url = this.base642base64url(urldataB64);
+ const pushTo = `/multisig/${this.$route.params.account}/${urldataB64url}`;
+ this.$router.push(pushTo);
+ },
},
};
diff --git a/src/pages/Arc14.vue b/src/pages/Arc14.vue
index 484aad2b..73d8bac7 100644
--- a/src/pages/Arc14.vue
+++ b/src/pages/Arc14.vue
@@ -69,7 +69,6 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
openSuccess: "toast/openSuccess",
axiosGet: "axios/get",
getSK: "wallet/getSK",
diff --git a/src/pages/Connect.vue b/src/pages/Connect.vue
index 077158cb..bf9f20fe 100644
--- a/src/pages/Connect.vue
+++ b/src/pages/Connect.vue
@@ -598,7 +598,6 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
openSuccess: "toast/openSuccess",
openError: "toast/openError",
axiosGet: "axios/get",
diff --git a/src/pages/Sign.vue b/src/pages/Sign.vue
index 0bb322ee..7569d6e3 100644
--- a/src/pages/Sign.vue
+++ b/src/pages/Sign.vue
@@ -50,6 +50,38 @@
{{ payTo }}
+
+
+
+ Tx to unregister from the participation
+
+
+
+
+
+ {{ txn.voteFirst }}
+
+
+
+
+
+ {{ txn.voteLast }}
+
+
-
+
@@ -207,6 +246,20 @@
{{ multisigDecoded.txn.tag }}
+
+
+
+ {{ encodeAddress(multisigDecoded.txn.from.publicKey) }}
+
+
Return to scheduled payment management
+
+ Return to the account
+
{{ $t("global.last_error") }}: {{ $store.state.toast.lastError }}
+
+
@@ -749,6 +814,7 @@ export default {
this.multisigDecoded.txn &&
this.multisigDecoded.txn.type &&
(this.multisigDecoded.txn.type == "appl" ||
+ this.multisigDecoded.txn.type == "keyreg" ||
this.multisigDecoded.txn.type == "acfg")
) {
return false;
@@ -757,7 +823,9 @@ export default {
this.txn &&
this.txn &&
this.txn.type &&
- (this.txn.type == "appl" || this.txn.type == "acfg")
+ (this.txn.type == "appl" ||
+ this.txn.type == "keyreg" ||
+ this.txn.type == "acfg")
) {
return false;
}
@@ -944,6 +1012,8 @@ export default {
getRealm: "fa2/getRealm",
signTwoFactor: "fa2/signTwoFactor",
resetError: "toast/resetError",
+ storeArc14Auth: "arc14/storeArc14Auth",
+ returnTo: "signer/returnTo",
}),
isBase64(str) {
try {
@@ -1545,14 +1615,50 @@ export default {
}
},
retToWalletConnect() {
+ this.returnTo("");
this.$router.push({ name: "Connect" });
},
retToSignAll() {
+ this.returnTo("");
this.$router.push({ name: "SignAll" });
},
retToScheduledPayments() {
+ this.returnTo("");
this.$router.push({ name: "scheduled-payment" });
},
+ async retToArc14Participation() {
+ const encoded = this.rawSignedTxn;
+ console.log("encoded", encoded);
+ const signedAuthTxn = this.rawSignedTxn;
+ console.log("signedAuthTxn", signedAuthTxn);
+ console.log(
+ "check signedAuthTxn",
+ algosdk.decodeSignedTransaction(Buffer.from(signedAuthTxn, "base64")),
+ this.multisigDecoded
+ );
+ const b64 = signedAuthTxn;
+ const auth = "SigTx " + b64;
+ console.log("storeArc14Auth", {
+ chain: this.$store.state.config.env,
+ addr: algosdk.encodeAddress(this.multisigDecoded.txn.from.publicKey),
+ realm: Buffer.from(this.multisigDecoded.txn.note).toString("utf-8"),
+ token: auth,
+ });
+ await this.storeArc14Auth({
+ chain: this.$store.state.config.env,
+ addr: algosdk.encodeAddress(this.multisigDecoded.txn.from.publicKey),
+ realm: Buffer.from(this.multisigDecoded.txn.note).toString("utf-8"),
+ token: auth,
+ });
+ console.log(
+ "this.$store.state.arc14.address2chain2realm2token",
+ this.$store.state.arc14.address2chain2realm2token
+ );
+
+ this.returnTo("");
+ this.$router.push({ name: "AccountOverview" });
+ },
+
async sign2FAClick(e) {
try {
this.prolong();
diff --git a/src/pages/Swap.vue b/src/pages/Swap.vue
index a124a2af..ed6c2329 100644
--- a/src/pages/Swap.vue
+++ b/src/pages/Swap.vue
@@ -435,7 +435,6 @@ export default {
setTransaction: "wallet/setTransaction",
getAsset: "indexer/getAsset",
prolong: "wallet/prolong",
- setAccountOnline: "kmd/setAccountOnline",
openSuccess: "toast/openSuccess",
openError: "toast/openError",
axiosGet: "axios/get",
diff --git a/src/store/arc14.js b/src/store/arc14.js
index 45b53d82..5ff03865 100644
--- a/src/store/arc14.js
+++ b/src/store/arc14.js
@@ -15,30 +15,43 @@ const mutations = {
},
};
const actions = {
+ async storeArc14Auth({ commit }, { chain, addr, realm, token }) {
+ await commit("storeArc14Auth", {
+ chain,
+ addr,
+ realm,
+ token,
+ });
+ },
+ async getAuthTx({ dispatch, commit }, { account, realm }) {
+ if (!account) throw new Error("Address not found.");
+ const url = new URL(this.state.config.algod);
+ let algodclient = new algosdk.Algodv2(
+ this.state.config.algodToken,
+ this.state.config.algod,
+ url.port
+ );
+
+ const suggestedParams = await algodclient.getTransactionParams().do();
+
+ const authParams = suggestedParams;
+ authParams.fee = 0;
+ const note = Buffer.from(realm, "utf-8");
+ const authObj = {
+ from: account,
+ to: account,
+ amount: 0,
+ note: new Uint8Array(note),
+ suggestedParams: authParams,
+ };
+ const authTxn =
+ algosdk.makePaymentTxnWithSuggestedParamsFromObject(authObj);
+ return authTxn;
+ },
async signAuthTx({ dispatch, commit }, { account, realm }) {
try {
if (!account) throw new Error("Address not found.");
- const url = new URL(this.state.config.algod);
- let algodclient = new algosdk.Algodv2(
- this.state.config.algodToken,
- this.state.config.algod,
- url.port
- );
-
- const suggestedParams = await algodclient.getTransactionParams().do();
-
- const authParams = suggestedParams;
- authParams.fee = 0;
- const note = Buffer.from(realm, "utf-8");
- const authObj = {
- from: account,
- to: account,
- amount: 0,
- note: new Uint8Array(note),
- suggestedParams: authParams,
- };
- const authTxn =
- algosdk.makePaymentTxnWithSuggestedParamsFromObject(authObj);
+ const authTxn = await dispatch("getAuthTx");
let signedAuthTxn = await dispatch(
"signer/signTransaction",
diff --git a/src/store/index.js b/src/store/index.js
index 22628cb6..9d81f1ad 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -7,7 +7,7 @@ import indexer from "./indexer";
import toast from "./toast";
import vote from "./vote";
import publicData from "./publicData";
-import kmd from "./kmd";
+import participation from "./participation";
import arc14 from "./arc14";
import signer from "./signer";
import wc from "./wc";
@@ -26,7 +26,7 @@ export default createStore({
toast,
vote,
publicData,
- kmd,
+ participation,
arc14,
signer,
wc,
diff --git a/src/store/kmd.js b/src/store/participation.js
similarity index 50%
rename from src/store/kmd.js
rename to src/store/participation.js
index 94e03b90..bc3bf050 100644
--- a/src/store/kmd.js
+++ b/src/store/participation.js
@@ -1,7 +1,22 @@
import algosdk from "algosdk";
const actions = {
- async setAccountOnline({ dispatch }, { account, rounds }) {
+ async getARC14ParticipationRealm({ dispatch }) {
+ if (!this.state.config || !this.state.config.participation)
+ throw new Error("Please setup participation server in your settings.");
+ const data = await dispatch(
+ "axios/get",
+ {
+ url: `${this.state.config.participation}/v1/participation/realm`,
+ },
+ { root: true }
+ );
+ return data;
+ },
+ async getParticipationData(
+ { dispatch },
+ { account, rounds, participationAuth }
+ ) {
try {
if (!this.state.config || !this.state.config.participation)
throw new Error("Please setup participation server in your settings.");
@@ -16,32 +31,83 @@ const actions = {
const suggestedParams = await algodclient.getTransactionParams().do();
- const authParams = suggestedParams;
- authParams.fee = 0;
- const note = Buffer.from("KMD", "ascii");
- const authObj = {
+ const auth = participationAuth;
+ const voteFirst = suggestedParams.firstRound + 2;
+ const voteLast = voteFirst + rounds;
+ const data = await dispatch(
+ "axios/get",
+ {
+ url: `${this.state.config.participation}/v1/KMD/addpartkey?roundFirstValid=${voteFirst}&roundLastValid=${voteLast}&address=${account}`,
+ headers: {
+ Authorization: auth,
+ },
+ },
+ { root: true }
+ );
+ if (!data) throw new Error("Unable to create participation key");
+ suggestedParams.fee = 1000;
+ suggestedParams.flatFee = true;
+ const toSignData = {
from: account,
- to: account,
- amount: 0,
- note: new Uint8Array(note),
- suggestedParams: authParams,
+ suggestedParams: suggestedParams,
+ selectionKey: data.selectionKey,
+ stateProofKey: data.stateProofKey,
+ voteFirst: voteFirst,
+ voteLast: voteLast,
+ voteKey: data.voteKey,
+ voteKeyDilution: data.voteKeyDilution,
+ //nonParticipation: false,
};
- const authTxn =
- algosdk.makePaymentTxnWithSuggestedParamsFromObject(authObj);
- let signedAuthTxn = await dispatch(
- "signer/signTransaction",
- { from: account, tx: authTxn },
- {
- root: true,
- }
+ return toSignData;
+ } catch (error) {
+ console.error("error", error, dispatch);
+ const msg = error.response ? error.response : error.message;
+ dispatch("toast/openError", msg, {
+ root: true,
+ });
+ }
+ },
+ async setAccountOnline({ dispatch }, { account, rounds, participationAuth }) {
+ try {
+ if (!this.state.config || !this.state.config.participation)
+ throw new Error("Please setup participation server in your settings.");
+ if (!account) throw new Error("Address not found.");
+
+ const url = new URL(this.state.config.algod);
+ let algodclient = new algosdk.Algodv2(
+ this.state.config.algodToken,
+ this.state.config.algod,
+ url.port
);
- if (!signedAuthTxn) {
- throw new Error("Unable to to sign the transaction for authentication");
- }
- const b64 = Buffer.from(signedAuthTxn).toString("base64");
- const auth = "SigTx " + b64;
+ const suggestedParams = await algodclient.getTransactionParams().do();
+
+ // const authParams = suggestedParams;
+ // authParams.fee = 0;
+ // const note = Buffer.from("KMD", "ascii");
+ // const authObj = {
+ // from: account,
+ // to: account,
+ // amount: 0,
+ // note: new Uint8Array(note),
+ // suggestedParams: authParams,
+ // };
+ // const authTxn =
+ // algosdk.makePaymentTxnWithSuggestedParamsFromObject(authObj);
+ // let signedAuthTxn = await dispatch(
+ // "signer/signTransaction",
+ // { from: account, tx: authTxn },
+ // {
+ // root: true,
+ // }
+ // );
+ // if (!signedAuthTxn) {
+ // throw new Error("Unable to to sign the transaction for authentication");
+ // }
+ // const b64 = Buffer.from(signedAuthTxn).toString("base64");
+ // const auth = "SigTx " + b64;
+ const auth = participationAuth;
const voteFirst = suggestedParams.firstRound + 2;
const voteLast = voteFirst + rounds;
const data = await dispatch(
@@ -152,6 +218,41 @@ const actions = {
});
}
},
+ async getAccountOfflineTx({ dispatch }, { account }) {
+ try {
+ if (!this.state.config || !this.state.config.participation)
+ throw new Error("Please setup participation server in your settings.");
+ if (!account) throw new Error("Address not found.");
+
+ const url = new URL(this.state.config.algod);
+ let algodclient = new algosdk.Algodv2(
+ this.state.config.algodToken,
+ this.state.config.algod,
+ url.port
+ );
+
+ const suggestedParams = await algodclient.getTransactionParams().do();
+
+ const authParams = suggestedParams;
+ authParams.fee = 0;
+ suggestedParams.fee = 1000;
+ suggestedParams.flatFee = true;
+ const toSignData = {
+ from: account,
+ suggestedParams: suggestedParams,
+ //nonParticipation: true, // TRAP
+ };
+ const txn =
+ algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject(toSignData);
+ return txn;
+ } catch (error) {
+ console.error("error", error, dispatch);
+ const msg = error.response ? error.response : error.message;
+ dispatch("toast/openError", msg, {
+ root: true,
+ });
+ }
+ },
};
export default {
namespaced: true,