Skip to content

Commit

Permalink
Add str conversions for types for JSON (#313)
Browse files Browse the repository at this point in the history
* Add str conversions for PublicKey

* doc

* rem

* account id

* strkey types

* docs

* fix

* upd

* accurate docs

* fix

* doc

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* upd

* remove todo
  • Loading branch information
leighmcculloch authored Oct 24, 2023
1 parent 313b59d commit ae0b8bb
Show file tree
Hide file tree
Showing 10 changed files with 829 additions and 127 deletions.
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ doctest = false
crate-git-revision = "0.0.6"

[dependencies]
stellar-strkey = { version = "0.0.7", optional = true }
base64 = { version = "0.13.0", optional = true }
serde = { version = "1.0.139", features = ["derive"], optional = true }
serde_with = { version = "3.0.0", optional = true }
Expand All @@ -33,15 +34,15 @@ serde_json = "1.0.89"

[features]
default = ["std", "curr"]
std = ["alloc"]
std = ["alloc", "dep:stellar-strkey"]
alloc = ["dep:hex"]
curr = []
next = []

# Features dependent on optional dependencies.
base64 = ["std", "dep:base64"]
serde = ["alloc", "dep:serde", "dep:serde_with", "hex/serde"]
serde_json = ["serde", "dep:serde_json"]
serde_json = ["std", "serde", "dep:serde_json"]
arbitrary = ["std", "dep:arbitrary"]
hex = []

Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ export RUSTFLAGS=-Dwarnings -Dclippy::all -Dclippy::pedantic

CARGO_HACK_ARGS=--feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex

XDRGEN_VERSION=b405294c
CARGO_DOC_ARGS?=--open

XDRGEN_VERSION=64612a24
XDRGEN_TYPES_CUSTOM_STR_IMPL=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId

all: build test

test:
Expand Down Expand Up @@ -35,12 +37,12 @@ ifeq ($(LOCAL_XDRGEN),)
docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
gem install specific_install -v 0.3.8 && \
gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_VERSION) && \
xdrgen --language rust --namespace generated --output src/curr $^ \
xdrgen --language rust --namespace generated --output src/curr --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL) $^ \
'
else
docker run -i --rm -v $$PWD/../xdrgen:/xdrgen -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
pushd /xdrgen && bundle install --deployment && rake install && popd && \
xdrgen --language rust --namespace generated --output src/curr $^ \
xdrgen --language rust --namespace generated --output src/curr --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL) $^ \
'
endif
rustfmt $@
Expand Down
Loading

0 comments on commit ae0b8bb

Please sign in to comment.