@wallet01/cosmos
Advanced tools
Comparing version 0.5.4 to 0.5.5
# @wallet01/cosmos | ||
## 0.5.5 | ||
### Patch Changes | ||
- bundle packages using tsup | ||
- Updated dependencies | ||
- @wallet01/core@0.5.5 | ||
## 0.5.4 | ||
@@ -4,0 +12,0 @@ |
@@ -1,90 +0,7 @@ | ||
import { BaseConnector, setLastUsedConnector } from "@wallet01/core"; | ||
import emitter from "../utils/emiter"; | ||
export class KeplrConnector extends BaseConnector { | ||
provider; | ||
constructor(chain = "secret-4") { | ||
super(chain, "keplr"); | ||
} | ||
async getProvider() { | ||
if (typeof window !== "undefined" && window.keplr) { | ||
this.provider = window.keplr; | ||
return this.provider; | ||
} | ||
else { | ||
throw new Error("Wallet Not Installed!"); | ||
} | ||
} | ||
async getAccount() { | ||
if (!this.provider) | ||
throw new Error("Provider undefined"); | ||
try { | ||
await this.provider.enable(this.chain); | ||
const { bech32Address } = await this.provider.getKey(this.chain); | ||
return [bech32Address]; | ||
} | ||
catch (error) { | ||
console.error(error); | ||
throw new Error("Error in getting accounts"); | ||
} | ||
} | ||
async getChainId() { | ||
return this.chain; | ||
} | ||
async switchChain(chainId) { | ||
if (!this.provider) | ||
throw new Error("Provider undefined"); | ||
try { | ||
await this.provider.enable(chainId); | ||
this.chain = chainId; | ||
} | ||
catch (err) { | ||
console.error(err); | ||
throw err; | ||
} | ||
} | ||
async connect({ chainId = "secret-4" }) { | ||
try { | ||
const provider = await this.getProvider(); | ||
if (!provider) | ||
throw new Error("Keplr not installed"); | ||
await this.provider.enable(chainId); | ||
setLastUsedConnector(this.name); | ||
} | ||
catch (error) { | ||
console.error(error); | ||
throw error; | ||
} | ||
} | ||
async disconnect() { | ||
this.chain = ""; | ||
emitter.emit("disconnected"); | ||
} | ||
async resolveDid(_address) { | ||
console.error("Cosmos Ecosystem doesn't support DIDs as of now"); | ||
return null; | ||
} | ||
async signMessage(message) { | ||
if (!this.provider) | ||
throw new Error("Provider Undefined"); | ||
try { | ||
const address = (await this.getAccount())[0]; | ||
if (!address) | ||
throw new Error("No address found"); | ||
const { signature } = await this.provider.signArbitrary(this.chain, address, message); | ||
return signature; | ||
} | ||
catch (error) { | ||
console.warn(error); | ||
throw error; | ||
} | ||
} | ||
onAccountsChanged() { | ||
console.log("Account Changed"); | ||
} | ||
onChainChanged(_chain) { | ||
console.log("Chain Changed"); | ||
} | ||
onDisconnect() { | ||
console.log("Wallet disconnected"); | ||
} | ||
} | ||
import { | ||
KeplrConnector | ||
} from "../chunk-6U2GXV7V.js"; | ||
import "../chunk-3TMGHRIN.js"; | ||
export { | ||
KeplrConnector | ||
}; |
@@ -1,2 +0,7 @@ | ||
import { KeplrConnector } from "./connectors/keplr"; | ||
export { KeplrConnector }; | ||
import { | ||
KeplrConnector | ||
} from "./chunk-6U2GXV7V.js"; | ||
import "./chunk-3TMGHRIN.js"; | ||
export { | ||
KeplrConnector | ||
}; |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
// src/providers/keplrProvider.ts | ||
import {} from "@keplr-wallet/types"; |
@@ -1,10 +0,6 @@ | ||
import EventEmitter from 'eventemitter3'; | ||
const eventEmitter = new EventEmitter(); | ||
const emitter = { | ||
on: (event, fn) => eventEmitter.on(event, fn), | ||
once: (event, fn) => eventEmitter.once(event, fn), | ||
off: (event, fn) => eventEmitter.off(event, fn), | ||
emit: (event, payload) => eventEmitter.emit(event, payload), | ||
import { | ||
emiter_default | ||
} from "../chunk-3TMGHRIN.js"; | ||
export { | ||
emiter_default as default | ||
}; | ||
Object.freeze(emitter); | ||
export default emitter; |
{ | ||
"name": "@wallet01/cosmos", | ||
"version": "0.5.4", | ||
"main": "dist/index.js", | ||
"version": "0.5.5", | ||
"main": "dist/index.cjs", | ||
"types": "dist/index.d.ts", | ||
@@ -12,6 +12,7 @@ "import": "dist/index.js", | ||
"eventemitter3": "^4.0.7", | ||
"@wallet01/core": "0.5.4" | ||
"@wallet01/core": "0.5.5" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^3.0.2", | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.4", | ||
@@ -25,5 +26,5 @@ "tsconfig": "0.0.0" | ||
"clean": "rimraf dist/", | ||
"build": "pnpm clean && tsc", | ||
"build": "tsup && tsc --emitDeclarationOnly --declaration", | ||
"dev": "pnpm build --watch" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
21280
40
457
4
1
+ Added@wallet01/core@0.5.5(transitive)
- Removed@wallet01/core@0.5.4(transitive)
Updated@wallet01/core@0.5.5