@fabianbormann/cardano-peer-connect
Advanced tools
Comparing version 1.2.5 to 1.2.6
# Changelog | ||
## [1.2.6](https://github.com/fabianbormann/cardano-peer-connect/compare/v1.2.5...v1.2.6) (2023-03-28) | ||
### Features | ||
* Allow to set discovery seed ([963c771](https://github.com/fabianbormann/cardano-peer-connect/commit/963c771394f35ef61923a43f237aa6b2762c4265)) | ||
### Bug Fixes | ||
* Add defaul trackers and remove hardcoded trackers for discovery ([b1f54de](https://github.com/fabianbormann/cardano-peer-connect/commit/b1f54de894201a142ffda2c6e776346a6b89585a)) | ||
* add wallet information for autoconnect ([1315193](https://github.com/fabianbormann/cardano-peer-connect/commit/1315193fbd8c24db2d72f1d442db19cef2b9d59f)) | ||
* Set correct parameter in verifyConnection ([aff0fc6](https://github.com/fabianbormann/cardano-peer-connect/commit/aff0fc6e8c970068a8d9960c5f72580d55c5eaaf)) | ||
## [1.2.5](https://github.com/fabianbormann/cardano-peer-connect/compare/v1.2.4...v1.2.5) (2023-03-24) | ||
@@ -4,0 +18,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type { DAppPeerConnectParameters, IDAppInfos } from './types'; | ||
import type { DAppPeerConnectParameters, IDAppInfos, IWalletInfo } from './types'; | ||
import { Logger, LogLevel } from './lib/Logger'; | ||
@@ -12,9 +12,9 @@ export default class DAppPeerConnect { | ||
protected identicon: string | null; | ||
protected onConnect?: (address: string) => void; | ||
protected onConnect?: (address: string, walletInfo?: IWalletInfo) => void; | ||
protected onDisconnect?: (address: string) => void; | ||
protected onApiEject?: (name: string, address: string) => void; | ||
protected onApiInject?: (name: string, address: string) => void; | ||
protected setUpDiscoveryMeerkcat: (address?: string) => void; | ||
protected setUpDiscoveryMeerkcat: (announce: Array<string>, address?: string) => void; | ||
setLogLevel: (level: LogLevel, meerkat?: boolean) => void; | ||
constructor({ dAppInfo, seed, announce, loggingEnabled, verifyConnection, onConnect, onDisconnect, onApiEject, onApiInject, useWalletDiscovery, }: DAppPeerConnectParameters); | ||
constructor({ dAppInfo, seed, discoverySeed, announce, loggingEnabled, verifyConnection, onConnect, onDisconnect, onApiEject, onApiInject, useWalletDiscovery, }: DAppPeerConnectParameters); | ||
private leftServer; | ||
@@ -21,0 +21,0 @@ shutdownServer: () => void; |
@@ -58,6 +58,7 @@ import { Value } from './lib/ExperimentalContainer'; | ||
seed?: string; | ||
discoverySeed?: string; | ||
announce?: Array<string>; | ||
loggingEnabled?: boolean; | ||
verifyConnection?: (walletInfo: IWalletInfo, callback: (granted: boolean, allowAutoConnect: boolean) => void) => void; | ||
onConnect?: (address: string) => void; | ||
verifyConnection?: (walletInfo: IWalletInfo, callback: (granted: boolean, allowAutoConnect: boolean, walletInfo?: IWalletInfo) => void) => void; | ||
onConnect?: (address: string, walletInfo?: IWalletInfo) => void; | ||
onDisconnect?: (address: string) => void; | ||
@@ -64,0 +65,0 @@ onApiEject?: (name: string, address: string) => void; |
{ | ||
"name": "@fabianbormann/cardano-peer-connect", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "This library aims to provide an abstract class to simplify to wallet implementation for CIP-????", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# Cardano Peer Connect | ||
<p align="left"> | ||
<img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/fabianbormann/cardano-peer-connect/test.yml?label=Tests&style=for-the-badge" /> | ||
<img alt="Release" src="https://img.shields.io/github/actions/workflow/status/fabianbormann/cardano-peer-connect/release.yml?label=Release&style=for-the-badge" /> | ||
@@ -6,0 +6,0 @@ <a href="https://conventionalcommits.org"><img alt="conventionalcommits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&style=for-the-badge" /></a> |
@@ -100,5 +100,3 @@ import Meerkat from '@fabianbormann/meerkat'; | ||
seed: | ||
this.discoverySeed ?? | ||
AutoConnectHelper.getWalletAutoDiscoverySeed() ?? | ||
undefined, | ||
this.discoverySeed ? this.discoverySeed : undefined, | ||
loggingEnabled: true, | ||
@@ -105,0 +103,0 @@ }).setMaxListeners(20); |
@@ -30,3 +30,3 @@ import Meerkat from '@fabianbormann/meerkat'; | ||
protected onConnect?: (address: string) => void; | ||
protected onConnect?: (address: string, walletInfo?: IWalletInfo) => void; | ||
protected onDisconnect?: (address: string) => void; | ||
@@ -36,3 +36,3 @@ protected onApiEject?: (name: string, address: string) => void; | ||
protected setUpDiscoveryMeerkcat = (address?: string) => { | ||
protected setUpDiscoveryMeerkcat = (announce: Array<string>, address?: string) => { | ||
if (address || AutoConnectHelper.getWalletDiscoveryAddress()) { | ||
@@ -50,8 +50,3 @@ this.meerkat.logger.debug( | ||
seed: AutoConnectHelper.getWalletAutoDiscoverySeed() ?? undefined, | ||
announce: [ | ||
'https://pro.passwordchaos.gimbalabs.io', | ||
'wss://tracker.files.fm:7073/announce', | ||
'wss://tracker.btorrent.xyz', | ||
'wss://tracker.openwebtorrent.com:443/announce', | ||
], | ||
announce: announce, | ||
loggingEnabled: this.enableLogging, | ||
@@ -119,2 +114,3 @@ identifier: address ?? AutoConnectHelper.getWalletDiscoveryAddress()!, | ||
seed, | ||
discoverySeed, | ||
announce, | ||
@@ -135,2 +131,11 @@ loggingEnabled, | ||
if(!announce) { | ||
announce = [ | ||
'https://pro.passwordchaos.gimbalabs.io', | ||
'wss://tracker.files.fm:7073/announce', | ||
'wss://tracker.btorrent.xyz', | ||
'wss://tracker.openwebtorrent.com:443/announce', | ||
] | ||
} | ||
this.meerkat = new Meerkat({ | ||
@@ -152,3 +157,3 @@ seed: seed || localStorage.getItem('meerkat-dapp-seed') || undefined, | ||
//initialize discovery meerkat 1 second later | ||
this.setUpDiscoveryMeerkcat(); | ||
this.setUpDiscoveryMeerkcat(announce!, discoverySeed); | ||
}, 1000); | ||
@@ -208,3 +213,4 @@ } | ||
granted: boolean, | ||
allowAutoConnect: boolean = false | ||
allowAutoConnect: boolean = false, | ||
connectedWalletInfo?: IWalletInfo | ||
) => { | ||
@@ -232,3 +238,3 @@ if (walletInfo.requestAutoconnect && granted && allowAutoConnect) { | ||
if (this.onConnect) { | ||
this.onConnect(address); | ||
this.onConnect(address, connectedWalletInfo); | ||
} | ||
@@ -251,9 +257,6 @@ } else { | ||
if (AutoConnectHelper.isAutoConnectId(address)) { | ||
connectWallet(true); | ||
connectWallet(true, true, walletInfo); | ||
} else { | ||
verifyConnection( | ||
{ | ||
...walletInfo, | ||
address: address, | ||
}, | ||
walletInfo, | ||
connectWallet | ||
@@ -459,2 +462,8 @@ ); | ||
callback({ | ||
dApp: this.dAppInfo, | ||
connected: true, | ||
error: false | ||
}); | ||
if (onApiInject) { | ||
@@ -461,0 +470,0 @@ onApiInject(args.api.name, address); |
@@ -83,2 +83,3 @@ import { Value } from './lib/ExperimentalContainer'; | ||
seed?: string; | ||
discoverySeed?: string; | ||
announce?: Array<string>; | ||
@@ -88,5 +89,5 @@ loggingEnabled?: boolean; | ||
walletInfo: IWalletInfo, | ||
callback: (granted: boolean, allowAutoConnect: boolean) => void | ||
callback: (granted: boolean, allowAutoConnect: boolean, walletInfo?: IWalletInfo) => void | ||
) => void; | ||
onConnect?: (address: string) => void; | ||
onConnect?: (address: string, walletInfo?: IWalletInfo) => void; | ||
onDisconnect?: (address: string) => void; | ||
@@ -93,0 +94,0 @@ onApiEject?: (name: string, address: string) => void; |
Sorry, the diff of this file is too big to display
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
4615938
9665