From 7125e3a1db4a36e9e5e025f9bb1f8d9465c32797 Mon Sep 17 00:00:00 2001 From: ffranr Date: Tue, 3 Oct 2023 12:50:02 +0100 Subject: [PATCH] rpc: export function unmarshall universe ID --- rpcserver.go | 20 ++++++++++---------- universe_rpc_diff.go | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 37fa80291..93053e4fd 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2530,7 +2530,7 @@ func unmarshalAssetSyncConfig( error) { // Parse the universe ID from the RPC form. - uniID, err := unmarshalUniID(config.Id) + uniID, err := UnmarshalUniID(config.Id) if err != nil { return nil, fmt.Errorf("unable to parse universe id: %w", err) @@ -2550,8 +2550,8 @@ func unmarshalAssetSyncConfig( }, nil } -// unmarshalUniID parses the RPC universe ID into the native counterpart. -func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { +// UnmarshalUniID parses the RPC universe ID into the native counterpart. +func UnmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { switch { case rpcID.GetAssetId() != nil: var assetID asset.ID @@ -2613,7 +2613,7 @@ func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { func (r *rpcServer) QueryAssetRoots(ctx context.Context, req *unirpc.AssetRootQuery) (*unirpc.QueryRootResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -2640,7 +2640,7 @@ func (r *rpcServer) QueryAssetRoots(ctx context.Context, func (r *rpcServer) DeleteAssetRoot(ctx context.Context, req *unirpc.DeleteRootQuery) (*unirpc.DeleteRootResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -2676,7 +2676,7 @@ func marshalLeafKey(leafKey universe.LeafKey) *unirpc.AssetKey { func (r *rpcServer) AssetLeafKeys(ctx context.Context, req *unirpc.ID) (*unirpc.AssetLeafKeyResponse, error) { - universeID, err := unmarshalUniID(req) + universeID, err := UnmarshalUniID(req) if err != nil { return nil, err } @@ -2738,7 +2738,7 @@ func (r *rpcServer) marshalAssetLeaf(ctx context.Context, func (r *rpcServer) AssetLeaves(ctx context.Context, req *unirpc.ID) (*unirpc.AssetLeafResponse, error) { - universeID, err := unmarshalUniID(req) + universeID, err := UnmarshalUniID(req) if err != nil { return nil, err } @@ -2927,7 +2927,7 @@ func (r *rpcServer) marshalIssuanceProof(ctx context.Context, func (r *rpcServer) QueryProof(ctx context.Context, req *unirpc.UniverseKey) (*unirpc.AssetProofResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -2996,7 +2996,7 @@ func (r *rpcServer) InsertProof(ctx context.Context, return nil, fmt.Errorf("key cannot be nil") } - universeID, err := unmarshalUniID(req.Key.Id) + universeID, err := UnmarshalUniID(req.Key.Id) if err != nil { return nil, err } @@ -3064,7 +3064,7 @@ func unmarshalUniverseSyncType(req unirpc.UniverseSyncMode) ( func unmarshalSyncTargets(targets []*unirpc.SyncTarget) ([]universe.Identifier, error) { uniIDs := make([]universe.Identifier, 0, len(targets)) for _, target := range targets { - uniID, err := unmarshalUniID(target.Id) + uniID, err := UnmarshalUniID(target.Id) if err != nil { return nil, err } diff --git a/universe_rpc_diff.go b/universe_rpc_diff.go index 6df361233..da13e7dd4 100644 --- a/universe_rpc_diff.go +++ b/universe_rpc_diff.go @@ -44,7 +44,7 @@ func unmarshalMerkleSumNode(root *unirpc.MerkleSumNode) mssmt.Node { func unmarshalUniverseRoot( root *unirpc.UniverseRoot) (universe.BaseRoot, error) { - id, err := unmarshalUniID(root.Id) + id, err := UnmarshalUniID(root.Id) if err != nil { return universe.BaseRoot{}, err } @@ -60,7 +60,7 @@ func unmarshalUniverseRoots( baseRoots := make([]universe.BaseRoot, 0, len(roots)) for _, root := range roots { - id, err := unmarshalUniID(root.Id) + id, err := UnmarshalUniID(root.Id) if err != nil { return nil, err }