Skip to content

Commit

Permalink
feature: Alonzo data mapping
Browse files Browse the repository at this point in the history
Adds collateral, redeemers, and scripts concepts, and extends the protocol params
model.
  • Loading branch information
rhyslbw committed Aug 11, 2021
1 parent ab63d79 commit eff1d9c
Show file tree
Hide file tree
Showing 28 changed files with 1,121 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
- node-ipc:/ipc

cardano-db-sync-extended:
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-alonzo-white-1.4}
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-alonzo-purple-1.0}
command: [
"--config", "/config/cardano-db-sync/config.json",
"--socket-path", "/node-ipc/node.socket",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-cardano-db-hasura/hasura/project/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 2
endpoint: http://localhost:8090
endpoint: http://localhost:8092
metadata_directory: metadata
actions:
kind: synchronous
Expand Down
178 changes: 174 additions & 4 deletions packages/api-cardano-db-hasura/hasura/project/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,52 @@
- tipBlockNo
filter: {}
limit: 1
- table:
schema: public
name: Collateral
configuration:
custom_root_fields:
select_aggregate: collateralInputs_aggregate
select: collateralInputs
custom_column_names: {}
object_relationships:
- name: sourceTransaction
using:
manual_configuration:
remote_table:
schema: public
name: Transaction
column_mapping:
sourceTxHash: hash
- name: transaction
using:
manual_configuration:
remote_table:
schema: public
name: Transaction
column_mapping:
txHash: hash
array_relationships:
- name: tokens
using:
manual_configuration:
remote_table:
schema: public
name: TokenInOutput
column_mapping:
source_tx_out_id: tx_out_id
select_permissions:
- role: cardano-graphql
permission:
columns:
- address
- sourceTxHash
- sourceTxIndex
- txHash
- value
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: Delegation
Expand All @@ -253,6 +299,14 @@
select: delegations
custom_column_names: {}
object_relationships:
- name: redeemer
using:
manual_configuration:
remote_table:
schema: public
name: Redeemer
column_mapping:
redeemerId: id
- name: stakePool
using:
manual_configuration:
Expand Down Expand Up @@ -334,6 +388,36 @@
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: Redeemer
configuration:
custom_root_fields:
select_aggregate: redeemers_aggregate
select: redeemers
custom_column_names: {}
object_relationships:
- name: transaction
using:
manual_configuration:
remote_table:
schema: public
name: Transaction
column_mapping:
txId: id
select_permissions:
- role: cardano-graphql
permission:
columns:
- fee
- index
- purpose
- scriptHash
- unitMem
- unitSteps
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: Reward
Expand Down Expand Up @@ -368,6 +452,33 @@
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: Script
configuration:
custom_root_fields:
select_aggregate: scripts_aggregate
select: scripts
custom_column_names: {}
object_relationships:
- name: transaction
using:
manual_configuration:
remote_table:
schema: public
name: Transaction
column_mapping:
txId: id
select_permissions:
- role: cardano-graphql
permission:
columns:
- hash
- serialisedSize
- type
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: ShelleyEpochProtocolParams
Expand All @@ -376,19 +487,31 @@
permission:
columns:
- a0
- coinsPerUtxoWord
- collateralPercent
- costModels
- decentralisationParam
- eMax
- epoch_no
- extraEntropy
- keyDeposit
- maxBlockBodySize
- maxBlockExMem
- maxBlockExSteps
- maxBlockHeaderSize
- maxCollateralInputs
- maxTxExMem
- maxTxExSteps
- maxTxSize
- maxValSize
- minFeeA
- minFeeB
- minPoolCost
- minUTxOValue
- nOpt
- poolDeposit
- priceMem
- priceStep
- protocolVersion
- rho
- tau
Expand Down Expand Up @@ -424,6 +547,14 @@
select: stakeDeregistrations
custom_column_names: {}
object_relationships:
- name: redeemer
using:
manual_configuration:
remote_table:
schema: public
name: Redeemer
column_mapping:
redeemerId: id
- name: transaction
using:
manual_configuration:
Expand Down Expand Up @@ -727,6 +858,22 @@
name: TransactionOutput
column_mapping:
hash: txHash
- name: redeemers
using:
manual_configuration:
remote_table:
schema: public
name: Redeemer
column_mapping:
id: txId
- name: scripts
using:
manual_configuration:
remote_table:
schema: public
name: Script
column_mapping:
id: txId
- name: withdrawals
using:
manual_configuration:
Expand All @@ -747,15 +894,25 @@
- includedAt
- invalidBefore
- invalidHereafter
- scriptSize
- size
- totalOutput
- validContract
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: TransactionInput
object_relationships:
- name: redeemer
using:
manual_configuration:
remote_table:
schema: public
name: Redeemer
column_mapping:
redeemerId: id
- name: sourceTransaction
using:
manual_configuration:
Expand Down Expand Up @@ -819,9 +976,10 @@
permission:
columns:
- address
- value
- txHash
- addressHasScript
- index
- txHash
- value
filter: {}
limit: 2500
allow_aggregations: true
Expand Down Expand Up @@ -856,9 +1014,10 @@
permission:
columns:
- address
- value
- txHash
- addressHasScript
- index
- txHash
- value
filter: {}
limit: 2500
allow_aggregations: true
Expand All @@ -871,6 +1030,14 @@
select: withdrawals
custom_column_names: {}
object_relationships:
- name: redeemer
using:
manual_configuration:
remote_table:
schema: public
name: Redeemer
column_mapping:
redeemerId: id
- name: transaction
using:
manual_configuration:
Expand All @@ -888,6 +1055,9 @@
filter: {}
limit: 2500
allow_aggregations: true
- table:
schema: public
name: epoch_param
- table:
schema: public
name: pool_relay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ DROP VIEW IF EXISTS
"ActiveStake",
"Block",
"Cardano",
"Collateral",
"Delegation",
"Epoch",
"ShelleyEpochProtocolParams",
"Redeemer",
"Reward",
"Script",
"ShelleyEpochProtocolParams",
"SlotLeader",
"StakeDeregistration",
"StakePool",
Expand Down
Loading

0 comments on commit eff1d9c

Please sign in to comment.