Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add transaction types to enum #2091

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yaboiishere
Copy link
Contributor

resolves: #2082

@yaboiishere yaboiishere self-assigned this Feb 7, 2025
@@ -21,7 +21,7 @@ schemas:
source_tx_hash:
$ref: '#/components/schemas/TransactionHash'
source_tx_type:
type: string
$ref: '#/components/schemas/TransactionType'
Copy link
Member

@davidyuk davidyuk Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose doing it more accurately by specifying only possible values. For example, a contract can't be created by a spend transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. I'll look into it

@@ -141,3 +141,33 @@ components:
required:
- next
- prev
TransactionType:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use something like $ref: '#/components/schemas/Tx/allOf/0/properties/type' instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for something like that. I'll use it

@@ -180,8 +180,7 @@ schemas:
items:
$ref: '#/components/schemas/Signature'
tx:
type: object
# TODO: define properties
$ref: '#/components/schemas/Tx'
Copy link
Member

@davidyuk davidyuk Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, it can be only name claim, contract call, contract deploy (?)
Doing as you propose, TypeScript will ask the developer to go over every transaction type (not necessary).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So make it like the TransactionType should be and add only the possible ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define source_tx_type as an enum instead of a string
2 participants