Skip to content

Extend instance init to allow core and chain abstraction params for b… #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions packages/reown_appkit/lib/base/appkit_base_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,11 @@ class ReownAppKit implements IReownAppKit {
return client;
}

///---------- GENERIC ----------///

@override
final String protocol = 'wc';

@override
final int version = 2;

@override
final IReownCore core;

@override
final PairingMetadata metadata;

///
ReownAppKit({
required this.core,
required this.metadata,
static ReownSign createReOwnSignInstance({
required IReownCore core,
required PairingMetadata metadata,
}) {
reOwnSign = ReownSign(
return ReownSign(
core: core,
metadata: metadata,
proposals: GenericStore(
Expand Down Expand Up @@ -116,6 +101,29 @@ class ReownAppKit implements IReownAppKit {
);
}

///---------- GENERIC ----------///

@override
final String protocol = 'wc';

@override
final int version = 2;

@override
final IReownCore core;

@override
final PairingMetadata metadata;

///
ReownAppKit(
{required this.core,
required this.metadata,
ReownSign? overrideReOwnSign}) {
reOwnSign = overrideReOwnSign ??
createReOwnSignInstance(core: core, metadata: metadata);
}

@override
Future<void> init() async {
if (_initialized) {
Expand Down
54 changes: 35 additions & 19 deletions packages/reown_walletkit/lib/walletkit_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,11 @@ class ReownWalletKit with WidgetsBindingObserver implements IReownWalletKit {
return walletKit;
}

///---------- GENERIC ----------///

@override
final String protocol = 'wc';

@override
final int version = 2;

@override
final IReownCore core;

@override
final PairingMetadata metadata;

ReownWalletKit({
required this.core,
required this.metadata,
static ReownSign createReOwnSignInstance({
required IReownCore core,
required PairingMetadata metadata,
}) {
reOwnSign = ReownSign(
return ReownSign(
core: core,
metadata: metadata,
proposals: GenericStore(
Expand Down Expand Up @@ -107,8 +93,13 @@ class ReownWalletKit with WidgetsBindingObserver implements IReownWalletKit {
},
),
);
}

chainAbstraction = ChainAbstraction(
static ChainAbstraction createChainAbstraction({
required IReownCore core,
required PairingMetadata metadata,
}) {
return ChainAbstraction(
core: core,
pulseMetadata: PulseMetadataCompat(
url: metadata.url,
Expand All @@ -118,6 +109,31 @@ class ReownWalletKit with WidgetsBindingObserver implements IReownWalletKit {
);
}

///---------- GENERIC ----------///

@override
final String protocol = 'wc';

@override
final int version = 2;

@override
final IReownCore core;

@override
final PairingMetadata metadata;

ReownWalletKit(
{required this.core,
required this.metadata,
ReownSign? overrideReOwnSign,
ChainAbstraction? overrideChainAbstraction}) {
reOwnSign = overrideReOwnSign ??
createReOwnSignInstance(core: core, metadata: metadata);
chainAbstraction = overrideChainAbstraction ??
createChainAbstraction(core: core, metadata: metadata);
}

@override
Future<void> init() async {
if (_initialized) {
Expand Down