@wallet01/cosmos
Advanced tools
Comparing version 0.4.3 to 0.5.0
# @wallet01/cosmos | ||
## 0.5.0 | ||
### Minor Changes | ||
- change bundling from tsup to tsc | ||
### Patch Changes | ||
- Updated dependencies | ||
- @wallet01/core@0.5.0 | ||
## 0.4.3 | ||
@@ -4,0 +15,0 @@ |
@@ -1,25 +0,4 @@ | ||
import { Keplr } from '@keplr-wallet/types'; | ||
export { Keplr as KeplrProvider } from '@keplr-wallet/types'; | ||
import { BaseConnector } from '@wallet01/core'; | ||
declare class KeplrConnector extends BaseConnector<Keplr> { | ||
provider: Keplr; | ||
chain: string; | ||
name: string; | ||
constructor(chain?: string); | ||
getProvider(): Promise<Keplr>; | ||
getAccount(): Promise<string[]>; | ||
getChainId(): Promise<string>; | ||
switchChain(chainId: string): Promise<void>; | ||
connect({ chainId }: { | ||
chainId?: string | undefined; | ||
}): Promise<void>; | ||
disconnect(): Promise<void>; | ||
resolveDid(_address: string): Promise<string | null>; | ||
signMessage(message: string): Promise<string>; | ||
protected onAccountsChanged(): void; | ||
protected onChainChanged(_chain: string | number): void; | ||
protected onDisconnect(): void; | ||
} | ||
export { KeplrConnector }; | ||
import { KeplrConnector } from "./connectors/keplr"; | ||
import { KeplrProvider } from "./providers/keplrProvider"; | ||
export { KeplrConnector, type KeplrProvider }; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@wallet01/cosmos", | ||
"version": "0.4.3", | ||
"main": "dist/index.mjs", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"version": "0.5.0", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@keplr-wallet/types": "^0.11.13", | ||
"eventemitter3": "^4.0.7", | ||
"@keplr-wallet/types": "^0.11.13", | ||
"@wallet01/core": "0.4.2" | ||
"@wallet01/core": "0.5.0" | ||
}, | ||
@@ -16,2 +15,3 @@ "devDependencies": { | ||
"tsup": "^6.3.0", | ||
"typescript": "^4.9.4", | ||
"tsconfig": "0.0.0" | ||
@@ -24,4 +24,5 @@ }, | ||
"clean": "rimraf dist/", | ||
"build": "pnpm clean && tsup" | ||
"build": "pnpm clean && tsc", | ||
"dev": "pnpm build --watch" | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import { Window as KeplrWindow } from '@keplr-wallet/types'; | ||
import { KeplrProvider } from '../providers/keplrProvider'; | ||
import { BaseConnector, setLastUsedConnector } from '@wallet01/core'; | ||
import emitter from '../utils/emiter'; | ||
import { Window as KeplrWindow } from "@keplr-wallet/types"; | ||
import { KeplrProvider } from "../providers/keplrProvider"; | ||
import { BaseConnector, setLastUsedConnector } from "@wallet01/core"; | ||
import emitter from "../utils/emiter"; | ||
@@ -10,17 +10,13 @@ declare const window: KeplrWindow; | ||
provider!: KeplrProvider; | ||
chain: string; | ||
name: string; | ||
constructor(chain: string = 'secret-4') { | ||
super(chain); | ||
this.chain = chain; | ||
this.name = 'Keplr'; | ||
constructor(chain: string = "secret-4") { | ||
super(chain, "keplr"); | ||
} | ||
async getProvider(): Promise<KeplrProvider> { | ||
if (typeof window !== 'undefined' && window.keplr) { | ||
if (typeof window !== "undefined" && window.keplr) { | ||
this.provider = window.keplr; | ||
return this.provider; | ||
} else { | ||
throw new Error('Wallet Not Installed!'); | ||
throw new Error("Wallet Not Installed!"); | ||
} | ||
@@ -30,3 +26,3 @@ } | ||
async getAccount(): Promise<string[]> { | ||
if (!this.provider) throw new Error('Provider undefined'); | ||
if (!this.provider) throw new Error("Provider undefined"); | ||
try { | ||
@@ -38,3 +34,3 @@ await this.provider.enable(this.chain); | ||
console.error(error); | ||
throw new Error('Error in getting accounts'); | ||
throw new Error("Error in getting accounts"); | ||
} | ||
@@ -48,3 +44,3 @@ } | ||
async switchChain(chainId: string): Promise<void> { | ||
if (!this.provider) throw new Error('Provider undefined'); | ||
if (!this.provider) throw new Error("Provider undefined"); | ||
try { | ||
@@ -59,6 +55,6 @@ await this.provider.enable(chainId); | ||
async connect({ chainId = 'secret-4' }): Promise<void> { | ||
async connect({ chainId = "secret-4" }): Promise<void> { | ||
try { | ||
const provider = await this.getProvider(); | ||
if (!provider) throw new Error('Keplr not installed'); | ||
if (!provider) throw new Error("Keplr not installed"); | ||
@@ -74,4 +70,4 @@ await this.provider.enable(chainId); | ||
async disconnect(): Promise<void> { | ||
this.chain = ''; | ||
emitter.emit('disconnected'); | ||
this.chain = ""; | ||
emitter.emit("disconnected"); | ||
} | ||
@@ -85,9 +81,11 @@ | ||
async signMessage(message: string): Promise<string> { | ||
if (!this.provider) throw new Error('Provider Undefined'); | ||
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, | ||
( | ||
await this.getAccount() | ||
)[0], | ||
address, | ||
message | ||
@@ -103,12 +101,12 @@ ); | ||
protected onAccountsChanged(): void { | ||
console.log('Account Changed'); | ||
console.log("Account Changed"); | ||
} | ||
protected onChainChanged(_chain: string | number): void { | ||
console.log('Chain Changed'); | ||
console.log("Chain Changed"); | ||
} | ||
protected onDisconnect(): void { | ||
console.log('Wallet disconnected'); | ||
console.log("Wallet disconnected"); | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import { KeplrConnector } from './connectors/keplr'; | ||
import { KeplrProvider } from './providers/keplrProvider'; | ||
import { KeplrConnector } from "./connectors/keplr"; | ||
import { KeplrProvider } from "./providers/keplrProvider"; | ||
export { KeplrConnector, KeplrProvider }; | ||
export { KeplrConnector, type KeplrProvider }; |
{ | ||
"extends": "tsconfig/base.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["./src/**/*.ts"] | ||
"include": ["src"] | ||
} |
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
14033
29
287
4
1
+ Added@wallet01/core@0.5.0(transitive)
- Removed@wallet01/core@0.4.2(transitive)
Updated@wallet01/core@0.5.0