From 8bcf220c5d0539faf0dda5cd07d110e8b4722c3d Mon Sep 17 00:00:00 2001 From: John Hyde Date: Tue, 9 Sep 2025 17:46:40 -0700 Subject: [PATCH] Fix the client code to match schema again --- client.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/client.go b/client.go index b15559f..9a103d2 100644 --- a/client.go +++ b/client.go @@ -251,7 +251,7 @@ func (c *Client) IsShipActive(ctx context.Context, point uint32) (bool, error) { return false, fmt.Errorf("failed to query ship activity: %w", err) } - return resp.IsActive.Value, nil + return resp.AzimuthIsActive.Value, nil } // GetSponsor retrieves the sponsor of a point @@ -272,7 +272,7 @@ func (c *Client) GetSponsor(ctx context.Context, point uint32) (uint32, error) { } // Parse sponsor point number from BigInt - sponsorPoint, err := resp.GetSponsor.Value.ToUint32() + sponsorPoint, err := resp.AzimuthGetSponsor.Value.ToUint32() if err != nil { return 0, fmt.Errorf("invalid sponsor point format: %w", err) } @@ -297,7 +297,7 @@ func (c *Client) GetOwner(ctx context.Context, point uint32) (string, error) { return "", fmt.Errorf("failed to query owner: %w", err) } - return resp.GetOwner.Value, nil + return resp.AzimuthGetOwner.Value, nil } // GetPointOwnership retrieves comprehensive ownership information for a point @@ -325,20 +325,20 @@ func (c *Client) GetPointOwnership(ctx context.Context, point uint32) (*PointOwn // Query for sponsor point number sponsorPoint := uint32(0) - if hasSponsorResp.HasSponsor.Value { + if hasSponsorResp.AzimuthHasSponsor.Value { sponsorResp, err := GetSponsor(ctx, c.gqlClient, pointBigInt, "latest", c.contractAddress) if err != nil { return nil, fmt.Errorf("failed to query sponsor: %w", err) } - if parsed, err := sponsorResp.GetSponsor.Value.ToUint32(); err == nil { + if parsed, err := sponsorResp.AzimuthGetSponsor.Value.ToUint32(); err == nil { sponsorPoint = parsed } } return &PointOwnership{ - Owner: ownerResp.GetOwner.Value, - IsActive: activeResp.IsActive.Value, - HasSponsor: hasSponsorResp.HasSponsor.Value, + Owner: ownerResp.AzimuthGetOwner.Value, + IsActive: activeResp.AzimuthIsActive.Value, + HasSponsor: hasSponsorResp.AzimuthHasSponsor.Value, Sponsor: sponsorPoint, }, nil } @@ -361,14 +361,14 @@ func (c *Client) getShipKeys(ctx context.Context, point uint32) (*ShipKeys, erro } // Check if keys exist for this point - if resp.GetKeys.Value.Value1 == "" { + if resp.AzimuthGetKeys.Value.Value1 == "" { return nil, fmt.Errorf("no keys found for point %d", point) } keys := &ShipKeys{} // Parse encryption key (32 bytes hex, remove 0x prefix if present) - encKeyHex := resp.GetKeys.Value.Value0 + encKeyHex := resp.AzimuthGetKeys.Value.Value0 if len(encKeyHex) > 2 && encKeyHex[:2] == "0x" { encKeyHex = encKeyHex[2:] } @@ -382,7 +382,7 @@ func (c *Client) getShipKeys(ctx context.Context, point uint32) (*ShipKeys, erro } // Parse authentication key (32 bytes hex, remove 0x prefix if present) - authKeyHex := resp.GetKeys.Value.Value1 + authKeyHex := resp.AzimuthGetKeys.Value.Value1 if len(authKeyHex) > 2 && authKeyHex[:2] == "0x" { authKeyHex = authKeyHex[2:] } @@ -397,14 +397,14 @@ func (c *Client) getShipKeys(ctx context.Context, point uint32) (*ShipKeys, erro keys.AuthenticationKey = reverseBytes(authKey) // Parse crypto suite version - suite, err := resp.GetKeys.Value.Value2.ToUint32() + suite, err := resp.AzimuthGetKeys.Value.Value2.ToUint32() if err != nil { return nil, fmt.Errorf("failed to parse crypto suite version: %w", err) } keys.CryptoSuiteVersion = uint64(suite) // Parse key revision number - revision, err := resp.GetKeys.Value.Value3.ToUint32() + revision, err := resp.AzimuthGetKeys.Value.Value3.ToUint32() if err != nil { return nil, fmt.Errorf("failed to parse key revision: %w", err) } @@ -421,7 +421,7 @@ func (c *Client) getLatestBlockHash(ctx context.Context) (string, error) { return "", fmt.Errorf("failed to query sync status: %w", err) } - return resp.GetSyncStatus.LatestProcessedBlockHash, nil + return resp.AzimuthGetSyncStatus.LatestProcessedBlockHash, nil } // ValidateStarSponsorship validates that a star is sponsored by the expected galaxy