Page: Reference.TYPE_TRANSACTIONAL
v.0 by Stepan
2018-05-08 09:05
2018-05-08 09:05
References section specification.
Reference allows link from contract and ask to be exist another contract, identifying be several ways: approved contracts by hashId, contracts from transaction pack - by transactional_id.
Reference set
some_section:
references:
- name: contract_wide_unique_name
type: transactional_or_existing
transactional_id: trid
origin: origin_id
contract_id: existing_approved_contract_id
required: true
fields:
- name: field_name
value: expected value
Reference check
Fields description: fields is required unless otherwise indicated:
field | value |
---|---|
name | Some name |
type | transactional |
transactional_id | Referenced contract is looking inside transaction (newItems), with matching transactoinal.id, requires type == transactional |
contract_id | Referenced contract is looking inside ledger by id, should have status approved, not locked. It not required, but it can be in the referencedItems |
required | true if referenced contract must exist. While check, if refererenced contract was not found, error is adding. |
fields | Optional, for type == transactional is looking for contract with fields matching with values and formats of specifeid fields |
origin | Optional. Looking for contratc with matching origin. Contract shoul be included to the transaction as exists, so it copy exist in the transaction pack as references (type == existing) the check it status in the ledger (should be APPROVED), or if type == transactional then should be included to transaction pack as new. |
signed_by | Optional, array of roles, that should match with signs in the found contracts |
References with required = true is checking for exist according with table. If any of references is missing error is adding.
Important! While transaction pack loading, existing items (referencedItems) includes as binary, and it hashId calculates by fact state. Father checking for that contract not need: if by calculated hashId has approve from ledger, we no need to check sign in it.