Script tag schema (#245)

* updated tx schema for v2 and v3, some errors remaining

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* linted transaction spec v2, wip script tag

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed state error on script tag

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed transaction schema script error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2022-08-25 14:58:42 +02:00 committed by GitHub
parent a9abc4114a
commit e41ce5df76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 180 additions and 76 deletions

View File

@ -9,18 +9,18 @@ type: object
additionalProperties: false additionalProperties: false
title: Transaction Schema title: Transaction Schema
required: required:
- id - id
- inputs - inputs
- outputs - outputs
- operation - operation
- metadata - metadata
- asset - asset
- version - version
properties: properties:
id: id:
anyOf: anyOf:
- "$ref": "#/definitions/sha3_hexdigest" - "$ref": "#/definitions/sha3_hexdigest"
- type: 'null' - type: 'null'
operation: operation:
"$ref": "#/definitions/operation" "$ref": "#/definitions/operation"
asset: asset:
@ -39,6 +39,8 @@ properties:
version: version:
type: string type: string
pattern: "^2\\.0$" pattern: "^2\\.0$"
script:
"$ref": "#/definitions/script"
definitions: definitions:
offset: offset:
type: integer type: integer
@ -48,10 +50,10 @@ definitions:
type: string type: string
public_keys: public_keys:
anyOf: anyOf:
- type: array - type: array
items: items:
"$ref": "#/definitions/base58" "$ref": "#/definitions/base58"
- type: 'null' - type: 'null'
sha3_hexdigest: sha3_hexdigest:
pattern: "[0-9a-f]{64}" pattern: "[0-9a-f]{64}"
type: string type: string
@ -61,11 +63,11 @@ definitions:
operation: operation:
type: string type: string
enum: enum:
- CREATE - CREATE
- TRANSFER - TRANSFER
- VALIDATOR_ELECTION - VALIDATOR_ELECTION
- CHAIN_MIGRATION_ELECTION - CHAIN_MIGRATION_ELECTION
- VOTE - VOTE
asset: asset:
type: object type: object
additionalProperties: false additionalProperties: false
@ -74,16 +76,16 @@ definitions:
"$ref": "#/definitions/sha3_hexdigest" "$ref": "#/definitions/sha3_hexdigest"
data: data:
anyOf: anyOf:
- type: object - type: object
additionalProperties: true additionalProperties: true
- type: 'null' - type: 'null'
output: output:
type: object type: object
additionalProperties: false additionalProperties: false
required: required:
- amount - amount
- condition - condition
- public_keys - public_keys
properties: properties:
amount: amount:
type: string type: string
@ -92,8 +94,8 @@ definitions:
type: object type: object
additionalProperties: false additionalProperties: false
required: required:
- details - details
- uri - uri
properties: properties:
details: details:
"$ref": "#/definitions/condition_details" "$ref": "#/definitions/condition_details"
@ -108,63 +110,113 @@ definitions:
type: "object" type: "object"
additionalProperties: false additionalProperties: false
required: required:
- owners_before - owners_before
- fulfillment - fulfillment
properties: properties:
owners_before: owners_before:
"$ref": "#/definitions/public_keys" "$ref": "#/definitions/public_keys"
fulfillment: fulfillment:
anyOf: anyOf:
- type: string - type: string
pattern: "^[a-zA-Z0-9_-]*$" pattern: "^[a-zA-Z0-9_-]*$"
- "$ref": "#/definitions/condition_details" - "$ref": "#/definitions/condition_details"
fulfills: fulfills:
anyOf: anyOf:
- type: 'object' - type: 'object'
additionalProperties: false additionalProperties: false
required: required:
- output_index - output_index
- transaction_id - transaction_id
properties: properties:
output_index: output_index:
"$ref": "#/definitions/offset" "$ref": "#/definitions/offset"
transaction_id: transaction_id:
"$ref": "#/definitions/sha3_hexdigest" "$ref": "#/definitions/sha3_hexdigest"
- type: 'null' - type: 'null'
metadata: metadata:
anyOf: anyOf:
- type: object - type: object
additionalProperties: true additionalProperties: true
minProperties: 1 minProperties: 1
- type: 'null' - type: 'null'
condition_details: condition_details:
anyOf: anyOf:
- type: object - type: object
additionalProperties: false additionalProperties: false
required: required:
- type - type
- public_key - public_key
properties: properties:
type: type:
type: string type: string
pattern: "^(ed25519|zenroom)-sha-256$" pattern: "^(ed25519|zenroom)-sha-256$"
public_key: public_key:
"$ref": "#/definitions/base58" "$ref": "#/definitions/base58"
- type: object - type: object
additionalProperties: false additionalProperties: false
required: required:
- type - type
- threshold - threshold
- subconditions - subconditions
properties: properties:
type: type:
type: "string" type: "string"
pattern: "^threshold-sha-256$" pattern: "^threshold-sha-256$"
threshold: threshold:
type: integer type: integer
minimum: 1 minimum: 1
maximum: 100 maximum: 100
subconditions: subconditions:
type: array type: array
items: items:
"$ref": "#/definitions/condition_details" "$ref": "#/definitions/condition_details"
script:
type: object
additionalProperties: false
required:
- code
- state
- input
- output
properties:
code:
anyOf:
- type: object
additionalProperties: false
required:
- type
- raw
- parameters
properties:
type:
type: string
enum:
- zenroom
raw:
type: string
parameters:
type: array
items:
type: object
- type: object
additionalProperties: false
required:
- transaction_id
properties:
transaction_id:
"$ref": "#/definitions/sha3_hexdigest"
state:
anyOf:
- type: object
"$ref": "#/definitions/sha3_hexdigest"
input:
type: object
output:
type: object
policies:
type: object
properties:
raw:
type: object
txids:
type: object

View File

@ -40,7 +40,9 @@ properties:
"$ref": "#/definitions/metadata" "$ref": "#/definitions/metadata"
version: version:
type: string type: string
pattern: "^2\\.0$" pattern: "^3\\.0$"
script:
"$ref": "#/definitions/script"
definitions: definitions:
offset: offset:
type: integer type: integer
@ -172,3 +174,53 @@ definitions:
type: array type: array
items: items:
"$ref": "#/definitions/condition_details" "$ref": "#/definitions/condition_details"
script:
type: object
additionalProperties: false
required:
- code
- state
- input
- output
properties:
code:
anyOf:
- type: object
additionalProperties: false
required:
- type
- raw
- parameters
properties:
type:
type: string
enum:
- zenroom
raw:
type: string
parameters:
type: array
items:
type: object
- type: object
additionalProperties: false
required:
- transaction_id
properties:
transaction_id:
"$ref": "#/definitions/sha3_hexdigest"
state:
anyOf:
- type: object
"$ref": "#/definitions/sha3_hexdigest"
input:
type: object
output:
type: object
policies:
type: object
properties:
raw:
type: object
txids:
type: object