@@ -2350,7 +2350,9 @@ func (r *rpcServer) SubscribeReceiveAssetEventNtfns(
23502350 // RPC event type and sent over the stream.
23512351 case event := <- eventSubscriber .NewItemCreated .ChanOut ():
23522352
2353- rpcEvent , err := marshallReceiveAssetEvent (event )
2353+ rpcEvent , err := marshallReceiveAssetEvent (
2354+ event , r .cfg .TapAddrBook ,
2355+ )
23542356 if err != nil {
23552357 return fmt .Errorf ("failed to marshall " +
23562358 "asset receive event into RPC event: " +
@@ -2385,8 +2387,8 @@ func (r *rpcServer) SubscribeReceiveAssetEventNtfns(
23852387}
23862388
23872389// marshallReceiveAssetEvent maps an asset receive event to its RPC counterpart.
2388- func marshallReceiveAssetEvent (
2389- eventInterface fn. Event ) (* taprpc.ReceiveAssetEvent , error ) {
2390+ func marshallReceiveAssetEvent (eventInterface fn. Event ,
2391+ db address. Storage ) (* taprpc.ReceiveAssetEvent , error ) {
23902392
23912393 switch event := eventInterface .(type ) {
23922394 case * proof.BackoffWaitEvent :
@@ -2413,6 +2415,23 @@ func marshallReceiveAssetEvent(
24132415 Event : & eventRpc ,
24142416 }, nil
24152417
2418+ case * tapgarden.AssetReceiveCompleteEvent :
2419+ rpcAddr , err := marshalAddr (& event .Address , db )
2420+ if err != nil {
2421+ return nil , fmt .Errorf ("error marshaling addr: %w" , err )
2422+ }
2423+
2424+ eventRpc := taprpc.ReceiveAssetEvent_AssetReceiveCompleteEvent {
2425+ AssetReceiveCompleteEvent : & taprpc.AssetReceiveCompleteEvent {
2426+ Timestamp : event .Timestamp ().UnixMicro (),
2427+ Address : rpcAddr ,
2428+ Outpoint : event .OutPoint .String (),
2429+ },
2430+ }
2431+ return & taprpc.ReceiveAssetEvent {
2432+ Event : & eventRpc ,
2433+ }, nil
2434+
24162435 default :
24172436 return nil , fmt .Errorf ("unknown event type: %T" , eventInterface )
24182437 }
0 commit comments