0.3.39 • Published 5 months ago

@interchain-kit/vue v0.3.39

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
5 months ago

@interchain-kit/vue

Install

Using npm:

npm install @interchain-kit/vue

Using yarn:

yarn add @interchain-kit/vue

Usage

Setup

import @interchain-ui/vue stylesheet.

main.ts

import "@interchain-ui/vue/style.css";

import chain registry info that you need

App.ts

<script setup lang="ts">
import { ChainProvider } from '@interchain-kit/vue'
import { keplrWallet } from '@interchain-kit/keplr-extension';
import { leapWallet } from '@interchain-kit/leap-extension';
import { RouterView } from 'vue-router';
import { chain as junoChain, assetList as junoAssetList } from "@chain-registry/v2/mainnet/juno";
import { chain as osmosisChain,assetList as osmosisAssetList } from "@chain-registry/v2/mainnet/osmosis";
import { chain as cosmoshubChain, assetList as cosmoshubAssetList } from "@chain-registry/v2/mainnet/cosmoshub";
import { chain as osmosisTestChain, assetList as osmosisTestAssetList } from "@chain-registry/v2/testnet/osmosistestnet"
</script>

<template>
  <ChainProvider
    :wallets="[keplrWallet, leapWallet]"
    :chains="[osmosisChain, junoChain, cosmoshubChain, osmosisTestChain]"
    :asset-lists="[osmosisAssetList, junoAssetList, cosmoshubAssetList, osmosisTestAssetList]"
    :signer-options="{}"
    :endpoint-options="{}"
  >
    <router-view />
  </ChainProvider>
</template>

<style scoped>
</style>

or import all chain registry

App.ts

<script setup lang="ts">
import { ChainProvider } from '@interchain-kit/vue';
import { keplrWallet } from '@interchain-kit/keplr-extension';
import { chains, assetLists } from '@chain-registry/v2/mainnet';
import Show from './views/show.vue';
</script>

<template>
  <ChainProvider
    :wallets="[keplrWallet]"
    :chains="[chains]"
    :asset-lists="[assetLists]"
    :signer-options="{}"
    :endpoint-options="{}"
  >
    <show />
  </ChainProvider>
</template>

<style scoped>
</style>

show.vue

<script setup lang="ts">
import { ref } from 'vue'
import { useChain } from '@interchain-kit/vue';

const chainName = ref('osmosis')
const { address } = useChain(chainName);
</script>

<template>
  <div>
    <div>address: {{ address }}</div>
  </div>
</template>

<style scoped>
</style>

useChain

<script setup lang="ts">
import { ref } from 'vue'
import { useChain } from '@interchain-kit/vue';

const chainName = ref('osmosistestnet')
const { chain, assetList, address, wallet, queryClient, signingClient } = useChain(chainName)
const balance = ref('0')

const getBalance = async() => {
  const {balance: bc} =  await queryClient.value.balance({
    address: address.value,
    denom: 'uosmo',
  })
  balance.value = bc?.amount || '0'
}
</script>

<template>
  <div>
    <div>chain: {{ chain.prettyName }}</div>
    <div>assetList: {{ assetList?.assets?.length }}</div>
    <div>address: {{ address }}</div>
    <div>wallet: {{ wallet?.option?.prettyName }}</div>
    <div>balance: {{ balance }}</div> <button @click="getBalance">getBalance</button>
  </div>
</template>

<style scoped>
</style>

useChainWallet

App.ts

<script setup lang="ts">
import { ChainProvider } from '@interchain-kit/vue'
import { keplrWallet } from '@interchain-kit/keplr-extension';
import { leapWallet } from '@interchain-kit/leap-extension';
import Show from './views/show.vue';
import { chains, assetLists } from '@chain-registry/v2/mainnet';

const chainNames = ['juno', 'stargaze']
</script>

