-
Notifications
You must be signed in to change notification settings - Fork 524
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
Add DepositPreauth #958
Add DepositPreauth #958
Conversation
83c794b
to
3888032
Compare
return checkResult(expected, 'prepare', response) | ||
}) | ||
}) | ||
|
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.
Would it be worthwhile to include a test for Unauthorize
?
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.
Good call. Added in cd1be9d
@mDuo13 I exposed a method called |
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 wasn't able to test out the changes, but I left some suggestions on the documentation. (I commented on the index.md
file, but of course, the changes should go in the upstream ejs files first.)
docs/index.md
Outdated
|
||
### Return Value | ||
|
||
This method returns an object with containing a key for each parsed flag. Each flag has a boolean value of `true` or `false`. |
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.
The example implies that flags that are false
are omitted from the return value, or at least that flags whose value is their default value are omitted. That should be explicit. Alternatively, it would be OK (maybe more useful?) if all known flags were included (even if most of them are false
).
docs/index.md
Outdated
|
||
### Parameters | ||
|
||
This method takes one parameter, the `Flags` number to parse. |
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.
Maybe worth a note that this only works for AccountRoot Flags
since the flags have different mappings on other types of objects or in transactions like AccountSet.
docs/index.md
Outdated
|
||
Name | Type | Description | ||
---- | ---- | ----------- | ||
transaction | [transaction](https://developers.ripple.com/transaction-formats.html) | The specification (JSON) of the transaction to prepare. Set `Account` to the address of the account that is creating the transaction. Common fields like `Fee`, `Flags`, and `Sequence` may be omitted; `prepareTransaction` will set them automatically. |
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.
In the rippled API documentation, we use the term "Auto-fillable fields" for fields whose values can be automatically provided, and "Common fields" for fields that apply to all transactions (but whose values cannot be automatically provided, such as Account
). Let's try to match that usage here.
docs/index.md
Outdated
@@ -4955,6 +5060,10 @@ sign(txJSON: string, keypair: object, options: object): {signedTransaction: stri | |||
|
|||
Sign a prepared transaction. The signed transaction must subsequently be [submitted](#submit). | |||
|
|||
This method can sign any of [the transaction types supported by ripple-binary-codec](https://github.com/ripple/ripple-binary-codec/blob/cfcde79c19c359e9a0466d7bc3dc9a3aef47bb99/src/enums/definitions.json#L1637). When a new transaction type is added, it will be unrecognized until ripple-binary-codec is updated. An error will be thrown: |
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.
For style reasons, avoid future tense and passive voice except when talking about future events. (In this paragraph, there are two instances of future tense, one of which is appropriate and one of which isn't.) Here's a suggested rephrase:
When a new transaction type is added to the XRP Ledger, it will be unrecognized until ripple-binary-codec is updated. If you try to sign an unrecognized transaction type, this method throws an error similar to the following:
This is ready for re-review |
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 was able to run the code and it works nicely. The revised wording looks good, too. (Left one nitpick you can optionally fix.)
docs/index.md
Outdated
@@ -4164,8 +4155,8 @@ Notably, this is the preferred method for preparing a `DepositPreauth` transacti | |||
|
|||
Name | Type | Description | |||
---- | ---- | ----------- | |||
transaction | [transaction](https://developers.ripple.com/transaction-formats.html) | The specification (JSON) of the transaction to prepare. Set `Account` to the address of the account that is creating the transaction. Common fields like `Fee`, `Flags`, and `Sequence` may be omitted; `prepareTransaction` will set them automatically. | |||
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction | |||
transaction | [transaction](https://developers.ripple.com/transaction-formats.html) | The specification (JSON) of the transaction to prepare. Set `Account` to the address of the account that is creating the transaction. Auto-fillable fields like `Fee`, `Flags`, and `Sequence` may be omitted; `prepareTransaction` will set them automatically. |
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.
Nit: I suggest changing the last sentence just a little more for conciseness, active voice, etc.:
You may omit auto-fillable fields like
Fee
,Flags
, andSequence
to have them set automatically.
prepareTransaction
, the preferred method for preparingDepositPreauth
transactions.DepositPreauth
transactions thanks to ripple-binary-codec v0.1.15. However, this release was not tagged on GitHub, so I incremented the library's version to v0.2.0 and published it to npm and GitHub.DepositPreauth
transactions.specification
will be provided, butrawTransaction
will be included.