diff --git a/images/hasura/hasura-data/metadata/databases/default/tables/public_input.yaml b/images/hasura/hasura-data/metadata/databases/default/tables/public_input.yaml index afa0264..8bb6c9d 100644 --- a/images/hasura/hasura-data/metadata/databases/default/tables/public_input.yaml +++ b/images/hasura/hasura-data/metadata/databases/default/tables/public_input.yaml @@ -35,6 +35,11 @@ computed_fields: function: name: input_unlocking_bytecode_pattern schema: public + - name: unlocking_bytecode_hex + definition: + function: + name: input_unlocking_bytecode_hex + schema: public - name: value_satoshis definition: function: @@ -53,6 +58,7 @@ select_permissions: computed_fields: - redeem_bytecode_pattern - unlocking_bytecode_pattern + - unlocking_bytecode_hex - value_satoshis filter: {} limit: 1000 diff --git a/images/hasura/hasura-data/metadata/databases/default/tables/public_output.yaml b/images/hasura/hasura-data/metadata/databases/default/tables/public_output.yaml index be40ea2..327e34e 100644 --- a/images/hasura/hasura-data/metadata/databases/default/tables/public_output.yaml +++ b/images/hasura/hasura-data/metadata/databases/default/tables/public_output.yaml @@ -22,6 +22,11 @@ computed_fields: function: name: output_locking_bytecode_pattern schema: public + - name: locking_bytecode_hex + definition: + function: + name: output_locking_bytecode_hex + schema: public select_permissions: - role: public permission: @@ -36,5 +41,6 @@ select_permissions: - nonfungible_token_commitment computed_fields: - locking_bytecode_pattern + - locking_bytecode_hex filter: {} limit: 5000 diff --git a/images/hasura/hasura-data/migrations/default/1616195337538_init/up.sql b/images/hasura/hasura-data/migrations/default/1616195337538_init/up.sql index b3c9e28..0f14fa0 100644 --- a/images/hasura/hasura-data/migrations/default/1616195337538_init/up.sql +++ b/images/hasura/hasura-data/migrations/default/1616195337538_init/up.sql @@ -525,6 +525,13 @@ AS $$ $$; COMMENT ON FUNCTION output_locking_bytecode_pattern (output) IS 'Extract the first byte of each instruction for the locking bytecode of an output. The resulting pattern excludes the contents of pushed values such that similar bytecode sequences produce the same pattern.'; +CREATE FUNCTION output_locking_bytecode_hex(output_row output) RETURNS text + LANGUAGE sql IMMUTABLE +AS $$ + SELECT encode($1.locking_bytecode, 'hex'); +$$; +COMMENT ON FUNCTION output_locking_bytecode_hex (output) IS 'Transform output locking bytecode to hex string.'; + CREATE FUNCTION input_unlocking_bytecode_pattern(input_row input) RETURNS text LANGUAGE sql IMMUTABLE AS $$ @@ -532,6 +539,13 @@ AS $$ $$; COMMENT ON FUNCTION input_unlocking_bytecode_pattern (input) IS 'Extract the first byte of each instruction for the unlocking bytecode of an input. The resulting pattern excludes the contents of pushed values such that similar bytecode sequences produce the same pattern.'; +CREATE FUNCTION input_unlocking_bytecode_hex(input_row input) RETURNS text + LANGUAGE sql IMMUTABLE +AS $$ + SELECT encode($1.unlocking_bytecode, 'hex'); +$$; +COMMENT ON FUNCTION input_unlocking_bytecode_hex (input) IS 'Transform input unlocking bytecode to hex string.'; + CREATE FUNCTION parse_bytecode_pattern_with_pushdata_lengths(bytecode bytea) RETURNS bytea LANGUAGE plpgsql IMMUTABLE AS $$