Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Oct 18, 2024
1 parent 8002b5b commit 09d70ec
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions 18.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ Here, the fields are
}
```

- t: type of Transport
- a: target of Transport
- g: optional tags for the Transport

### Transport types

The supported transport types are:
- `t`: type of Transport
- `a`: target of Transport
- `g`: optional tags for the Transport

### Tags

Tags are an optional array of `[tag, value, value, ...]` tuples that can be used to specify additional features about the transport. A single tag can have multiple values.

### Transport types

The supported transport types are described below.

#### Nostr

- type: `nostr`
Expand All @@ -70,8 +70,6 @@ Tags are an optional array of `[tag, value, value, ...]` tuples that can be used

The `n` tag specifies the NIPs the receiver supports. At least one tag value MUST be specified. For [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content.

[NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) SHOULDNT be used because it is deprecated and reveals metadata about sender and receiver public keys.

#### HTTP POST

- type: `post`
Expand Down Expand Up @@ -101,10 +99,30 @@ The payment request is serialized using CBOR, encoded in `base64_urlsafe`, toget

`"creq" + "A" + base64(CBOR(PaymentRequest))`

_Example_
### Example

This is an example payment request expressed as JSON:

```json
{
"i": "b7a90176",
"a": 10,
"u": "sat",
"m": ["https://nofees.testnut.cashu.space"],
"t": [
{
"t": "nostr",
"a": "nprofile1qy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsz9mhwden5te0wfjkccte9curxven9eehqctrv5hszrthwden5te0dehhxtnvdakqqgydaqy7curk439ykptkysv7udhdhu68sucm295akqefdehkf0d495cwunl5",
"g": [["n","17"]]
}
]
}
```

This payment request serializes to (see [here](https://cbor.nemo157.com/#type=hex&value=a3617482a261694800ffd48b8f5ecf80617081a36161016173784061636331323433356537623834383463336366313835303134393231386166393066373136613532626634613565643334376534386563633133663737333838616358210244538319de485d55bed3b29a642bee5879375ab9e7a620e11e48ba482421f3cfa261694800ad268c4d1f5826617082a3616102617378403133323364336434373037613538616432653233616461346539663166343966356135623461633762373038656230643631663733386634383330376538656561635821023456aa110d84b4ac747aebd82c3b005aca50bf457ebd5737a4414fac3ae7d94da36161016173784035366263626362623763633634303662336661356435376432313734663465666638623434303262313736393236643361353764336333646362623539643537616358210273129c5719e599379a974a626363c333c56cafc0e6d01abe46d5808280789c63616d75687474703a2f2f6c6f63616c686f73743a33333338617563736174)):

```sh
creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag
creqApWF0gaNhdGVub3N0cmFheKlucHJvZmlsZTFxeTI4d3VtbjhnaGo3dW45ZDNzaGp0bnl2OWtoMnVld2Q5aHN6OW1od2RlbjV0ZTB3ZmprY2N0ZTljdXJ4dmVuOWVlaHFjdHJ2NWhzenJ0aHdkZW41dGUwZGVoaHh0bnZkYWtxcWd5ZGFxeTdjdXJrNDM5eWtwdGt5c3Y3dWRoZGh1NjhzdWNtMjk1YWtxZWZkZWhrZjBkNDk1Y3d1bmw1YWeBgmFuYjE3YWloYjdhOTAxNzZhYQphdWNzYXRhbYF4Imh0dHBzOi8vbm9mZWVzLnRlc3RudXQuY2FzaHUuc3BhY2U=
```

[00]: 00.md

0 comments on commit 09d70ec

Please sign in to comment.