UNPKG

@keplr-ewallet/ewallet-sdk-cosmos

Version:
29 lines 1 kB
export async function getPublicKey() { console.log("[keplr-cosmos] getPublicKey: start"); try { await this.waitUntilInitialized; if (this.state === null) { throw new Error("Cosmos SDK is not properly initialized"); } if (this.state.publicKey) { console.log("[keplr-cosmos] getPublicKey: cached public key"); return this.state.publicKey; } console.log("[keplr-cosmos] getPublicKey: getPublicKey from eWallet"); const pk = await this.eWallet.getPublicKey(); if (pk === null) { this.state.publicKey = null; return null; } else { const publicKey = Buffer.from(pk, "hex"); this.state.publicKey = publicKey; return this.state.publicKey; } } catch (error) { console.error("[keplr-cosmos] getPublicKey failed with error:", error); throw error; } } //# sourceMappingURL=get_public_key.js.map