@embarky/vue
v0.0.5
Published
base on `@embarky/core-sdk`, like `@embarky/react`
Downloads
1
Readme
@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
| attr | required | description | default | | --------------- | -------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | appId | true | get from | - | | theme | false | theme for embarky component, the value can be 'light' or 'dark' | dark | | defaultChain | false | defaultChain | | | supportedChains | false | Array 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 ] | | allowMethods | false | Array of social login method | ["farcaster", "twitter", "google"] | | allowWallets | false | Array of wallet login method | ["metaMask", "walletConnect", "tomo"] |