-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paul/xrp dex #598
Paul/xrp dex #598
Conversation
e0f8cc7
to
8432f50
Compare
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.
One easy change and one optional change.
src/ripple/rippleTypes.ts
Outdated
export interface RippleNetworkLocation { | ||
currency: string | ||
issuer: string | ||
} |
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.
You already have asXrpNetworkLocation
a few lines above. You can do type RippleNetworkLocation = ReturnType<typeof asXrpNetworkLocation>
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.
Ah good catch. how'd i miss that.
src/ripple/RippleEngine.ts
Outdated
return nativeAmount | ||
} else { | ||
const { networkLocation, denominations } = this.allTokensMap[tokenId] | ||
const { currency, issuer } = networkLocation as RippleNetworkLocation |
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.
Please use asXrpNetworkLocation
instead of a type-cast.
src/ripple/RippleEngine.ts
Outdated
const TakerGets = this.nativeToXrpAmount( | ||
fromNativeAmount, | ||
fromTokenId | ||
) | ||
const TakerPays = this.nativeToXrpAmount(toNativeAmount, toTokenId) | ||
|
||
const Expiration = unixTimeToRippleTime( | ||
(expiration ?? DEX_ORDER_EXPIRATION_TIME_DEFAULT_S) * 1000 | ||
) |
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.
Optional: I see that you are using uppercase, because that is what the OfferCreate
JSON expects. However, we generally reserve uppercase names for types. Would it make more sense to use lowercase for the variables, and then do { ... Expiration: exipration, ... }
and such to change case inside the object?
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.
it crossed my mind but went for the convenient route. will do
/rebase |
961e1a6
to
a635901
Compare
Matches edge-exchange-plugins
Makes this generic for other types of txs
a635901
to
188efca
Compare
CHANGELOG
Add Ripple makeTx routine for xrp dex OfferCreate
Dependencies
noneDescription
none