-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: rename Bridge -> BTC * refactor: transfer -> send and receive * fix: rename Transfer component * revert change to tab name * refactor: update translation references * update schemas * update directory and file casing * casing * casing * casing * casing * casing
- Loading branch information
Showing
84 changed files
with
313 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import i18n from 'i18next'; | ||
|
||
import yup, { AddressType, MaxAmountValidationParams, MinAmountValidationParams } from '../yup.custom'; | ||
|
||
const BTC_ISSUE_AMOUNT_FIELD = 'issue-amount'; | ||
const BTC_ISSUE_CUSTOM_VAULT_FIELD = 'issue-custom-vault'; | ||
const BTC_ISSUE_CUSTOM_VAULT_SWITCH = 'issue-custom-vault-switch'; | ||
const BTC_ISSUE_GRIEFING_COLLATERAL_TOKEN = 'issue-griefing-collateral-token'; | ||
const BTC_ISSUE_FEE_TOKEN = 'issue-fee-token'; | ||
|
||
type BTCIssueFormData = { | ||
[BTC_ISSUE_AMOUNT_FIELD]?: string; | ||
[BTC_ISSUE_CUSTOM_VAULT_FIELD]?: string; | ||
[BTC_ISSUE_CUSTOM_VAULT_SWITCH]?: boolean; | ||
[BTC_ISSUE_GRIEFING_COLLATERAL_TOKEN]?: string; | ||
[BTC_ISSUE_FEE_TOKEN]?: string; | ||
}; | ||
|
||
type BTCIssueValidationParams = { | ||
[BTC_ISSUE_AMOUNT_FIELD]: MaxAmountValidationParams & MinAmountValidationParams; | ||
}; | ||
|
||
const btcIssueSchema = (params: BTCIssueValidationParams): yup.ObjectSchema<any> => | ||
yup.object().shape({ | ||
[BTC_ISSUE_AMOUNT_FIELD]: yup | ||
.string() | ||
.requiredAmount('issue') | ||
.maxAmount( | ||
params[BTC_ISSUE_AMOUNT_FIELD], | ||
'issue', | ||
i18n.t('forms.amount_must_be_at_most', { | ||
action: 'issue', | ||
amount: params[BTC_ISSUE_AMOUNT_FIELD].maxAmount.toString() | ||
}) | ||
) | ||
.minAmount(params[BTC_ISSUE_AMOUNT_FIELD], 'issue'), | ||
[BTC_ISSUE_CUSTOM_VAULT_FIELD]: yup.string().when([BTC_ISSUE_CUSTOM_VAULT_SWITCH], { | ||
is: (isManualVault: string) => isManualVault, | ||
then: (schema) => schema.required(i18n.t('forms.please_select_your_field', { field: 'issue vault' })) | ||
}), | ||
[BTC_ISSUE_GRIEFING_COLLATERAL_TOKEN]: yup.string().required(), | ||
[BTC_ISSUE_FEE_TOKEN]: yup.string().required() | ||
}); | ||
|
||
const BTC_REDEEM_AMOUNT_FIELD = 'redeem-amount'; | ||
const BTC_REDEEM_CUSTOM_VAULT_FIELD = 'redeem-custom-vault'; | ||
const BTC_REDEEM_CUSTOM_VAULT_SWITCH = 'redeem-custom-vault-switch'; | ||
const BTC_REDEEM_PREMIUM_VAULT_FIELD = 'redeem-premium-vault'; | ||
const BTC_REDEEM_ADDRESS = 'redeem-address'; | ||
const BTC_REDEEM_FEE_TOKEN = 'redeem-fee-token'; | ||
|
||
type BTCRedeemFormData = { | ||
[BTC_REDEEM_AMOUNT_FIELD]?: string; | ||
[BTC_REDEEM_CUSTOM_VAULT_FIELD]?: string; | ||
[BTC_REDEEM_CUSTOM_VAULT_SWITCH]?: boolean; | ||
[BTC_REDEEM_PREMIUM_VAULT_FIELD]?: boolean; | ||
[BTC_REDEEM_ADDRESS]?: string; | ||
[BTC_REDEEM_FEE_TOKEN]?: string; | ||
}; | ||
|
||
type BTCRedeemValidationParams = { | ||
[BTC_REDEEM_AMOUNT_FIELD]: MaxAmountValidationParams & MinAmountValidationParams; | ||
}; | ||
|
||
const btcRedeemSchema = (params: BTCRedeemValidationParams): yup.ObjectSchema<any> => | ||
yup.object().shape({ | ||
[BTC_REDEEM_AMOUNT_FIELD]: yup | ||
.string() | ||
.requiredAmount('redeem') | ||
.maxAmount( | ||
params[BTC_REDEEM_AMOUNT_FIELD], | ||
'redeem', | ||
i18n.t('forms.amount_must_be_at_most', { | ||
action: 'redeem', | ||
amount: params[BTC_REDEEM_AMOUNT_FIELD].maxAmount.toString() | ||
}) | ||
) | ||
.minAmount(params[BTC_REDEEM_AMOUNT_FIELD], 'redeem'), | ||
[BTC_REDEEM_CUSTOM_VAULT_FIELD]: yup.string().when([BTC_REDEEM_CUSTOM_VAULT_SWITCH], { | ||
is: (isManualVault: string) => isManualVault, | ||
then: (schema) => schema.required(i18n.t('forms.please_select_your_field', { field: 'redeem vault' })) | ||
}), | ||
[BTC_REDEEM_ADDRESS]: yup | ||
.string() | ||
.required(i18n.t('forms.please_enter_your_field', { field: 'BTC address' })) | ||
.address(AddressType.BTC), | ||
[BTC_REDEEM_FEE_TOKEN]: yup.string().required() | ||
}); | ||
|
||
export { | ||
BTC_ISSUE_AMOUNT_FIELD, | ||
BTC_ISSUE_CUSTOM_VAULT_FIELD, | ||
BTC_ISSUE_CUSTOM_VAULT_SWITCH, | ||
BTC_ISSUE_FEE_TOKEN, | ||
BTC_ISSUE_GRIEFING_COLLATERAL_TOKEN, | ||
BTC_REDEEM_ADDRESS, | ||
BTC_REDEEM_AMOUNT_FIELD, | ||
BTC_REDEEM_CUSTOM_VAULT_FIELD, | ||
BTC_REDEEM_CUSTOM_VAULT_SWITCH, | ||
BTC_REDEEM_FEE_TOKEN, | ||
BTC_REDEEM_PREMIUM_VAULT_FIELD, | ||
btcIssueSchema, | ||
btcRedeemSchema | ||
}; | ||
export type { BTCIssueFormData, BTCRedeemFormData }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9b64c30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
interbtc-ui-kintsugi-testnet – ./
kintnet.interlay.io
interbtc-ui-kintsugi-testnet-interlay.vercel.app
interbtc-ui-kintsugi-testnet-git-master-interlay.vercel.app
interbtc-ui.vercel.app
9b64c30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
interbtc-ui-interlay-testnet – ./
interbtc-ui-interlay-testnet.vercel.app
testnet.interlay.io
interbtc-ui-interlay-testnet-git-master-interlay.vercel.app
interbtc-ui-interlay-testnet-interlay.vercel.app