Disable tokenization if wallet address is not exposed via API

This commit is contained in:
silverpill 2022-05-27 21:20:23 +00:00
parent 4aa085fd86
commit 8a51c79a6e
4 changed files with 10 additions and 5 deletions

View file

@ -42,7 +42,7 @@ export function getVerifiedEthereumAddress(profile: Profile): string | null {
export interface User extends Profile {
source: Source;
wallet_address: string;
wallet_address: string | null;
}
export interface UserCreateForm {

View file

@ -463,6 +463,7 @@ export default class PostComponent extends Vue {
Boolean(this.store.instance?.blockchain_contract_address) &&
this.post.account.id === this.store.currentUser?.id &&
this.post.visibility === "public" &&
Boolean(this.store.currentUser?.wallet_address) &&
!this.isTokenized &&
!this.isWaitingForToken
)
@ -472,6 +473,7 @@ export default class PostComponent extends Vue {
const { currentUser, instance } = this.store
if (
!currentUser ||
!currentUser.wallet_address ||
!instance ||
!instance.blockchain_contract_address
) {

View file

@ -396,8 +396,7 @@ export default class ProfileView extends Vue {
// Only users with verified address can configure subscription
return (
Boolean(this.store.instance?.blockchain_contract_address) &&
this.profile !== null &&
getVerifiedEthereumAddress(this.profile) !== null &&
Boolean(this.store.currentUser?.wallet_address) &&
this.isCurrentUser()
)
}

View file

@ -184,13 +184,17 @@ async function checkSubscription() {
}
function canConfigureSubscription(): boolean {
// If wallet is not connected, subscriptionConfigured is set to null
return isCurrentUser() && subscriptionConfigured === false
return (
isCurrentUser() &&
currentUser.wallet_address &&
subscriptionConfigured === false
)
}
async function onConfigureSubscription() {
if (
!currentUser ||
!currentUser.wallet_address ||
!isCurrentUser() ||
!instance ||
!instance.blockchain_contract_address