-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extend pasing logic with addressable entity #10
Conversation
parser.go
Outdated
return nil, err | ||
log.Println("Error pn fetching schemas bytes from addressable entity: ", err) | ||
|
||
schemasURefValue, err = p.casperClient.QueryGlobalStateByStateHash(context.Background(), nil, fmt.Sprintf("hash-%s", contractHash.ToHex()), []string{eventSchemaNamedKey}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZhmakAS, it probably would make more sense to provide the possibility to specify the version and use the dedicated approach for 1.5.x and 2.0.0. With fallbacks, we won't be able to use the parser efficiently in 1.5.x
Fixed after review
Added versioned fallback to FetchContractSchemasBytes method
parser.go
Outdated
|
||
const ( | ||
NetworkVersionV1 NetworkVersion = iota | ||
NetworkVersionV2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call the versions:
Casper1x
Casper2x
README.md
Outdated
There is only one interface change: | ||
|
||
- `func LoadContractMetadataWithoutSchema` accept list of `NamedKeys` and ContractPackageHash instead of `casper.Contract` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it more user-oriented.
Migration to Casper 2.0.0 (Condor)
Casper 2.0.0 introduces changes in the API that aren't backward compatible with Casper 1.x. To use CES Go Parser with Casper 2.0.0 you need to the the version v2
of the parser:
"github.com/make-software/ces-go-parser/v2"
If you want to use the same version of the parser for both Casper 1.x and Casper 2.x, you'll need to use the soft-migration constructor that requires you to specify the network version you are currently running on:
parser, err := ces.NewParserWithVersion(rpcClient, []casper.Hash{contractHash}, ces.CasperVersion1x)
if err != nil {
panic(err)
}
Breaking changes
In CES Go Parser 2.0.0, the LoadContractMetadataWithoutSchema
function accepts a list of NamedKeys
and ContractPackageHash instead of casper.Contract
it accepted previously:
// @todo Example here
Fixed after review
Summary
TODO
Checklist