0.0.5 • Published 11 months ago

@embarky/vue v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@embarky-vue

base on @embarky/core-sdk, like @embarky/react

Prerequisites

To integrate the Embarky Vue SDK, your project must be on:

  • a minimum Vue version of 3.x
  • a minimum TypeScript version of 5

Quick start

install

(Installation)

// npm
npm i @embarky/vue

// yarn
yarn add @embarky/vue

Import the plugin and style

(Set Up Your App with Embarky)

// main.js
import { EmbarkyVuePlugin } from "@embarky/vue";
import App from "./App.vue";
import { createApp } from "vue";
// import style
import "@embarky/vue/style.css";

const config = {
     appId: "xxx",
}
createApp(App)
  .use(EmbarkyVuePlugin, {
    config,
  })
  .mount("#app");

Usage

(Using the useEmbarky Hook)

// App.vue or other vue component
<script setup>
import { useEmbarky } from '@embarky/vue'

const { login, logout, userAccount } = useEmbarky()
</script>

<template>
    <button @click="login">login</button>
    <button @click="logout">logout</button>
    <div>
        UserAccount : 
        <pre>{{ userAccount }}</pre>
    </div>
</template>

EmbarkyVuePlugin Config

attrrequireddescriptiondefault
appId trueget from-
themefalsetheme for embarky component, the value can be 'light' or 'dark'dark
defaultChainfalsedefaultChain
supportedChainsfalseArray of chain, chain must be imported from '@wagmi/vue/chains' mainnet, goerli, sepolia, optimism, optimismSepolia, polygon, polygonMumbai, arbitrum, arbitrumSepolia, base, baseSepolia, bsc, bscTestnet, scroll, scrollSepolia
allowMethodsfalseArray of social login method"farcaster", "twitter", "google"
allowWalletsfalseArray of wallet login method"metaMask", "walletConnect", "tomo"

API

login

logout

linkGoogle

unlinkGoogle