Skip to content

Commit b508134

Browse files
author
Chris Clark
committed
Allow memos on all transaction types
1 parent 4f86691 commit b508134

14 files changed

+137
-95
lines changed

docs/index.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Transaction Fees](#transaction-fees)
1717
- [Transaction Instructions](#transaction-instructions)
1818
- [Transaction ID](#transaction-id)
19+
- [Transaction Memos](#transaction-memos)
1920
- [Transaction Specifications](#transaction-specifications)
2021
- [Payment](#payment)
2122
- [Trustline](#trustline)
@@ -256,6 +257,16 @@ A transaction ID is a 64-bit hexadecimal string that uniquely identifies the tra
256257

257258
You can look up a transaction by ID using the [getTransaction](#gettransaction) method.
258259

260+
## Transaction Memos
261+
262+
Every transaction can optionally have an array of memos for user applications. The `memos` field in each [transaction specification](#transaction-specifications) is an array of objects with the following structure:
263+
264+
Name | Type | Description
265+
---- | ---- | -----------
266+
data | string | *Optional* Arbitrary string, conventionally containing the content of the memo.
267+
format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted.
268+
type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted.
269+
259270
# Transaction Specifications
260271

261272
A *transaction specification* specifies what a transaction should do. Each [Transaction Type](#transaction-types) has its own type of specification.
@@ -280,11 +291,7 @@ destination | object | The destination of the funds to be sent.
280291
allowPartialPayment | boolean | *Optional* A boolean that, if set to true, indicates that this payment should go through even if the whole amount cannot be delivered because of a lack of liquidity or funds in the source account account
281292
invoiceID | string | *Optional* A 256-bit hash that can be used to identify a particular payment.
282293
limitQuality | boolean | *Optional* Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of destination.amount:source.maxAmount.
283-
memos | array | *Optional* Array of memos to attach to the transaction.
284-
memos[] | object | Memo objects represent arbitrary data that can be included in a transaction
285-
*memos[].* data | string | *Optional* Arbitrary string, conventionally containing the content of the memo.
286-
*memos[].* format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted.
287-
*memos[].* type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted.
294+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
288295
noDirectRipple | boolean | *Optional* A boolean that can be set to true if paths are specified and the sender would like the Ripple Network to disregard any direct paths from the source account to the destination account. This may be used to take advantage of an arbitrage opportunity or by gateways wishing to issue balances from a hot wallet to a user who has mistakenly set a trustline directly to the hot wallet
289296
paths | string | *Optional* The paths of trustlines and orders to use in executing the payment.
290297

@@ -324,6 +331,7 @@ counterparty | [address](#ripple-address) | The address of the account this trus
324331
limit | [value](#value) | The maximum amount that the owner of the trustline can be owed through the trustline.
325332
authorized | boolean | *Optional* If true, authorize the counterparty to hold issuances from this account.
326333
frozen | boolean | *Optional* If true, the trustline is frozen, which means that funds can only be sent to the owner.
334+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
327335
qualityIn | number | *Optional* Incoming balances on this trustline are valued at this ratio.
328336
qualityOut | number | *Optional* Outgoing balances on this trustline are valued at this ratio.
329337
ripplingDisabled | boolean | *Optional* If true, payments cannot ripple through this trustline.
@@ -356,6 +364,7 @@ totalPrice | [amount](#amount) | The total price to be paid for the `quantity` t
356364
expirationTime | date-time string | *Optional* Time after which the offer is no longer active, as an [ISO 8601 date-time](https://en.wikipedia.org/wiki/ISO_8601).
357365
fillOrKill | boolean | *Optional* Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged.
358366
immediateOrCancel | boolean | *Optional* Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger.
367+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
359368
passive | boolean | *Optional* If enabled, the offer will not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It will still consume offers that cross it.
360369

361370
### Example
@@ -385,6 +394,7 @@ See [Transaction Types](#transaction-types) for a description.
385394
Name | Type | Description
386395
---- | ---- | -----------
387396
orderSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the order to cancel.
397+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
388398

389399
### Example
390400

@@ -409,6 +419,7 @@ domain | string | *Optional* The domain that owns this account, as a hexadecima
409419
emailHash | string,null | *Optional* Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.
410420
enableTransactionIDTracking | boolean | *Optional* Track the ID of this account’s most recent transaction.
411421
globalFreeze | boolean | *Optional* Freeze all assets issued by this account.
422+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
412423
messageKey | string | *Optional* Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Ripple.
413424
noFreeze | boolean | *Optional* Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled.
414425
passwordSpent | boolean | *Optional* Indicates that the account has used its free SetRegularKey transaction.
@@ -444,11 +455,7 @@ destination | object | Fields pertaining to the destination of the payment.
444455
allowCancelAfter | date-time string | *Optional* If present, the suspended payment may be cancelled after this time.
445456
allowExecuteAfter | date-time string | *Optional* If present, the suspended payment can not be executed before this time.
446457
digest | string | *Optional* If present, proof is required upon execution.
447-
memos | array | *Optional* Array of memos to attach to the transaction.
448-
memos[] | object | Memo objects represent arbitrary data that can be included in a transaction
449-
*memos[].* data | string | *Optional* Arbitrary string, conventionally containing the content of the memo.
450-
*memos[].* format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted.
451-
*memos[].* type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted.
458+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
452459

453460
### Example
454461

@@ -484,11 +491,7 @@ Name | Type | Description
484491
---- | ---- | -----------
485492
owner | [address](#ripple-address) | The address of the owner of the suspended payment to cancel.
486493
suspensionSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to cancel.
487-
memos | array | *Optional* Array of memos to attach to the transaction.
488-
memos[] | object | Memo objects represent arbitrary data that can be included in a transaction
489-
*memos[].* data | string | *Optional* Arbitrary string, conventionally containing the content of the memo.
490-
*memos[].* format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted.
491-
*memos[].* type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted.
494+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
492495

493496
### Example
494497

@@ -510,11 +513,7 @@ Name | Type | Description
510513
owner | [address](#ripple-address) | The address of the owner of the suspended payment to execute.
511514
suspensionSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to execute.
512515
digest | string | *Optional* The original `digest` from the suspended payment creation transaction. This is sha256 hash of `proof` string. It is replicated here so that the relatively expensive hashing operation can be delegated to a server without ledger history and the server with ledger history only has to do a quick comparison of the old digest with the new digest.
513-
memos | array | *Optional* Array of memos to attach to the transaction.
514-
memos[] | object | Memo objects represent arbitrary data that can be included in a transaction
515-
*memos[].* data | string | *Optional* Arbitrary string, conventionally containing the content of the memo.
516-
*memos[].* format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted.
517-
*memos[].* type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted.
516+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
518517
method | integer | *Optional* The method for verifying the proof; only method `1` is supported.
519518
proof | string | *Optional* A value that produces the digest when hashed. It must be 32 charaters long and contain only 8-bit characters.
520519

@@ -2577,6 +2576,7 @@ domain | string | *Optional* The domain that owns this account, as a hexadecima
25772576
emailHash | string,null | *Optional* Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.
25782577
enableTransactionIDTracking | boolean | *Optional* Track the ID of this account’s most recent transaction.
25792578
globalFreeze | boolean | *Optional* Freeze all assets issued by this account.
2579+
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
25802580
messageKey | string | *Optional* Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Ripple.
25812581
noFreeze | boolean | *Optional* Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled.
25822582
passwordSpent | boolean | *Optional* Indicates that the account has used its free SetRegularKey transaction.

docs/src/transactions.md.ejs

+6
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ We recommended that you specify a `maxLedgerVersion` because without it there is
5555
A transaction ID is a 64-bit hexadecimal string that uniquely identifies the transaction. The transaction ID is derived from the transaction instruction and specifications, using a strong hash function.
5656

5757
You can look up a transaction by ID using the [getTransaction](#gettransaction) method.
58+
59+
## Transaction Memos
60+
61+
Every transaction can optionally have an array of memos for user applications. The `memos` field in each [transaction specification](#transaction-specifications) is an array of objects with the following structure:
62+
63+
<%- renderSchema('objects/memos.json') %>

src/common/schema-validator.js

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function loadSchemas() {
4343
require('./schemas/objects/signed-value.json'),
4444
require('./schemas/objects/orderbook.json'),
4545
require('./schemas/objects/instructions.json'),
46+
require('./schemas/objects/settings.json'),
4647
require('./schemas/specifications/settings.json'),
4748
require('./schemas/specifications/payment.json'),
4849
require('./schemas/specifications/suspended-payment-cancellation.json'),

src/common/schemas/objects/memos.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"title": "memos",
4+
"link": "transaction-memos",
45
"description": "Array of memos to attach to the transaction.",
56
"type": "array",
67
"items": {
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "settingsPlusMemos",
4+
"type": "object",
5+
"properties": {
6+
"passwordSpent": {
7+
"type": "boolean",
8+
"description": "Indicates that the account has used its free SetRegularKey transaction."
9+
},
10+
"requireDestinationTag": {
11+
"type": "boolean",
12+
"description": "Requires incoming payments to specify a destination tag."
13+
},
14+
"requireAuthorization": {
15+
"type": "boolean",
16+
"description": "If set, this account must individually approve other users in order for those users to hold this account’s issuances."
17+
},
18+
"disallowIncomingXRP": {
19+
"type": "boolean",
20+
"description": "Indicates that client applications should not send XRP to this account. Not enforced by rippled."
21+
},
22+
"disableMasterKey": {
23+
"type": "boolean",
24+
"description": "Disallows use of the master key to sign transactions for this account."
25+
},
26+
"enableTransactionIDTracking": {
27+
"type": "boolean",
28+
"description": "Track the ID of this account’s most recent transaction."
29+
},
30+
"noFreeze": {
31+
"type": "boolean",
32+
"description": "Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled."
33+
},
34+
"globalFreeze": {
35+
"type": "boolean",
36+
"description": "Freeze all assets issued by this account."
37+
},
38+
"defaultRipple": {
39+
"type": "boolean",
40+
"description": "Enable [rippling](https://ripple.com/knowledge_center/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))"
41+
},
42+
"emailHash": {
43+
"description": "Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.",
44+
"oneOf": [
45+
{"type": "null"},
46+
{"$ref": "hash128"}
47+
]
48+
},
49+
"messageKey": {
50+
"type": "string",
51+
"description": "Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Ripple."
52+
},
53+
"domain": {
54+
"type": "string",
55+
"description": " The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase."
56+
},
57+
"transferRate": {
58+
"description": " The fee to charge when users transfer this account’s issuances, represented as billionths of a unit. Use `null` to set no fee.",
59+
"oneOf": [
60+
{"type": "null"},
61+
{"type": "number", "minimum": 1, "maximum": 4.294967295}
62+
]
63+
},
64+
"regularKey": {
65+
"oneOf": [
66+
{"$ref": "address"},
67+
{"type": "null"}
68+
],
69+
"description": "The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use `null` to remove the regular key."
70+
},
71+
"memos": {"$ref": "memos"}
72+
},
73+
"additionalProperties": false
74+
}
+4-69
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,8 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"title": "getSettings",
4-
"type": "object",
5-
"properties": {
6-
"passwordSpent": {
7-
"type": "boolean",
8-
"description": "Indicates that the account has used its free SetRegularKey transaction."
9-
},
10-
"requireDestinationTag": {
11-
"type": "boolean",
12-
"description": "Requires incoming payments to specify a destination tag."
13-
},
14-
"requireAuthorization": {
15-
"type": "boolean",
16-
"description": "If set, this account must individually approve other users in order for those users to hold this account’s issuances."
17-
},
18-
"disallowIncomingXRP": {
19-
"type": "boolean",
20-
"description": "Indicates that client applications should not send XRP to this account. Not enforced by rippled."
21-
},
22-
"disableMasterKey": {
23-
"type": "boolean",
24-
"description": "Disallows use of the master key to sign transactions for this account."
25-
},
26-
"enableTransactionIDTracking": {
27-
"type": "boolean",
28-
"description": "Track the ID of this account’s most recent transaction."
29-
},
30-
"noFreeze": {
31-
"type": "boolean",
32-
"description": "Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled."
33-
},
34-
"globalFreeze": {
35-
"type": "boolean",
36-
"description": "Freeze all assets issued by this account."
37-
},
38-
"defaultRipple": {
39-
"type": "boolean",
40-
"description": "Enable [rippling](https://ripple.com/knowledge_center/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))"
41-
},
42-
"emailHash": {
43-
"description": "Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.",
44-
"oneOf": [
45-
{"type": "null"},
46-
{"$ref": "hash128"}
47-
]
48-
},
49-
"messageKey": {
50-
"type": "string",
51-
"description": "Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Ripple."
52-
},
53-
"domain": {
54-
"type": "string",
55-
"description": " The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase."
56-
},
57-
"transferRate": {
58-
"description": " The fee to charge when users transfer this account’s issuances, represented as billionths of a unit. Use `null` to set no fee.",
59-
"oneOf": [
60-
{"type": "null"},
61-
{"type": "number", "minimum": 1, "maximum": 4.294967295}
62-
]
63-
},
64-
"regularKey": {
65-
"oneOf": [
66-
{"$ref": "address"},
67-
{"type": "null"}
68-
],
69-
"description": "The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use `null` to remove the regular key."
70-
}
71-
},
72-
"additionalProperties": false
4+
"$ref": "settingsPlusMemos",
5+
"not": {
6+
"required": ["memos"]
7+
}
738
}

src/common/schemas/specifications/order-cancellation.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"orderSequence": {
88
"$ref": "sequence",
99
"description": "The [account sequence number](#account-sequence-number) of the order to cancel."
10-
}
10+
},
11+
"memos": {"$ref": "memos"}
1112
},
1213
"required": ["orderSequence"],
1314
"additionalProperties": false

0 commit comments

Comments
 (0)