You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It encourages using the types defined outside the package as a name enum of sorts. Those types happen to be named the same, which is lucky given that if the Go types were named according to Go naming conventions they wouldn't match the Rust names encoded in the stellar-xdr Rust crate.
Instead of the approach taken today, this package could provide a list of constants for all the types, and that would provide the same amount of certainty if folks were wanting to avoid having hardcoded strings.
A list of all names from the stellar-xdr crate can be generated using the crate itself, it exports a type TypeVariant which is a list of all the types supported:
Alternatively, use the stellar-xdr CLI. The stellar-xdr CLI is built into the stellar-xdr crate, and has a sub-command that will output a list of all the types.
Install the stellar-xdr CLI that matches the version depended on by the Rust library in this Go package.
Note that the stellar xdr command in the stellar-cli, is just a reexport of the stellar-xdr CLI, they're the same thing. But in this case it is better to use the stellar-xdr CLI directly because it's guaranteed to be available for any version of the stellar-xdr crate.
I think the interface created by
ConvertBytes
andConvertInterface
is a little odd.Use looks like this in the stellar-rpc:
Ref: https://github.com/stellar/stellar-rpc/blob/cd2ef199c70b19a8630a2c3059fd6dc4382223b6/cmd/stellar-rpc/internal/methods/json.go
Ref: https://github.com/stellar/stellar-rpc/blob/cd2ef199c70b19a8630a2c3059fd6dc4382223b6/cmd/stellar-rpc/internal/methods/get_events.go
It encourages using the types defined outside the package as a name enum of sorts. Those types happen to be named the same, which is lucky given that if the Go types were named according to Go naming conventions they wouldn't match the Rust names encoded in the stellar-xdr Rust crate.
Instead of the approach taken today, this package could provide a list of constants for all the types, and that would provide the same amount of certainty if folks were wanting to avoid having hardcoded strings.
The above example would become:
This issue was inspired by reviewing the code at:
The text was updated successfully, but these errors were encountered: