Skip to content

Commit

Permalink
Update xdr lib to v22 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Nov 13, 2024
1 parent 97d158b commit fecaf46
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 20 deletions.
23 changes: 12 additions & 11 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ console_error_panic_hook = { version = "0.1.7", optional = true }
# serde-wasm-bindgen = "0.6.5"

[dependencies.stellar-xdr]
version = "21.0.1"
version = "22.0.0"
features = ["std", "curr", "base64", "serde", "serde_json", "schemars"]
git = "https://github.com/stellar/rs-stellar-xdr"
rev = "89a8bcde36aeda551cb0e3f9aa3e9fcf315fe1cc"
# git = "https://github.com/stellar/rs-stellar-xdr"
# rev = "89a8bcde36aeda551cb0e3f9aa3e9fcf315fe1cc"

[dev-dependencies]
wasm-bindgen-test = "0.3.34"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn encode(type_variant: String, json: String) -> Result<String, String> {
let type_variant = TypeVariant::from_str(&type_variant).map_err(|e| format!("{e}"))?;
// TODO: Return a native JS value.
// let t: Type = serde_wasm_bindgen::from_value(js).map_err(|e| format!("{e}"))?;
let t = Type::read_json(type_variant, json.as_bytes()).map_err(|e| format!("{e}"))?;
let t = Type::from_json(type_variant, json.as_bytes()).map_err(|e| format!("{e}"))?;
let b64 = t
.to_xdr_base64(Limits::none())
.map_err(|e| format!("{e}"))?;
Expand Down
44 changes: 39 additions & 5 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fn pass() {
"ConfigSettingEntry",
"ScEnvMetaKind",
"ScEnvMetaEntry",
"ScEnvMetaEntryInterfaceVersion",
"ScMetaV0",
"ScMetaKind",
"ScMetaEntry",
Expand Down Expand Up @@ -174,6 +175,19 @@ fn pass() {
"LedgerKeyConfigSetting",
"LedgerKeyTtl",
"EnvelopeType",
"BucketListType",
"BucketEntryType",
"HotArchiveBucketEntryType",
"ColdArchiveBucketEntryType",
"BucketMetadata",
"BucketMetadataExt",
"BucketEntry",
"HotArchiveBucketEntry",
"ColdArchiveArchivedLeaf",
"ColdArchiveDeletedLeaf",
"ColdArchiveBoundaryLeaf",
"ColdArchiveHashEntry",
"ColdArchiveBucketEntry",
"UpgradeType",
"StellarValueType",
"LedgerCloseValueSignature",
Expand All @@ -188,10 +202,6 @@ fn pass() {
"ConfigUpgradeSetKey",
"LedgerUpgrade",
"ConfigUpgradeSet",
"BucketEntryType",
"BucketMetadata",
"BucketMetadataExt",
"BucketEntry",
"TxSetComponentType",
"TxSetComponent",
"TxSetComponentTxsMaybeDiscountedFee",
Expand Down Expand Up @@ -221,6 +231,7 @@ fn pass() {
"ContractEventBody",
"ContractEventV0",
"DiagnosticEvent",
"DiagnosticEvents",
"SorobanTransactionMetaExtV1",
"SorobanTransactionMetaExt",
"SorobanTransactionMeta",
Expand Down Expand Up @@ -248,15 +259,27 @@ fn pass() {
"DontHave",
"SurveyMessageCommandType",
"SurveyMessageResponseType",
"TimeSlicedSurveyStartCollectingMessage",
"SignedTimeSlicedSurveyStartCollectingMessage",
"TimeSlicedSurveyStopCollectingMessage",
"SignedTimeSlicedSurveyStopCollectingMessage",
"SurveyRequestMessage",
"TimeSlicedSurveyRequestMessage",
"SignedSurveyRequestMessage",
"SignedTimeSlicedSurveyRequestMessage",
"EncryptedBody",
"SurveyResponseMessage",
"TimeSlicedSurveyResponseMessage",
"SignedSurveyResponseMessage",
"SignedTimeSlicedSurveyResponseMessage",
"PeerStats",
"PeerStatList",
"TimeSlicedNodeData",
"TimeSlicedPeerData",
"TimeSlicedPeerDataList",
"TopologyResponseBodyV0",
"TopologyResponseBodyV1",
"TopologyResponseBodyV2",
"SurveyResponseBody",
"TxAdvertVector",
"FloodAdvert",
Expand Down Expand Up @@ -299,6 +322,7 @@ fn pass() {
"ContractIdPreimage",
"ContractIdPreimageFromAddress",
"CreateContractArgs",
"CreateContractArgsV2",
"InvokeContractArgs",
"HostFunction",
"SorobanAuthorizedFunctionType",
Expand Down Expand Up @@ -326,6 +350,13 @@ fn pass() {
"PreconditionType",
"Preconditions",
"LedgerFootprint",
"ArchivalProofType",
"ArchivalProofNode",
"ProofLevel",
"NonexistenceProofBody",
"ExistenceProofBody",
"ArchivalProof",
"ArchivalProofBody",
"SorobanResources",
"SorobanTransactionData",
"TransactionV0",
Expand Down Expand Up @@ -438,7 +469,10 @@ fn pass() {
"Curve25519Secret",
"Curve25519Public",
"HmacSha256Key",
"HmacSha256Mac"
"HmacSha256Mac",
"ShortHashSeed",
"BinaryFuseFilterType",
"SerializedBinaryFuseFilter"
]
);
}
Expand Down

0 comments on commit fecaf46

Please sign in to comment.