diff --git a/18.md b/18.md index 34571360..e4e58bff 100644 --- a/18.md +++ b/18.md @@ -24,6 +24,7 @@ A Payment Request is defined as follows "u": str , "s": bool , "m": Array[str] , + "pm": Array[str] , "d": str , "t": Array[Transport] , "nut10": NUT10Option , @@ -36,7 +37,8 @@ Here, the fields are - `a`: The amount of the requested payment - `u`: The unit of the requested payment (MUST be set if `a` is set) - `s`: Whether the payment request is for single use -- `m`: A set of mints from which the payment is requested +- `m`: A set of mints from which the payment is requested. If this field is defined, the sender SHOULD only send proofs from these mints. The fields `m` and `pm` are mutually exclusive; a payment request MUST NOT contain both fields. +- `pm`: A set of preferred mints the receiver supports. If this field is defined, the receiver will accept proofs from any mint but prefers these mints for faster and cheaper transactions. The fields `m` and `pm` are mutually exclusive; a payment request MUST NOT contain both fields. - `d`: A human readable description that the sending wallet will display after scanning the request - `t`: The method of `Transport` chosen to transmit the payment (can be multiple, sorted by preference) - `nut10`: The required [NUT-10][10] locking condition diff --git a/26.md b/26.md index 555d8bcf..8d8bc3c6 100644 --- a/26.md +++ b/26.md @@ -33,16 +33,17 @@ The payment request is encoded as a sequence of TLV fields. Each TLV entry consi ### Top-Level TLV Tags -| Tag | Field | Type | Description | -| ---- | ----------- | --------- | -------------------------------------------------------------------- | -| 0x01 | id | string | Payment identifier (corresponds to `i` in JSON) | -| 0x02 | amount | u64 | Amount in base units (corresponds to `a` in JSON) | -| 0x03 | unit | u8/string | Currency unit (corresponds to `u` in JSON) | -| 0x04 | single_use | u8 | Single-use flag: 0=false, 1=true (corresponds to `s` in JSON) | -| 0x05 | mint | string | Mint URL (repeatable for multiple mints, corresponds to `m` in JSON) | -| 0x06 | description | string | Human-readable description (corresponds to `d` in JSON) | -| 0x07 | transport | sub-TLV | Transport configuration (repeatable, corresponds to `t` in JSON) | -| 0x08 | nut10 | sub-TLV | NUT-10 spending conditions (corresponds to `nut10` in JSON) | +| Tag | Field | Type | Description | +| ---- | --------------- | --------- | ------------------------------------------------------------------------------- | +| 0x01 | id | string | Payment identifier (corresponds to `i` in JSON) | +| 0x02 | amount | u64 | Amount in base units (corresponds to `a` in JSON) | +| 0x03 | unit | u8/string | Currency unit (corresponds to `u` in JSON) | +| 0x04 | single_use | u8 | Single-use flag: 0=false, 1=true (corresponds to `s` in JSON) | +| 0x05 | mint | string | Mint URL (repeatable for multiple mints, corresponds to `m` in JSON) | +| 0x06 | description | string | Human-readable description (corresponds to `d` in JSON) | +| 0x07 | transport | sub-TLV | Transport configuration (repeatable, corresponds to `t` in JSON) | +| 0x08 | nut10 | sub-TLV | NUT-10 spending conditions (corresponds to `nut10` in JSON) | +| 0x09 | preferred_mints | string | Preferred mint URL (repeatable for multiple mints, corresponds to `pm` in JSON) | All fields are optional. Unknown tags MUST be ignored to maintain forward compatibility. diff --git a/tests/18-tests.md b/tests/18-tests.md index e88a9570..cf8eaf97 100644 --- a/tests/18-tests.md +++ b/tests/18-tests.md @@ -157,3 +157,22 @@ Encoded: ``` creqApWFpaGM5ZTQ1ZDJhYWEZAfRhdWNzYXRhbYF4GGh0dHBzOi8vbWludC5leGFtcGxlLmNvbWVudXQxMKNha2RQMlBLYWR4QjAyYzNiNWJiMjdlMzYxNDU3YzkyZDkzZDc4ZGQ3M2QzZDUzNzMyMTEwYjJjZmU4YjUwZmJjMGFiYzYxNWU5YzMzMWF0gYJndGltZW91dGQzNjAw ``` + +### Preferred Mints Field + +A payment request specifying preferred mints using the `pm` field. + +```json +{ + "i": "pm_test", + "a": 100, + "u": "sat", + "pm": ["https://mint.example.com"] +} +``` + +Encoded: + +``` +creqApGFpZ3BtX3Rlc3RhYRhkYXVjc2F0YnBtgXgYaHR0cHM6Ly9taW50LmV4YW1wbGUuY29t +``` diff --git a/tests/26-test.md b/tests/26-test.md index e6a2dde7..ea2e2394 100644 --- a/tests/26-test.md +++ b/tests/26-test.md @@ -413,3 +413,24 @@ Encoded: ``` CREQB1QYQQKCM4WD6X7M2LW4HXJAQZQQYQQQQQQQQQQQRYQVQQXCN5VVZSQXRGW368QUE69UHK66TWWSHX27RPD4CXCEFWVDHK6PZHCW8 ``` + +--- + +### Preferred Mints Field + +A payment request specifying preferred mints using the `pm` field (tag 0x09). + +```json +{ + "i": "pm_test", + "a": 100, + "u": "sat", + "pm": ["https://mint.example.com"] +} +``` + +Encoded: + +``` +CREQB1QYQQWURDTA6X2UM5QGQQSQQQQQQQQQQQVSPSQQGQPYQPS6R5W3C8XW309AKKJMN59EJHSCTDWPKX2TNRDAKSYWN0VM +```