<template>
  <ChainProvider
    :wallets="[keplrWallet, leapWallet]"
    :chains="chains.filter(c => chainNames.includes(c.chainName))"
    :asset-lists="assetLists.filter(c => chainNames.includes(c.chainName))"
    :signer-options="{}"
    :endpoint-options="{}"
  >
    <show />
  </ChainProvider>
</template>

<style scoped>
</style>

show.vue

<script setup lang="ts">
import { ref } from 'vue'
import { useChainWallet, useWalletManager } from '@interchain-kit/vue';

const junoChainName = ref('juno')
const keplrWalletName = ref('keplr-extension')
const juno = useChainWallet(junoChainName, keplrWalletName);

const stargazeChainName = ref('stargaze')
const leapWalletName = ref('leap-extension')
const stargaze = useChainWallet(stargazeChainName, leapWalletName);

const walletManager = useWalletManager()
	
const connectKeplr = async() => {
  await walletManager.connect('keplr-extension')
}
const connectLeap = async() => {
  await walletManager.connect('leap-extension')
}
</script>

<template>
  <div>
    <button @click="connectKeplr">connect keplr</button>
    <button @click="connectLeap">connect leap</button>
    <div>juno address: {{ juno.address }}</div>
    <div>stargaze address: {{ stargaze.address }}</div>
  </div>
</template>

<style scoped>
</style>

useChains

WIP

Developing

When first cloning the repo, under project root directory run:

yarn
# build the prod packages. When devs would like to navigate to the source code, this will only navigate from references to their definitions (.d.ts files) between packages.
yarn build

Interchain JavaScript Stack

A unified toolkit for building applications and smart contracts in the Interchain ecosystem ⚛️

CategoryToolsDescription
Chain InformationChain Registry, Utils, ClientEverything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
Wallet ConnectorsInterchain Kitbeta, Cosmos KitExperience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
Signing ClientsInterchainJSbeta, CosmJSA single, universal signing interface for any network
SDK ClientsTelescopeYour Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
Starter KitsCreate Interchain Appbeta, Create Cosmos AppSet up a modern Interchain app by running one command.
UI KitsInterchain UIThe Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
Testing FrameworksStarshipUnified Testing and Development for the Interchain.
TypeScript Smart ContractsCreate Hyperweb AppBuild and deploy full-stack blockchain applications with TypeScript
CosmWasm ContractsCosmWasm TS CodegenConvert your CosmWasm smart contracts into dev-friendly TypeScript classes.

Credits

🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to our github ⚛️

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

0.3.39

5 months ago

0.3.38

5 months ago

0.3.37

5 months ago

0.3.36

6 months ago

0.3.35

6 months ago

0.3.34

6 months ago

0.3.33

6 months ago

0.3.28

6 months ago

0.3.25

6 months ago

0.3.23

6 months ago

0.3.18

6 months ago

0.3.16

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.9

7 months ago

0.3.5

7 months ago

0.3.3

7 months ago

0.2.222

7 months ago

0.2.221

7 months ago

0.2.220

7 months ago

0.2.211

7 months ago

0.2.208

7 months ago

0.2.207

8 months ago

0.2.205

8 months ago

0.2.202

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

10 months ago

0.1.0

10 months ago

0.0.1-beta.62

10 months ago

0.0.1-beta.57

10 months ago

0.0.1-beta.55

10 months ago

0.0.1-beta.54

10 months ago

0.0.1-beta.52

10 months ago

0.0.1-beta.50

10 months ago

0.0.1-beta.49

10 months ago

0.0.1-beta.48

10 months ago

0.0.1-beta.47

10 months ago

0.0.1-beta.45

11 months ago

0.0.1-beta.43

11 months ago

0.0.1-beta.40

11 months ago

0.0.1-beta.39

11 months ago

0.0.1-beta.38

12 months ago

0.0.1-beta.37

1 year ago

0.0.1-beta.36

1 year ago

0.0.1-beta.35

1 year ago

0.0.1-beta.34

1 year ago