Skip to content

feat(EWM-514, EWM-513): add [email protected] support #884

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 2 commits into
base: dev
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
58 changes: 50 additions & 8 deletions lib/feature/browser_v2/inpage_provider/inpage_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,15 @@ class InpageProvider extends ProviderApi {
throw s.ApprovalsHandleException(LocaleKeys.accountNotDeployed.tr());
}

final signatureId = await _computeSignatureId(input.withSignatureId);

final executionOutput = await nr.runLocal(
accountStuffBoc: contractState.boc,
contractAbi: input.functionCall.abi,
methodId: input.functionCall.method,
input: input.functionCall.params,
responsible: input.responsible ?? false,
signatureId: signatureId,
);

return RunLocalOutput(executionOutput.output, executionOutput.code);
Expand Down Expand Up @@ -1381,7 +1384,6 @@ class InpageProvider extends ProviderApi {
@override
Future<SignDataOutput> signData(SignDataInput input) async {
final publicKey = nr.PublicKey(publicKey: input.publicKey);
final withSignatureId = input.withSignatureId;
final accountInteraction = _checkAccountInteractionPermission(
publicKey: publicKey,
);
Expand All @@ -1392,13 +1394,7 @@ class InpageProvider extends ProviderApi {
publicKey: publicKey,
data: input.data,
);
final signatureId = withSignatureId == true
? await nekotonRepository.currentTransport.transport.getSignatureId()
: withSignatureId == false
? null
: withSignatureId != null && withSignatureId is num
? withSignatureId.toInt()
: null;
final signatureId = await _computeSignatureId(input.withSignatureId);

final signedData = await nekotonRepository.seedList.signData(
data: input.data,
Expand Down Expand Up @@ -1661,6 +1657,41 @@ class InpageProvider extends ProviderApi {
return ChangeNetworkOutput(await transport?.toNetwork());
}

@override
Future<RunGetterOutput> runGetter(RunGetterInput input) async {
_checkBasicPermission();

final address = nr.Address(address: input.address);
final cachedState = input.cachedState == null
? null
: nr.FullContractState.fromJson(input.cachedState!.toJson());
final contractState = cachedState ??
await nekotonRepository.currentTransport.transport
.getFullContractState(address);

if (contractState == null) {
throw Exception(
LocaleKeys.accountNotFound.tr(args: [address.address]),
);
}

if (!contractState.isDeployed || contractState.lastTransactionId == null) {
throw s.ApprovalsHandleException(LocaleKeys.accountNotDeployed.tr());
}

final signatureId = await _computeSignatureId(input.withSignatureId);

final executionOutput = await nr.runGetter(
accountStuffBoc: contractState.boc,
contractAbi: input.getterCall.abi,
methodId: input.getterCall.getter,
input: input.getterCall.params,
signatureId: signatureId,
);

return RunGetterOutput(executionOutput.output, executionOutput.code);
}

Future<List<ConnectionData>> _getConnections(int networkId) async {
final connections = connectionsStorageService.connections;
final networksIds = connectionsStorageService.networksIds;
Expand Down Expand Up @@ -1700,4 +1731,15 @@ class InpageProvider extends ProviderApi {

return list;
}

Future<int?> _computeSignatureId(Object? withSignatureId) async {
final signatureId = withSignatureId == true
? await nekotonRepository.currentTransport.transport.getSignatureId()
: withSignatureId == false
? null
: withSignatureId != null && withSignatureId is num
? withSignatureId.toInt()
: null;
return signatureId;
}
}
2 changes: 0 additions & 2 deletions module-info.java

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies:
money2_fixer: 3.0.0
native_dio_adapter: ^1.4.0
nekoton_repository: 0.68.0
nekoton_webview: 0.1.9
nekoton_webview: 0.1.11
ntp: 2.0.0
open_settings_plus: 0.4.0
package_info_plus: 8.3.0
Expand Down