stellar / js-xdr

Read/write XDR encoded data structures (RFC 4506)
Apache License 2.0
25 stars 31 forks source link

`config` function returns local `types` map #21

Closed bartekn closed 6 years ago

bartekn commented 6 years ago

Currently config function adds new types to the global types map and it makes js-xdr impossible to use with different XDR schemes inside a single project (with the same types names) but also when multiple versions of stellar-base are included in a project (like in https://github.com/stellar/js-stellar-sdk/issues/191).

I removed the global types variable and to make it possible to add new types for an existing context I added a second argument to config function (with default value of {}).

robertDurst commented 6 years ago

@bartekn I assume this also is a ref to #6

bartekn commented 6 years ago

@bartekn I assume this also is a ref to #6

@robertDurst #6 is more about primitives like unsigned char, char, etc. When I mention type in this PR I mean types defined by users in XDR schemas like:

struct DecoratedSignature
{
    SignatureHint hint;  // last 4 bytes of the public key, used as a hint
    Signature signature; // actual signature
};