update new fields
This commit is contained in:
@@ -7,29 +7,23 @@ import {
|
||||
Gateway,
|
||||
MixNode,
|
||||
Operation,
|
||||
TauriContractSettingsParams,
|
||||
TauriContractStateParams,
|
||||
TauriTxResult,
|
||||
TCreateAccount,
|
||||
TDelegation,
|
||||
TSignInWithMnemonic,
|
||||
} from '../types'
|
||||
|
||||
export const createAccount = async (): Promise<TCreateAccount> =>
|
||||
await invoke('create_new_account')
|
||||
export const createAccount = async (): Promise<TCreateAccount> => await invoke('create_new_account')
|
||||
|
||||
export const signInWithMnemonic = async (
|
||||
mnemonic: string,
|
||||
): Promise<TSignInWithMnemonic> =>
|
||||
export const signInWithMnemonic = async (mnemonic: string): Promise<TSignInWithMnemonic> =>
|
||||
await invoke('connect_with_mnemonic', { mnemonic })
|
||||
|
||||
export const minorToMajor = async (amount: string): Promise<Coin> =>
|
||||
await invoke('minor_to_major', { amount })
|
||||
export const minorToMajor = async (amount: string): Promise<Coin> => await invoke('minor_to_major', { amount })
|
||||
|
||||
export const majorToMinor = async (amount: string): Promise<Coin> =>
|
||||
await invoke('major_to_minor', { amount })
|
||||
export const majorToMinor = async (amount: string): Promise<Coin> => await invoke('major_to_minor', { amount })
|
||||
|
||||
export const getGasFee = async (operation: Operation): Promise<Coin> =>
|
||||
await invoke('get_fee', { operation })
|
||||
export const getGasFee = async (operation: Operation): Promise<Coin> => await invoke('get_fee', { operation })
|
||||
|
||||
export const delegate = async ({
|
||||
type,
|
||||
@@ -39,8 +33,7 @@ export const delegate = async ({
|
||||
type: EnumNodeType
|
||||
identity: string
|
||||
amount: Coin
|
||||
}): Promise<DelegationResult> =>
|
||||
await invoke(`delegate_to_${type}`, { identity, amount })
|
||||
}): Promise<DelegationResult> => await invoke(`delegate_to_${type}`, { identity, amount })
|
||||
|
||||
export const undelegate = async ({
|
||||
type,
|
||||
@@ -48,19 +41,13 @@ export const undelegate = async ({
|
||||
}: {
|
||||
type: EnumNodeType
|
||||
identity: string
|
||||
}): Promise<DelegationResult> =>
|
||||
await invoke(`undelegate_from_${type}`, { identity })
|
||||
}): Promise<DelegationResult> => await invoke(`undelegate_from_${type}`, { identity })
|
||||
|
||||
export const send = async (args: {
|
||||
amount: Coin
|
||||
address: string
|
||||
memo: string
|
||||
}): Promise<TauriTxResult> => await invoke('send', args)
|
||||
export const checkMixnodeOwnership = async (): Promise<boolean> =>
|
||||
await invoke('owns_mixnode')
|
||||
export const send = async (args: { amount: Coin; address: string; memo: string }): Promise<TauriTxResult> =>
|
||||
await invoke('send', args)
|
||||
export const checkMixnodeOwnership = async (): Promise<boolean> => await invoke('owns_mixnode')
|
||||
|
||||
export const checkGatewayOwnership = async (): Promise<boolean> =>
|
||||
await invoke('owns_gateway')
|
||||
export const checkGatewayOwnership = async (): Promise<boolean> => await invoke('owns_gateway')
|
||||
|
||||
export const bond = async ({
|
||||
type,
|
||||
@@ -70,21 +57,15 @@ export const bond = async ({
|
||||
type: EnumNodeType
|
||||
data: MixNode | Gateway
|
||||
amount: Coin
|
||||
}): Promise<any> => await invoke(`bond_${type}`, { [type]: data, bond: amount })
|
||||
}): Promise<any> => await invoke(`bond_${type}`, { [type]: data, pledge: amount })
|
||||
|
||||
export const unbond = async (type: EnumNodeType) =>
|
||||
await invoke(`unbond_${type}`)
|
||||
export const unbond = async (type: EnumNodeType) => await invoke(`unbond_${type}`)
|
||||
|
||||
export const userBalance = async (): Promise<Balance> =>
|
||||
await invoke('get_balance')
|
||||
export const userBalance = async (): Promise<Balance> => await invoke('get_balance')
|
||||
|
||||
export const getContractParams =
|
||||
async (): Promise<TauriContractSettingsParams> =>
|
||||
await invoke('get_contract_settings')
|
||||
export const getContractParams = async (): Promise<TauriContractStateParams> => await invoke('get_contract_settings')
|
||||
|
||||
export const setContractParams = async (
|
||||
params: TauriContractSettingsParams,
|
||||
): Promise<TauriContractSettingsParams> =>
|
||||
export const setContractParams = async (params: TauriContractStateParams): Promise<TauriContractStateParams> =>
|
||||
await invoke('update_contract_settings', { params })
|
||||
|
||||
export const getReverseMixDelegations = async (): Promise<TDelegation> =>
|
||||
|
||||
@@ -27,6 +27,7 @@ type TBondFormFields = {
|
||||
ownerSignature: string
|
||||
identityKey: string
|
||||
sphinxKey: string
|
||||
profitPercentage: number
|
||||
amount: string
|
||||
host: string
|
||||
version: string
|
||||
@@ -45,6 +46,7 @@ const defaultValues = {
|
||||
amount: '',
|
||||
host: '',
|
||||
version: '',
|
||||
profitPercentage: 0,
|
||||
location: undefined,
|
||||
mixPort: 1789,
|
||||
verlocPort: 1790,
|
||||
@@ -179,7 +181,7 @@ export const BondForm = ({
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sm={9}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
{...register('amount')}
|
||||
variant="outlined"
|
||||
@@ -197,6 +199,21 @@ export const BondForm = ({
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
{...register('profitPercentage')}
|
||||
variant="outlined"
|
||||
required
|
||||
id="profitPercentage"
|
||||
name="profitPercentage"
|
||||
label="Profit percentage"
|
||||
fullWidth
|
||||
error={!!errors.profitPercentage}
|
||||
helperText={errors.profitPercentage?.message}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
{...register('host')}
|
||||
|
||||
@@ -25,6 +25,7 @@ export const validationSchema = Yup.object().shape({
|
||||
.test('valid-signature', 'A valid signature is required', function (value) {
|
||||
return validateKey(value || '', 64)
|
||||
}),
|
||||
profitPercentage: Yup.string().required('Profit Percentage is required').min(1).max(100),
|
||||
amount: Yup.string()
|
||||
.required('An amount is required')
|
||||
.test('valid-amount', `A valid amount is required (min 100 ${MAJOR_CURRENCY})`, function (value) {
|
||||
|
||||
Reference in New Issue
Block a user