feat(antd-csharp): gRPC WalletService parity with REST - #162
Closed
Nic-dorman wants to merge 2 commits into
Closed
Conversation
Adds WalletService over gRPC mirroring the existing REST surface 1:1: * GetAddress(GetWalletAddressRequest) → GetWalletAddressResponse * GetBalance(GetWalletBalanceRequest) → GetWalletBalanceResponse * Approve(WalletApproveRequest) → WalletApproveResponse Pure-gRPC consumers (e.g. Indelible's wallet-less external-signer flow that still wants /diagnostics + balance) no longer need to keep a REST client alongside just for wallet ops, and the dual-transport SDKs can stop returning UnsupportedOperationException on their *GrpcClient. Implementation notes: * New proto/antd/v1/wallet.proto added to build.rs's compile list and the grpc/mod.rs serve registration. * WalletServiceImpl in grpc/service.rs reuses antd/src/rest/wallet.rs's handler bodies — Client::wallet() access is transport-agnostic; the approve path spawns a tokio task to match REST. * Missing wallet returns Status::failed_precondition (the gRPC analog of REST's 503 service-unavailable for this case) with the same "wallet not configured — set AUTONOMI_WALLET_KEY" message. Out of scope: * SDK fan-out — covered in 11 follow-up PRs (rust/go/py/java/kotlin/ csharp/ruby/dart/swift/cpp/elixir). * Wallet configuration over gRPC — V2-335 (post-v1.0). * External-signer prepare/finalize — shipped separately via the UploadService + ChunkService PrepareChunk/FinalizeChunk RPCs from the V2-284 daemon PR. Gates on dev2: * cargo check / clippy -- -D warnings — clean on antd + antd-rust. * cargo test — 37/37 passing. * cargo fmt --check — clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces NotSupportedException raises on AntdGrpcClient.Wallet*Async with
real gRPC calls + in-process mock-stub tests:
* Task<WalletAddress> WalletAddressAsync()
* Task<WalletBalance> WalletBalanceAsync()
* Task<bool> WalletApproveAsync()
Implementation notes:
* New WalletService.WalletServiceClient stub on AntdGrpcClient,
constructed alongside the existing health/data/chunks/files stubs.
* Antd.Sdk.csproj adds wallet.proto to the Protobuf compile list.
* New internal AntdGrpcClient constructor accepting pre-built service
clients so tests can inject MockWalletServiceClient subclasses
(mirrors the V2-284 csharp PR's pattern); guarded by
InternalsVisibleTo("Antd.Sdk.Tests"). Dispose/DisposeAsync now
null-checks _channel to support the constructor-without-channel path.
* A missing daemon wallet emits gRPC FailedPrecondition; the existing
ExceptionMapping.FromGrpcStatus / Wrap surfaces it as
PaymentException (established FailedPrecondition->Payment convention
across all SDKs).
Tests (GrpcWalletTests.cs, new):
* MockWalletServiceClient subclasses the generated stub and overrides
*Async methods to return canned TestCalls.AsyncUnaryCall values.
* TestServiceInvoker is a not-exercised CallInvoker for the four
non-wallet services injected into the test client.
* 4 tests: address, balance, approve, plus the unconfigured-wallet
PaymentException path.
* New Grpc.Core.Testing 2.46.6 PackageReference for the TestCalls
helper.
Gates on dev2:
* dotnet build Antd.Sdk/ — clean.
* dotnet test Antd.Sdk.Tests/ --filter 'FullyQualifiedName~GrpcWalletTests'
— 4/4 passing.
Depends on the antd-side daemon PR landing first.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nic-dorman
force-pushed
the
nic/v2-286-antd-grpc-walletservice
branch
from
May 28, 2026 15:51
b02ff94 to
1cfddfb
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
NotSupportedExceptionraises onAntdGrpcClient.Wallet*Asyncwith real gRPC calls + in-process mock-stub tests:Task<WalletAddress> WalletAddressAsync()Task<WalletBalance> WalletBalanceAsync()Task<bool> WalletApproveAsync()Depends on #154.
Implementation notes
WalletService.WalletServiceClientstub onAntdGrpcClient, constructed alongside the existing health/data/chunks/files stubs.Antd.Sdk.csprojaddswallet.prototo theProtobufcompile list.internal AntdGrpcClientconstructor accepting pre-built service clients so tests can injectMockWalletServiceClientsubclasses (mirrors the V2-284 csharp PR's pattern); guarded byInternalsVisibleTo("Antd.Sdk.Tests").Dispose/DisposeAsyncnow null-check_channelto support the constructor-without-channel path.FailedPrecondition; the existingExceptionMapping.FromGrpcStatus/Wrapsurfaces it asPaymentException.Tests
GrpcWalletTests.cs(new):MockWalletServiceClientsubclasses the generated stub and overrides*Asyncmethods to return cannedTestCalls.AsyncUnaryCallvalues.TestServiceInvokeris a not-exercisedCallInvokerfor the four non-wallet services injected into the test client.PaymentExceptionpath.Grpc.Core.Testing2.46.6PackageReference.Gates passed on dev2
dotnet build Antd.Sdk/— cleandotnet test Antd.Sdk.Tests/— 4/4 GrpcWalletTests passing