Skip to content
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

Add access to approve session properties #271

Merged
Merged
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
1 change: 1 addition & 0 deletions lib/apis/sign_api/i_sign_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ abstract class ISignClient {
Future<ApproveResponse> approve({
required int id,
required Map<String, Namespace> namespaces,
Map<String, String>? sessionProperties,
String? relayProtocol,
});
Future<void> reject({
Expand Down
1 change: 1 addition & 0 deletions lib/apis/sign_api/i_sign_engine_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ abstract class ISignEngineWallet extends ISignEngineCommon {
Future<ApproveResponse> approveSession({
required int id,
required Map<String, Namespace> namespaces,
Map<String, String>? sessionProperties,
String? relayProtocol,
});
Future<void> rejectSession({
Expand Down
18 changes: 10 additions & 8 deletions lib/apis/sign_api/sign_client.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import 'package:event/event.dart';
import 'package:walletconnect_flutter_v2/apis/core/core.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/core/i_core.dart';
import 'package:walletconnect_flutter_v2/apis/core/pairing/i_pairing_store.dart';
import 'package:walletconnect_flutter_v2/apis/core/pairing/utils/pairing_models.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart';
import 'package:walletconnect_flutter_v2/apis/models/json_rpc_response.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/sign_engine.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sign_engine.dart';
import 'package:walletconnect_flutter_v2/apis/core/pairing/utils/pairing_models.dart';
import 'package:walletconnect_flutter_v2/apis/core/i_core.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sessions.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sign_client.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sign_engine.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/json_rpc_models.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/proposal_models.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/sign_client_models.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/sign_client_events.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/session_models.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/sign_client_events.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/models/sign_client_models.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/sessions.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/sign_engine.dart';
import 'package:walletconnect_flutter_v2/apis/utils/constants.dart';
import 'package:walletconnect_flutter_v2/apis/utils/log_level.dart';
import 'package:web3dart/web3dart.dart';
Expand Down Expand Up @@ -174,12 +174,14 @@ class SignClient implements ISignClient {
Future<ApproveResponse> approve({
required int id,
required Map<String, Namespace> namespaces,
Map<String, String>? sessionProperties,
String? relayProtocol,
}) async {
try {
return await engine.approveSession(
id: id,
namespaces: namespaces,
sessionProperties: sessionProperties,
relayProtocol: relayProtocol,
);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion lib/apis/sign_api/sign_engine.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;

import 'package:http/http.dart' as http;
import 'package:walletconnect_flutter_v2/apis/core/pairing/utils/json_rpc_utils.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/core/verify/models/verify_context.dart';
Expand Down Expand Up @@ -309,6 +309,7 @@ class SignEngine implements ISignEngine {
metadata: metadata,
),
peer: proposal.proposer,
sessionProperties: proposal.sessionProperties,
);

// print('session connect');
Expand Down
2 changes: 2 additions & 0 deletions lib/apis/web3wallet/web3wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ class Web3Wallet implements IWeb3Wallet {
Future<ApproveResponse> approveSession({
required int id,
required Map<String, Namespace> namespaces,
Map<String, String>? sessionProperties,
String? relayProtocol,
}) async {
try {
return await signEngine.approveSession(
id: id,
namespaces: namespaces,
sessionProperties: sessionProperties,
relayProtocol: relayProtocol,
);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion test/sign_api/utils/sign_client_test_wrapper.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/i_http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/sign_engine.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sessions.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/sign_engine.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';

class SignClientTestWrapper implements ISignEngine {
Expand Down Expand Up @@ -128,6 +128,7 @@ class SignClientTestWrapper implements ISignEngine {
Future<ApproveResponse> approveSession({
required int id,
required Map<String, Namespace> namespaces,
Map<String, String>? sessionProperties,
String? relayProtocol,
}) async {
try {
Expand Down
Loading