-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [x] Add addresses to asset_summary, closes #263
- [x] Convert block view to rpc and add parent_hash to output - [x] Convert account_list view to rpc and add stake_address_hex, script_hash to output - [x] Convert asset_list view to rpc and add asset_name_ascii to output - [x] Convert asset_token_registry from view to rpc
- Loading branch information
Showing
20 changed files
with
302 additions
and
151 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
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,17 @@ | ||
CREATE OR REPLACE FUNCTION grest.account_list() | ||
RETURNS TABLE ( | ||
stake_address text, | ||
stake_address_hex text, | ||
script_hash text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
sa.view::text, | ||
ENCODE(sa.hash_raw,'hex'), | ||
ENCODE(sa.script_hash,'hex') | ||
FROM stake_address AS sa | ||
ORDER BY sa.id; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.account_list IS 'Get a list of all accounts'; |
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,19 @@ | ||
CREATE OR REPLACE FUNCTION grest.asset_list() | ||
RETURNS TABLE ( | ||
policy_id text, | ||
asset_name text, | ||
asset_name_ascii text, | ||
fingerprint text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
ENCODE(ma.policy, 'hex')::text AS policy_id, | ||
ENCODE(ma.name, 'hex')::text AS asset_name, | ||
ENCODE(ma.name, 'escape')::text as asset_name_ascii, | ||
ma.fingerprint::text | ||
FROM public.multi_asset AS ma | ||
ORDER BY ma.policy, ma.name; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.asset_list IS 'Get a raw listing of all native assets on chain, without any CIP overlays'; |
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,26 @@ | ||
CREATE OR REPLACE FUNCTION grest.asset_token_registry() | ||
RETURNS TABLE ( | ||
policy_id text, | ||
asset_name text, | ||
asset_name_ascii text, | ||
ticker text, | ||
description text, | ||
url text, | ||
decimals integer, | ||
logo text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
asset_policy AS policy_id, | ||
asset_name, | ||
name AS asset_name_ascii, | ||
ticker, | ||
description, | ||
url, | ||
decimals, | ||
logo | ||
FROM grest.asset_registry_cache; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.asset_token_registry IS 'An array of token registry information (registered via github) for each asset'; |
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,45 @@ | ||
CREATE OR REPLACE FUNCTION grest.blocks() | ||
RETURNS TABLE ( | ||
hash text, | ||
epoch_no word31type, | ||
abs_slot word63type, | ||
epoch_slot word31type, | ||
block_height word31type, | ||
block_size word31type, | ||
block_time integer, | ||
tx_count bigint, | ||
vrf_key character varying, | ||
pool character varying, | ||
proto_major word31type, | ||
proto_minor word31type, | ||
op_cert_counter word63type, | ||
parent_hash text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
ENCODE(b.hash::bytea, 'hex') AS hash, | ||
b.epoch_no AS epoch_no, | ||
b.slot_no AS abs_slot, | ||
b.epoch_slot_no AS epoch_slot, | ||
b.block_no AS block_height, | ||
b.size AS block_size, | ||
EXTRACT(EPOCH FROM b.time)::integer AS block_time, | ||
b.tx_count, | ||
b.vrf_key, | ||
ph.view AS pool, | ||
b.proto_major, | ||
b.proto_minor, | ||
b.op_cert_counter, | ||
( | ||
SELECT ENCODE(tb.hash::bytea, 'hex') | ||
FROM block tb | ||
WHERE id = b.previous_id | ||
) AS parent_hash | ||
FROM block AS b | ||
LEFT JOIN slot_leader AS sl ON b.slot_leader_id = sl.id | ||
LEFT JOIN pool_hash AS ph ON sl.pool_hash_id = ph.id | ||
ORDER BY b.id DESC; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.blocks IS 'Get detailed information about all blocks (paginated - latest first)'; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.