This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
JSON stringify types over the ffi #131
Merged
KendallWeihe
merged 10 commits into
main
from
kendall/experiment-json-stringify-wasm-ffi
Oct 7, 2024
Merged
JSON stringify types over the ffi #131
KendallWeihe
merged 10 commits into
main
from
kendall/experiment-json-stringify-wasm-ffi
Oct 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KendallWeihe
requested review from
nitro-neal,
shamilovtim,
diehuxx and
frankhinek
as code owners
October 2, 2024 17:45
TBD Spec Test Vectors Report (tbdex-rs)
❌ Missing Vectors (1)These are test vectors without any test cases.
Automatically generated at: 2024-10-07T13:56:29.475Z |
KendallWeihe
commented
Oct 2, 2024
rule: SubmissionRequirementRule; | ||
}; | ||
|
||
// todo make enum |
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.
I would want to make this and Optionality
above actual ts enums, or type unions to be more exact
TBD Spec Test Vectors Report (tbdex-core-kt)
Automatically generated at: 2024-10-07T13:59:50.909Z |
KendallWeihe
changed the title
Prototype JSON stringifying all Offering over FFI
JSON stringify types over the ffi
Oct 2, 2024
nitro-neal
reviewed
Oct 4, 2024
nitro-neal
approved these changes
Oct 4, 2024
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.
awesome job
nitro-neal
reviewed
Oct 4, 2024
throw tbdexError(error); | ||
} | ||
}; | ||
static fromJSONString = (json: string): Exchange => { |
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.
may be a bit cleaner something like this (from chad)
const obj = JSON.parse(json);
const createInstance = (ClassType: any, objPart?: any) =>
objPart ? new ClassType(objPart.metadata, objPart.data, objPart.signature) : undefined;
const rfq = createInstance(Rfq, obj.rfq);
const quote = createInstance(Quote, obj.quote);
const order = createInstance(Order, obj.order);
const orderInstructions = createInstance(OrderInstructions, obj.orderInstructions);
const cancel = createInstance(Cancel, obj.cancel);
const orderStatuses = obj.orderStatuses
? obj.orderStatuses.map((x: any) => createInstance(OrderStatus, x))
: undefined;
const close = createInstance(Close, obj.close);
return new Exchange(rfq, quote, order, orderInstructions, cancel, orderStatuses, close);
}
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I JSON-stringified Offering's over the wasm FFI & ran some experiments
It is surprisingly faster! I wouldn't have guessed that.