@dynamic-labs/utils
Advanced tools
Comparing version 4.0.0-alpha.38 to 4.0.0-alpha.39
'use client' | ||
var version = "4.0.0-alpha.38"; | ||
var version = "4.0.0-alpha.39"; | ||
export { version }; |
{ | ||
"name": "@dynamic-labs/utils", | ||
"version": "4.0.0-alpha.38", | ||
"version": "4.0.0-alpha.39", | ||
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.", | ||
@@ -23,5 +23,5 @@ "author": "Dynamic Labs, Inc.", | ||
"tldts": "6.0.16", | ||
"@dynamic-labs/assert-package-version": "4.0.0-alpha.38", | ||
"@dynamic-labs/logger": "4.0.0-alpha.38", | ||
"@dynamic-labs/types": "4.0.0-alpha.38", | ||
"@dynamic-labs/assert-package-version": "4.0.0-alpha.39", | ||
"@dynamic-labs/logger": "4.0.0-alpha.39", | ||
"@dynamic-labs/types": "4.0.0-alpha.39", | ||
"buffer": "6.0.3", | ||
@@ -28,0 +28,0 @@ "eventemitter3": "5.0.1" |
@@ -12,3 +12,3 @@ import { type EventEmitter } from 'eventemitter3'; | ||
*/ | ||
type Eip6963ProviderInfo = { | ||
export type Eip6963ProviderInfo = { | ||
uuid: string; | ||
@@ -19,6 +19,12 @@ name: string; | ||
}; | ||
type Eip6963ProviderDetail = { | ||
export type Eip6963ProviderDetail = { | ||
info: Eip6963ProviderInfo; | ||
provider: IEthereum; | ||
}; | ||
export type Eip6963AnnounceProviderEvent = CustomEvent & { | ||
type: 'eip6963:announceProvider'; | ||
detail: Eip6963ProviderDetail; | ||
}; | ||
export declare const isEip9693Event: (event: unknown) => event is Eip6963AnnounceProviderEvent; | ||
export declare const listenToEip6963Events: (handler: (event: Eip6963AnnounceProviderEvent) => void) => () => void; | ||
export declare class Eip6963Provider { | ||
@@ -34,2 +40,1 @@ providers: Eip6963ProviderDetail[]; | ||
} | ||
export {}; |
'use client' | ||
const isEip9693Event = (event) => event.type === 'eip6963:announceProvider' && | ||
event.detail !== undefined; | ||
const listenToEip6963Events = (handler) => { | ||
const eventHandler = (event) => { | ||
if (!isEip9693Event(event)) { | ||
return; | ||
} | ||
handler(event); | ||
}; | ||
window.addEventListener('eip6963:announceProvider', eventHandler); | ||
return () => { | ||
window.removeEventListener('eip6963:announceProvider', eventHandler); | ||
}; | ||
}; | ||
class Eip6963Provider { | ||
@@ -12,6 +24,3 @@ constructor() { | ||
} | ||
window.addEventListener('eip6963:announceProvider', (event) => { | ||
if (!isEip9693Event(event)) { | ||
return; | ||
} | ||
listenToEip6963Events((event) => { | ||
this.providers.push(event.detail); | ||
@@ -36,2 +45,2 @@ }); | ||
export { Eip6963Provider, Eip6963ProviderSingleton }; | ||
export { Eip6963Provider, Eip6963ProviderSingleton, isEip9693Event, listenToEip6963Events }; |
@@ -62,3 +62,3 @@ 'use client' | ||
export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js'; | ||
export { Eip6963Provider, Eip6963ProviderSingleton } from './eip6963/eip6963Provider.js'; | ||
export { Eip6963Provider, Eip6963ProviderSingleton, isEip9693Event, listenToEip6963Events } from './eip6963/eip6963Provider.js'; | ||
export { createEventTimeline } from './eventTimeline/eventTimeline.js'; | ||
@@ -65,0 +65,0 @@ export { runSafe } from './runSafe/runSafe.js'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
578071
4796
+ Added@dynamic-labs/assert-package-version@4.0.0-alpha.39(transitive)
+ Added@dynamic-labs/logger@4.0.0-alpha.39(transitive)
+ Added@dynamic-labs/types@4.0.0-alpha.39(transitive)
- Removed@dynamic-labs/assert-package-version@4.0.0-alpha.38(transitive)
- Removed@dynamic-labs/logger@4.0.0-alpha.38(transitive)
- Removed@dynamic-labs/types@4.0.0-alpha.38(transitive)