-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accurately allocate hashes to 28 byte type
BREAKING CHANGE: - Hash32HexString -> Hash32Hex - Hash32HexString_comparison_exp -> Hash32Hex_comparison_exp - SlotLeader.hash, StakePool.hash, StakePoolOwner.hash are now Hash28Hex type
- Loading branch information
Showing
10 changed files
with
67 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
2 changes: 1 addition & 1 deletion
2
packages/api-cardano-db-hasura/src/example_queries/blocks/blocksByHashes.graphql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
query blocksByHashes( | ||
$hashes: [Hash32HexString]! | ||
$hashes: [Hash32Hex]! | ||
) { | ||
blocks ( | ||
where: { | ||
|
2 changes: 1 addition & 1 deletion
2
...cardano-db-hasura/src/example_queries/transactions/aggregateDataWithinTransaction.graphql
This file contains 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
2 changes: 1 addition & 1 deletion
2
...db-hasura/src/example_queries/transactions/filteredAggregateDataWithinTransaction.graphql
This file contains 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
2 changes: 1 addition & 1 deletion
2
...cardano-db-hasura/src/example_queries/transactions/transactionsByHashesOrderByFee.graphql
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { GraphQLError, GraphQLScalarType, Kind } from 'graphql' | ||
|
||
export const Hash32Hex = new GraphQLScalarType({ | ||
name: 'Hash32Hex', | ||
description: 'Hex encoded 32 byte, 64 characters', | ||
serialize (value: string) { | ||
return value.substring(2) | ||
}, | ||
parseValue (value: string) { | ||
return validateInput(value) | ||
}, | ||
parseLiteral (ast) { | ||
switch (ast.kind) { | ||
case Kind.STRING : | ||
return validateInput(ast.value) | ||
} | ||
} | ||
}) | ||
|
||
function validateInput (input: string) { | ||
if (input.length !== 64) throw new GraphQLError(`${input} is not a valid 32 byte hash`) | ||
return `\\x${input}` | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './DateTimeUtcToIso' | ||
export * from './Hash32HexString' | ||
export * from './Hash28Hex' | ||
export * from './Hash32Hex' | ||
export * from './Percentage' |