Setup
Setup your Vue 3 project to work with TON.
Installation
Install the peer dependancies:
npm install @tonconnect/ui @ton/ton
Install the package:
npm install @d0rich/vueton
Initialization
It accepts three configurations for different libraries:
tonClient
-TonClient
from@ton/ton
.tonConnectUI
-TonConnectUI
from@tonconnect/ui
.axiosRetry
(optional) -axios-retry
options.
import { createVueton } from '@d0rich/vueton'
const vueton = createVueton({
tonClient: {/* ton-client options */},
tonConnectUI: {/* ton-connect-ui options */},
axiosRetry: {/* axios-retry options */}
})
tonClient
also can be a sync/async function that returns TonClient
instance. It is useful when you want to use a library like @orbs-network/ton-access
.
import { createVueton } from '@d0rich/vueton'
import { getHttpEndpoint } from '@orbs-network/ton-access'
const vueton = createVueton({
tonClient: async () => {
const endpoint = await getHttpEndpoint({
// options
})
return { endpoint }
},
tonConnectUI: {/* ton-connect-ui options */},
axiosRetry: {/* axios-retry options */}
})
Activate the plugin:
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
app.use(vueton)