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

Enhance Plutus Encoder Functionality and Tx Building Capability #15

Closed
wants to merge 0 commits into from

Conversation

MIxAxIM
Copy link
Contributor

@MIxAxIM MIxAxIM commented Jan 24, 2024

PlutusType: "Ignore"

By adding plutusType:"Ignore" in front of a value or struct, the Plutus encoder will skip that for serialization. This allows the inclusion of standard structs, variables, or any type within the datum or redeemer struct. Consequently, one struct can be used as both datum or redeemer and in other parts of the codebase as well.

PlutusType: "omitempty"

By adding plutusType:"omitempty" in front of a value, as illustrated in the following Golang example:

type Datum struct {
	_             struct{}        `plutusType:"DefList" plutusConstr:"1"`
	TokenName     string          `plutusType:"StringBytes, omitempty"`
	TokenPolicyId string          `plutusType:"HexString, omitempty"`
	Amount        int64           `plutusType:"Int"`
	Address       Address.Address `plutusType:"Address"`
	Deadline      int64           `plutusType:"Int"`
}

The Plutus encoder will ignore variables with no values, functioning similarly to JSON's "omitempty".

PlutusType: "Int"

The Plutus encoder now accepts all kinds of integers.

SetWallet for Tx building

With this new addition, we can now use the set wallet with an address type as well.

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.

1 participant