48 lines
998 B
JavaScript
48 lines
998 B
JavaScript
import {defineStore} from "pinia";
|
|
import {ref, computed} from "vue";
|
|
|
|
export const walletStore = defineStore(
|
|
"localwallet",
|
|
() => {
|
|
const walletType = ref();
|
|
const address = ref();
|
|
const chainId = ref();
|
|
const token = ref();
|
|
const refreshToken = ref();
|
|
const passportAddress = ref();
|
|
const eoaAddress = ref();
|
|
|
|
|
|
const showAddress = computed(() => {
|
|
if (address.value.length > 10) {
|
|
return `${address.value.slice(0, 6)}...${address.value.slice(-4)}`;
|
|
} else {
|
|
return address.value
|
|
}
|
|
})
|
|
function reset() {
|
|
walletType.value = '';
|
|
address.value = '';
|
|
chainId.value = '';
|
|
token.value = '';
|
|
passportAddress.value = '';
|
|
refreshToken.value = '';
|
|
eoaAddress.value = '';
|
|
}
|
|
return {
|
|
walletType,
|
|
address,
|
|
passportAddress,
|
|
chainId,
|
|
token,
|
|
refreshToken,
|
|
showAddress,
|
|
eoaAddress,
|
|
reset,
|
|
};
|
|
},
|
|
{
|
|
persist: true,
|
|
}
|
|
);
|