diff --git a/cms/src/components/wallet/MoneroWallet.vue b/cms/src/components/wallet/MoneroWallet.vue
index 6a19b06..4d21318 100644
--- a/cms/src/components/wallet/MoneroWallet.vue
+++ b/cms/src/components/wallet/MoneroWallet.vue
@@ -49,6 +49,7 @@
+
+
+
+
+
+
Withdraw all unlocked funds
@@ -90,9 +102,12 @@
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus';
import { computed, onBeforeMount, reactive, ref } from 'vue';
import { storeToRefs } from 'pinia';
+import { moneroWithdrawPriorityOptions } from '@/consts/moneroWallet/moneroWithdrawPriorityOptions';
+import { MoneroWithdrawPriority } from '@/types/moneroWallet/MoneroWithdrawPriority';
import { WalletSyncStatus } from '@/types/wallet/WalletSyncStatus';
import { useMoneroWalletStore } from '@/stores/moneroWallet';
import { isMoneroStandardAddress } from '@/utils/monero/isMoneroStandardAddress';
+import { resolveMoneroWithdrawPriorityLabel } from '@/utils/monero/resolveMoneroWithdrawPriorityLabel';
import { resolveAxiosErrorMessage } from '@/utils/resolveAxiosErrorMessage';
import { resolveWalletSyncStatusLabel } from '@/utils/wallet/resolveWalletSyncStatusLabel';
import { resolveWalletSyncStatusTagType } from '@/utils/wallet/resolveWalletSyncStatusTagType';
@@ -110,7 +125,8 @@ const withdrawing = ref(false);
const revealingSeed = ref(false);
const withdrawFormRef = ref();
const withdrawForm = reactive({
- destinationAddress: ''
+ destinationAddress: '',
+ priority: MoneroWithdrawPriority.Automatic
});
const seedDialogVisible = ref(false);
const revealedMnemonic = ref('');
@@ -209,11 +225,17 @@ const onWithdrawSubmit = async (): Promise => {
const trimmedAddress = withdrawForm.destinationAddress.trim();
try {
- await ElMessageBox.confirm(`Withdraw all unlocked funds to:\n${trimmedAddress}`, 'Confirm withdrawal', {
- confirmButtonText: 'Continue',
- cancelButtonText: 'Cancel',
- type: 'warning'
- });
+ const priorityLabel = resolveMoneroWithdrawPriorityLabel(withdrawForm.priority);
+
+ await ElMessageBox.confirm(
+ `Withdraw all unlocked funds at ${priorityLabel} fee to:\n${trimmedAddress}`,
+ 'Confirm withdrawal',
+ {
+ confirmButtonText: 'Continue',
+ cancelButtonText: 'Cancel',
+ type: 'warning'
+ }
+ );
} catch {
return;
}
@@ -229,6 +251,7 @@ const onWithdrawSubmit = async (): Promise => {
try {
const result = await withdrawAll({
destinationAddress: trimmedAddress,
+ priority: withdrawForm.priority,
password
});
@@ -290,3 +313,14 @@ const clearSeed = (): void => {
revealedMnemonic.value = '';
};
+
+
diff --git a/cms/src/consts/moneroWallet/moneroWithdrawPriorityOptions.ts b/cms/src/consts/moneroWallet/moneroWithdrawPriorityOptions.ts
new file mode 100644
index 0000000..46cf233
--- /dev/null
+++ b/cms/src/consts/moneroWallet/moneroWithdrawPriorityOptions.ts
@@ -0,0 +1,13 @@
+import { MoneroWithdrawPriority } from '@/types/moneroWallet/MoneroWithdrawPriority';
+import type { MoneroWithdrawPriorityLabel } from '@/types/moneroWallet/MoneroWithdrawPriorityLabel';
+
+export const moneroWithdrawPriorityOptions = [
+ { value: MoneroWithdrawPriority.Automatic, label: 'Automatic' },
+ { value: MoneroWithdrawPriority.Slow, label: 'Slow (0.2×)' },
+ { value: MoneroWithdrawPriority.Normal, label: 'Normal (1×)' },
+ { value: MoneroWithdrawPriority.Fast, label: 'Fast (5×)' },
+ { value: MoneroWithdrawPriority.Fastest, label: 'Fastest (200×)' }
+] as const satisfies ReadonlyArray<{
+ value: MoneroWithdrawPriority;
+ label: MoneroWithdrawPriorityLabel;
+}>;
diff --git a/cms/src/types/moneroWallet/MoneroWalletWithdrawPayload.ts b/cms/src/types/moneroWallet/MoneroWalletWithdrawPayload.ts
index 6e5ebef..18c428a 100644
--- a/cms/src/types/moneroWallet/MoneroWalletWithdrawPayload.ts
+++ b/cms/src/types/moneroWallet/MoneroWalletWithdrawPayload.ts
@@ -1,4 +1,7 @@
+import { MoneroWithdrawPriority } from './MoneroWithdrawPriority';
+
export interface MoneroWalletWithdrawPayload {
destinationAddress: string;
+ priority: MoneroWithdrawPriority;
password: string;
}
diff --git a/cms/src/types/moneroWallet/MoneroWithdrawPriority.ts b/cms/src/types/moneroWallet/MoneroWithdrawPriority.ts
new file mode 100644
index 0000000..384137b
--- /dev/null
+++ b/cms/src/types/moneroWallet/MoneroWithdrawPriority.ts
@@ -0,0 +1,7 @@
+export enum MoneroWithdrawPriority {
+ Automatic = 0,
+ Slow = 1,
+ Normal = 2,
+ Fast = 3,
+ Fastest = 4
+}
diff --git a/cms/src/types/moneroWallet/MoneroWithdrawPriorityLabel.ts b/cms/src/types/moneroWallet/MoneroWithdrawPriorityLabel.ts
new file mode 100644
index 0000000..82c0a42
--- /dev/null
+++ b/cms/src/types/moneroWallet/MoneroWithdrawPriorityLabel.ts
@@ -0,0 +1,6 @@
+export type MoneroWithdrawPriorityLabel =
+ | 'Automatic'
+ | 'Slow (0.2×)'
+ | 'Normal (1×)'
+ | 'Fast (5×)'
+ | 'Fastest (200×)';
diff --git a/cms/src/utils/monero/resolveMoneroWithdrawPriorityLabel.ts b/cms/src/utils/monero/resolveMoneroWithdrawPriorityLabel.ts
new file mode 100644
index 0000000..295decf
--- /dev/null
+++ b/cms/src/utils/monero/resolveMoneroWithdrawPriorityLabel.ts
@@ -0,0 +1,13 @@
+import { moneroWithdrawPriorityOptions } from '@/consts/moneroWallet/moneroWithdrawPriorityOptions';
+import { MoneroWithdrawPriority } from '@/types/moneroWallet/MoneroWithdrawPriority';
+import type { MoneroWithdrawPriorityLabel } from '@/types/moneroWallet/MoneroWithdrawPriorityLabel';
+
+export const resolveMoneroWithdrawPriorityLabel = (priority: MoneroWithdrawPriority): MoneroWithdrawPriorityLabel => {
+ const option = moneroWithdrawPriorityOptions.find(({ value }) => value === priority);
+
+ if (!option) {
+ throw new Error(`Invalid Monero withdraw priority: ${priority}`);
+ }
+
+ return option.label;
+};