From 2e6768a85e6f461c7732d67c1327e5e8049c6928 Mon Sep 17 00:00:00 2001 From: Siggi Date: Mon, 28 Mar 2022 22:47:32 +0200 Subject: [PATCH] Fixed graphql return types when updating metadata --- transports/graphql.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/transports/graphql.go b/transports/graphql.go index b07d7a2..2395ab2 100644 --- a/transports/graphql.go +++ b/transports/graphql.go @@ -35,6 +35,11 @@ type XPubData struct { XPub *bux.Xpub `json:"xpub"` } +// XPubMetadataData is the xpub data for the metadata mutation +type XPubMetadataData struct { + XPub *bux.Xpub `json:"xpub_metadata"` +} + // AccessKeyData is the access key data type AccessKeyData struct { AccessKey *bux.AccessKey `json:"access_key"` @@ -50,6 +55,11 @@ type DestinationData struct { Destination *bux.Destination `json:"destination"` } +// DestinationMetadataData is the destination data for the metadata mutation +type DestinationMetadataData struct { + Destination *bux.Destination `json:"destination_metadata"` +} + // DestinationsData is a slice of destination data type DestinationsData struct { Destinations []*bux.Destination `json:"destinations"` @@ -65,6 +75,11 @@ type TransactionData struct { Transaction *bux.Transaction `json:"transaction"` } +// TransactionMetadataData is a transaction for the metadata mutation +type TransactionMetadataData struct { + Transaction *bux.Transaction `json:"transaction_metadata"` +} + // TransactionsData is a slice of transactions type TransactionsData struct { Transactions []*bux.Transaction `json:"transactions"` @@ -205,7 +220,7 @@ func (g *TransportGraphQL) UpdateXPubMetadata(ctx context.Context, metadata *bux FieldMetadata: processMetadata(metadata), } - var respData XPubData + var respData XPubMetadataData if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil { return nil, err } @@ -458,7 +473,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByID(ctx context.Context, id FieldMetadata: processMetadata(metadata), } - var respData DestinationData + var respData DestinationMetadataData if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil { return nil, err } @@ -493,7 +508,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByAddress(ctx context.Contex FieldMetadata: processMetadata(metadata), } - var respData DestinationData + var respData DestinationMetadataData if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil { return nil, err } @@ -528,7 +543,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByLockingScript(ctx context. FieldMetadata: processMetadata(metadata), } - var respData DestinationData + var respData DestinationMetadataData if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil { return nil, err } @@ -835,7 +850,7 @@ func (g *TransportGraphQL) UpdateTransactionMetadata(ctx context.Context, txID s FieldMetadata: processMetadata(metadata), } - var respData TransactionData + var respData TransactionMetadataData if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil { return nil, err }