diff --git a/packages/agent_dart_base/lib/agent/actor.dart b/packages/agent_dart_base/lib/agent/actor.dart index 0e60e37b..38c3f774 100644 --- a/packages/agent_dart_base/lib/agent/actor.dart +++ b/packages/agent_dart_base/lib/agent/actor.dart @@ -411,8 +411,9 @@ ActorMethod _createActorMethod(Actor actor, String methodName, Func func) { final ecid = effectiveCanisterId != null ? Principal.from(effectiveCanisterId) : cid; - // final { requestId, response } = - final result = await agent!.call( + final callSync = actor.metadata.config?.callSync ?? newOptions.callSync; + + final result = await agent!.callRequest( cid, CallOptions( methodName: methodName, diff --git a/packages/agent_dart_base/lib/agent/agent/api.dart b/packages/agent_dart_base/lib/agent/agent/api.dart index 439502db..06609a5b 100644 --- a/packages/agent_dart_base/lib/agent/agent/api.dart +++ b/packages/agent_dart_base/lib/agent/agent/api.dart @@ -157,7 +157,7 @@ abstract class Agent { Identity? identity, ); - Future call( + Future callRequest( Principal canisterId, CallOptions fields, Identity? identity, diff --git a/packages/agent_dart_base/lib/agent/agent/http/index.dart b/packages/agent_dart_base/lib/agent/agent/http/index.dart index 9fb0661e..c9f4e83f 100644 --- a/packages/agent_dart_base/lib/agent/agent/http/index.dart +++ b/packages/agent_dart_base/lib/agent/agent/http/index.dart @@ -210,7 +210,7 @@ class HttpAgent implements Agent { } @override - Future call( + Future callRequest( Principal canisterId, CallOptions fields, Identity? identity, diff --git a/packages/agent_dart_base/lib/agent/agent/proxy.dart b/packages/agent_dart_base/lib/agent/agent/proxy.dart index d81bd361..8a82a3a0 100644 --- a/packages/agent_dart_base/lib/agent/agent/proxy.dart +++ b/packages/agent_dart_base/lib/agent/agent/proxy.dart @@ -280,7 +280,7 @@ class ProxyStubAgent { final void Function(ProxyMessage msg) _frontend; final Agent _agent; - void onmessage(ProxyMessage msg) { + void onMessage(ProxyMessage msg) { switch (msg.type) { case ProxyMessageKind.getPrincipal: _agent.getPrincipal().then((response) { @@ -305,7 +305,7 @@ class ProxyStubAgent { }); break; case ProxyMessageKind.call: - _agent.call(msg.args?[0], msg.args?[1], msg.args?[2]).then((response) { + _agent.callRequest(msg.args?[0], msg.args?[1], msg.args?[2]).then((response) { _frontend( ProxyMessageCallResponse.fromJson({ 'id': msg.id, @@ -356,7 +356,7 @@ class ProxyAgent implements Agent { @override BinaryBlob? rootKey; - void onmessage(ProxyMessage msg) { + void onMessage(ProxyMessage msg) { final id = msg.id; final maybePromise = _pendingCalls[id]; @@ -417,7 +417,7 @@ class ProxyAgent implements Agent { } @override - Future call( + Future callRequest( Principal canisterId, CallOptions fields, Identity? identity, diff --git a/packages/agent_dart_base/test/agent/http/http.dart b/packages/agent_dart_base/test/agent/http/http.dart index 3bdc2b38..d392a58f 100644 --- a/packages/agent_dart_base/test/agent/http/http.dart +++ b/packages/agent_dart_base/test/agent/http/http.dart @@ -42,14 +42,12 @@ void httpTest() { }); }); - // ignore: unused_local_variable - final res = await agent.call( + final res = await agent.callRequest( canisterId, CallOptions(arg: arg, methodName: methodName), null, ); - - // print((res as CallResponseBody).toJson()); + print(res.toJson()); final mockPartialRequest = { 'request_type': SubmitRequestType.call, @@ -64,16 +62,15 @@ void httpTest() { }; final mockPartialsRequestId = requestIdOf(mockPartialRequest); - final expectedRequest = { 'content': mockPartialRequest, }; - - final expectedRequestId = - requestIdOf(expectedRequest['content'] as Map); - + final expectedRequestId = requestIdOf( + expectedRequest['content'] as Map, + ); expect(expectedRequestId, mockPartialsRequestId); }); }); + group('description 2 ', () {}); }