Comparing version 0.0.3-alpha to 0.0.4-alpha
63
index.ts
@@ -1,61 +0,1 @@ | ||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. | ||
import { OfflineDirectSigner } from '@cosmjs/proto-signing' | ||
import { SigningStargateClient } from '@cosmjs/stargate' | ||
import { createIgnite, Environment, Ignite, registry } from '@ignt/client' | ||
import { Ref, ref } from 'vue' | ||
// defaults | ||
let apiURL = process.env.API_COSMOS || 'http://localhost:1317' | ||
let rpcURL = process.env.API_TENDERMINT || 'http://localhost:26657' | ||
let wsURL = process.env.WS_TENDERMINT || 'ws://localhost:26657/websocket' | ||
let prefix = process.env.ADDRESS_PREFIX || 'cosmos' | ||
// singleton state | ||
let ignite: Ref<Ignite | undefined> = ref<Ignite>() | ||
type Response = { | ||
ignite: Ref<Ignite | undefined> | ||
signIn: (offlineSigner: OfflineDirectSigner) => void | ||
signOut: () => void | ||
} | ||
function useIgnite(): Response { | ||
let initIgnite = !ignite.value | ||
if (initIgnite) { | ||
let env: Environment = { | ||
apiURL, | ||
rpcURL, | ||
wsURL, | ||
prefix | ||
} | ||
ignite.value = createIgnite({ | ||
env | ||
}).connectWS() | ||
} | ||
let signIn = async (offlineSigner: OfflineDirectSigner) => { | ||
let [acc] = await offlineSigner.getAccounts() | ||
let stargateClient = await SigningStargateClient.connectWithSigner( | ||
ignite.value?.env.rpcURL, | ||
offlineSigner, | ||
{ registry } | ||
) | ||
ignite.value?.signIn(stargateClient, acc.address) | ||
} | ||
let signOut = () => { | ||
ignite.value?.signOut() | ||
} | ||
return { | ||
ignite, | ||
signIn, | ||
signOut | ||
} | ||
} | ||
export { useModule as useCosmosAuthV1Beta1Module } from './cosmos.auth.v1beta1' | ||
@@ -80,3 +20,2 @@ export { useModule as useCosmosBankV1Beta1Module } from './cosmos.bank.v1beta1' | ||
export { useModule as useIbcCorePortV1Module } from './ibc.core.port.v1' | ||
export { useIgnite } | ||
export * from './useIgnite' |
{ | ||
"name": "@ignt/vue", | ||
"version": "0.0.3-alpha", | ||
"version": "0.0.4-alpha", | ||
"description": "Autogenerated Vue API", | ||
@@ -5,0 +5,0 @@ "author": "Ignite Codegen <hello@ignt.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41
40078
899