use new vesting requests and types
This commit is contained in:
@@ -66,6 +66,7 @@ fn main() {
|
||||
vesting::bond::vesting_unbond_gateway,
|
||||
vesting::bond::vesting_unbond_mixnode,
|
||||
vesting::bond::withdraw_vested_coins,
|
||||
vesting::bond::vesting_update_mixnode,
|
||||
vesting::delegate::vesting_delegate_to_mixnode,
|
||||
vesting::delegate::vesting_undelegate_from_mixnode,
|
||||
vesting::queries::delegated_free,
|
||||
|
||||
@@ -64,3 +64,14 @@ pub async fn withdraw_vested_coins(
|
||||
nymd_client!(state).withdraw_vested_coins(amount).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn vesting_update_mixnode(
|
||||
profit_margin_percent: u8,
|
||||
state: tauri::State<'_, Arc<RwLock<State>>>,
|
||||
) -> Result<(), BackendError> {
|
||||
nymd_client!(state)
|
||||
.vesting_update_mixnode_config(profit_margin_percent)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { Coin, DelegationResult, EnumNodeType, Gateway, MixNode, TauriTxResult } from '../types'
|
||||
import { Coin, DelegationResult, EnumNodeType, Gateway, MixNode, TauriTxResult, TBondArgs } from '../types'
|
||||
|
||||
export const bond = async ({
|
||||
type,
|
||||
data,
|
||||
pledge,
|
||||
ownerSignature,
|
||||
}: {
|
||||
type: EnumNodeType
|
||||
data: MixNode | Gateway
|
||||
pledge: Coin
|
||||
ownerSignature: string
|
||||
}): Promise<any> => await invoke(`bond_${type}`, { [type]: data, ownerSignature, pledge })
|
||||
export const bond = async ({ type, data, pledge, ownerSignature }: TBondArgs): Promise<any> =>
|
||||
await invoke(`bond_${type}`, { [type]: data, ownerSignature, pledge })
|
||||
|
||||
export const unbond = async (type: EnumNodeType) => await invoke(`unbond_${type}`)
|
||||
|
||||
@@ -36,5 +27,5 @@ export const undelegate = async ({
|
||||
export const send = async (args: { amount: Coin; address: string; memo: string }): Promise<TauriTxResult> =>
|
||||
await invoke('send', args)
|
||||
|
||||
export const updateMixnode = async ({ profitMarginPercent }: { profitMarginPercent: number }) =>
|
||||
export const updateMixnode = async (profitMarginPercent: number) =>
|
||||
await invoke('update_mixnode', { profitMarginPercent })
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { VestingAccountInfo } from 'src/types/rust/vestingaccountinfo'
|
||||
import { majorToMinor, minorToMajor } from '.'
|
||||
import { Coin, DelegationResult, OriginalVestingResponse, Period } from '../types'
|
||||
import {
|
||||
Coin,
|
||||
DelegationResult,
|
||||
EnumNodeType,
|
||||
Gateway,
|
||||
MixNode,
|
||||
OriginalVestingResponse,
|
||||
Period,
|
||||
PledgeData,
|
||||
} from '../types'
|
||||
|
||||
export const getLockedCoins = async (address: string): Promise<Coin> => {
|
||||
const res: Coin = await invoke('locked_coins', { address })
|
||||
@@ -36,6 +45,20 @@ export const withdrawVestedCoins = async (amount: string) => {
|
||||
export const getCurrentVestingPeriod = async (address: string): Promise<Period> =>
|
||||
await invoke('get_current_vesting_period', { address })
|
||||
|
||||
export const vestingBond = async ({
|
||||
type,
|
||||
data,
|
||||
pledge,
|
||||
ownerSignature,
|
||||
}: {
|
||||
type: EnumNodeType
|
||||
data: MixNode | Gateway
|
||||
pledge: Coin
|
||||
ownerSignature: string
|
||||
}): Promise<any> => await invoke(`vesting_bond_${type}`, { [type]: data, ownerSignature, pledge })
|
||||
|
||||
export const vestingUnbond = async (type: EnumNodeType) => await invoke(`vesting_unbond_${type}`)
|
||||
|
||||
export const vestingDelegateToMixnode = async ({
|
||||
identity,
|
||||
amount,
|
||||
@@ -49,3 +72,14 @@ export const vestingUnelegateFromMixnode = async (identity: string): Promise<Del
|
||||
|
||||
export const getVestingAccountInfo = async (address: string): Promise<VestingAccountInfo> =>
|
||||
await invoke('get_account_info', { address })
|
||||
|
||||
export const getVestingPledgeInfo = async ({
|
||||
address,
|
||||
type,
|
||||
}: {
|
||||
address?: string
|
||||
type: EnumNodeType
|
||||
}): Promise<PledgeData> => await invoke(`vesting_get_${type}_pledge`, { address })
|
||||
|
||||
export const vestingUpdateMixnode = async (profitMarginPercent: number) =>
|
||||
await invoke('vesting_update_mixnode', { profitMarginPercent })
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface CoreNodeStatusResponse {
|
||||
identity: string;
|
||||
count: number;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Coin, Denom, MixNode } from '.'
|
||||
import { Coin, Denom, Gateway, MixNode, PledgeData } from '.'
|
||||
|
||||
export enum EnumNodeType {
|
||||
mixnode = 'mixnode',
|
||||
@@ -8,6 +8,7 @@ export enum EnumNodeType {
|
||||
export type TNodeOwnership = {
|
||||
hasOwnership: boolean
|
||||
nodeType?: EnumNodeType
|
||||
vestingPledge?: PledgeData
|
||||
}
|
||||
|
||||
export type TClientDetails = {
|
||||
@@ -54,6 +55,13 @@ export type TMixnodeBondDetails = {
|
||||
proxy: any
|
||||
}
|
||||
|
||||
export type TBondArgs = {
|
||||
type: EnumNodeType
|
||||
data: MixNode | Gateway
|
||||
pledge: Coin
|
||||
ownerSignature: string
|
||||
}
|
||||
|
||||
export type TCurrency = {
|
||||
minor: 'UNYM' | 'UNYMT'
|
||||
major: 'NYM' | 'NYMT'
|
||||
|
||||
@@ -20,3 +20,4 @@ export * from './network'
|
||||
export * from './originalvestingresponse'
|
||||
export * from './vestingperiod'
|
||||
export * from './vestingaccountinfo'
|
||||
export * from './pledgedata'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { invoke } from '@tauri-apps/api'
|
||||
import { appWindow } from '@tauri-apps/api/window'
|
||||
import bs58 from 'bs58'
|
||||
import { minor, valid } from 'semver'
|
||||
import { userBalance, majorToMinor, getGasFee } from '../requests'
|
||||
import { userBalance, majorToMinor } from '../requests'
|
||||
import { Coin, Network, Period, TCurrency } from '../types'
|
||||
|
||||
export const validateKey = (key: string, bytesLength: number): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user