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

Document xrpToDrops, dropsToXrp, iso8601ToRippleTime, schemaValidator… #926

Closed
wants to merge 3 commits into from

Conversation

intelliot
Copy link
Collaborator

These docs are far from perfect, but this should help to clarify how these methods can be used.

@intelliot
Copy link
Collaborator Author

Providing these docs as follow-up to #915

@@ -0,0 +1,34 @@
## createPaymentTransaction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is for #922
Should it be included yet?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks


### Parameters

`drops`: A string or BigNumber representing an amount of drops. If `drops` is a string, it may start with `-`, must contain at least one number, and must not contain `.`. This method throws a `ValidationError` for invalid input.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is, but if drops is a string, it can contain .
https://github.com/ripple/ripple-lib/pull/892/files#diff-12042bcf08631e33198bb47382ee4813R176


`txFlags.Payment.PartialPayment`: If the specified destination amount cannot be sent without spending more than the source maxAmount, reduce the received amount instead of failing outright. See [Partial Payments](https://developers.ripple.com/partial-payments.html) for more details.

`txFlags.Payment.PartialPayment`: Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of `Amount`:`SendMax`. See [Limit Quality](https://developers.ripple.com/payment.html#limit-quality) for details.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PartialPayment -> LimitQuality

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the ratio of Amount:SendMax"
Should this instead refer to ripple-lib's destination.amount and source:maxAmount?
https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#payment


`txFlags.OfferCreate.FillOrKill`: Treat the offer as a Fill or Kill order. Only try to match existing offers in the ledger, and only do so if the entire TakerPays quantity can be obtained.

`txFlags.OfferCreate.Sell`: Exchange the entire TakerGets amount, even if it means obtaining more than the TakerPays amount in exchange.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above, not sure if FillOrKill/OfferCreate should be described with rippled's TakerPays and TabkerGets or ripple-lib's quantity/totalPrice
https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#order


### TrustSet Flags

`txFlags.TrustSet.SetAuth`: Authorize the other party to hold issuances from this account. (No effect unless using the asfRequireAuth AccountSet flag.) Cannot be unset.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asfRequireAuth AccountSet flag -> AccountSet.RequireAuth?


### AccountSet Flags

Account Flags can be enabled and disabled with the SetFlag and ClearFlag parameters. See [AccountSet Flags](https://developers.ripple.com/accountset.html#accountset-flags).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this should instead mention the prepareSettings settings parameter
https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#preparesettings

* EscrowFinish
* EscrowCancel
* PaymentChannelCreate
* PaymentChannelFund
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this list include SetRegularKey and SignerListSet?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think they're already there, although the list is not ordered

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️


`RippleAPI.schemaValidator.isValidAddress(address: string): boolean`

This method checks an address for validity. It does this by attempting to decoding the address. If decoding succeeds, this method returns `true`. Otherwise, it returns `false`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempting to decoding -> attempting to decode


`RippleAPI.schemaValidator.schemaValidate(schemaName: string, object: any): void`

This method checks an object for conformance to a specified schema. It does not return anything, but will throw a `ValidationError` if the object does not conform to the schema.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about including an example for schemaValidate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea


`RippleAPI.schemaValidator.isValidSecret(secret: string): boolean`

This method checks a secret for validity. It does this by attempting to decoding the secret. If decoding succeeds, this method returns `true`. Otherwise, it returns `false`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempting to decoding -> attempting to decode

@intelliot
Copy link
Collaborator Author

@wilsonianb I think I've fixed everything. Have a second look whenever!

Copy link
Collaborator

@wilsonianb wilsonianb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@intelliot
Copy link
Collaborator Author

I realized, when writing these docs, that it doesn't really make sense to have these methods under schemaValidator. I'd like to move them to be on the RippleAPI object directly.

@intelliot
Copy link
Collaborator Author

Awaiting #932

@mDuo13
Copy link
Collaborator

mDuo13 commented Aug 30, 2018

Is there a reverse of iso8601ToRippleTime that can also be exposed? That's the operation I do more often in my XRP Ledger code.

@intelliot
Copy link
Collaborator Author

Merged via 5fed1f0

@intelliot intelliot closed this Oct 18, 2018
@intelliot intelliot deleted the schemaValidator-docs branch October 18, 2018 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants