diff --git a/src/libs/utils.js b/src/libs/utils.js index 6518809c..cb863779 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -205,6 +205,12 @@ export async function sign(device, chainId, signerAddress, messages, fee, memo, transport = await TransportWebUSB.create() signer = new LedgerSigner(transport, { hdPaths: [getHdPath(signerAddress)] }) break + case 'pingKMS': + if (!window.PingSigner) { + throw new Error('Please install Ping KMS extension') + } + signer = window.PingSigner + break case 'keplr': default: if (!window.getOfflineSigner || !window.keplr) { @@ -220,7 +226,7 @@ export async function sign(device, chainId, signerAddress, messages, fee, memo, // Ensure the address has some tokens to spend const client = await PingWalletClient.offline(signer) // const client = await SigningStargateClient.offline(signer) - return client.signAmino2(device === 'keplr' ? signerAddress : toSignAddress(signerAddress), messages, fee, memo, signerData) + return client.signAmino2(device.startsWith('ledger') ? toSignAddress(signerAddress) : signerAddress, messages, fee, memo, signerData) // return signDirect(signer, signerAddress, messages, fee, memo, signerData) } diff --git a/src/views/OperationDelegateComponent.vue b/src/views/OperationDelegateComponent.vue index 891cb62f..7e9140e2 100644 --- a/src/views/OperationDelegateComponent.vue +++ b/src/views/OperationDelegateComponent.vue @@ -224,47 +224,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -278,7 +238,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BAvatar, BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormSelectOption, - BForm, BFormRadioGroup, BFormRadio, BButton, BInputGroupAppend, BFormCheckbox, BOverlay, + BForm, BButton, BInputGroupAppend, BFormCheckbox, BOverlay, } from 'bootstrap-vue' import Ripple from 'vue-ripple-directive' import { @@ -289,6 +249,7 @@ import { } from '@/libs/utils' import vSelect from 'vue-select' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'DelegateDialogue', @@ -303,13 +264,12 @@ export default { BFormGroup, BFormSelect, BFormSelectOption, - BFormRadioGroup, - BFormRadio, BFormCheckbox, vSelect, BButton, BInputGroupAppend, BOverlay, + WalletInputVue, ValidationProvider, ValidationObserver, diff --git a/src/views/OperationGovDepositComponent.vue b/src/views/OperationGovDepositComponent.vue index 0c29564f..0080c1e9 100644 --- a/src/views/OperationGovDepositComponent.vue +++ b/src/views/OperationGovDepositComponent.vue @@ -193,47 +193,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -247,7 +207,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormCheckbox, - BForm, BFormRadioGroup, BFormRadio, BInputGroupAppend, BOverlay, BButton, BFormSelectOption, + BForm, BInputGroupAppend, BOverlay, BButton, BFormSelectOption, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -258,6 +218,7 @@ import { formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, setLocalTxHistory, sign, timeIn, } from '@/libs/utils' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'DepositDialogue', @@ -270,8 +231,6 @@ export default { BFormInput, BFormGroup, BFormSelect, - BFormRadioGroup, - BFormRadio, BFormCheckbox, BInputGroupAppend, BOverlay, @@ -280,6 +239,8 @@ export default { ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationRedelegateComponent.vue b/src/views/OperationRedelegateComponent.vue index aa9bc1b1..1db25d1b 100644 --- a/src/views/OperationRedelegateComponent.vue +++ b/src/views/OperationRedelegateComponent.vue @@ -193,47 +193,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -247,7 +207,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, - BForm, BFormRadioGroup, BFormRadio, BFormCheckbox, BInputGroupAppend, + BForm, BFormCheckbox, BInputGroupAppend, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -258,6 +218,7 @@ import { } from '@/libs/utils' import vSelect from 'vue-select' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'UnbondDialogue', @@ -270,14 +231,14 @@ export default { BFormInput, BFormGroup, BFormSelect, - BFormRadioGroup, - BFormRadio, vSelect, BFormCheckbox, BInputGroupAppend, ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationTransfer2Component.vue b/src/views/OperationTransfer2Component.vue index 9ef50abb..dcefc7d1 100644 --- a/src/views/OperationTransfer2Component.vue +++ b/src/views/OperationTransfer2Component.vue @@ -241,47 +241,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -295,7 +255,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BInputGroupAppend, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption, - BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend, BFormCheckbox, BOverlay, BSpinner, + BForm, BInputGroupPrepend, BFormCheckbox, BOverlay, BSpinner, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -310,6 +270,7 @@ import { coin } from '@cosmjs/amino' import dayjs from 'dayjs' import { toHex } from '@cosmjs/encoding' import { sha256 } from '@cosmjs/crypto' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'TransforDialogue', @@ -326,8 +287,6 @@ export default { BFormGroup, BFormSelect, BFormSelectOption, - BFormRadioGroup, - BFormRadio, BFormCheckbox, BSpinner, vSelect, @@ -335,6 +294,8 @@ export default { ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationTransferComponent.vue b/src/views/OperationTransferComponent.vue index b62a8a0c..36a5d4d8 100644 --- a/src/views/OperationTransferComponent.vue +++ b/src/views/OperationTransferComponent.vue @@ -196,47 +196,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -250,7 +210,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BInputGroupAppend, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption, - BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend, BFormCheckbox, + BForm, BInputGroupPrepend, BFormCheckbox, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -261,6 +221,7 @@ import { } from '@/libs/utils' import { Cosmos } from '@cosmostation/cosmosjs' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'TransforDialogue', @@ -277,12 +238,12 @@ export default { BFormGroup, BFormSelect, BFormSelectOption, - BFormRadioGroup, - BFormRadio, BFormCheckbox, ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationUnbondComponent.vue b/src/views/OperationUnbondComponent.vue index 41d5c197..8268fb74 100644 --- a/src/views/OperationUnbondComponent.vue +++ b/src/views/OperationUnbondComponent.vue @@ -171,47 +171,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -225,7 +185,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BInputGroupAppend, - BForm, BFormRadioGroup, BFormRadio, BFormCheckbox, + BForm, BFormCheckbox, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -236,6 +196,7 @@ import { } from '@/libs/utils' import vSelect from 'vue-select' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'UnbondDialogue', @@ -248,14 +209,14 @@ export default { BFormInput, BFormGroup, BFormSelect, - BFormRadioGroup, - BFormRadio, vSelect, BInputGroupAppend, BFormCheckbox, ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationVoteComponent.vue b/src/views/OperationVoteComponent.vue index 3c38671f..f6505d73 100644 --- a/src/views/OperationVoteComponent.vue +++ b/src/views/OperationVoteComponent.vue @@ -182,47 +182,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -236,7 +196,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormCheckbox, - BForm, BFormRadioGroup, BFormRadio, BInputGroupAppend, BOverlay, BButton, + BForm, BFormRadio, BInputGroupAppend, BOverlay, BButton, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -247,6 +207,7 @@ import { formatToken, getLocalAccounts, setLocalTxHistory, sign, timeIn, } from '@/libs/utils' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'VoteDialogue', @@ -259,7 +220,6 @@ export default { BFormInput, BFormGroup, BFormSelect, - BFormRadioGroup, BFormRadio, BFormCheckbox, BInputGroupAppend, @@ -268,6 +228,8 @@ export default { ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationWithdrawCommissionComponent.vue b/src/views/OperationWithdrawCommissionComponent.vue index 4536f17b..8264a8ed 100644 --- a/src/views/OperationWithdrawCommissionComponent.vue +++ b/src/views/OperationWithdrawCommissionComponent.vue @@ -108,47 +108,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -162,7 +122,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormCheckbox, - BForm, BFormRadioGroup, BFormRadio, BInputGroupAppend, + BForm, BInputGroupAppend, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -172,6 +132,7 @@ import { formatToken, setLocalTxHistory, sign, timeIn, } from '@/libs/utils' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'WithdrawCommissionDialogue', @@ -184,13 +145,13 @@ export default { BFormInput, BFormGroup, BFormSelect, - BFormRadioGroup, - BFormRadio, BFormCheckbox, BInputGroupAppend, ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/OperationWithdrawComponent.vue b/src/views/OperationWithdrawComponent.vue index 264f815b..1a455dc1 100644 --- a/src/views/OperationWithdrawComponent.vue +++ b/src/views/OperationWithdrawComponent.vue @@ -116,47 +116,7 @@ - - - - - Keplr - - - Ledger(USB) - - - Ledger(Bluetooth) - - - {{ errors[0] }} - - + @@ -170,7 +130,7 @@ import { ValidationProvider, ValidationObserver } from 'vee-validate' import { BModal, BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup, BFormSelect, - BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend, BFormCheckbox, BInputGroupAppend, + BForm, BInputGroupPrepend, BFormCheckbox, BInputGroupAppend, } from 'bootstrap-vue' import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, @@ -179,6 +139,7 @@ import { formatToken, getLocalAccounts, getLocalChains, sign, timeIn, setLocalTxHistory, extractAccountNumberAndSequence, } from '@/libs/utils' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import WalletInputVue from './components/WalletInput.vue' export default { name: 'WithdrawDialogue', @@ -193,13 +154,13 @@ export default { BAvatar, BFormGroup, BFormSelect, - BFormRadioGroup, - BFormRadio, BFormCheckbox, BInputGroupAppend, ValidationProvider, ValidationObserver, + + WalletInputVue, // eslint-disable-next-line vue/no-unused-components ToastificationContent, }, diff --git a/src/views/components/WalletInput.vue b/src/views/components/WalletInput.vue new file mode 100644 index 00000000..b4ee042a --- /dev/null +++ b/src/views/components/WalletInput.vue @@ -0,0 +1,80 @@ + + +