Categorygithub.com/blndgs/model
modulepackage
0.52.0
Repository: https://github.com/blndgs/model.git
Documentation: pkg.go.dev

# README

Model

codecov NPM Version Go Release

Reusing data types, domain model or Shared Kernel in DDD parlance. This uses Protobuf definitions and holds the equivalent code for both Golang and Typescript that can be used in userland code.

Protobuf

If you don’t have buf installed, follow the installation guide from buf.build.

Generating models

buf generate

Updating the model

All models are currently defined in the asset.proto file. It is a relatively small model.

If adding lots of models, might make sense to split into a new file.

The below steps are needed to successfully update and distribute the models:

  • Add model changes to .proto file.
  • Verify there are no errors by linting. Use buf lint
  • Also format the proto files using buf format -w.
  • Generate the code definition of your model. Use buf generate
  • If adding support for a new language, please update buf.gen.yaml to include the task.
  • Commit the generated code.
  • Bump up the version number in package.json

Reproducible models

On every PR and Push, Github actions runs multiple tasks, one of which runs buf generate on the CI runner and checks if there is a diff between the generated code you are submitting and what it generates. If there is a diff, the CI run fails.

This ensures bad code isn't mistakenly committed and we can safely distribute the changes to everyone

Test

For the test run the following command:

go test ./...

# Packages

No description provided by the author

# Functions

BuildCrossChainData constructs the cross-chain data payload used in cross-chain UserOperations.
BuildSortedHashList constructs a sorted hash list for cross-chain operations.
ExtractDestinationChainID retrieves the chain ID from the 'to' field of the intent.
ExtractJSONFromField tries to unmarshal the provided field data into an Intent struct.
ExtractSourceChainID retrieves the chain ID from the 'from' field of the intent.
FromBigInt converts a *big.Int to a protobuf BigInt message.
IsCrossChainData checks if the provided data represents cross-chain data.
IsCrossChainIntent checks if the given Intent represents a cross-chain intent.
ParseCrossChainData parses the cross-chain data into a structured format.
ToBigInt converts a protobuf BigInt message to a *big.Int.

# Constants

ConventionalUserOp indicates that the UserOperation does not contain Intent JSON and must have a valid EVM calldata value.
No description provided by the author
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
Define error constants.
No description provided by the author
No description provided by the author
Placeholder for the userOp hash that will be computed during validation.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Intent Json values must be present.
UnknownUserOp indicates that the UserOperation's state is unknown or ambiguous.
UnSignedUserOp indicates that the UserOperation does not contain a signature value.
Unsolved Cross-chain userOp that contains 1 or more cross-chain unsolved userOps.
No description provided by the author

# Variables

No description provided by the author
Error definitions.
Error definitions.
Error definitions.
Error definitions.
Error definitions.
Error definitions.
Error definitions.
No description provided by the author
UserOpArr is the ABI type for an array of UserOperations.
UserOpPrimitives is the primitive ABI types for each UserOperation field.
UserOpType is the ABI type of a UserOperation.

# Structs

BodyOfUserOps represents the request body for HTTP requests sent to the Solver.
CrossChainData represents the parsed components of cross-chain data.
CrossChainHashListEntry represents an entry in the cross-chain hash list.
UserOperation represents an EIP-4337 style transaction for a smart contract account.
UserOperationExt extends the UserOperation with additional information necessary for processing by the Solver.This includes the original hash value of the UserOperation and its processing status.The sequence of UserOperationExt instances must correspond to the sequence in the UserOps slice.

# Type aliases

No description provided by the author
UserOpSolvedStatus is an enum type that defines the possible states of a UserOperation's resolution.It indicates whether an operation is unsolved, solved, conventional, or in an unknown state.