Skip to content
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

Merged
merged 4 commits into from
Aug 14, 2023
Merged

Paul/xrp dex #598

merged 4 commits into from
Aug 14, 2023

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Aug 9, 2023

CHANGELOG

Add Ripple makeTx routine for xrp dex OfferCreate

Dependencies

none

Description

none

Copy link
Contributor

@swansontec swansontec left a 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.

Comment on lines 53 to 56
export interface RippleNetworkLocation {
currency: string
issuer: string
}
Copy link
Contributor

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>

Copy link
Member Author

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.

return nativeAmount
} else {
const { networkLocation, denominations } = this.allTokensMap[tokenId]
const { currency, issuer } = networkLocation as RippleNetworkLocation
Copy link
Contributor

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.

Comment on lines 153 to 160
const TakerGets = this.nativeToXrpAmount(
fromNativeAmount,
fromTokenId
)
const TakerPays = this.nativeToXrpAmount(toNativeAmount, toTokenId)

const Expiration = unixTimeToRippleTime(
(expiration ?? DEX_ORDER_EXPIRATION_TIME_DEFAULT_S) * 1000
)
Copy link
Contributor

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?

Copy link
Member Author

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

@paullinator
Copy link
Member Author

/rebase

@paullinator paullinator merged commit 297b744 into master Aug 14, 2023
@paullinator paullinator deleted the paul/xrpDex branch August 14, 2023 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants