Skip to content

Commit

Permalink
feat(solana): Support LTAI balances
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Oct 27, 2024
1 parent 8f8fff0 commit 2a86b6a
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 79 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ WALLET_CONNECT_PROJECT_ID=

# APIs
LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000
WALLET_CONNECT_PROJECT_ID=

# RPCs
SOLANA_RPC=

# Blockchain addresses (change in development)
# LTAI_BASE_ADDRESS=0x92e1d72210429Ce7eE8a0d64D526D4b9752801FF
# LTAI_SOLANA_ADDRESS=5ooRTqmvm95bHwp4HMo3iszCwsEseY5hksfSa9EDVpBY
# LTAI_PUBLISHER_ADDRESS=0xae92Dc50115dbBb1CF0BA848e83842daf00CE129
# WAGMI_BASE_ID=84532
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ plugins:

rules:
'no-unused-vars': [ 'warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' } ]
no-case-declarations: off

'vue/multi-word-component-names': 'off'
'vue/no-v-html': 'off'
Expand Down
60 changes: 15 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@hey-api/client-axios": "^0.2.7",
"@libertai/libertai-js": "0.0.10",
"@quasar/extras": "^1.16.12",
"@solana/web3.js": "^1.95.4",
"@tanstack/vue-query": "^5.51.21",
"@wagmi/vue": "^0.0.36",
"axios": "^1.7.3",
Expand Down
4 changes: 2 additions & 2 deletions src/components/AccountButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@
import { useAccount, useConnect, useDisconnect } from '@wagmi/vue';
import { watchAccount } from '@wagmi/vue/actions';
import LtaiIcon from 'components/libertai/LtaiIcon.vue';
import { config } from 'src/config/wagmi';
import { watch, watchEffect } from 'vue';
import { useWallet, WalletModalProvider } from 'solana-wallets-vue';
import { config } from 'src/config/wagmi';
import { useAccountStore } from 'stores/account';
import { watch, watchEffect } from 'vue';
const accountStore = useAccountStore();
Expand Down
2 changes: 2 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const envSchema = z.object({
ALEPH_API_URL: z.string().optional(),
LTAI_SUBSCRIPTIONS_API_URL: z.string(),
WALLET_CONNECT_PROJECT_ID: z.string(),
SOLANA_RPC: z.string().url(),
LTAI_BASE_ADDRESS: z.string().startsWith('0x').optional().default('0xF8B1b47AA748F5C7b5D0e80C726a843913EB573a'),
LTAI_SOLANA_ADDRESS: z.string().optional().default('mntpN8z1d29f3MWhMD7VqZFpeYmbD88MgwS3Bkz8y7u'),
LTAI_PUBLISHER_ADDRESS: z.string().startsWith('0x').optional().default('0xCBFc3EeC41CBBfCAcc50337d712890C47a14ba99'),
WAGMI_BASE_ID: z.union([z.literal(base.id), z.literal(baseSepolia.id)]).default(base.id),
});
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/AuthenticatedPage.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<template>
<q-page>
<slot v-if="account.isConnected.value" />
<slot v-if="accountStore.account !== null" />
</q-page>
</template>

<script lang="ts" setup>
import { useAccount } from '@wagmi/vue';
import { useQuasar } from 'quasar';
import { useAccountStore } from 'stores/account';
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
const $q = useQuasar();
const router = useRouter();
const account = useAccount();
const accountStore = useAccountStore();
onMounted(async () => {
if (!account.isConnected.value) {
if (accountStore.account === null) {
$q.notify({ message: 'Account not connected', color: 'negative' });
await router.push({ path: '/' });
return;
Expand Down
5 changes: 2 additions & 3 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<div class="row q-gutter-x-sm">
<q-btn
v-if="accountStore.account === null"
:class="{ 'float-right q-pa-sm': !$q.screen.gt.sm }"

:class="{ 'float-right q-pa-sm': !$q.screen.gt.sm }"
no-caps
rounded
text-color="primary"
Expand Down Expand Up @@ -81,9 +80,9 @@
</template>

<script lang="ts" setup>
import AccountButton from 'src/components/AccountButton.vue';
import ChatsList from 'components/ChatsList.vue';
import LtaiIcon from 'components/libertai/LtaiIcon.vue';
import AccountButton from 'src/components/AccountButton.vue';
import { useAccountStore } from 'stores/account';
import { useGeneralStore } from 'stores/general';
Expand Down
3 changes: 2 additions & 1 deletion src/pages/TokensDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@
</template>

<script lang="ts" setup>
import { useQuasar } from 'quasar';
import { useTokensStore } from 'stores/tokens';
import { onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useTokensStore } from 'stores/tokens';
import web3 from 'web3';
const route = useRoute();
Expand Down
Loading

0 comments on commit 2a86b6a

Please sign in to comment.