Skip to content

Commit 58c931e

Browse files
authored
Merge pull request #81 from GalaxyPay/dev
feat: pq mode
2 parents 6ac166c + fea9c67 commit 58c931e

14 files changed

Lines changed: 368 additions & 288 deletions

‎package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "algo-tools",
3-
"version": "5.0.18",
3+
"version": "5.1.0",
44
"type": "module",
55
"scripts": {
66
"dev": "vite",
@@ -10,15 +10,15 @@
1010
},
1111
"dependencies": {
1212
"@algorandfoundation/algokit-utils": "^9.2.0",
13-
"@lucide/vue": "^1.31.0",
13+
"@lucide/vue": "^1.34.0",
1414
"@tailwindcss/vite": "^4.3.3",
1515
"@tanstack/vue-table": "^8.21.3",
1616
"@txnlab/use-wallet-defly": "^5.0.0",
1717
"@txnlab/use-wallet-lute": "^5.0.0",
1818
"@txnlab/use-wallet-pera": "^5.0.0",
1919
"@txnlab/use-wallet-vue": "^5.0.0",
2020
"@vueuse/core": "^14.4.0",
21-
"algosdk": "^3.6.0",
21+
"algosdk": "^3.7.0",
2222
"class-variance-authority": "^0.7.1",
2323
"clsx": "^2.1.1",
2424
"core-js": "^3.50.0",
@@ -37,7 +37,7 @@
3737
"vue-sonner": "^2.0.9"
3838
},
3939
"devDependencies": {
40-
"@tsconfig/node22": "^22.0.5",
40+
"@tsconfig/node22": "^22.0.6",
4141
"@types/node": "^26.2.0",
4242
"@vitejs/plugin-vue": "^6.0.8",
4343
"@vue/eslint-config-typescript": "^14.9.0",
@@ -48,10 +48,10 @@
4848
"unplugin-auto-import": "^21.1.0",
4949
"unplugin-fonts": "^1.4.0",
5050
"unplugin-vue-components": "^32.1.0",
51-
"vite": "^8.2.1",
51+
"vite": "^8.2.2",
5252
"vite-plugin-node-polyfills": "^0.28.0",
5353
"vite-plugin-vue-devtools": "^8.2.1",
54-
"vue-tsc": "^3.3.9"
54+
"vue-tsc": "^3.3.11"
5555
},
5656
"engines": {
5757
"node": ">=22"

‎pnpm-lock.yaml‎

Lines changed: 249 additions & 239 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ allowBuilds:
33
esbuild: true
44
vue-demi: true
55
minimumReleaseAge: 1440
6-
minimumReleaseAgeExclude:
7-
- "@txnlab/use-wallet@5.0.0"
8-
- "@txnlab/use-wallet-defly@5.0.0"
9-
- "@txnlab/use-wallet-lute@5.0.0"
10-
- "@txnlab/use-wallet-pera@5.0.0"
11-
- "@txnlab/use-wallet-vue@5.0.0"
126
overrides:
137
"ws": ">=7.5.10"
148
"bn.js": ">=4.12.3"

‎src/components/AppCard.vue‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { execAtc, fetchAsync } from "@/utils";
2+
import { execAtc, fetchAsync, getSuggestedParams } from "@/utils";
33
import { useWallet } from "@txnlab/use-wallet-vue";
44
import algosdk, { modelsv2 } from "algosdk";
55
import { CircleOff, Delete, Info, X } from "@lucide/vue";
@@ -69,7 +69,10 @@ async function closeOut() {
6969
warningDialog.value.show = false;
7070
try {
7171
const atc = new algosdk.AtomicTransactionComposer();
72-
const suggestedParams = await algodClient.value.getTransactionParams().do();
72+
const suggestedParams = await getSuggestedParams(
73+
algodClient.value,
74+
store.pqMode
75+
);
7376
const txn = algosdk.makeApplicationCloseOutTxnFromObject({
7477
sender: activeAddress.value!,
7578
suggestedParams,
@@ -87,7 +90,10 @@ async function clearState() {
8790
warningDialog.value.show = false;
8891
try {
8992
const atc = new algosdk.AtomicTransactionComposer();
90-
const suggestedParams = await algodClient.value.getTransactionParams().do();
93+
const suggestedParams = await getSuggestedParams(
94+
algodClient.value,
95+
store.pqMode
96+
);
9197
const txn = algosdk.makeApplicationClearStateTxnFromObject({
9298
sender: activeAddress.value!,
9399
suggestedParams,
@@ -105,7 +111,10 @@ async function deleteApp() {
105111
warningDialog.value.show = false;
106112
try {
107113
const atc = new algosdk.AtomicTransactionComposer();
108-
const suggestedParams = await algodClient.value.getTransactionParams().do();
114+
const suggestedParams = await getSuggestedParams(
115+
algodClient.value,
116+
store.pqMode
117+
);
109118
const txn = algosdk.makeApplicationDeleteTxnFromObject({
110119
sender: activeAddress.value!,
111120
suggestedParams,

‎src/components/AssetCard.vue‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<script lang="ts" setup>
2-
import { execAtc, getAssetInfo, resolveProtocol } from "@/utils";
2+
import {
3+
execAtc,
4+
getAssetInfo,
5+
getSuggestedParams,
6+
resolveProtocol,
7+
} from "@/utils";
38
import { useWallet } from "@txnlab/use-wallet-vue";
49
import algosdk, { modelsv2 } from "algosdk";
510
import { Delete, Info, X } from "@lucide/vue";
@@ -73,7 +78,10 @@ async function setReceiver() {
7378
async function destroy() {
7479
try {
7580
const atc = new algosdk.AtomicTransactionComposer();
76-
const suggestedParams = await algodClient.value.getTransactionParams().do();
81+
const suggestedParams = await getSuggestedParams(
82+
algodClient.value,
83+
store.pqMode
84+
);
7785
const txn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({
7886
sender: activeAddress.value!,
7987
suggestedParams,
@@ -96,7 +104,10 @@ async function closeOut() {
96104
try {
97105
const atc = new algosdk.AtomicTransactionComposer();
98106
showReceiver.value = false;
99-
const suggestedParams = await algodClient.value.getTransactionParams().do();
107+
const suggestedParams = await getSuggestedParams(
108+
algodClient.value,
109+
store.pqMode
110+
);
100111
let txn;
101112
if (props.asset.assetId) {
102113
txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({

‎src/components/DonateDialog.vue‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { bigintAmount, execAtc } from "@/utils";
2+
import { bigintAmount, execAtc, getSuggestedParams } from "@/utils";
33
import { useWallet } from "@txnlab/use-wallet-vue";
44
import algosdk from "algosdk";
55
import { X } from "@lucide/vue";
@@ -28,7 +28,10 @@ async function donate() {
2828
if (!valid) return;
2929
const atc = new algosdk.AtomicTransactionComposer();
3030
const enc = new TextEncoder();
31-
const suggestedParams = await algodClient.value.getTransactionParams().do();
31+
const suggestedParams = await getSuggestedParams(
32+
algodClient.value,
33+
store.pqMode
34+
);
3235
const note64 = note ? enc.encode(note.value) : undefined;
3336
const microAlgo = bigintAmount(amount.value!, 6);
3437
const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({

‎src/components/InboxAsset.vue‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { Arc59Factory } from "@/clients/Arc59Client";
3-
import { getAssetInfo, resolveProtocol } from "@/utils";
3+
import { getAssetInfo, getSuggestedParams, resolveProtocol } from "@/utils";
44
import { AlgorandClient } from "@algorandfoundation/algokit-utils";
55
import { useWallet } from "@txnlab/use-wallet-vue";
66
import algosdk, { modelsv2 } from "algosdk";
@@ -71,13 +71,18 @@ async function claim() {
7171
const claimerOptedIn = store.account?.assets?.some(
7272
(a) => a.assetId === asset.assetId
7373
);
74-
let totalTxns = 3;
74+
let outerTxnCount = 1;
75+
let innerTxnCount = 2;
7576
if (props.inboxInfo.minBalance < props.inboxInfo.amount) {
76-
totalTxns += 2;
77+
outerTxnCount++;
78+
innerTxnCount++;
7779
composer.arc59ClaimAlgo({ args: {}, staticFee: (0).algo() });
7880
}
7981
// If the claimer hasn't already opted in, add a transaction to do so
80-
const suggestedParams = await algodClient.value.getTransactionParams().do();
82+
const suggestedParams = await getSuggestedParams(
83+
algodClient.value,
84+
store.pqMode
85+
);
8186
if (!claimerOptedIn) {
8287
const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({
8388
sender: store.account.address,
@@ -88,7 +93,10 @@ async function claim() {
8893
});
8994
composer.addTransaction(txn, transactionSigner);
9095
}
91-
const fee = (Number(suggestedParams.minFee) * totalTxns).microAlgos();
96+
const fee = (
97+
Number(suggestedParams.minFee) * outerTxnCount +
98+
innerTxnCount * 1000
99+
).microAlgos();
92100
composer.arc59Claim({ args: { asa: asset.assetId }, staticFee: fee });
93101
toastId = toast.info("Processing...", {
94102
duration: Infinity,
@@ -110,8 +118,11 @@ async function reject() {
110118
try {
111119
store.overlay = true;
112120
const appClient = getAppClient();
113-
const suggestedParams = await algodClient.value.getTransactionParams().do();
114-
const fee = (Number(suggestedParams.minFee) * 3).microAlgos();
121+
const suggestedParams = await getSuggestedParams(
122+
algodClient.value,
123+
store.pqMode
124+
);
125+
const fee = (Number(suggestedParams.minFee) + 2000).microAlgos();
115126
toastId = toast.info("Processing...", {
116127
duration: Infinity,
117128
});

‎src/components/NavWallet.vue‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { bigintToString, formatAddr } from "@/lib/utils";
33
import { useWallet } from "@txnlab/use-wallet-vue";
44
import { Clipboard, LogOut, Wallet2 } from "@lucide/vue";
55
import { toast } from "vue-sonner";
6+
import { set } from "idb-keyval";
67
78
const store = useAppStore();
89
const { activeAddress, activeWallet } = useWallet();
@@ -32,6 +33,11 @@ async function handleDisconnect() {
3233
}
3334
}
3435
36+
async function setPqMode() {
37+
await set("pqMode", !store.pqMode);
38+
await store.getCache();
39+
}
40+
3541
const activeAvatar = computed<string>(
3642
() => getAvatarUrl(activeAddress.value) || ""
3743
);
@@ -135,6 +141,17 @@ function getAvatarUrl(addr: string | null) {
135141
</DropdownMenuGroup>
136142
<DropdownMenuSeparator />
137143
</template>
144+
<DropdownMenuItem>
145+
<div class="flex space-x-2" @click.stop>
146+
<Checkbox
147+
id="pqMode"
148+
v-model="store.pqMode"
149+
class="border-gray-500"
150+
@click.prevent="setPqMode()"
151+
/>
152+
<Label for="pqMode">PQ Mode (3x fee)</Label>
153+
</div>
154+
</DropdownMenuItem>
138155
<DropdownMenuItem @click="handleCopyAddress()">
139156
<Clipboard />
140157
Copy Address

‎src/components/VanitySell.vue‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { vanityAbi } from "@/data";
3-
import { bigintAmount, delay, execAtc } from "@/utils";
3+
import { bigintAmount, delay, execAtc, getSuggestedParams } from "@/utils";
44
import { useWallet } from "@txnlab/use-wallet-vue";
55
import algosdk from "algosdk";
66
import { X } from "@lucide/vue";
@@ -70,10 +70,11 @@ async function sell() {
7070
.accountInformation(m2a.value.addr)
7171
.do();
7272
const atc = new algosdk.AtomicTransactionComposer();
73-
const suggestedParams = await algodClient.value.getTransactionParams().do();
73+
const suggestedParams = await getSuggestedParams(
74+
algodClient.value,
75+
store.pqMode
76+
);
7477
75-
suggestedParams.fee = suggestedParams.minFee * 2n;
76-
suggestedParams.flatFee = true;
7778
const appAddr = algosdk.getApplicationAddress(store.network.vanityId);
7879
const price = bigintAmount(vanity.value.price!, 6);
7980
const tax = Math.floor(Number(price) / 20);
@@ -84,6 +85,7 @@ async function sell() {
8485
receiver: appAddr,
8586
amount: tax,
8687
});
88+
payTxn.fee += 1000n;
8789
8890
const txnWithSigner = { txn: payTxn, signer: transactionSigner };
8991
const key = m2a.value.sk.slice(0, 32);
@@ -93,6 +95,7 @@ async function sell() {
9395
const optinOrNoop = optedIn
9496
? algosdk.OnApplicationComplete.NoOpOC
9597
: algosdk.OnApplicationComplete.OptInOC;
98+
suggestedParams.flatFee = true;
9699
suggestedParams.fee = 0n;
97100
const method = vanityAbi.methods.find((m) => m.name == "post");
98101
if (!method) throw Error("Invalid Method");

‎src/pages/burn.vue‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" setup>
22
import router from "@/router";
33
import burnTeal from "@/teal/burn.teal?raw";
4-
import { bigintAmount, execAtc } from "@/utils";
4+
import { bigintAmount, execAtc, getSuggestedParams } from "@/utils";
55
import { useWallet } from "@txnlab/use-wallet-vue";
66
import algosdk, {
77
IntDecoding,
@@ -109,12 +109,12 @@ async function burn() {
109109
const valid = validate();
110110
if (!valid) return;
111111
const atc = new algosdk.AtomicTransactionComposer();
112-
const suggestedParams = await algodClient.value.getTransactionParams().do();
112+
const suggestedParams = await getSuggestedParams(
113+
algodClient.value,
114+
store.pqMode
115+
);
113116
114117
if (!opted.value && needFunding.value) {
115-
suggestedParams.flatFee = true;
116-
suggestedParams.fee = suggestedParams.minFee;
117-
118118
const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
119119
receiver: lsig.value.hash,
120120
sender: activeAddress.value!,
@@ -125,8 +125,6 @@ async function burn() {
125125
}
126126
127127
if (!opted.value) {
128-
suggestedParams.flatFee = true;
129-
suggestedParams.fee = 0n;
130128
const lsigAcct = new algosdk.LogicSigAccount(
131129
new Uint8Array(Buffer.from(lsig.value.result, "base64"))
132130
);
@@ -138,11 +136,10 @@ async function burn() {
138136
assetIndex: assetId.value,
139137
amount: 0,
140138
});
139+
txn.fee = 0n;
141140
atc.addTransaction({ txn, signer: lsigSigner });
142141
}
143142
144-
suggestedParams.flatFee = true;
145-
suggestedParams.fee = suggestedParams.minFee * 2n;
146143
if (amount.value || closeout.value) {
147144
const burnObj: any = {
148145
sender: activeAddress.value!,
@@ -156,6 +153,7 @@ async function burn() {
156153
if (closeout.value) burnObj.closeRemainderTo = lsig.value.hash;
157154
const txn =
158155
algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject(burnObj);
156+
if (!opted.value) txn.fee += 1000n;
159157
atc.addTransaction({ txn, signer: transactionSigner });
160158
}
161159
await execAtc(atc, algodClient.value, "Asset Burned");

0 commit comments

Comments
 (0)